Ticket #1187 (closed feature: fixed)

Opened 5 years ago

Last modified 5 years ago

ZoomBox control: add property mode with values zoomin/zoomout

Reported by: bartvde Owned by: pspencer
Priority: minor Milestone: 2.6 Release
Component: Control Version: 2.5
Keywords: Cc:
State: Complete

Description

This would make it possible to easily have ESRI style zoomout controls, where the user can click or draw a box to zoom out. The smaller the box, the more the map will zoom out.

The proposal is to add a property named "mode" with possible values zoomin and zoomout, and a default value of zoomin so nothing will change for existing applications.

I will add a patch for this later.

Attachments

ticket1187.patch Download (2.5 KB) - added by bartvde 5 years ago.

Change History

Changed 5 years ago by crschmidt

  • state set to Review
  • milestone set to 2.6 Release

I like the patch: I'm not sure if I like the names 'zoomin', 'zoomout'. Perhaps just 'in' and 'out', since we know it's a zoom control?

Changed 5 years ago by bartvde

Hi Chris, maybe then we should use direction instead of mode? So direction=in or direction=out? Let me know what you conclude on and I can change the patch.

Changed 5 years ago by crschmidt

  • state changed from Review to Needs More Work

Bart: Given no further feedback from anyone else, I'm happy with direction:in / direction:out. If you update the patch, I'll review again: thanks!

Changed 5 years ago by bartvde

  • keywords review added

Chris, I've updated the patch. Btw I changed "in" and "out" for direction in "forward" and "backward", which makes more sense as possible values for direction in the linguistic sense.

Changed 5 years ago by tschaub

I don't want to drag this one out, but I will say that string values strike me the wrong way for some reason. Elsewhere in the library, where we do have "mode" type properties, we typically use static (class) properties or constants as possible values (as in control.type = OpenLayers.Control.BUTTON). I can't really imagine many more modes for the zoom box, so it seems to me that a boolean is appropriate (as in control.out = true).

Don't know how others feel about this. I think for me it's about remembering as little as possible. If I want to make the zoom box go out, it makes sense that I'd set control.out to true (or maybe control.zoomout - but then I might forget if it is camel case or not). Anyway, I'm not strongly opinionated about this.

(Is it "forwards" or "forward" or maybe "foreword", is it "backwards" or "backward" or perhaps "backwoods"? A smart editor might help with OpenLayers.Control.BUTTON, but it's not going to lend a hand with the spelling of "backwords".)

Changed 5 years ago by bartvde

Tim, I agree, a boolean would suffice. I'll update the patch. I'll name the boolean out.

Changed 5 years ago by pspencer

Hi Bart,

in looking over the patch, I have a couple of suggestions that I would like to put forward.

* the zoom factor is only calculated from the width. I think it should be calculated from the width or height depending on which calculation yields a smaller result * the new bounding box is centered on the current center of the map, I think it should be centered on the zoom box.

Making these two changes should result in the old extent of the map being fit (more or less) into the area covered by the zoom box, which is the most logical interpretation of zooming out by a box that I can think of.

Changed 5 years ago by bartvde

Hey Paul. Good suggestions. I'll make the changes and update the patch.

Changed 5 years ago by bartvde

Changed 5 years ago by bartvde

Paul, I've updated the patch with your suggestions, please review again. Thanks.

Changed 5 years ago by pspencer

  • state changed from Needs More Work to Review

reviewing ...

Changed 5 years ago by pspencer

  • owner set to pspencer
  • status changed from new to assigned
  • state changed from Review to Commit

Reviewed, the patch looks good to me, changing to commit (and committing)

Changed 5 years ago by pagameba

  • keywords review removed
  • status changed from assigned to closed
  • state changed from Commit to Complete
  • resolution set to fixed

(In [5796]) (Closes #1187.) applying Bart's patch to add a zoom out option to the zoom control. r=pspencer.

Note: See TracTickets for help on using tickets.