OpenLayers OpenLayers

Changeset 556

Show
Ignore:
Timestamp:
06/07/06 23:46:33 (3 years ago)
Author:
crschmidt
Message:

Change it such that the Control location and direction can be selected.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Control/MouseToolbar.js

    r555 r556  
    11// @require: OpenLayers/Control.js 
    22OpenLayers.Control.MouseToolbar = Class.create(); 
    3 OpenLayers.Control.MouseToolbar.X = 4
    4 OpenLayers.Control.MouseToolbar.Y = 4
     3OpenLayers.Control.MouseToolbar.X = 6
     4OpenLayers.Control.MouseToolbar.Y = 300
    55OpenLayers.Control.MouseToolbar.prototype =  
    66  Object.extend( new OpenLayers.Control(), { 
     
    1212    direction: "vertical", 
    1313     
    14     initialize: function(direction) { 
     14    initialize: function(position, direction) { 
    1515        OpenLayers.Control.prototype.initialize.apply(this, arguments); 
     16        this.position = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X, 
     17                                             OpenLayers.Control.MouseToolbar.Y); 
     18        if (position) { 
     19            this.position = position; 
     20        } 
    1621        if (direction) { 
    1722            this.direction = direction;  
     
    2934        this.map.events.register( "mouseout", this, this.defaultMouseOut ); 
    3035        var sz = new OpenLayers.Size(28,28); 
    31         var centered = new OpenLayers.Pixel(12, 300)
     36        var centered = this.position
    3237        this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz); 
    33         this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", new OpenLayers.Pixel(12,328), sz); 
    34         this._addButton("measure", "measuring-stick-off.png", "measuring-stick-on.png", new OpenLayers.Pixel(12,356), sz); 
     38        centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0)); 
     39        this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz); 
     40        centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0)); 
     41        this._addButton("measure", "measuring-stick-off.png", "measuring-stick-on.png", centered, sz); 
    3542        this.switchModeTo("pan"); 
    3643        this.map.events.register("zoomend", this, function() { this.switchModeTo("pan"); });