Trigger feature related events with feature information and layer related events with layer information. Also adding events.on and events.un convenience methods. r=crschmidt (closes #1343)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@6149 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -79,8 +79,11 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
this.divEvents.destroy();
|
||||
this.divEvents = null;
|
||||
|
||||
this.map.events.unregister("zoomend", this, this.moveZoomBar);
|
||||
this.map.events.unregister("changebaselayer", this, this.redraw);
|
||||
this.map.events.un({
|
||||
"zoomend": this.moveZoomBar,
|
||||
"changebaselayer": this.redraw,
|
||||
scope: this
|
||||
});
|
||||
|
||||
OpenLayers.Control.PanZoom.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
@@ -164,11 +167,13 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
this.slider = slider;
|
||||
|
||||
this.sliderEvents = new OpenLayers.Events(this, slider, null, true);
|
||||
this.sliderEvents.register("mousedown", this, this.zoomBarDown);
|
||||
this.sliderEvents.register("mousemove", this, this.zoomBarDrag);
|
||||
this.sliderEvents.register("mouseup", this, this.zoomBarUp);
|
||||
this.sliderEvents.register("dblclick", this, this.doubleClick);
|
||||
this.sliderEvents.register("click", this, this.doubleClick);
|
||||
this.sliderEvents.on({
|
||||
"mousedown": this.zoomBarDown,
|
||||
"mousemove": this.zoomBarDrag,
|
||||
"mouseup": this.zoomBarUp,
|
||||
"dblclick": this.doubleClick,
|
||||
"click": this.doubleClick
|
||||
});
|
||||
|
||||
var sz = new OpenLayers.Size();
|
||||
sz.h = this.zoomStopHeight * this.map.getNumZoomLevels();
|
||||
@@ -194,10 +199,12 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
this.zoombarDiv = div;
|
||||
|
||||
this.divEvents = new OpenLayers.Events(this, div, null, true);
|
||||
this.divEvents.register("mousedown", this, this.divClick);
|
||||
this.divEvents.register("mousemove", this, this.passEventToSlider);
|
||||
this.divEvents.register("dblclick", this, this.doubleClick);
|
||||
this.divEvents.register("click", this, this.doubleClick);
|
||||
this.divEvents.on({
|
||||
"mousedown": this.divClick,
|
||||
"mousemove": this.passEventToSlider,
|
||||
"dblclick": this.doubleClick,
|
||||
"click": this.doubleClick
|
||||
});
|
||||
|
||||
this.div.appendChild(div);
|
||||
|
||||
@@ -250,8 +257,11 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) {
|
||||
return;
|
||||
}
|
||||
this.map.events.register("mousemove", this, this.passEventToSlider);
|
||||
this.map.events.register("mouseup", this, this.passEventToSlider);
|
||||
this.map.events.on({
|
||||
"mousemove": this.passEventToSlider,
|
||||
"mouseup": this.passEventToSlider,
|
||||
scope: this
|
||||
});
|
||||
this.mouseDragStart = evt.xy.clone();
|
||||
this.zoomStart = evt.xy.clone();
|
||||
this.div.style.cursor = "move";
|
||||
@@ -298,8 +308,11 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
}
|
||||
if (this.zoomStart) {
|
||||
this.div.style.cursor="";
|
||||
this.map.events.unregister("mouseup", this, this.passEventToSlider);
|
||||
this.map.events.unregister("mousemove", this, this.passEventToSlider);
|
||||
this.map.events.un({
|
||||
"mouseup": this.passEventToSlider,
|
||||
"mousemove": this.passEventToSlider,
|
||||
scope: this
|
||||
});
|
||||
var deltaY = this.zoomStart.y - evt.xy.y;
|
||||
this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight));
|
||||
this.moveZoomBar();
|
||||
|
||||
Reference in New Issue
Block a user