-1
的moveByPx方法如何覆蓋消除「movestart」事件觸發的變焦以外的任何行動OpenLayers.Map的的moveTo和moveByPx方法呢?覆蓋的moveTo和OpenLayers.Map
的moveByPx方法如何覆蓋消除「movestart」事件觸發的變焦以外的任何行動OpenLayers.Map的的moveTo和moveByPx方法呢?覆蓋的moveTo和OpenLayers.Map
map = new OpenLayers.Map("map");
OpenLayers.Map.prototype.moveByPx = function (a, b) {
var c = this.size.w/2,
d = this.size.h/2,
e = c + a,
f = d + b,
g = this.baseLayer.wrapDateLine,
h = 0,
k = 0;
this.restrictedExtent && (h = c, k = d, g = !1);
a = g || e <= this.maxPx.x - h && e >= this.minPx.x + h ? Math.round(a) : 0;
b = f <= this.maxPx.y - k && f >= this.minPx.y + k ? Math.round(b) : 0;
if (a || b) {
this.dragging || (this.dragging = !0);
this.center = null;
a && (this.layerContainerOriginPx.x -= a, this.minPx.x -= a, this.maxPx.x -= a);
b && (this.layerContainerOriginPx.y -= b, this.minPx.y -= b, this.maxPx.y -= b);
this.applyTransform();
d = 0;
for (e = this.layers.length; d < e; ++d)
c = this.layers[d], c.visibility && (c === this.baseLayer || c.inRange) && (c.moveByPx(a, b), c.events.triggerEvent("move"));
this.events.triggerEvent("move")
}
}
map.events.register("movestart", map, function (e) {
My Code...
});
沒有給出的解釋,只是代碼。格式嚴格的代碼。 – danwild