From ebc60202b7aac0f54f6c5cbe3c300ecc6635d9a6 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Wed, 12 Sep 2007 20:14:14 +0000 Subject: [PATCH] Patch from Erik/I to fix: Popups don't move adequately after zooming with scroll wheel (Closes #494) git-svn-id: http://svn.openlayers.org/trunk/openlayers@4250 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Popup/Anchored.js | 4 +++ lib/OpenLayers/Popup/AnchoredBubble.js | 17 +++++++++--- tests/Popup/test_Anchored.html | 37 ++++++++++++++++++++++++++ tests/list-tests.html | 1 + 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 tests/Popup/test_Anchored.html diff --git a/lib/OpenLayers/Popup/Anchored.js b/lib/OpenLayers/Popup/Anchored.js index 1c6023a6f0..3c3009adc0 100644 --- a/lib/OpenLayers/Popup/Anchored.js +++ b/lib/OpenLayers/Popup/Anchored.js @@ -91,11 +91,15 @@ OpenLayers.Popup.Anchored = /** * Method: moveTo + * Since the popup is moving to a new px, it might need also to be moved + * relative to where the marker is. * * Parameters: * px - {} */ moveTo: function(px) { + this.relativePosition = this.calculateRelativePosition(px); + var newPx = this.calculateNewPx(px); var newArguments = new Array(newPx); diff --git a/lib/OpenLayers/Popup/AnchoredBubble.js b/lib/OpenLayers/Popup/AnchoredBubble.js index 478a953785..ae3ee3eb42 100644 --- a/lib/OpenLayers/Popup/AnchoredBubble.js +++ b/lib/OpenLayers/Popup/AnchoredBubble.js @@ -52,9 +52,6 @@ OpenLayers.Popup.AnchoredBubble = this.setContentHTML(); - this.setRicoCorners(!this.rounded); - this.rounded = true; - //set the popup color and opacity this.setBackgroundColor(); this.setOpacity(); @@ -62,6 +59,20 @@ OpenLayers.Popup.AnchoredBubble = return this.div; }, + /** + * Method: moveTo + * The popup may have been moved to a new relative location, in which case + * we will want to re-do the rico corners. + * + * Parameters: + * px - {} + */ + moveTo: function(px) { + OpenLayers.Popup.Anchored.prototype.moveTo.apply(this, arguments); + this.setRicoCorners(!this.rounded); + this.rounded = true; + }, + /** * APIMethod: setSize * diff --git a/tests/Popup/test_Anchored.html b/tests/Popup/test_Anchored.html new file mode 100644 index 0000000000..f87a1dc1aa --- /dev/null +++ b/tests/Popup/test_Anchored.html @@ -0,0 +1,37 @@ + + + + + + + + diff --git a/tests/list-tests.html b/tests/list-tests.html index c54630d1d8..834a4cc5ea 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -31,6 +31,7 @@
  • test_Marker.html
  • Marker/test_Box.html
  • test_Popup.html
  • +
  • Popup/test_Anchored.html
  • test_Feature.html
  • Feature/test_Vector.html
  • test_Events.html