Bug 313489

Summary: [crop tool] result non centred canvas , and different zoom level.
Product: [Applications] krita Reporter: David REVOY <info>
Component: UsabilityAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, halla
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: 3 screenshots commented about the crop bug + a screenshot proposition.

Description David REVOY 2013-01-19 10:01:24 UTC
Created attachment 76554 [details]
3 screenshots commented about the crop bug + a screenshot proposition.

When applying a crop transformation, the result is non centred  , and also the zoom level is different. Resulting in a disturbing experience. 

The result should be centred in the viewport and keep the same zoom level. 

Picture of a step by step with screenshot in attachement
( File 'crop me' downloadable here : http://david.revoy.free.fr/forums/krita/2013-01-19_crop-test-files.kra )
Comment 1 Halla Rempt 2013-03-31 10:30:22 UTC
Ack. This is something Dmitry has been working on for some time, but it really needs to be fixed.
Comment 2 Dmitry Kazakov 2013-04-21 08:44:51 UTC
Git commit dfae0ee3d742457cba428fb7b9b4a7588dd31ffc by Dmitry Kazakov.
Committed on 21/04/2013 at 10:44.
Pushed by dkazakov into branch 'krita-testing-kazakov'.

Fixed a recentering after crop/resize bug

This introduces quite a non-trivial still-point concept... please, read
about it in the docs for KisImage::sigImageSizeChanged.

The general idea of user iteractions:
1) When rescaling/rotating the whole image (the actual content
   doesn't change):

   -> the scaling/rotating of the image happens around its center
      (not around the center of the screen!)

2) When cropping/changing the size of the canvas (the amount of content
   changes):

   -> the content of the image that is left after cropping does not
      change its position on screen

3) When working in FIT_WIDTH/FIT_PAGE modes:

   -> changing the size of the image switches zoom mode to CONSTANT

M  +6    -28   krita/image/kis_image.cc
M  +18   -1    krita/image/kis_image.h
M  +4    -3    krita/image/kis_image_signal_router.cpp
M  +61   -2    krita/image/kis_image_signal_router.h
M  +1    -1    krita/image/kis_processing_applicator.cpp
M  +2    -1    krita/image/tests/kis_image_signal_router_test.cpp
M  +0    -1    krita/plugins/tools/tool_crop/kis_tool_crop.cc
M  +8    -4    krita/ui/canvas/kis_canvas2.cpp
M  +1    -1    krita/ui/canvas/kis_canvas2.h
M  +2    -0    krita/ui/canvas/kis_canvas_controller.h
M  +5    -1    krita/ui/kis_statusbar.cc
M  +1    -1    krita/ui/kis_statusbar.h
M  +66   -16   krita/ui/kis_view2.cpp
M  +5    -4    krita/ui/kis_view2.h
M  +47   -0    krita/ui/tests/kis_zoom_and_pan_test.cpp
M  +3    -0    krita/ui/tests/kis_zoom_and_pan_test.h
M  +1    -1    libs/widgets/KoZoomController.cpp

http://commits.kde.org/calligra/dfae0ee3d742457cba428fb7b9b4a7588dd31ffc
Comment 3 David REVOY 2013-12-03 08:25:16 UTC
A bump on this bug thread to reopen it because the fix for Bug 328070 broke it a bit. ( zoom level broke, centering still works ) Now when accepting a 'crop' action ; there is a 'Zoom to fit' action performed just after the cropping. 

* To reproduce :
- Open a new document ( ex: Design template ; A4 )
- Krita , by default expose the new document to fill 100% of the viewport thanks to 'Zoom to fit' zoom, that's fine.
- Draw a little letter centred on the canvas, of the size of your 'real' thumb with default brush
- Zoom on it with keyboard + key to get it on full canvas size  ( ex: 200% here )
- Select the crop tool and drag to do a square around it, and crop the letter painted. 
- Press enter to accept

* Result :
- Letter is correctly cropped to the user choosen dimension but view-port zoom change ; it is reset to the same zoom level as the previous 'Zoom-to-fit ' ( so the letter drawn is now sized like your 'real thumb' again ) . Centering is ok and still works fine. 

* Expectation :
- Zoom level is protected during the process. So the crop tool is more WYSIWYG when pressing enter.
Comment 4 Dmitry Kazakov 2013-12-03 09:00:21 UTC
Yeah.. The bug seems to have resurrected...
It happened before the fix of  the bug 328070 though, I've just checked.
Comment 5 David REVOY 2013-12-03 09:08:28 UTC
oops, then sorry for pointing your fix on bug 328070 as the culpit.
Comment 6 Dmitry Kazakov 2013-12-03 09:47:25 UTC
Git commit 1c062777977996b81b30cd55046f727a36aba1d5 by Dmitry Kazakov.
Committed on 03/12/2013 at 09:47.
Pushed by dkazakov into branch 'master'.

Fix a Gemini merge bug

The crop tool should not call any setZoom() stuff. Is was moved to
KisImage::crop() long time ago.

M  +0    -3    krita/plugins/tools/tool_crop/kis_tool_crop.cc

http://commits.kde.org/calligra/1c062777977996b81b30cd55046f727a36aba1d5
Comment 7 Dmitry Kazakov 2013-12-03 10:47:22 UTC
(In reply to comment #5)
> oops, then sorry for pointing your fix on bug 328070 as the culpit.

np, the bug appeared, when git tried to merge two branches and couldn't understand what has happened :) Anyway, the bug is fixed now :)
Comment 8 Dmitry Kazakov 2013-12-05 19:56:33 UTC
Git commit 490e686383e5b3a469b72ff83e6f315d49d1e9e3 by Dmitry Kazakov.
Committed on 03/12/2013 at 09:47.
Pushed by dkazakov into branch 'calligra/2.8'.

Fix a Gemini merge bug

The crop tool should not call any setZoom() stuff. Is was moved to
KisImage::crop() long time ago.

M  +0    -3    krita/plugins/tools/tool_crop/kis_tool_crop.cc

http://commits.kde.org/calligra/490e686383e5b3a469b72ff83e6f315d49d1e9e3