| 805 | | |
|---|
| 806 | | //set new size (width and height) |
|---|
| 807 | | this.zoomOutTile.imgDiv.style.width = |
|---|
| 808 | | Math.round(this.map.tileSize.w * Math.pow(2, newZoomlevel)) + "px"; |
|---|
| 809 | | this.zoomOutTile.imgDiv.style.height = |
|---|
| 810 | | Math.round(this.map.tileSize.h * Math.pow(2, newZoomlevel)) + "px"; |
|---|
| 811 | | |
|---|
| 812 | | //set new position (top and left) |
|---|
| 813 | | var bounds = this.zoomOutTile.bounds; |
|---|
| 814 | | var extent = this.map.getExtent(); |
|---|
| 815 | | var maxExtent = this.map.getMaxExtent(); |
|---|
| 816 | | |
|---|
| 817 | | var resolution = this.map.getMaxResolution(); |
|---|
| 818 | | var centerLonLat = extent.getCenterLonLat(); |
|---|
| 819 | | |
|---|
| 820 | | var offsetlon = bounds.left - centerLonLat.lon; |
|---|
| 821 | | var offsetlat = -bounds.top + centerLonLat.lat; |
|---|
| 822 | | |
|---|
| 823 | | var offsetx = offsetlon / newResolution |
|---|
| 824 | | - parseInt(this.map.layerContainerDiv.style.left); |
|---|
| 825 | | var offsety = offsetlat / newResolution |
|---|
| 826 | | - parseInt(this.map.layerContainerDiv.style.top); |
|---|
| 827 | | |
|---|
| 828 | | this.zoomOutTile.imgDiv.style.left = |
|---|
| 829 | | Math.round(centerPx.x + offsetx) + "px"; |
|---|
| 830 | | this.zoomOutTile.imgDiv.style.top = |
|---|
| 831 | | Math.round(centerPx.y + offsety) + "px"; |
|---|
| 832 | | |
|---|
| 833 | | |
|---|
| 834 | | this.map.baseLayer.zoomOutTile.imgDiv.style.display = "block"; |
|---|
| 835 | | |
|---|
| | 805 | |
|---|
| | 806 | |
|---|
| | 807 | var newTileSize = new OpenLayers.Size(); |
|---|
| | 808 | newTileSize.w = Math.round(this.map.tileSize.w * Math.pow(2, newZoomlevel)); |
|---|
| | 809 | newTileSize.h = Math.round(this.map.tileSize.h * Math.pow(2, newZoomlevel)); |
|---|
| | 810 | |
|---|
| | 811 | // handles bug in ie: |
|---|
| | 812 | // turn zoomOut tile scale off, if tileSize > 2^15 |
|---|
| | 813 | var ieBug; |
|---|
| | 814 | if (navigator.appName == "Microsoft Internet Explorer"){ |
|---|
| | 815 | if ((newTileSize.w > Math.pow(2,15)) && |
|---|
| | 816 | (newTileSize.h > Math.pow(2,15)) ){ |
|---|
| | 817 | ieBug = true; |
|---|
| | 818 | this.map.baseLayer.zoomOutTile.imgDiv.style.display = "none"; |
|---|
| | 819 | } |
|---|
| | 820 | else { |
|---|
| | 821 | ieBug = false; |
|---|
| | 822 | } |
|---|
| | 823 | } |
|---|
| | 824 | else { |
|---|
| | 825 | ieBug = false; |
|---|
| | 826 | } |
|---|
| | 827 | |
|---|
| | 828 | if (!ieBug) { |
|---|
| | 829 | //set new size (width and height) |
|---|
| | 830 | this.zoomOutTile.imgDiv.style.width = newTileSize.w + "px"; |
|---|
| | 831 | this.zoomOutTile.imgDiv.style.height = newTileSize.h + "px"; |
|---|
| | 832 | |
|---|
| | 833 | //set new position (top and left) |
|---|
| | 834 | var bounds = this.zoomOutTile.bounds; |
|---|
| | 835 | var extent = this.map.getExtent(); |
|---|
| | 836 | var maxExtent = this.map.getMaxExtent(); |
|---|
| | 837 | |
|---|
| | 838 | var resolution = this.map.getMaxResolution(); |
|---|
| | 839 | var centerLonLat = extent.getCenterLonLat(); |
|---|
| | 840 | |
|---|
| | 841 | var offsetlon = bounds.left - centerLonLat.lon; |
|---|
| | 842 | var offsetlat = -bounds.top + centerLonLat.lat; |
|---|
| | 843 | |
|---|
| | 844 | var offsetx = offsetlon / newResolution |
|---|
| | 845 | - parseInt(this.map.layerContainerDiv.style.left); |
|---|
| | 846 | var offsety = offsetlat / newResolution |
|---|
| | 847 | - parseInt(this.map.layerContainerDiv.style.top); |
|---|
| | 848 | |
|---|
| | 849 | this.zoomOutTile.imgDiv.style.left = |
|---|
| | 850 | Math.round(centerPx.x + offsetx) + "px"; |
|---|
| | 851 | this.zoomOutTile.imgDiv.style.top = |
|---|
| | 852 | Math.round(centerPx.y + offsety) + "px"; |
|---|
| | 853 | |
|---|
| | 854 | |
|---|
| | 855 | this.map.baseLayer.zoomOutTile.imgDiv.style.display = "block"; |
|---|
| | 856 | } |
|---|
| | 857 | |
|---|