Changeset 552
- Timestamp:
- 06/07/06 15:09:39 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Control/MouseToolbar.js
r509 r552 9 9 10 10 buttons: null, 11 12 direction: "vertical", 11 13 12 initialize: function( ) {14 initialize: function(direction) { 13 15 OpenLayers.Control.prototype.initialize.apply(this, arguments); 14 this.mode = null; 16 if (direction) { 17 this.direction = direction; 18 } 15 19 }, 16 20 … … 23 27 this.map.events.register( "mousemove", this, this.defaultMouseMove ); 24 28 this.map.events.register( "mouseout", this, this.defaultMouseOut ); 25 var sz = new OpenLayers.Size( 18,18);29 var sz = new OpenLayers.Size(28,28); 26 30 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); 28 33 return this.div; 29 34 }, … … 43 48 44 49 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); 46 52 btn.action = id; 47 53 btn.map = this.map; … … 50 56 this.buttons[id] = btn; 51 57 return btn; 58 }, 59 60 stopAction: function(evt) { 61 Event.stop(evt); 52 62 }, 53 63 … … 70 80 defaultMouseDown: function (evt) { 71 81 this.mouseDragStart = evt.xy.copyOf(); 72 if (evt.shiftKey ) {82 if (evt.shiftKey && this.mode !="zoombox") { 73 83 this.switchModeTo("zoombox"); 74 } else if (evt.altKey ) {84 } else if (evt.altKey && this.mode !="measure") { 75 85 this.switchModeTo("measure"); 86 } else if (!this.mode) { 87 this.switchModeTo("pan"); 76 88 } 89 77 90 switch (this.mode) { 78 91 case "zoombox": … … 100 113 101 114 switchModeTo: function(mode) { 102 console.log('leave mode?'+mode+","+this.mode);103 115 if (mode != this.mode) { 104 116 this.mode = mode;
