Bug 385978

Summary: Unable to Ctrl+Scrollwheel zoom swatches in palette docker when docker width is < 220px
Product: [Applications] krita Reporter: Neviril <nevineviril>
Component: DockersAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: halla
Priority: NOR    
Version First Reported In: 3.3.1   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Palette Docker scrolling patch

Description Neviril 2017-10-20 07:14:09 UTC
The Krita documentation (https://docs.krita.org/Palette) states:

"If you find the size of color swatches too small, you can increase the size by hovering your mouse over the palette and scrolling while holding Ctrl"

However, as of Krita 3.3.1 (Windows 10 64bit 1709) this doesn't appear to be possible when the Palette docker width is less than a certain size (determined to be roughly 220px on this configuration).

As soon as the width of the docker is increased above this threshold, the shortcut starts working again.
Comment 1 Halla Rempt 2017-10-20 07:29:51 UTC
Um, that's actually intentional, I think, looking at the code: 

        int numDegrees = event->delta() / 8;
        int numSteps = numDegrees / 7;
        int curSize = horizontalHeader()->sectionSize(0);
        int setSize = numSteps + curSize;

        if ( setSize >= 12 ) {
            horizontalHeader()->setDefaultSectionSize(setSize);
            verticalHeader()->setDefaultSectionSize(setSize);
            KisConfig cfg;
            cfg.setPaletteDockerPaletteViewSectionSize(setSize);
        }
Comment 2 Neviril 2017-10-20 07:34:20 UTC

Quick and dirty workaround.

In /libs/ui/kis_palette_view.cpp
In KisPaletteView::wheelEvent

There is this check:

...
if ( setSize >= 12 ) {
...

Reducing the value setSize is checked against to a lower value (e.g. 1, although this is probably too small) appears to resolve this bug.


The main issue here is that all scroll wheel events are blocked, but it would be useful if scrolling up (e.g. increasing swatch size) was still allowed.
Comment 3 Neviril 2017-10-20 08:07:14 UTC
This modification makes it working as intended and solves an inconsistency in the UI (decreasing docker width to the minimum size sets swatch size to 8px, but this swatch size cannot be normally set while scroll-zooming):



if ( (event->delta() <= 0) && (setSize <= 8) ) {
	// Ignore scroll-zooming down below a certain size
} else {
	horizontalHeader()->setDefaultSectionSize(setSize);
	verticalHeader()->setDefaultSectionSize(setSize);
	KisConfig cfg;
	cfg.setPaletteDockerPaletteViewSectionSize(setSize);				
}
Comment 4 Halla Rempt 2017-10-20 08:17:30 UTC
If you can give me a patch I can apply, I will push it :-)
Comment 5 Neviril 2017-10-20 08:49:35 UTC
Created attachment 108469 [details]
Palette Docker scrolling patch

This patch solves an inconsistency in the UI where the user is unable to scrollwheel-zoom-in color swatches in the palette docker after the same has been reduced to its minimum width, which causes color swatch size to be set to 8px, a size that cannot be normally set with the ctrl+scrollwheel shortcut. This color swatch size is now made accessible with the scroll wheel, and scroll events are now blocked only when trying to further zoom out.
Comment 6 Halla Rempt 2017-10-20 09:00:30 UTC
Git commit 98cdd4fdbe7ee991311a6f06546826d5b48cc63c by Boudewijn Rempt.
Committed on 20/10/2017 at 09:00.
Pushed by rempt into branch 'krita/3.3'.

Fix using the wheel when the palettte docker is very small

This patch solves an inconsistency in the UI where the user is unable
to scrollwheel-zoom-in color swatches in the palette docker after the
same has been reduced to its minimum width, which causes color swatch
size to be set to 8px, a size that cannot be normally set with the
ctrl+scrollwheel shortcut. This color swatch size is now made accessible
with the scroll wheel, and scroll events are now blocked only when trying
to further zoom out.
Patch by Neviril <nevineviril@yahoo.com> Thanks!

M  +8    -6    libs/ui/kis_palette_view.cpp

https://commits.kde.org/krita/98cdd4fdbe7ee991311a6f06546826d5b48cc63c
Comment 7 Halla Rempt 2017-10-20 09:00:33 UTC
Git commit 2f13d9350762efda0f328b2fc0ed9764f01c10a4 by Boudewijn Rempt.
Committed on 20/10/2017 at 09:00.
Pushed by rempt into branch 'master'.

Fix using the wheel when the palettte docker is very small

This patch solves an inconsistency in the UI where the user is unable
to scrollwheel-zoom-in color swatches in the palette docker after the
same has been reduced to its minimum width, which causes color swatch
size to be set to 8px, a size that cannot be normally set with the
ctrl+scrollwheel shortcut. This color swatch size is now made accessible
with the scroll wheel, and scroll events are now blocked only when trying
to further zoom out.
Patch by Neviril <nevineviril@yahoo.com> Thanks!

M  +8    -6    libs/ui/kis_palette_view.cpp

https://commits.kde.org/krita/2f13d9350762efda0f328b2fc0ed9764f01c10a4