Changeset 2295
- Timestamp:
- 03/02/07 06:00:20 (2 years ago)
- Files:
-
- sandbox/emanuel/animatedZooming/lib/OpenLayers/Control/MouseDefaults.js (modified) (1 diff)
- sandbox/emanuel/animatedZooming/lib/OpenLayers/Control/MouseToolbar.js (modified) (1 diff)
- sandbox/emanuel/animatedZooming/lib/OpenLayers/Control/OverviewMap.js (modified) (2 diffs)
- sandbox/emanuel/animatedZooming/lib/OpenLayers/Layer.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/emanuel/animatedZooming/lib/OpenLayers/Control/MouseDefaults.js
r2292 r2295 78 78 var deltaX = evt.xy.x - centerPx.x; 79 79 var deltaY = evt.xy.y - centerPx.y; 80 // some problems if you pan AND zoom in the same time... TODO81 80 this.map.pan(deltaX, deltaY,true); 82 81 83 // 1. jump to new center (no pan animation!) 84 var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); 85 //this.map.setCenter(newCenter, this.map.zoom); 86 87 // 2. zoom to new level 82 // zoom to new level 88 83 this.map.zoomIn(); 89 84 sandbox/emanuel/animatedZooming/lib/OpenLayers/Control/MouseToolbar.js
r2292 r2295 119 119 var deltaX = evt.xy.x - centerPx.x; 120 120 var deltaY = evt.xy.y - centerPx.y; 121 // some problems if you pan AND zoom in the same time... TODO122 121 this.map.pan(deltaX, deltaY,true); 123 122 124 // jump to new center (no pan animation!) 125 var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); 126 //this.map.setCenter(newCenter, this.map.zoom); 127 128 // get tile below mouseposition 129 var targetTile = evt.target; 130 // 2. zoom to new level 131 this.map.zoomIn(targetTile); 123 // zoom to new level 124 this.map.zoomIn(); 132 125 133 126 OpenLayers.Event.stop(evt); sandbox/emanuel/animatedZooming/lib/OpenLayers/Control/OverviewMap.js
r2280 r2295 299 299 var newLeft = Math.max(0, (left + deltaX)); 300 300 newLeft = Math.min(newLeft, this.ovmap.size.w - width); 301 this.setRectPxBounds(new OpenLayers.Bounds(newLeft,301 pxBounds = new OpenLayers.Bounds(newLeft, 302 302 newTop + height, 303 303 newLeft + width, 304 newTop) );305 this.updateMapToRect( );304 newTop); 305 this.updateMapToRect(pxBounds); 306 306 OpenLayers.Event.stop(evt); 307 307 }, … … 429 429 * Updates the map extent to match the extent rectangle position and size 430 430 */ 431 updateMapToRect: function() { 432 var pxBounds = this.getRectPxBounds(); 431 updateMapToRect: function(pxBounds) { 432 if (!pxBounds) 433 var pxBounds = this.getRectPxBounds(); 433 434 var lonLatBounds = this.getMapBoundsFromRectBounds(pxBounds); 434 this.map.setCenter(lonLatBounds.getCenterLonLat(), this.map.zoom); 435 436 var centerPx = this.map.getViewPortPxFromLonLat(lonLatBounds.getCenterLonLat()); 437 438 var resolution = this.map.getResolution(); 439 440 var width = lonLatBounds.getWidth(); 441 width = width / resolution; 442 var height = lonLatBounds.getHeight(); 443 height = height / resolution; 444 445 // pan to recenter rectangle 446 this.map.pan(centerPx.x-width/2,centerPx.y-height/2); 435 447 }, 436 448 sandbox/emanuel/animatedZooming/lib/OpenLayers/Layer.js
r2292 r2295 530 530 var res = this.map.getResolution(); 531 531 532 var delta_x = viewPortPx.x - Math.ceil( (size.w / 2));533 var delta_y = viewPortPx.y - Math.ceil( (size.h / 2));532 var delta_x = viewPortPx.x - Math.ceil(size.w / 2); 533 var delta_y = viewPortPx.y - Math.ceil(size.h / 2); 534 534 535 535 lonlat = new OpenLayers.LonLat(center.lon + delta_x * res , … … 691 691 */ 692 692 cloneLayerContainer_share:function() { 693 // 1. clone layerContainerDiv with all childs (replace, if already exist) 694 if (this.map.layerContainerDivClone){ 695 this.map.viewPortDiv.removeChild(this.map.layerContainerDivClone); 696 this.map.layerContainerDivClone = null; 697 } 698 this.map.layerContainerDivClone = this.map.layerContainerDiv.cloneNode(true); 699 this.map.layerContainerDivClone.id = "map_OpenLayers_Container_clone"; 700 // 2. append layerContainerDivClone to viewPortDiv 701 // (now the cloned div is above the original; it hides the original) 702 this.map.viewPortDiv.appendChild(this.map.layerContainerDivClone); 703 704 this.map.layerContainerDiv.style.display= "none"; 705 693 694 // function for map only; not for overviewmap! 695 if (this.map.div.id == "map") { 696 // 1. clone layerContainerDiv with all childs (replace, if already exist) 697 if (this.map.layerContainerDivClone){ 698 this.map.viewPortDiv.removeChild(this.map.layerContainerDivClone); 699 this.map.layerContainerDivClone = null; 700 } 701 this.map.layerContainerDivClone = this.map.layerContainerDiv.cloneNode(true); 702 this.map.layerContainerDivClone.id = "map_OpenLayers_Container_clone"; 703 // 2. append layerContainerDivClone to viewPortDiv 704 // (now the cloned div is above the original; it hides the original) 705 this.map.viewPortDiv.appendChild(this.map.layerContainerDivClone); 706 707 this.map.layerContainerDiv.style.display= "none"; 708 } 706 709 }, 707 710
