Merge branch 'control-inheritance' of https://github.com/marcjansen/openlayers into control-inheritance

Conflicts:
	tests/Control/ZoomOut.html
	tests/Control/ZoomToMaxExtent.html
This commit is contained in:
Marc Jansen
2012-06-08 09:44:36 +02:00
6 changed files with 332 additions and 41 deletions

View File

@@ -4,7 +4,7 @@
* full text of the license. */
/**
* @requires OpenLayers/Control.js
* @requires OpenLayers/Control/Button.js
*/
/**
@@ -15,7 +15,7 @@
* Inherits from:
* - <OpenLayers.Control>
*/
OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control.Button, {
/**
* APIProperty: slideFactor
@@ -40,14 +40,6 @@ OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
*/
direction: null,
/**
* Property: type
* {String} The type of <OpenLayers.Control> -- When added to a
* <Control.Panel>, 'type' is used by the panel to determine how to
* handle our events.
*/
type: OpenLayers.Control.TYPE_BUTTON,
/**
* Constructor: OpenLayers.Control.Pan
* Control which handles the panning (in any of the cardinal directions)
@@ -70,26 +62,27 @@ OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
* Method: trigger
*/
trigger: function(){
if (this.map) {
var getSlideFactor = OpenLayers.Function.bind(function (dim) {
return this.slideRatio ?
this.map.getSize()[dim] * this.slideRatio :
this.slideFactor;
}, this);
var getSlideFactor = OpenLayers.Function.bind(function (dim) {
return this.slideRatio ?
this.map.getSize()[dim] * this.slideRatio :
this.slideFactor;
}, this);
switch (this.direction) {
case OpenLayers.Control.Pan.NORTH:
this.map.pan(0, -getSlideFactor("h"));
break;
case OpenLayers.Control.Pan.SOUTH:
this.map.pan(0, getSlideFactor("h"));
break;
case OpenLayers.Control.Pan.WEST:
this.map.pan(-getSlideFactor("w"), 0);
break;
case OpenLayers.Control.Pan.EAST:
this.map.pan(getSlideFactor("w"), 0);
break;
switch (this.direction) {
case OpenLayers.Control.Pan.NORTH:
this.map.pan(0, -getSlideFactor("h"));
break;
case OpenLayers.Control.Pan.SOUTH:
this.map.pan(0, getSlideFactor("h"));
break;
case OpenLayers.Control.Pan.WEST:
this.map.pan(-getSlideFactor("w"), 0);
break;
case OpenLayers.Control.Pan.EAST:
this.map.pan(getSlideFactor("w"), 0);
break;
}
}
},

View File

@@ -4,7 +4,7 @@
* full text of the license. */
/**
* @requires OpenLayers/Control.js
* @requires OpenLayers/Control/Button.js
*/
/**
@@ -14,21 +14,15 @@
* Inherits from:
* - <OpenLayers.Control>
*/
OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control, {
OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control.Button, {
/**
* Property: type
* {String} The type of <OpenLayers.Control> -- When added to a
* <Control.Panel>, 'type' is used by the panel to determine how to
* handle our events.
*/
type: OpenLayers.Control.TYPE_BUTTON,
/**
* Method: trigger
*/
trigger: function(){
this.map.zoomIn();
if (this.map) {
this.map.zoomIn();
}
},
CLASS_NAME: "OpenLayers.Control.ZoomIn"