Feature request #4173
Zoom out tool-variability
|Pull Request or Patch supplied:||Yes||Resolution:||fixed/implemented|
The zoom out tool could maybe be improved by working more like ArcMap/Mapinfo.
I find it very useful to be able too zoom out much or little depending on
how big "zoom box" I draw with the zoom out tool.
In ArcMap/Mapinfo it works like this: A large zoom-box makes a small zoom out. A
small zoom-box makes a big change in scale.
The zoom out algorithm could be something like this: A full zoom out box covering the whole screen = no zoom, if the zoom box is 50% of screen=double scale, if zoom box 1/4 of screen= 4 times the scale, 1/10 of screen= 10times the scale.
There is already some zoom out variability in qgis but it only works if zoom out box is drawn from right to left or bottom to top of screen.
#2 Updated by Steven Mizuno about 6 years ago
- File patch_for_4173.diff added
- Pull Request or Patch supplied changed from No to Yes
Map Tool Zoom (In/Out) improvements and fixes - patchProblems found:
- it is hard to get the starting point of the zoom rectangle exactly where you click
[needed to fix 1 before 2 and 3 can be tested]
- carefully drawing a zoom rectangle from exact upper left corner of map canvas to lower right zooms slightly. I would expect zoom ratio of 1.0, hence no change.
- reversing step 2 - draw from lower right to upper left also zooms, but slightly different value
- record start point on mouse press, rather than on mouse move (there is typically a few pixels' movement of mouse before drag is registered; therefore, the position reported is where the drag was recognized.
- adjust the zoomrect (integer pixel values) by 1 - right, bottom to get the outside of the rectangle for transform to map coordinates
- normalize the completed zoomrect before further processing
- allow variable zoom out - calc. ratio of old to new extent; take smaller of zoom ratio width or height to scale by
- allow Ctrl key to invert operation of zoom in/zoom out (no visual indication, such as changing the cursor, is provided)
Effective on mouse release; no effect until then.
- exact upper left to lower right corner (any corner to diagonally opposite corner), zoom in or out should be no change in scale or extent - tests that zoom rect is same as map extent
- begin a zoom rect on some pixel, drag to start the rect, then position up and left 1 pixel from start point (using intersecting vector lines helps) scales by the smaller of the map canvas dimensions to 1 (or the inverse) - tests case where zoom rect is empty; is adjusted to 1px
- like test 2 - except position over the start point; should be same result as test 2 - tests the 1px case
- for any zoom rect that exceeds a dimension (either) of the map canvas the zoom is reversed (zoom in becomes zoom out, for example)
easiest to test by having the main window less than full screen and starting near one corner and dragging beyond the diagonally opposite corner