OpenLayers OpenLayers

Changeset 552

Show
Ignore:
Timestamp:
06/07/06 15:09:39 (2 years ago)
Author:
crschmidt
Message:

r3113@creusa: crschmidt | 2006-06-07 12:19:31 -0400
Changes to MouseToolbar: images are correct, fixes to various small mouse issues when combining clicked icons with modifier keys.

Files:

Legend:

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

    r509 r552  
    99 
    1010    buttons: null, 
     11 
     12    direction: "vertical", 
    1113     
    12     initialize: function() { 
     14    initialize: function(direction) { 
    1315        OpenLayers.Control.prototype.initialize.apply(this, arguments); 
    14         this.mode = null; 
     16        if (direction) { 
     17            this.direction = direction;  
     18        } 
    1519    }, 
    1620     
     
    2327        this.map.events.register( "mousemove", this, this.defaultMouseMove ); 
    2428        this.map.events.register( "mouseout", this, this.defaultMouseOut ); 
    25         var sz = new OpenLayers.Size(18,18); 
     29        var sz = new OpenLayers.Size(28,28); 
    2630        var centered = new OpenLayers.Pixel(100, 20); 
    27         this._addButton("zoombox", "west-mini.png", "east-mini.png", centered, sz); 
     31        this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz); 
     32        this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", new OpenLayers.Pixel(100,47), sz); 
    2833        return this.div; 
    2934    }, 
     
    4348         
    4449        btn.events = new OpenLayers.Events(this, btn); 
    45         btn.events.register("click", this, this.buttonClick);  
     50        btn.events.register("mousedown", this, this.buttonClick);  
     51        btn.events.register("mouseup", this, this.stopAction);  
    4652        btn.action = id; 
    4753        btn.map = this.map; 
     
    5056        this.buttons[id] = btn; 
    5157        return btn; 
     58    }, 
     59 
     60    stopAction: function(evt) { 
     61        Event.stop(evt); 
    5262    }, 
    5363 
     
    7080    defaultMouseDown: function (evt) { 
    7181        this.mouseDragStart = evt.xy.copyOf(); 
    72         if (evt.shiftKey) { 
     82        if (evt.shiftKey && this.mode !="zoombox") { 
    7383            this.switchModeTo("zoombox"); 
    74         } else if (evt.altKey) { 
     84        } else if (evt.altKey && this.mode !="measure") { 
    7585            this.switchModeTo("measure"); 
     86        } else if (!this.mode) { 
     87            this.switchModeTo("pan"); 
    7688        } 
     89         
    7790        switch (this.mode) { 
    7891            case "zoombox": 
     
    100113 
    101114    switchModeTo: function(mode) { 
    102             console.log('leave mode?'+mode+","+this.mode); 
    103115        if (mode != this.mode) { 
    104116            this.mode = mode;