Change it such that the Control location and direction can be selected.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@556 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// @require: OpenLayers/Control.js
|
||||
OpenLayers.Control.MouseToolbar = Class.create();
|
||||
OpenLayers.Control.MouseToolbar.X = 4;
|
||||
OpenLayers.Control.MouseToolbar.Y = 4;
|
||||
OpenLayers.Control.MouseToolbar.X = 6;
|
||||
OpenLayers.Control.MouseToolbar.Y = 300;
|
||||
OpenLayers.Control.MouseToolbar.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
|
||||
@@ -11,8 +11,13 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
|
||||
direction: "vertical",
|
||||
|
||||
initialize: function(direction) {
|
||||
initialize: function(position, direction) {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
||||
this.position = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,
|
||||
OpenLayers.Control.MouseToolbar.Y);
|
||||
if (position) {
|
||||
this.position = position;
|
||||
}
|
||||
if (direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
@@ -28,10 +33,12 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
this.map.events.register( "mousemove", this, this.defaultMouseMove );
|
||||
this.map.events.register( "mouseout", this, this.defaultMouseOut );
|
||||
var sz = new OpenLayers.Size(28,28);
|
||||
var centered = new OpenLayers.Pixel(12, 300);
|
||||
var centered = this.position;
|
||||
this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz);
|
||||
this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", new OpenLayers.Pixel(12,328), sz);
|
||||
this._addButton("measure", "measuring-stick-off.png", "measuring-stick-on.png", new OpenLayers.Pixel(12,356), sz);
|
||||
centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0));
|
||||
this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz);
|
||||
centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0));
|
||||
this._addButton("measure", "measuring-stick-off.png", "measuring-stick-on.png", centered, sz);
|
||||
this.switchModeTo("pan");
|
||||
this.map.events.register("zoomend", this, function() { this.switchModeTo("pan"); });
|
||||
return this.div;
|
||||
|
||||
Reference in New Issue
Block a user