Feature request #4173

Zoom out tool-variability

Added by Anders Larsson almost 13 years ago. Updated about 8 years ago.

Assignee:Steven Mizuno
Category:Map Canvas
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Easy fix?:No Copied to github as #:14149


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.

patch_for_4173.diff Magnifier (4.26 KB) Steven Mizuno, 2011-08-18 11:37 AM


#1 Updated by Steven Mizuno almost 13 years ago

  • Assignee set to Steven Mizuno

I can take this one - I was already considering the changes suggested. Also have found some minor issues with how the zoom rectangle is transformed to map coordinates.

#2 Updated by Steven Mizuno almost 13 years ago

Map Tool Zoom (In/Out) improvements and fixes - patch

Problems found:
  1. 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]
  2. 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.
  3. reversing step 2 - draw from lower right to upper left also zooms, but slightly different value
  1. 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.
  2. adjust the zoomrect (integer pixel values) by 1 - right, bottom to get the outside of the rectangle for transform to map coordinates
  3. 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.
  1. 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
  2. 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
  3. like test 2 - except position over the start point; should be same result as test 2 - tests the 1px case
  4. 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

#3 Updated by Giovanni Manghi over 12 years ago

  • Target version set to Version 1.7.4

#4 Updated by Giovanni Manghi about 12 years ago

  • Target version changed from Version 1.7.4 to Version 2.0.0

#5 Updated by Paolo Cavallini over 11 years ago

Can we apply this patch?

#6 Updated by Pirmin Kalberer over 11 years ago

  • Target version changed from Version 2.0.0 to Future Release - Nice to have

#7 Updated by Nyall Dawson about 8 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

Most of this behavior is now implemented. New tickets can be reopened if there's anything missing from this.

Also available in: Atom PDF