From faa37490ea6efa8b7c91cfc813da6a39f45b61aa Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sun, 29 Jul 2012 12:13:10 +0200 Subject: [PATCH] Use ol.Pixel to represent pixels --- src/ol/base/map.js | 7 ++++--- src/ol/base/mapbrowserevent.js | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ol/base/map.js b/src/ol/base/map.js index e59350ae04..cab5f28005 100644 --- a/src/ol/base/map.js +++ b/src/ol/base/map.js @@ -36,6 +36,7 @@ goog.require('ol.Extent'); goog.require('ol.LayerRenderer'); goog.require('ol.MapBrowserEvent'); goog.require('ol.Object'); +goog.require('ol.Pixel'); goog.require('ol.Projection'); goog.require('ol.Size'); goog.require('ol.TransformFunction'); @@ -330,7 +331,7 @@ ol.Map.prototype.getControls = function() { /** - * @param {ol.Coordinate} pixel Pixel. + * @param {ol.Pixel} pixel Pixel. * @return {ol.Coordinate|undefined} Coordinate. */ ol.Map.prototype.getCoordinateFromPixel = function(pixel) { @@ -387,14 +388,14 @@ ol.Map.prototype.getLayers = function() { /** * @param {ol.Coordinate} coordinate Coordinate. - * @return {ol.Coordinate|undefined} Pixel. + * @return {ol.Pixel|undefined} Pixel. */ ol.Map.prototype.getPixelFromCoordinate = function(coordinate) { if (this.isDef()) { this.updateMatrices_(); var vec3 = [coordinate.x, coordinate.y, 0]; goog.vec.Mat4.multVec3(this.coordinateToPixelMatrix_, vec3, vec3); - return new ol.Coordinate(vec3[0], vec3[1]); + return new ol.Pixel(vec3[0], vec3[1]); } else { return undefined; } diff --git a/src/ol/base/mapbrowserevent.js b/src/ol/base/mapbrowserevent.js index 0d7510bced..6466e4a9fc 100644 --- a/src/ol/base/mapbrowserevent.js +++ b/src/ol/base/mapbrowserevent.js @@ -3,6 +3,7 @@ goog.provide('ol.MapBrowserEvent'); goog.require('goog.events.BrowserEvent'); goog.require('ol.Coordinate'); goog.require('ol.MapEvent'); +goog.require('ol.Pixel'); @@ -41,7 +42,7 @@ ol.MapBrowserEvent.prototype.getCoordinate = function() { return this.coordinate_; } else { var browserEvent = this.browserEvent; - var pixel = new ol.Coordinate(browserEvent.offsetX, browserEvent.offsetY); + var pixel = new ol.Pixel(browserEvent.offsetX, browserEvent.offsetY); var coordinate = this.map.getCoordinateFromPixel(pixel); this.coordinate_ = coordinate; return coordinate;