Ticket #1726 (closed feature: fixed)

Opened 5 years ago

Last modified 4 years ago

Give Popups an 'closeOnPan' Option

Reported by: euzuro Owned by: euzuro
Priority: minor Milestone: 2.8 Release
Component: Popup Version: 2.6
Keywords: Cc:
State: Complete

Description (last modified by jrf) (diff)

When closeOnPan is true, the popup disappears when the map moves.

Attachments

closeOnPan.patch Download (1.1 KB) - added by jrf 5 years ago.
closeOnPan.2.patch Download (3.2 KB) - added by euzuro 5 years ago.
new patch. includes tests (all pass on ff2 & ie7), a mod to the popups.html example to show it in action, and the requested unregistering in the destroy()
closeOnPan.3.patch Download (3.3 KB) - added by euzuro 5 years ago.
take three -- thanks for spotting the [un]register flub, chris
closeOnMove.patch Download (3.3 KB) - added by crschmidt 4 years ago.

Change History

Changed 5 years ago by euzuro

  • status changed from new to assigned

Changed 5 years ago by jrf

  • description modified (diff)

Changed 5 years ago by jrf

  • description modified (diff)

So I figured that [8173] would be the only thing needed to implement this, but then it turns out that onMove is never called...

grep -r onMove * | grep "js:"

lib/OpenLayers/Popup.js: /** Method: onMove

lib/OpenLayers/Popup.js: onMove: function(){

lib/OpenLayers/Popup.js: OpenLayers.Console.log("onMove");

and similar results for grep -r Move *

So, what am I missing about how the popup's position is updated?

Changed 5 years ago by jrf

Doh. That onMove function was something I added. Taking that out and doing this.map.events.register inside the draw() method works well. Patch attached.

Changed 5 years ago by jrf

Changed 5 years ago by elemoine

listener unregistration should be done eventually, probably when the popup is destroyed. Events are good, but we should be careful not to forget about unregistering listeners.

Changed 5 years ago by euzuro

new patch. includes tests (all pass on ff2 & ie7), a mod to the popups.html example to show it in action, and the requested unregistering in the destroy()

Changed 5 years ago by euzuro

  • state set to Review

all tests pass ff2/ie7. please review

Changed 5 years ago by crschmidt

  • state changed from Review to Needs More Work

Erik,

The "unregister" in destroy is actually a register.

Changed 5 years ago by euzuro

take three -- thanks for spotting the [un]register flub, chris

Changed 5 years ago by euzuro

  • state changed from Needs More Work to Review

Changed 4 years ago by fredj

The popup is closed on pan and zoom ? I suggest to rename the attribute from 'closeOnPan' to 'closeOnMove'. (but I'm maybe too pedantic ...)

Changed 4 years ago by crschmidt

Changed 4 years ago by crschmidt

  • state changed from Review to Commit

Simple enough, though I agree that fred's name makes more sense. Feel free to commit closeOnMove.patch.

Changed 4 years ago by euzuro

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

(In [8397]) give popups a 'closeOnMove' option. if set to true, the popup will close itself as soon as the map is pan/zoom (move)ed. patch by jrf, euzuro review by elemoine, cr5. (Closes #1726)

Note: See TracTickets for help on using tickets.