From 5028aa3bc3cb6d0eb873450b217a2697b7467bcb Mon Sep 17 00:00:00 2001 From: oterral Date: Fri, 7 Mar 2014 13:25:06 +0100 Subject: [PATCH] Fix anchor origin calculation --- src/ol/format/kmlformat.js | 4 ++-- src/ol/style/iconstyle.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ol/format/kmlformat.js b/src/ol/format/kmlformat.js index b6d73fbb56..7088973182 100644 --- a/src/ol/format/kmlformat.js +++ b/src/ol/format/kmlformat.js @@ -450,7 +450,7 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) { anchorXUnits = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_; anchorYUnits = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_; } else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) { - anchor = [0.5, 1]; + anchor = [0.5, 0]; anchorXUnits = ol.style.IconAnchorUnits.FRACTION; anchorYUnits = ol.style.IconAnchorUnits.FRACTION; } @@ -471,7 +471,7 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) { var imageStyle = new ol.style.Icon({ anchor: anchor, - anchorOrigin: ol.style.IconAnchorOrigin.TOP_LEFT, + anchorOrigin: ol.style.IconAnchorOrigin.BOTTOM_LEFT, anchorXUnits: anchorXUnits, anchorYUnits: anchorYUnits, crossOrigin: 'anonymous', // FIXME should this be configurable? diff --git a/src/ol/style/iconstyle.js b/src/ol/style/iconstyle.js index 3fa3033849..186caa260d 100644 --- a/src/ol/style/iconstyle.js +++ b/src/ol/style/iconstyle.js @@ -157,7 +157,7 @@ ol.style.Icon.prototype.getAnchor = function() { } if (this.anchorOrigin_ == ol.style.IconAnchorOrigin.BOTTOM_LEFT || this.anchorOrigin_ == ol.style.IconAnchorOrigin.BOTTOM_RIGHT) { - anchor[1] += size[1]; + anchor[1] = -anchor[1] + size[1]; } } return anchor;