Bug 410929

Summary: "Fit to Height" zoom mode not implemented
Product: krita Reporter: Roy Blumenthal <royblumenthal>
Component: GeneralAssignee: Jonathan Colman <JonColmanKrita>
Status: RESOLVED FIXED    
Severity: wishlist CC: JonColmanKrita, tamtamy.tymona
Priority: NOR    
Version: 4.2.5   
Target Milestone: ---   
Platform: unspecified   
OS: All   
Latest Commit: Version Fixed In:
Attachments: Illustration of wide canvas showing workflow of 'fit to height' request

Description Roy Blumenthal 2019-08-15 10:54:34 UTC
Created attachment 122133 [details]
Illustration of wide canvas showing workflow of 'fit to height' request

SUMMARY
Currently, Krita has the ability to "fit to width" (hotkey: 3). But it seems there isn't a way to "fit to height" of canvas.

STEPS TO REPRODUCE
No steps to reproduce. Functionality isn't in place yet. (Hence the possibility that this is a wishlist issue rather than a dug report.)

OBSERVED RESULT
No way to fit the canvas to the screen using HEIGHT as the measure.

EXPECTED RESULT
While working on a wide canvas (eg, 1000 pixels high by 6000 wide), I would like to press a hotkey, and have the canvas resize so that the 1000 pixels fill my screen from top to bottom, using the cursor position as the centre of the zoom.

This would be similar to the current functionality of pressing the '3' key, which, in the example dimension above, would resize the screen view such that the 6000 pixel dimension would fit the screen from left to right. (One notable difference here is that the "fit to width" function zooms to the centre of the canvas, not to the centre of the cursor.)

SOFTWARE/OS VERSIONS
Windows: 10
Linux: Zorin 15

(As far as I know, this is in all versions. I have the same issues on my Win 10 machine, and a Linux Zorin 15 machine.)

ADDITIONAL INFORMATION
This functionality is needed for keeping track of where I am on a canvas. In my work as a live digital sketchnoter, I draw live interpretations of what people say in meetings and conferences.

This means I usually prepare a very wide canvas, with a prepared background image, and logo and various things. This would be on the left of my canvas. Since my window is just a normal sized window, I want the height of the canvas visible.

I'm attaching a pic showing roughly what I mean.

In the pic, I show a very wide canvas (1000 high by 6000 pixels wide), with the Krita UI superimposed over it, showing a view that is 1000 pixels high by 2000 pixels wide. It's showing what's going on on the left hand side of the wide canvas.

Over the course of a talk, I would draw something, perhaps zooming in on a detail, (eg, the speech bubble that says, "Fit to height?"), and then zoom back to the height of the canvas again so that the audience could see the "full" view (ie, 1000 by 2000 pixels). 

Once I'm done with that first part of the canvas, I would use the space key to drag along to the middle part of the canvas, showing the blank central portion. I would then draw in that. Zooming in and out as needed for showing details.

Right now, there is no way for my to instantly hit the height. I have to manually scroll zoom to the height using my mouse wheel. 

In the illustration, I've also shown the centre of canvas, and the centre of cursor. Currently, the '3' key fits to width, using the centre of the canvas as the mapping point for the height. What it SHOULD ideally do for this workflow is to use the centre of cursor for the mapping, so that the zoom keeps the image in place, and just fixes the width. The "fit to height" functionality should use centre of cursor, not centre of canvas.

I hope this explanation makes sense. I've marked it as minor, cos I'm sure not all users have this need. For me, it's mission critical, but for typical users, it's trivial, and probably not even needed. It would be amazing if you could do something like this though!

Thanks for reading my lengthy report!

Blue skies
Roy
Comment 1 Tiar 2019-08-15 15:08:10 UTC
There is "Fit Page Width" and "Fit Page" options, first always fits to width, the second one fits to height if the picture is tall and fits to width if the picture is wide (so no matter if it's a portrait or landscape, you'll always see the full canvas).

The code for it is in KoZoomController.cpp setZoom(), zoom modes are defined in KoZoomMode.h and .cpp, it would be super easy to add a new zoom mode that would be called Fit Page Height and always just fit to height.

