Merge all changes from the naturaldocs sandbox. This brings all the work that
has been done in the NaturalDocs branch back to trunk. Thanks to everyone who helped out in making this happen. (I could list people, but the list would be long, and I'm already mentally on vacation.) git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -4,38 +4,60 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Control/PanZoom.js
|
||||
*
|
||||
* Class: OpenLayers.Control.PanZoomBar
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Control.PanZoom>
|
||||
* - <OpenLayers.Control>
|
||||
*/
|
||||
OpenLayers.Control.PanZoomBar = OpenLayers.Class.create();
|
||||
OpenLayers.Control.PanZoomBar.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Control.PanZoom, {
|
||||
|
||||
/** @type int */
|
||||
/**
|
||||
* APIProperty: zoomStopWidth
|
||||
*/
|
||||
zoomStopWidth: 18,
|
||||
|
||||
/** @type int */
|
||||
/**
|
||||
* APIProperty: zoomStopHeight
|
||||
*/
|
||||
zoomStopHeight: 11,
|
||||
|
||||
/** @type DOMElement */
|
||||
/**
|
||||
* Property: slider
|
||||
*/
|
||||
slider: null,
|
||||
|
||||
/** @type OpenLayers.Events */
|
||||
/**
|
||||
* Property: sliderEvents
|
||||
* {<OpenLayers.Events>}
|
||||
*/
|
||||
sliderEvents: null,
|
||||
|
||||
/** @type DOMElement */
|
||||
/**
|
||||
* Property: zoomBarDiv
|
||||
* {DOMElement}
|
||||
*/
|
||||
zoomBarDiv: null,
|
||||
|
||||
/** @type OpenLayers.Events */
|
||||
/**
|
||||
* Property: divEvents
|
||||
* {<OpenLayers.Events>}
|
||||
*/
|
||||
divEvents: null,
|
||||
|
||||
/**
|
||||
* Constructor: <OpenLayers.Control.PanZoomBar>
|
||||
*/
|
||||
initialize: function() {
|
||||
OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* APIMethod: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
|
||||
@@ -58,15 +80,19 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Map} map
|
||||
* Method: setMap
|
||||
*
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments);
|
||||
this.map.events.register("changebaselayer", this, this.redraw);
|
||||
},
|
||||
|
||||
/** clear the div and start over.
|
||||
*
|
||||
/**
|
||||
* Method: redraw
|
||||
* clear the div and start over.
|
||||
*/
|
||||
redraw: function() {
|
||||
if (this.div != null) {
|
||||
@@ -76,7 +102,10 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Pixel} px
|
||||
* Method: draw
|
||||
*
|
||||
* Parameters:
|
||||
* px - {<OpenLayers.Pixel>}
|
||||
*/
|
||||
draw: function(px) {
|
||||
// initialize our internal div
|
||||
@@ -101,7 +130,10 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Pixel} location where zoombar drawing is to start.
|
||||
* Method: _addZoomBar
|
||||
*
|
||||
* Parameters:
|
||||
* location - {<OpenLayers.Pixel>} where zoombar drawing is to start.
|
||||
*/
|
||||
_addZoomBar:function(centered) {
|
||||
var imgLocation = OpenLayers.Util.getImagesLocation();
|
||||
@@ -162,17 +194,22 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
this.zoomStopHeight * this.map.getNumZoomLevels());
|
||||
return centered;
|
||||
},
|
||||
/*
|
||||
|
||||
/*
|
||||
* Method: passEventToSlider
|
||||
* 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.
|
||||
* @param {OpenLayers.Event} evt
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {<OpenLayers.Event>}
|
||||
*/
|
||||
passEventToSlider:function(evt) {
|
||||
this.sliderEvents.handleBrowserEvent(evt);
|
||||
},
|
||||
|
||||
/*
|
||||
* divClick: Picks up on clicks directly on the zoombar div
|
||||
* Method: divClick
|
||||
* Picks up on clicks directly on the zoombar div
|
||||
* and sets the zoom level appropriately.
|
||||
*/
|
||||
divClick: function (evt) {
|
||||
@@ -184,9 +221,12 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/*
|
||||
/*
|
||||
* Method: zoomBarDown
|
||||
* event listener for clicks on the slider
|
||||
* @param {OpenLayers.Event} evt
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {<OpenLayers.Event>}
|
||||
*/
|
||||
zoomBarDown:function(evt) {
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
@@ -201,10 +241,14 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
},
|
||||
|
||||
/*
|
||||
* 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
|
||||
* @param {OpenLayers.Event} evt
|
||||
* Method: zoomBarDrag
|
||||
* 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
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {<OpenLayers.Event>}
|
||||
*/
|
||||
zoomBarDrag:function(evt) {
|
||||
if (this.mouseDragStart != null) {
|
||||
@@ -220,10 +264,13 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
/*
|
||||
* Method: zoomBarUp
|
||||
* Perform cleanup when a mouseup event is received -- discover new zoom
|
||||
* level and switch to it.
|
||||
* @param {OpenLayers.Event} evt
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {<OpenLayers.Event>}
|
||||
*/
|
||||
zoomBarUp:function(evt) {
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
@@ -239,7 +286,8 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
/*
|
||||
* Method: moveZoomBar
|
||||
* Change the location of the slider to match the current zoom level.
|
||||
*/
|
||||
moveZoomBar:function() {
|
||||
|
||||
Reference in New Issue
Block a user