Changeset 6125
- Timestamp:
- 02/08/08 14:35:06 (1 year ago)
- Files:
-
- sandbox/tschaub/events/doc/authors.txt (modified) (3 diffs)
- sandbox/tschaub/events/doc/licenses/BSD-LICENSE.txt (copied) (copied from trunk/openlayers/doc/licenses/BSD-LICENSE.txt)
- sandbox/tschaub/events/examples/animated_panning.html (copied) (copied from trunk/openlayers/examples/animated_panning.html)
- sandbox/tschaub/events/examples/click-handler.html (modified) (3 diffs)
- sandbox/tschaub/events/lib/OpenLayers.js (modified) (1 diff)
- sandbox/tschaub/events/lib/OpenLayers/Control.js (modified) (1 diff)
- sandbox/tschaub/events/lib/OpenLayers/Control/DragFeature.js (modified) (10 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Control/ModifyFeature.js (modified) (7 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Control/Navigation.js (modified) (8 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Control/OverviewMap.js (modified) (8 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Events.js (modified) (1 diff)
- sandbox/tschaub/events/lib/OpenLayers/Format/SLD.js (modified) (3 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Format/WFS.js (modified) (7 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Format/WMC/v1_1_0.js (modified) (1 diff)
- sandbox/tschaub/events/lib/OpenLayers/Handler/Click.js (modified) (2 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Map.js (modified) (8 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Popup.js (modified) (3 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Renderer.js (modified) (1 diff)
- sandbox/tschaub/events/lib/OpenLayers/Renderer/VML.js (modified) (1 diff)
- sandbox/tschaub/events/lib/OpenLayers/Rule.js (modified) (2 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Rule/Comparison.js (modified) (6 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Rule/FeatureId.js (modified) (1 diff)
- sandbox/tschaub/events/lib/OpenLayers/Rule/Logical.js (modified) (6 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Style.js (modified) (7 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Tile/Image.js (modified) (2 diffs)
- sandbox/tschaub/events/lib/OpenLayers/Tween.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Tween.js)
- sandbox/tschaub/events/tests/Control/test_DragFeature.html (modified) (6 diffs)
- sandbox/tschaub/events/tests/Control/test_ModifyFeature.html (modified) (2 diffs)
- sandbox/tschaub/events/tests/Control/test_Navigation.html (modified) (1 diff)
- sandbox/tschaub/events/tests/Control/test_OverviewMap.html (modified) (4 diffs)
- sandbox/tschaub/events/tests/Control/test_PanZoom.html (modified) (8 diffs)
- sandbox/tschaub/events/tests/Control/test_Permalink.html (modified) (6 diffs)
- sandbox/tschaub/events/tests/Format/WMC (copied) (copied from trunk/openlayers/tests/Format/WMC)
- sandbox/tschaub/events/tests/Format/WMC/test_v1_1_0.html (copied) (copied from trunk/openlayers/tests/Format/WMC/test_v1_1_0.html)
- sandbox/tschaub/events/tests/Handler/test_Click.html (modified) (2 diffs)
- sandbox/tschaub/events/tests/Layer/test_Grid.html (modified) (1 diff)
- sandbox/tschaub/events/tests/Layer/test_KaMap.html (modified) (1 diff)
- sandbox/tschaub/events/tests/Rule/test_Logical.html (modified) (2 diffs)
- sandbox/tschaub/events/tests/list-tests.html (modified) (2 diffs)
- sandbox/tschaub/events/tests/manual/tween.html (copied) (copied from trunk/openlayers/tests/manual/tween.html)
- sandbox/tschaub/events/tests/test_Map.html (modified) (3 diffs)
- sandbox/tschaub/events/tests/test_Style.html (modified) (1 diff)
- sandbox/tschaub/events/tests/test_Tween.html (copied) (copied from trunk/openlayers/tests/test_Tween.html)
- sandbox/tschaub/events/theme/default/img/editing_tool_bar.png (copied) (copied from trunk/openlayers/theme/default/img/editing_tool_bar.png)
- sandbox/tschaub/events/theme/default/style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/tschaub/events/doc/authors.txt
r5970 r6125 1 1 OpenLayers contributors: 2 2 3 Seb Benthall 3 4 Howard Butler 4 5 Bertil Chaupis … … 25 26 James Stembridge 26 27 Erik Uzureau 28 Ivan Willig 27 29 Bill Woodall 28 30 Steve Woodbridge … … 33 35 Some portions of OpenLayers are used under the MIT license, availabie in 34 36 doc/licenses/MIT-LICENSE.txt. 37 38 Some portions of OpenLayers are Copyright 2001 Robert Penner, and are used 39 under the BSD license, available in doc/licenses/BSD-LICENSE.txt sandbox/tschaub/events/examples/click-handler.html
r5438 r6125 39 39 'single': true, 40 40 'double': false, 41 'pixelTolerance': null,41 'pixelTolerance': 0, 42 42 'stopSingle': false, 43 43 'stopDouble': false … … 103 103 } 104 104 }), 105 " nodrag": new OpenLayers.Control.Click({105 "drag": new OpenLayers.Control.Click({ 106 106 handlerOptions: { 107 107 "single": true, 108 "pixelTolerance": 1108 "pixelTolerance": null 109 109 } 110 110 }), … … 205 205 </tr> 206 206 <tr> 207 <td>single nodrag</td>208 <td><button id=" nodragStatus" onclick="toggle('nodrag')">off</button></td>209 <td><textarea class="output" id=" nodragOutput"></textarea></td>207 <td>single with drag</td> 208 <td><button id="dragStatus" onclick="toggle('drag')">off</button></td> 209 <td><textarea class="output" id="dragOutput"></textarea></td> 210 210 </tr> 211 211 <tr> sandbox/tschaub/events/lib/OpenLayers.js
r5921 r6125 80 80 "OpenLayers/BaseTypes/Size.js", 81 81 "OpenLayers/Console.js", 82 "OpenLayers/Tween.js", 82 83 "Rico/Corner.js", 83 84 "Rico/Color.js", sandbox/tschaub/events/lib/OpenLayers/Control.js
r5910 r6125 140 140 this.handler = null; 141 141 } 142 if(this.handlers) { 143 for(var key in this.handlers) { 144 if(this.handlers.hasOwnProperty(key) && 145 typeof this.handlers[key].destroy == "function") { 146 this.handlers[key].destroy(); 147 } 148 } 149 this.handlers = null; 150 } 142 151 if (this.map) { 143 152 this.map.removeControl(this); sandbox/tschaub/events/lib/OpenLayers/Control/DragFeature.js
r5614 r6125 78 78 79 79 /** 80 * Property: dragHandler81 * {<OpenLayers.Handler.Drag>}82 */83 dragHandler: null,84 85 /**86 80 * Property: dragCallbacks 87 81 * {Object} The functions that are sent to the drag handler for callback. 88 82 */ 89 83 dragCallbacks: {}, 90 91 /**92 * Property: featureHandler93 * {<OpenLayers.Handler.Feature>}94 */95 featureHandler: null,96 84 97 85 /** … … 120 108 OpenLayers.Control.prototype.initialize.apply(this, [options]); 121 109 this.layer = layer; 122 this.dragCallbacks = OpenLayers.Util.extend({down: this.downFeature, 123 move: this.moveFeature, 124 up: this.upFeature, 125 out: this.cancel, 126 done: this.doneDragging 127 }, this.dragCallbacks); 128 this.dragHandler = new OpenLayers.Handler.Drag(this, this.dragCallbacks); 129 this.featureCallbacks = OpenLayers.Util.extend({over: this.overFeature, 130 out: this.outFeature 131 }, this.featureCallbacks); 132 var handlerOptions = {geometryTypes: this.geometryTypes}; 133 this.featureHandler = new OpenLayers.Handler.Feature(this, this.layer, 134 this.featureCallbacks, 135 handlerOptions); 110 this.handlers = { 111 drag: new OpenLayers.Handler.Drag( 112 this, OpenLayers.Util.extend({ 113 down: this.downFeature, 114 move: this.moveFeature, 115 up: this.upFeature, 116 out: this.cancel, 117 done: this.doneDragging 118 }, this.dragCallbacks) 119 ), 120 feature: new OpenLayers.Handler.Feature( 121 this, this.layer, OpenLayers.Util.extend({ 122 over: this.overFeature, 123 out: this.outFeature 124 }, this.featureCallbacks), 125 {geometryTypes: this.geometryTypes} 126 ) 127 }; 136 128 }, 137 129 … … 142 134 destroy: function() { 143 135 this.layer = null; 144 this.dragHandler.destroy();145 this.featureHandler.destroy();146 136 OpenLayers.Control.prototype.destroy.apply(this, []); 147 137 }, … … 155 145 */ 156 146 activate: function() { 157 return (this. featureHandler.activate() &&147 return (this.handlers.feature.activate() && 158 148 OpenLayers.Control.prototype.activate.apply(this, arguments)); 159 149 }, … … 168 158 deactivate: function() { 169 159 // the return from the handlers is unimportant in this case 170 this. dragHandler.deactivate();171 this. featureHandler.deactivate();160 this.handlers.drag.deactivate(); 161 this.handlers.feature.deactivate(); 172 162 this.feature = null; 173 163 this.dragging = false; … … 185 175 */ 186 176 overFeature: function(feature) { 187 if(!this. dragHandler.dragging) {177 if(!this.handlers.drag.dragging) { 188 178 this.feature = feature; 189 this. dragHandler.activate();179 this.handlers.drag.activate(); 190 180 this.over = true; 191 181 // TBD replace with CSS classes … … 239 229 upFeature: function(pixel) { 240 230 if(!this.over) { 241 this. dragHandler.deactivate();231 this.handlers.drag.deactivate(); 242 232 this.feature = null; 243 233 // TBD replace with CSS classes … … 266 256 */ 267 257 outFeature: function(feature) { 268 if(!this. dragHandler.dragging) {258 if(!this.handlers.drag.dragging) { 269 259 this.over = false; 270 this. dragHandler.deactivate();260 this.handlers.drag.deactivate(); 271 261 // TBD replace with CSS classes 272 262 this.map.div.style.cursor = "default"; … … 284 274 */ 285 275 cancel: function() { 286 this. dragHandler.deactivate();276 this.handlers.drag.deactivate(); 287 277 this.over = false; 288 278 }, … … 296 286 */ 297 287 setMap: function(map) { 298 this. dragHandler.setMap(map);299 this. featureHandler.setMap(map);288 this.handlers.drag.setMap(map); 289 this.handlers.feature.setMap(map); 300 290 OpenLayers.Control.prototype.setMap.apply(this, arguments); 301 291 }, sandbox/tschaub/events/lib/OpenLayers/Control/ModifyFeature.js
r6064 r6125 84 84 85 85 /** 86 * Property: keyboardHandler87 * { <OpenLayers.Handler.Keyboard>}88 */ 89 keyboardHandler: null,86 * Property: handlers 87 * {Object} 88 */ 89 handlers: null, 90 90 91 91 /** … … 216 216 keypress: this.handleKeypress 217 217 }; 218 this. keyboardHandler = new OpenLayers.Handler.Keyboard(219 this, keyboardOptions220 );218 this.handlers = { 219 keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions) 220 }; 221 221 }, 222 222 … … 234 234 this.selectControl.destroy(); 235 235 this.dragControl.destroy(); 236 this.keyboardHandler.destroy();237 236 OpenLayers.Control.prototype.destroy.apply(this, []); 238 237 }, … … 247 246 activate: function() { 248 247 return (this.selectControl.activate() && 249 this. keyboardHandler.activate() &&248 this.handlers.keyboard.activate() && 250 249 OpenLayers.Control.prototype.activate.apply(this, arguments)); 251 250 }, … … 271 270 } 272 271 this.selectControl.deactivate(); 273 this. keyboardHandler.deactivate();272 this.handlers.keyboard.deactivate(); 274 273 deactivated = true; 275 274 } … … 359 358 [feature]); 360 359 this.dragControl.lastPixel = pixel; 361 this.dragControl. dragHandler.started = true;362 this.dragControl. dragHandler.start = pixel;363 this.dragControl. dragHandler.last = pixel;360 this.dragControl.handlers.drag.started = true; 361 this.dragControl.handlers.drag.start = pixel; 362 this.dragControl.handlers.drag.last = pixel; 364 363 } 365 364 } … … 493 492 if(vertex && 494 493 OpenLayers.Util.indexOf(this.vertices, vertex) != -1 && 495 !this.dragControl. dragHandler.dragging &&494 !this.dragControl.handlers.drag.dragging && 496 495 vertex.geometry.parent) { 497 496 // remove the vertex sandbox/tschaub/events/lib/OpenLayers/Control/Navigation.js
r5990 r6125 37 37 zoomBox: null, 38 38 39 /**40 * Property: wheelHandler41 * {<OpenLayers.Handler.MouseWheel>}42 */43 wheelHandler: null,44 45 39 /** 46 40 * Constructor: OpenLayers.Control.Navigation … … 52 46 */ 53 47 initialize: function(options) { 48 this.handlers = {}; 54 49 OpenLayers.Control.prototype.initialize.apply(this, arguments); 55 50 }, … … 62 57 */ 63 58 destroy: function() { 64 OpenLayers.Control.prototype.destroy.apply(this,arguments);65 66 59 this.deactivate(); 67 60 … … 71 64 this.dragPan = null; 72 65 73 if (this.wheelHandler) {74 this.wheelHandler.destroy();75 }76 this.wheelHandler = null;77 78 if (this.clickHandler) {79 this.clickHandler.destroy();80 }81 this.clickHandler = null;82 83 66 if (this.zoomBox) { 84 67 this.zoomBox.destroy(); 85 68 } 86 69 this.zoomBox = null; 70 OpenLayers.Control.prototype.destroy.apply(this,arguments); 87 71 }, 88 72 … … 92 76 activate: function() { 93 77 this.dragPan.activate(); 94 this. wheelHandler.activate();95 this. clickHandler.activate();78 this.handlers.wheel.activate(); 79 this.handlers.click.activate(); 96 80 this.zoomBox.activate(); 97 81 return OpenLayers.Control.prototype.activate.apply(this,arguments); … … 104 88 this.zoomBox.deactivate(); 105 89 this.dragPan.deactivate(); 106 this. clickHandler.deactivate();107 this. wheelHandler.deactivate();90 this.handlers.click.deactivate(); 91 this.handlers.wheel.deactivate(); 108 92 return OpenLayers.Control.prototype.deactivate.apply(this,arguments); 109 93 }, … … 113 97 */ 114 98 draw: function() { 115 this. clickHandler= new OpenLayers.Handler.Click(this,99 this.handlers.click = new OpenLayers.Handler.Click(this, 116 100 { 'dblclick': this.defaultDblClick }, 117 101 { … … 124 108 this.dragPan.draw(); 125 109 this.zoomBox.draw(); 126 this. wheelHandler= new OpenLayers.Handler.MouseWheel(110 this.handlers.wheel = new OpenLayers.Handler.MouseWheel( 127 111 this, {"up" : this.wheelUp, 128 112 "down": this.wheelDown} ); sandbox/tschaub/events/lib/OpenLayers/Control/OverviewMap.js
r6078 r6125 99 99 100 100 /** 101 * Property: dragHandler102 * { <OpenLayers.Handler.Drag>} A handler for dragging the extent rectangle.103 */ 104 dragHandler: null,101 * Property: handlers 102 * {Object} 103 */ 104 handlers: null, 105 105 106 106 /** … … 115 115 initialize: function(options) { 116 116 this.layers = []; 117 this.handlers = {}; 117 118 OpenLayers.Control.prototype.initialize.apply(this, [options]); 118 119 }, … … 126 127 return; 127 128 } 128 this.dragHandler.destroy(); 129 this.clickHandler.destroy(); 129 this.handlers.click.destroy(); 130 130 131 131 this.mapDiv.removeChild(this.extentRectangle); … … 283 283 */ 284 284 rectDrag: function(px) { 285 var deltaX = this. dragHandler.last.x - px.x;286 var deltaY = this. dragHandler.last.y - px.y;285 var deltaX = this.handlers.drag.last.x - px.x; 286 var deltaY = this.handlers.drag.last.y - px.y; 287 287 if(deltaX != 0 || deltaY != 0) { 288 288 var rectTop = this.rectPxBounds.top; … … 437 437 // create the overview map 438 438 var options = OpenLayers.Util.extend( 439 {controls: [], maxResolution: 'auto'}, this.mapOptions); 439 {controls: [], maxResolution: 'auto', 440 fallThrough: false}, this.mapOptions); 440 441 this.ovmap = new OpenLayers.Map(this.mapDiv, options); 441 442 … … 458 459 this.hComp = (this.hComp) ? this.hComp : 2; 459 460 460 this. dragHandler= new OpenLayers.Handler.Drag(461 this.handlers.drag = new OpenLayers.Handler.Drag( 461 462 this, {move: this.rectDrag, done: this.updateMapToRect}, 462 463 {map: this.ovmap} 463 464 ); 464 this. clickHandler= new OpenLayers.Handler.Click(465 this.handlers.click = new OpenLayers.Handler.Click( 465 466 this, { 466 467 "click": this.mapDivClick … … 472 473 } 473 474 ); 474 this. clickHandler.activate();475 this.handlers.click.activate(); 475 476 476 477 this.rectEvents = new OpenLayers.Events(this, this.extentRectangle, 477 478 null, true); 478 479 this.rectEvents.register("mouseover", this, function(e) { 479 if(!this. dragHandler.active && !this.map.dragging) {480 this. dragHandler.activate();480 if(!this.handlers.drag.active && !this.map.dragging) { 481 this.handlers.drag.activate(); 481 482 } 482 483 }); 483 484 this.rectEvents.register("mouseout", this, function(e) { 484 if(!this. dragHandler.dragging) {485 this. dragHandler.deactivate();485 if(!this.handlers.drag.dragging) { 486 this.handlers.drag.deactivate(); 486 487 } 487 488 }); … … 513 514 updateMapToRect: function() { 514 515 var lonLatBounds = this.getMapBoundsFromRectBounds(this.rectPxBounds); 515 this.map. setCenter(lonLatBounds.getCenterLonLat(), this.map.zoom);516 this.map.panTo(lonLatBounds.getCenterLonLat()); 516 517 }, 517 518 sandbox/tschaub/events/lib/OpenLayers/Events.js
r6078 r6125 314 314 */ 315 315 unloadCache: function() { 316 if (OpenLayers.Event.observers) { 316 // check for OpenLayers.Event before checking for observers, because 317 // OpenLayers.Event may be undefined in IE if no map instance was 318 // created 319 if (OpenLayers.Event && OpenLayers.Event.observers) { 317 320 for (var cacheID in OpenLayers.Event.observers) { 318 321 var elementObservers = OpenLayers.Event.observers[cacheID]; sandbox/tschaub/events/lib/OpenLayers/Format/SLD.js
r5978 r6125 344 344 for (var i=0; i<filters.length; i++) { 345 345 if (filters[i].nodeType == 1) { 346 rule. children.push(this.parseFilter(filters[i]));346 rule.rules.push(this.parseFilter(filters[i])); 347 347 } 348 348 } … … 358 358 for (var i=0; i<filters.length; i++) { 359 359 if (filters[i].nodeType == 1) { 360 rule. children.push(this.parseFilter(filters[i]));360 rule.rules.push(this.parseFilter(filters[i])); 361 361 } 362 362 } … … 369 369 var rule = new OpenLayers.Rule.Logical( 370 370 {type: OpenLayers.Rule.Logical.NOT}); 371 rule. children.push(this.parseFilter(filter[0]));371 rule.rules.push(this.parseFilter(filter[0])); 372 372 return rule; 373 373 } sandbox/tschaub/events/lib/OpenLayers/Format/WFS.js
r5868 r6125 22 22 */ 23 23 wfsns: "http://www.opengis.net/wfs", 24 25 ogcns: "http://www.opengis.net/ogc", 24 26 25 27 /* … … 58 60 */ 59 61 write: function(features) { 60 61 var transaction = this.createElementNS( 'http://www.opengis.net/wfs', 'wfs:Transaction');62 63 var transaction = this.createElementNS(this.wfsns, 'wfs:Transaction'); 62 64 transaction.setAttribute("version","1.0.0"); 63 65 transaction.setAttribute("service","WFS"); … … 75 77 } 76 78 } 77 return transaction; 79 80 return OpenLayers.Format.XML.prototype.write.apply(this,[transaction]); 78 81 }, 79 82 … … 91 94 featureContainer.appendChild(geomContainer); 92 95 for(var attr in feature.attributes) { 93 var attrText = document.createTextNode(feature.attributes[attr]);96 var attrText = this.createTextNode(feature.attributes[attr]); 94 97 var nodename = attr; 95 98 if (attr.search(":") != -1) { … … 129 132 130 133 var propertyNode = this.createElementNS(this.wfsns, 'wfs:Property'); 131 var nameNode = this.createElementNS( 'http://www.opengis.net/wfs', 'wfs:Name');134 var nameNode = this.createElementNS(this.wfsns, 'wfs:Name'); 132 135 133 var txtNode = document.createTextNode(this.geometryName);136 var txtNode = this.createTextNode(this.geometryName); 134 137 nameNode.appendChild(txtNode); 135 138 propertyNode.appendChild(nameNode); 136 139 137 var valueNode = this.createElementNS( 'http://www.opengis.net/wfs', 'wfs:Value');140 var valueNode = this.createElementNS(this.wfsns, 'wfs:Value'); 138 141 valueNode.appendChild(this.buildGeometryNode(feature.geometry)); 139 142 … … 141 144 updateNode.appendChild(propertyNode); 142 145 143 var filterNode = this.createElementNS( 'http://www.opengis.net/ogc', 'ogc:Filter');144 var filterIdNode = this.createElementNS( 'http://www.opengis.net/ogc', 'ogc:FeatureId');146 var filterNode = this.createElementNS(this.ogcns, 'ogc:Filter'); 147 var filterIdNode = this.createElementNS(this.ogcns, 'ogc:FeatureId'); 145 148 filterIdNode.setAttribute("fid", feature.fid); 146 149 filterNode.appendChild(filterIdNode); … … 165 168 deleteNode.setAttribute("typeName", this.layerName); 166 169 167 var filterNode = this.createElementNS( 'http://www.opengis.net/ogc', 'ogc:Filter');168 var filterIdNode = this.createElementNS( 'http://www.opengis.net/ogc', 'ogc:FeatureId');170 var filterNode = this.createElementNS(this.ogcns, 'ogc:Filter'); 171 var filterIdNode = this.createElementNS(this.ogcns, 'ogc:FeatureId'); 169 172 filterIdNode.setAttribute("fid", feature.fid); 170 173 filterNode.appendChild(filterIdNode); sandbox/tschaub/events/lib/OpenLayers/Format/WMC/v1_1_0.js
r5919 r6125 90 90 91 91 // min/max scale denominator elements go before the 4th element in v1 92 var minSD = this.createElementNS( 93 this.namespaces.sld, "sld:MinScaleDenominator" 94 ); 95 minSD.appendChild(this.createTextNode(layer.maxScale.toPrecision(10))); 96 node.insertBefore(minSD, node.childNodes[3]); 92 if(layer.options.resolutions || layer.options.scales || 93 layer.options.minResolution || layer.options.maxScale) { 94 var minSD = this.createElementNS( 95 this.namespaces.sld, "sld:MinScaleDenominator" 96 ); 97 minSD.appendChild(this.createTextNode(layer.maxScale.toPrecision(10))); 98 node.insertBefore(minSD, node.childNodes[3]); 99 } 97 100 98 var maxSD = this.createElementNS( 99 this.namespaces.sld, "sld:MaxScaleDenominator" 100 ); 101 maxSD.appendChild(this.createTextNode(layer.minScale.toPrecision(10))); 102 node.insertBefore(maxSD, node.childNodes[4]); 101 if(layer.options.resolutions || layer.options.scales || 102 layer.options.maxResolution || layer.options.minScale) { 103 var maxSD = this.createElementNS( 104 this.namespaces.sld, "sld:MaxScaleDenominator" 105 ); 106 maxSD.appendChild(this.createTextNode(layer.minScale.toPrecision(10))); 107 node.insertBefore(maxSD, node.childNodes[4]); 108 } 103 109 104 110 return node; sandbox/tschaub/events/lib/OpenLayers/Handler/Click.js
r5698 r6125 46 46 * APIProperty: pixelTolerance 47 47 * {Number} Maximum number of pixels between mouseup and mousedown for an 48 * event to be considered a click. Default is null. If set to an48 * event to be considered a click. Default is 0. If set to an 49 49 * integer value, clicks with a drag greater than the value will be 50 50 * ignored. This property can only be set when the handler is 51 51 * constructed. 52 52 */ 53 pixelTolerance: null,53 pixelTolerance: 0, 54 54 55 55 /** … … 183 183 passesTolerance: function(evt) { 184 184 var passes = true; 185 if(this.pixelTolerance && this.down) {185 if(this.pixelTolerance != null && this.down) { 186 186 var dpx = Math.sqrt( 187 187 Math.pow(this.down.x - evt.xy.x, 2) + sandbox/tschaub/events/lib/OpenLayers/Map.js
r6041 r6125 393 393 // Note that this is ok, as updateSize() does nothing if the 394 394 // map's size has not actually changed. 395 this.updateSizeDestroy = OpenLayers.Function.bind(this.updateSize, 396 this); 395 397 OpenLayers.Event.observe(window, 'resize', 396 OpenLayers.Function.bind(this.updateSize, this));398 this.updateSizeDestroy); 397 399 } 398 400 … … 454 456 */ 455 457 unloadDestroy: null, 458 459 /** 460 * Method: updateSizeDestroy 461 * When the map is destroyed, we need to stop listening to updateSize 462 * events: this method stores the function we need to unregister in 463 * non-IE browsers. 464 */ 465 updateSizeDestroy: null, 456 466 457 467 /** … … 468 478 OpenLayers.Event.stopObserving(window, 'unload', this.unloadDestroy); 469 479 this.unloadDestroy = null; 480 481 if (this.updateSizeDestroy) { 482 OpenLayers.Event.stopObserving(window, 'resize', 483 this.updateSizeDestroy); 484 } else { 485 this.events.unregister("resize", this, this.updateSize); 486 } 470 487 471 488 if (this.layers != null) { … … 1253 1270 * dx - {Integer} 1254 1271 * dy - {Integer} 1255 */ 1256 pan: function(dx, dy) { 1257 1272 * options - {Object} Only one at this time: "animate", which uses 1273 * panTo instead of setCenter. Default is true. 1274 */ 1275 pan: function(dx, dy, options) { 1276 1277 if (!options) { 1278 options = {} 1279 } 1258 1280 // getCenter 1259 1281 var centerPx = this.getViewPortPxFromLonLat(this.getCenter()); … … 1265 1287 if (!newCenterPx.equals(centerPx)) { 1266 1288 var newCenterLonLat = this.getLonLatFromViewPortPx(newCenterPx); 1267 this.setCenter(newCenterLonLat); 1289 if (options.animate) { 1290 this.panTo(newCenterLonLat); 1291 } else { 1292 this.setCenter(newCenterLonLat); 1293 } 1268 1294 } 1269 1295 1270 1296 }, 1297 1298 /** 1299 * APIMethod: panTo 1300 * Allows user to pan to a new lonlat 1301 * If the new lonlat is in the current extent the map will slide smoothly 1302 * 1303 * Parameters: 1304 * lonlat - {<OpenLayers.Lonlat>} 1305 */ 1306 panTo: function(lonlat) { 1307 if (this.getExtent().containsLonLat(lonlat)) { 1308 if (!this.panTween) { 1309 this.panTween = new OpenLayers.Tween(OpenLayers.Easing.Expo.easeOut); 1310 } 1311 var center = this.getCenter(); 1312 var from = { 1313 lon: center.lon, 1314 lat: center.lat 1315 }; 1316 var to = { 1317 lon: lonlat.lon, 1318 lat: lonlat.lat 1319 }; 1320 this.panTween.start(from, to, 50, { 1321 callbacks: { 1322 start: OpenLayers.Function.bind(function(lonlat) { 1323 this.events.triggerEvent("movestart"); 1324 }, this), 1325 eachStep: OpenLayers.Function.bind(function(lonlat) { 1326 var lonlat = new OpenLayers.LonLat(lonlat.lon, lonlat.lat); 1327 this.moveTo(lonlat, this.zoom, true); 1328 }, this), 1329 done: OpenLayers.Function.bind(function(lonlat) { 1330 this.events.triggerEvent("moveend"); 1331 }, this) 1332 } 1333 }); 1334 } else { 1335 this.setCenter(lonlat); 1336 } 1337 }, 1271 1338 1272 1339 /** … … 1283 1350 * TBD: reconsider forceZoomChange in 3.0 1284 1351 */ 1285 setCenter: function (lonlat, zoom, dragging, forceZoomChange) { 1286 this.dragging = !!dragging; 1287 1352 setCenter: function(lonlat, zoom, dragging, forceZoomChange) { 1353 this.moveTo(lonlat, zoom, { 1354 'dragging': dragging, 1355 'forceZoomChange': forceZoomChange, 1356 'caller': 'setCenter' 1357 }); 1358 }, 1359 1360 /** 1361 * Method: moveTo 1362 * 1363 * Parameters: 1364 * lonlat - {<OpenLayers.LonLat>} 1365 * zoom - {Integer} 1366 * options - {Object} 1367 */ 1368 moveTo: function(lonlat, zoom, options) { 1369 if (!options) { 1370 options = {}; 1371 } 1372 // dragging is false by default 1373 var dragging = options.dragging; 1374 // forceZoomChange is false by default 1375 var forceZoomChange = options.forceZoomChange; 1376 // noEvent is false by default 1377 var noEvent = options.noEvent; 1378 1379 if (this.panTween && options.caller == "setCenter") { 1380 this.panTween.stop(); 1381 } 1382 1288 1383 if (!this.center && !this.isValidLonLat(lonlat)) { 1289 1384 lonlat = this.maxExtent.getCenterLonLat(); … … 1335 1430 if (zoomChanged || centerChanged || !dragging) { 1336 1431 1337 if (!dragging) { this.events.triggerEvent("movestart"); } 1432 if (!dragging && !noEvent) { 1433 this.events.triggerEvent("movestart"); 1434 } 1338 1435 1339 1436 if (centerChanged) { … …