(I thought it's a bug but apparently it is a wish request, so I'll leave it here for now).
Comment 2 Jonathan Colman 2020-10-05 12:55:43 UTC
Seems doable, I'll have a go at this.
Comment 3 Dmitry Kazakov 2020-10-05 21:12:26 UTC
Git commit 6191b915c0e8ccb407986bd4fec3df1451b6c8b0 by Dmitry Kazakov, on behalf of Jonathan Colman.
Committed on 05/10/2020 at 21:11.
Pushed by dkazakov into branch 'master'.

Add Fit To Height zooming and shortcut

Added Fit to Height option in zoom drop-down, and ability to shortcut
via "Configure Krita..." Set ZOOM_HEIGHT enum value to 16,
so ZOOM_HEIGHT is a unique mask in KoZoomController::Private
(see KoZoomController_p.h line 41)

This commit resolves: https://bugs.kde.org/show_bug.cgi?id=410929

M  +4    -0    libs/ui/input/kis_zoom_action.cpp
M  +1    -0    libs/ui/input/kis_zoom_action.h
M  +3    -0    libs/widgets/KoZoomAction.cpp
M  +10   -1    libs/widgets/KoZoomController.cpp
M  +1    -1    libs/widgets/KoZoomController_p.h
M  +13   -2    libs/widgets/KoZoomMode.cpp
M  +1    -0    libs/widgets/KoZoomMode.h

https://invent.kde.org/graphics/krita/commit/6191b915c0e8ccb407986bd4fec3df1451b6c8b0
Comment 4 Dmitry Kazakov 2020-10-05 21:12:28 UTC
Git commit 3e810e688744494fcef98f5d75e9cdc7e564e6f8 by Dmitry Kazakov, on behalf of Jonathan Colman.
Committed on 05/10/2020 at 21:11.
Pushed by dkazakov into branch 'master'.

Fix Zoom Shortcut ordering

Previous commit inserted ZoomToHeightShortcut after ZoomToWidthShortcut
in Shortcuts enum. This result in RelativeZoomModeShortcut's
combinations to shortcut to "Fit Page Height" instead.

Fixed by moving ZoomToHeightShortcut to end of enum.

M  +2    -2    libs/ui/input/kis_zoom_action.h

https://invent.kde.org/graphics/krita/commit/3e810e688744494fcef98f5d75e9cdc7e564e6f8
Comment 5 Dmitry Kazakov 2020-10-05 21:34:59 UTC
Git commit 99e35e3dc58ed020a3cb12e3ff7f35b31083b327 by Dmitry Kazakov, on behalf of Jonathan Colman.
Committed on 05/10/2020 at 21:13.
Pushed by dkazakov into branch 'krita/4.3'.

Add Fit To Height zooming and shortcut

Added Fit to Height option in zoom drop-down, and ability to shortcut
via "Configure Krita..." Set ZOOM_HEIGHT enum value to 16,
so ZOOM_HEIGHT is a unique mask in KoZoomController::Private
(see KoZoomController_p.h line 41)

This commit resolves: https://bugs.kde.org/show_bug.cgi?id=410929

M  +4    -0    libs/ui/input/kis_zoom_action.cpp
M  +1    -0    libs/ui/input/kis_zoom_action.h
M  +3    -0    libs/widgets/KoZoomAction.cpp
M  +10   -1    libs/widgets/KoZoomController.cpp
M  +1    -1    libs/widgets/KoZoomController_p.h
M  +13   -2    libs/widgets/KoZoomMode.cpp
M  +1    -0    libs/widgets/KoZoomMode.h

https://invent.kde.org/graphics/krita/commit/99e35e3dc58ed020a3cb12e3ff7f35b31083b327
Comment 6 Dmitry Kazakov 2020-10-05 21:35:07 UTC
Git commit 1513cb03c0cbe8215e4fa6f5a52a68cc590e28c5 by Dmitry Kazakov, on behalf of Jonathan Colman.
Committed on 05/10/2020 at 21:13.
Pushed by dkazakov into branch 'krita/4.3'.

Fix Zoom Shortcut ordering

Previous commit inserted ZoomToHeightShortcut after ZoomToWidthShortcut
in Shortcuts enum. This result in RelativeZoomModeShortcut's
combinations to shortcut to "Fit Page Height" instead.

Fixed by moving ZoomToHeightShortcut to end of enum.

M  +2    -2    libs/ui/input/kis_zoom_action.h

https://invent.kde.org/graphics/krita/commit/1513cb03c0cbe8215e4fa6f5a52a68cc590e28c5