Changeset 6831
- Timestamp:
- 04/09/08 11:54:01 (9 months ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Layer.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Map.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Layer.js
r6540 r6831 998 998 /** 999 999 * APIMethod: getViewPortPxFromLonLat 1000 * Returns a pixel location given a map location. This method will return 1001 * fractional pixel values. 1000 1002 * 1001 1003 * Parameters: … … 1012 1014 var extent = this.map.getExtent(); 1013 1015 px = new OpenLayers.Pixel( 1014 Math.round(1/resolution * (lonlat.lon - extent.left)),1015 Math.round(1/resolution * (extent.top - lonlat.lat))1016 (1/resolution * (lonlat.lon - extent.left)), 1017 (1/resolution * (extent.top - lonlat.lat)) 1016 1018 ); 1017 1019 } trunk/openlayers/lib/OpenLayers/Map.js
r6828 r6831 1594 1594 1595 1595 if ((originPx != null) && (newPx != null)) { 1596 this.layerContainerDiv.style.left = (originPx.x - newPx.x) + "px";1597 this.layerContainerDiv.style.top = (originPx.y - newPx.y) + "px";1596 this.layerContainerDiv.style.left = Math.round(originPx.x - newPx.x) + "px"; 1597 this.layerContainerDiv.style.top = Math.round(originPx.y - newPx.y) + "px"; 1598 1598 } 1599 1599 }, … … 2023 2023 /** 2024 2024 * APIMethod: getPixelFromLonLat 2025 * 2026 * Parameters: 2027 * lonlat - {<OpenLayers.LonLat>} 2025 * Returns a pixel location given a map location. The map location is 2026 * translated to an integer pixel location (in viewport pixel 2027 * coordinates) by the current base layer. 2028 * 2029 * Parameters: 2030 * lonlat - {<OpenLayers.LonLat>} A map location. 2028 2031 * 2029 2032 * Returns: 2030 2033 * {<OpenLayers.Pixel>} An OpenLayers.Pixel corresponding to the 2031 * <OpenLayers.LonLat> translated into view port2032 * pixels by the currentbase layer.2034 * <OpenLayers.LonLat> translated into view port pixels by the current 2035 * base layer. 2033 2036 */ 2034 2037 getPixelFromLonLat: function (lonlat) { 2035 return this.getViewPortPxFromLonLat(lonlat); 2038 var px = this.getViewPortPxFromLonLat(lonlat); 2039 px.x = Math.round(px.x); 2040 px.y = Math.round(px.y); 2041 return px; 2036 2042 }, 2037 2043 … … 2117 2123 getLayerPxFromLonLat: function (lonlat) { 2118 2124 //adjust for displacement of layerContainerDiv 2119 var px = this.get ViewPortPxFromLonLat(lonlat);2125 var px = this.getPixelFromLonLat(lonlat); 2120 2126 return this.getLayerPxFromViewPortPx(px); 2121 2127 },
