Changeset 1481
- Timestamp:
- 09/18/06 14:48:29 (2 years ago)
- Files:
-
- branches/openlayers/2.1/doc/Layer.txt (modified) (1 diff)
- branches/openlayers/2.1/lib/OpenLayers/Control/MouseDefaults.js (modified) (2 diffs)
- branches/openlayers/2.1/lib/OpenLayers/Control/MouseToolbar.js (modified) (7 diffs)
- branches/openlayers/2.1/lib/OpenLayers/Control/PanZoomBar.js (modified) (2 diffs)
- branches/openlayers/2.1/lib/OpenLayers/Events.js (modified) (2 diffs)
- branches/openlayers/2.1/lib/OpenLayers/Layer.js (modified) (1 diff)
- branches/openlayers/2.1/lib/OpenLayers/Popup.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/openlayers/2.1/doc/Layer.txt
r1424 r1481 13 13 setName({String|name}) -- none -- Set the name of the layer to something different. 14 14 moveTo({OpenLayers.Bounds|bounds}, {Boolean|zoomChanged}) -- none -- Not implemented here, but the general function called on dragging or setCenter, to move the Layer to a new geographic location. 15 reproject() -- none -- Subclassed by vector layers to redraw vectors when base layer changes.16 15 setMap(map) -- none -- Set the map property of the layer. Also set the parameters which are inherited from the map. 17 16 getVisibility() -- {Boolean} -- Return true or false based on visibility of the layer. branches/openlayers/2.1/lib/OpenLayers/Control/MouseDefaults.js
r1447 r1481 142 142 */ 143 143 defaultMouseOut: function (evt) { 144 if (this.mouseDragStart != null 145 && OpenLayers.Util.mouseLeft(evt, this.map.div)) { 146 this.defaultMouseUp(evt); 144 if (this.mouseDragStart != null && 145 OpenLayers.Util.mouseLeft(evt, this.map.div)) { 146 if (this.zoomBox) { 147 this.removeZoomBox(); 148 } 149 this.mouseDragStart = null; 147 150 } 148 151 }, … … 189 192 ), this.map.getZoom() + 1); 190 193 } 191 this.map.viewPortDiv.removeChild(this.zoomBox); 192 this.zoomBox = null; 193 } 194 this.removeZoomBox(); 195 } 196 }, 197 198 /** 199 * Remove the zoombox from the screen and nullify our reference to it. 200 */ 201 removeZoomBox: function() { 202 this.map.viewPortDiv.removeChild(this.zoomBox); 203 this.zoomBox = null; 194 204 }, 195 205 branches/openlayers/2.1/lib/OpenLayers/Control/MouseToolbar.js
r1424 r1481 21 21 22 22 direction: "vertical", 23 24 /** @type String */ 25 buttonClicked: null, 23 26 24 27 initialize: function(position, direction) { … … 63 66 btn.activeImgLocation = activeImgLocation; 64 67 65 btn.events = new OpenLayers.Events(this, btn );66 btn.events.register("mousedown", this, this.button Click);67 btn.events.register("mouseup", this, Event.stop);68 btn.events.register(" click", this, Event.stop);68 btn.events = new OpenLayers.Events(this, btn, null, true); 69 btn.events.register("mousedown", this, this.buttonDown); 70 btn.events.register("mouseup", this, this.buttonUp); 71 btn.events.register("dblclick", this, Event.stop); 69 72 btn.action = id; 70 73 btn.title = title; … … 77 80 }, 78 81 79 buttonClick: function(evt) { 82 /** 83 * @param {Event} evt 84 */ 85 buttonDown: function(evt) { 80 86 if (!Event.isLeftClick(evt)) return; 81 this. switchModeTo(evt.element.action);87 this.buttonClicked = evt.element.action; 82 88 Event.stop(evt); 89 }, 90 91 /** 92 * @param {Event} evt 93 */ 94 buttonUp: function(evt) { 95 if (!Event.isLeftClick(evt)) return; 96 if (this.buttonClicked != null) { 97 if (this.buttonClicked == evt.element.action) { 98 this.switchModeTo(evt.element.action); 99 } 100 Event.stop(evt); 101 this.buttonClicked = null; 102 } 83 103 }, 84 104 … … 90 110 this.performedDrag = false; 91 111 var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); 92 this.map.setCenter(newCenter, this.map.zoom + 2);112 this.map.setCenter(newCenter, this.map.zoom + 1); 93 113 Event.stop(evt); 94 114 return false; … … 180 200 switchModeTo: function(mode) { 181 201 if (mode != this.mode) { 202 203 182 204 if (this.mode && this.buttons[this.mode]) { 183 205 OpenLayers.Util.modifyAlphaImageDiv(this.buttons[this.mode], null, null, null, this.buttons[this.mode].imgLocation); … … 196 218 OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode], null, null, null, this.buttons[mode].activeImgLocation); 197 219 } 220 switch (this.mode) { 221 case "zoombox": 222 this.map.div.style.cursor = "crosshair"; 223 break; 224 default: 225 this.map.div.style.cursor = "default"; 226 break; 227 } 228 198 229 } 199 230 }, … … 255 286 }, 256 287 288 /** 289 * @param {Event} evt 290 */ 257 291 defaultMouseOut: function (evt) { 258 292 if (this.mouseDragStart != null 259 293 && OpenLayers.Util.mouseLeft(evt, this.map.div)) { 260 this.defaultMouseUp(evt); 261 } 262 }, 294 if (this.zoomBox) { 295 this.removeZoomBox(); 296 if (this.startViaKeyboard) this.leaveMode(); 297 } 298 this.mouseDragStart = null; 299 this.map.div.style.cursor = "default"; 300 } 301 }, 302 263 303 defaultClick: function (evt) { 264 304 if (this.performedDrag) { branches/openlayers/2.1/lib/OpenLayers/Control/PanZoomBar.js
r1424 r1481 87 87 this.slider = slider; 88 88 89 this.sliderEvents = new OpenLayers.Events(this, slider );89 this.sliderEvents = new OpenLayers.Events(this, slider, null, true); 90 90 this.sliderEvents.register("mousedown", this, this.zoomBarDown); 91 91 this.sliderEvents.register("mousemove", this, this.zoomBarDrag); … … 117 117 this.zoombarDiv = div; 118 118 119 this.divEvents = new OpenLayers.Events(this, div );119 this.divEvents = new OpenLayers.Events(this, div, null, true); 120 120 this.divEvents.register("mousedown", this, this.divClick); 121 121 this.divEvents.register("mousemove", this, this.passEventToSlider); branches/openlayers/2.1/lib/OpenLayers/Events.js
r1424 r1481 38 38 * @param {DOMElement} element A dom element to respond to browser events 39 39 * @param {Array} eventTypes Array of custom application events 40 */ 41 initialize: function (object, element, eventTypes) { 40 * @param {Boolean} fallThrough Allow events to fall through after these 41 * have been handled? 42 */ 43 initialize: function (object, element, eventTypes, fallThrough) { 42 44 this.object = object; 43 45 this.element = element; 44 46 this.eventTypes = eventTypes; 47 this.fallThrough = fallThrough; 45 48 this.listeners = new Object(); 46 49 … … 177 180 } 178 181 // don't fall through to other DOM elements 179 Event.stop(evt); 182 if (!this.fallThrough) { 183 Event.stop(evt); 184 } 180 185 } 181 186 }, branches/openlayers/2.1/lib/OpenLayers/Layer.js
r1448 r1481 323 323 } 324 324 } 325 this.resolutions = this.resolutions.sort().reverse();326 325 }, 327 326 branches/openlayers/2.1/lib/OpenLayers/Popup.js
r1438 r1481 251 251 */ 252 252 registerEvents:function() { 253 Event.observe(this.div, "mousedown", 254 this.onmousedown.bindAsEventListener(this)); 255 Event.observe(this.div, "mousemove", 256 this.onmousemove.bindAsEventListener(this)); 257 Event.observe(this.div, "mouseup", 258 this.onmouseup.bindAsEventListener(this)); 259 Event.observe(this.div, "click", 260 OpenLayers.Util.safeStopPropagation); 261 Event.observe(this.div, "mouseout", 262 this.onmouseout.bindAsEventListener(this)); 263 Event.observe(this.div, "dblclick", 264 OpenLayers.Util.safeStopPropagation); 253 this.events = new OpenLayers.Events(this, this.div, null, true); 254 255 this.events.register("mousedown", this, this.onmousedown); 256 this.events.register("mousemove", this, this.onmousemove); 257 this.events.register("mouseup", this, this.onmouseup); 258 this.events.register("click", this, 259 OpenLayers.Util.safeStopPropagation); 260 this.events.register("mouseout", this, this.onmouseout); 261 this.events.register("dblclick", this, 262 OpenLayers.Util.safeStopPropagation); 265 263 }, 266 264
