Changeset 6426
- Timestamp:
- 03/01/08 19:27:00 (10 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/achipa/openlayers/examples/time-select-control.html
r6391 r6426 21 21 map.setCenter(new OpenLayers.LonLat(20.22, 22.05), 9); 22 22 map.addControl(new OpenLayers.Control.LayerSwitcher()); 23 timeBar = new OpenLayers.Control.PanTimeBar( );23 timeBar = new OpenLayers.Control.PanTimeBar( {continuous: true} ); 24 24 map.addControl(timeBar); 25 25 timepos = new OpenLayers.Control.TimePosition(); … … 58 58 // update the date of the layer from the map property and redraw to keeep up with changes 59 59 map.events.register("datechanged", lineLayer, lineLayer.setTimeFromMap); 60 map.events.register("datechanged", timeBar, timeBar.updateBar);61 60 map.events.register("datechanged", lineLayer, lineLayer.updateHighlight) 62 61 sandbox/achipa/openlayers/lib/OpenLayers/Control/PanTimeBar.js
r6369 r6426 39 39 40 40 /** 41 * Property: zoomBarDiv41 * Property: timeBarDiv 42 42 * {DOMElement} 43 43 */ … … 63 63 64 64 /** 65 * Ptoperty: now 65 * Property: Continuous drag. If true, the control will set fire datechanged events while 66 * being dragged. 67 * {bool} 68 */ 69 continuous: false, 70 71 /** 72 * Property: The current Date of the Control 66 73 * {int} 67 74 */ … … 92 99 this.divEvents = null; 93 100 94 this.map.events.unregister("timeend", this, this.moveTimeBar); 95 //this.map.events.unregister("addlayer", this, this.redraw); 101 this.map.events.unregister("datechanged", this, this.updateBar); 96 102 97 103 OpenLayers.Control.PanTime.prototype.destroy.apply(this, arguments); … … 106 112 setMap: function(map) { 107 113 OpenLayers.Control.PanTime.prototype.setMap.apply(this, arguments); 108 //this.map.events.register("addlayer", this, this.addLayerEvent);109 114 }, 110 115 … … 245 250 this.div.appendChild(slider); 246 251 247 if (this.time.length) this.map.events.register(" timeend", this, this.moveTimeBar);252 if (this.time.length) this.map.events.register("datechanged", this, this.updateBar); 248 253 249 254 centered = centered.add(0, this.timeStopHeight * this.time.length+10); … … 275 280 var top = OpenLayers.Util.pagePosition(evt.object)[1]; 276 281 var levels = Math.floor((y - top)/this.timeStopHeight); 277 //this.map.zoomTo((this.map.getNumZoomLevels() -1) - levels);278 282 OpenLayers.Event.stop(evt); 279 283 }, 280 284 281 285 /* 282 * Method: zoomBarDown286 * Method: timeBarDown 283 287 * event listener for clicks on the slider 284 288 * … … 301 305 302 306 /* 303 * Method: zoomBarDrag307 * Method: timeBarDrag 304 308 * This is what happens when a click has occurred, and the client is 305 309 * dragging. Here we must ensure that the slider doesn't go beyond the … … 318 322 var newTop = parseInt(this.slider.style.top) - deltaY; 319 323 this.slider.style.top = newTop+"px"; 324 if (this.continuous) { 325 this.now += Math.round(deltaY/this.timeStopHeight); 326 if (this.now < 0) this.now = 0; 327 else if (this.now > this.time.length) this.now = this.time.length; 328 this.setMapTime(); 329 } 320 330 } 321 331 this.mouseDragStart = evt.xy.clone(); … … 325 335 326 336 /* 327 * Method: zoomBarUp337 * Method: timeBarUp 328 338 * Perform cleanup when a mouseup event is received -- discover new zoom 329 339 * level and switch to it. … … 341 351 this.map.events.unregister("mousemove", this, this.passEventToSlider); 342 352 var deltaY = (this.timeStart.y+OpenLayers.Control.PanTime.Y-10) - (evt.xy.y+OpenLayers.Control.PanTime.Y-10); 343 this.now += Math.round(deltaY/this.timeStopHeight); 353 if (!this.continuous) 354 this.now += Math.round(deltaY/this.timeStopHeight); 344 355 if (this.now < 0) this.now = 0; 345 356 else if (this.now > this.time.length) this.now = this.time.length; sandbox/achipa/openlayers/lib/OpenLayers/Control/TimePosition.js
r6369 r6426 32 32 * Method: destroy 33 33 */ 34 destroy: function() {34 destroy: function() { 35 35 if (this.map) { 36 36 this.map.events.unregister('datechanged', this, this.redraw);
