r403@creusa: crschmidt | 2006-05-27 12:19:00 -0400
Reorganization of PanZoomBar, adding of documentation to all functions. git-svn-id: http://svn.openlayers.org/trunk/openlayers@427 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -110,6 +110,15 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
this.zoomStopHeight*(this.map.getZoomLevels()+1));
|
||||
return centered;
|
||||
},
|
||||
/*
|
||||
* @param evt
|
||||
* This function is used to pass events that happen on the div, or the map,
|
||||
* through to the slider, which then does its moving thing.
|
||||
*/
|
||||
passEventToSlider:function(evt) {
|
||||
this.sliderEvents.handleBrowserEvent(evt);
|
||||
},
|
||||
|
||||
/*
|
||||
* divClick: Picks up on clicks directly on the zoombar div
|
||||
* and sets the zoom level appropriately.
|
||||
@@ -121,6 +130,11 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
this.map.zoomTo(this.map.getZoomLevels() - levels);
|
||||
Event.stop(evt);
|
||||
},
|
||||
|
||||
/*
|
||||
* @param evt
|
||||
* event listener for clicks on the slider
|
||||
*/
|
||||
zoomBarDown:function(evt) {
|
||||
this.map.events.register("mousemove", this, this.passEventToSlider);
|
||||
this.map.events.register("mouseup", this, this.passEventToSlider);
|
||||
@@ -129,9 +143,13 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
this.div.style.cursor = "move";
|
||||
Event.stop(evt);
|
||||
},
|
||||
passEventToSlider:function(evt) {
|
||||
this.sliderEvents.handleBrowserEvent(evt);
|
||||
},
|
||||
|
||||
/*
|
||||
* @param evt
|
||||
* This is what happens when a click has occurred, and the client is dragging.
|
||||
* Here we must ensure that the slider doesn't go beyond the bottom/top of the
|
||||
* zoombar div, as well as moving the slider to its new visual location
|
||||
*/
|
||||
zoomBarDrag:function(evt) {
|
||||
if (this.mouseDragStart != null) {
|
||||
var deltaY = this.mouseDragStart.y - evt.xy.y
|
||||
@@ -145,16 +163,28 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
}
|
||||
Event.stop(evt);
|
||||
},
|
||||
|
||||
/*
|
||||
* @param evt
|
||||
* Perform cleanup when a mouseup event is received -- discover new zoom level
|
||||
* and switch to it.
|
||||
*/
|
||||
zoomBarUp:function(evt) {
|
||||
this.div.style.cursor="default";
|
||||
this.map.events.remove("mousemove");
|
||||
this.map.events.remove("mouseup");
|
||||
var deltaY = this.zoomStart.y - evt.xy.y
|
||||
this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight));
|
||||
this.moveZoomBar();
|
||||
this.mouseDragStart = null;
|
||||
Event.stop(evt);
|
||||
if (this.zoomStart) {
|
||||
this.div.style.cursor="default";
|
||||
this.map.events.remove("mousemove");
|
||||
this.map.events.remove("mouseup");
|
||||
var deltaY = this.zoomStart.y - evt.xy.y
|
||||
this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight));
|
||||
this.moveZoomBar();
|
||||
this.mouseDragStart = null;
|
||||
Event.stop(evt);
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Change the location of the slider to match the current zoom level.
|
||||
*/
|
||||
moveZoomBar:function() {
|
||||
var newTop =
|
||||
(this.map.getZoomLevels() - this.map.getZoom()) * this.zoomStopHeight
|
||||
|
||||
Reference in New Issue
Block a user