From 84a7d8583c53373f7c21c5d9a2d0b819ef14fa85 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Thu, 8 Jun 2006 03:46:33 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Control/MouseToolbar.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/Control/MouseToolbar.js b/lib/OpenLayers/Control/MouseToolbar.js index 45e83b3987..d2e5c50eab 100644 --- a/lib/OpenLayers/Control/MouseToolbar.js +++ b/lib/OpenLayers/Control/MouseToolbar.js @@ -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;