OpenLayers OpenLayers

Changeset 1347

Show
Ignore:
Timestamp:
08/24/06 01:01:10 (2 years ago)
Author:
crschmidt
Message:

If we choose to switch to a mode via the toolbar, don't leave that mode
until we're explicitly told to. This allows users to click the zoombox
and zoom several times.

Files:

Legend:

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

    r1339 r1347  
    4949        centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0)); 
    5050        this.switchModeTo("pan"); 
    51         this.map.events.register("zoomend", this, function() { this.switchModeTo("pan"); }); 
    5251        return this.div; 
    5352         
     
    106105        this.mouseDragStart = evt.xy.clone(); 
    107106        this.performedDrag = false; 
     107        this.startViaKeyboard = false; 
    108108        if (evt.shiftKey && this.mode !="zoombox") { 
    109109            this.switchModeTo("zoombox"); 
     110            this.startViaKeyboard = true; 
    110111        } else if (evt.altKey && this.mode !="measure") { 
    111112            this.switchModeTo("measure"); 
     
    240241        switch (this.mode) { 
    241242            case "zoombox": 
    242                 console.log(this.mouseDragStart, evt.xy); 
    243                 console.log(Math.abs(this.mouseDragStart.x - evt.xy.x) > 5 ||                        Math.abs((this.mouseDragStart.y - evt.xy.y)) > 5); 
    244                 console.log(Math.abs(this.mouseDragStart.x-evt.xy.x) > 5);  
    245                 console.log(Math.abs(this.mouseDragStart.y-evt.xy.y)>5);  
    246243                if (Math.abs(this.mouseDragStart.x - evt.xy.x) > 5 ||     
    247244                    Math.abs(this.mouseDragStart.y - evt.xy.y) > 5) {   
     
    261258                this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); 
    262259                this.zoomBox = null; 
    263                 this.leaveMode(); 
     260                console.log(this.startViaKeyboard); 
     261                if (this.startViaKeyboard) this.leaveMode(); 
    264262                break; 
    265263            case "pan":