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
This commit is contained in:
@@ -91,11 +91,15 @@ OpenLayers.Popup.Anchored =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: moveTo
|
* 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:
|
* Parameters:
|
||||||
* px - {<OpenLayers.Pixel>}
|
* px - {<OpenLayers.Pixel>}
|
||||||
*/
|
*/
|
||||||
moveTo: function(px) {
|
moveTo: function(px) {
|
||||||
|
this.relativePosition = this.calculateRelativePosition(px);
|
||||||
|
|
||||||
var newPx = this.calculateNewPx(px);
|
var newPx = this.calculateNewPx(px);
|
||||||
|
|
||||||
var newArguments = new Array(newPx);
|
var newArguments = new Array(newPx);
|
||||||
|
|||||||
@@ -52,9 +52,6 @@ OpenLayers.Popup.AnchoredBubble =
|
|||||||
|
|
||||||
this.setContentHTML();
|
this.setContentHTML();
|
||||||
|
|
||||||
this.setRicoCorners(!this.rounded);
|
|
||||||
this.rounded = true;
|
|
||||||
|
|
||||||
//set the popup color and opacity
|
//set the popup color and opacity
|
||||||
this.setBackgroundColor();
|
this.setBackgroundColor();
|
||||||
this.setOpacity();
|
this.setOpacity();
|
||||||
@@ -62,6 +59,20 @@ OpenLayers.Popup.AnchoredBubble =
|
|||||||
return this.div;
|
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 - {<OpenLayers.Pixel>}
|
||||||
|
*/
|
||||||
|
moveTo: function(px) {
|
||||||
|
OpenLayers.Popup.Anchored.prototype.moveTo.apply(this, arguments);
|
||||||
|
this.setRicoCorners(!this.rounded);
|
||||||
|
this.rounded = true;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: setSize
|
* APIMethod: setSize
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var popup;
|
||||||
|
|
||||||
|
function test_01_Popup_Anchored_default_constructor(t) {
|
||||||
|
t.plan( 4 );
|
||||||
|
|
||||||
|
popup = new OpenLayers.Popup.Anchored();
|
||||||
|
|
||||||
|
t.ok( popup instanceof OpenLayers.Popup.Anchored, "new OpenLayers.Popup.Anchored returns Popup.Anchored object" );
|
||||||
|
t.ok(popup.id.startsWith("OpenLayers.Popup.Anchored"), "valid default popupid");
|
||||||
|
var firstID = popup.id;
|
||||||
|
t.eq(popup.contentHTML, "", "good default popup.contentHTML");
|
||||||
|
|
||||||
|
|
||||||
|
popup = new OpenLayers.Popup.Anchored();
|
||||||
|
var newID = popup.id;
|
||||||
|
t.ok(newID != firstID, "default id generator creating unique ids");
|
||||||
|
}
|
||||||
|
function test_Popup_Anchored_updateRelPos(t) {
|
||||||
|
t.plan(1);
|
||||||
|
var popup = new OpenLayers.Popup.Anchored();
|
||||||
|
popup.calculateNewPx = function () {}
|
||||||
|
popup.calculateRelativePosition = function() {
|
||||||
|
t.ok(true, "update relative position is called on moveTo");
|
||||||
|
}
|
||||||
|
popup.moveTo(new OpenLayers.Pixel(0,0));
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
<li>test_Marker.html</li>
|
<li>test_Marker.html</li>
|
||||||
<li>Marker/test_Box.html</li>
|
<li>Marker/test_Box.html</li>
|
||||||
<li>test_Popup.html</li>
|
<li>test_Popup.html</li>
|
||||||
|
<li>Popup/test_Anchored.html</li>
|
||||||
<li>test_Feature.html</li>
|
<li>test_Feature.html</li>
|
||||||
<li>Feature/test_Vector.html</li>
|
<li>Feature/test_Vector.html</li>
|
||||||
<li>test_Events.html</li>
|
<li>test_Events.html</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user