Reset element.offsets in Map and Control.PanZoomBar every time movement is
initiated. Also, reset element.offsets every time map.updateSize() is called. git-svn-id: http://svn.openlayers.org/trunk/openlayers@2915 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -167,6 +167,8 @@ OpenLayers.Control.PanZoomBar.prototype =
|
|||||||
this.mouseDragStart = evt.xy.clone();
|
this.mouseDragStart = evt.xy.clone();
|
||||||
this.zoomStart = evt.xy.clone();
|
this.zoomStart = evt.xy.clone();
|
||||||
this.div.style.cursor = "move";
|
this.div.style.cursor = "move";
|
||||||
|
// reset the div offsets just in case the div moved
|
||||||
|
this.zoomBarDiv.offsets = null;
|
||||||
OpenLayers.Event.stop(evt);
|
OpenLayers.Event.stop(evt);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -179,12 +179,13 @@ OpenLayers.Map.prototype = {
|
|||||||
this.viewPortDiv.appendChild(this.layerContainerDiv);
|
this.viewPortDiv.appendChild(this.layerContainerDiv);
|
||||||
|
|
||||||
this.events = new OpenLayers.Events(this, div, this.EVENT_TYPES, this.fallThrough);
|
this.events = new OpenLayers.Events(this, div, this.EVENT_TYPES, this.fallThrough);
|
||||||
|
|
||||||
this.updateSize();
|
this.updateSize();
|
||||||
|
|
||||||
|
// update the map size and location before the map moves
|
||||||
|
this.events.register("movestart", this, this.updateSize);
|
||||||
|
|
||||||
// Because Mozilla does not support the "resize" event for elements other
|
// Because Mozilla does not support the "resize" event for elements other
|
||||||
// than "window", we need to put a hack here.
|
// than "window", we need to put a hack here.
|
||||||
//
|
|
||||||
if (navigator.appName.contains("Microsoft")) {
|
if (navigator.appName.contains("Microsoft")) {
|
||||||
// If IE, register the resize on the div
|
// If IE, register the resize on the div
|
||||||
this.events.register("resize", this, this.updateSize);
|
this.events.register("resize", this, this.updateSize);
|
||||||
@@ -633,6 +634,8 @@ OpenLayers.Map.prototype = {
|
|||||||
* "onresize" for an element)
|
* "onresize" for an element)
|
||||||
*/
|
*/
|
||||||
updateSize: function() {
|
updateSize: function() {
|
||||||
|
// the div might have moved on the page, also
|
||||||
|
this.events.element.offsets = null;
|
||||||
var newSize = this.getCurrentSize();
|
var newSize = this.getCurrentSize();
|
||||||
var oldSize = this.getSize();
|
var oldSize = this.getSize();
|
||||||
if (oldSize == null)
|
if (oldSize == null)
|
||||||
@@ -647,9 +650,6 @@ OpenLayers.Map.prototype = {
|
|||||||
this.layers[i].onMapResize();
|
this.layers[i].onMapResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// the div might have moved on the page, also
|
|
||||||
this.events.element.offsets = null;
|
|
||||||
|
|
||||||
if (this.baseLayer != null) {
|
if (this.baseLayer != null) {
|
||||||
var center = new OpenLayers.Pixel(newSize.w /2, newSize.h / 2);
|
var center = new OpenLayers.Pixel(newSize.w /2, newSize.h / 2);
|
||||||
var centerLL = this.getLonLatFromViewPortPx(center);
|
var centerLL = this.getLonLatFromViewPortPx(center);
|
||||||
|
|||||||
Reference in New Issue
Block a user