Don't transform the scale specified by the user

This commit is contained in:
oterral
2015-11-06 13:29:33 +01:00
parent d29f3b9068
commit 08a640b793
2 changed files with 7 additions and 1 deletions
+4 -1
View File
@@ -654,6 +654,9 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
(object['scale']); (object['scale']);
if (src == ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) { if (src == ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) {
size = ol.format.KML.DEFAULT_IMAGE_STYLE_SIZE_; size = ol.format.KML.DEFAULT_IMAGE_STYLE_SIZE_;
if (scale === undefined) {
scale = ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_;
}
} }
var imageStyle = new ol.style.Icon({ var imageStyle = new ol.style.Icon({
@@ -665,7 +668,7 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
offset: offset, offset: offset,
offsetOrigin: ol.style.IconOrigin.BOTTOM_LEFT, offsetOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
rotation: rotation, rotation: rotation,
scale: ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_ * scale, scale: scale,
size: size, size: size,
src: src src: src
}); });
+3
View File
@@ -1337,6 +1337,7 @@ describe('ol.format.KML', function() {
expect(imageStyle.getOrigin()).to.be(null); expect(imageStyle.getOrigin()).to.be(null);
expect(imageStyle.getRotation()).to.eql(0); expect(imageStyle.getRotation()).to.eql(0);
expect(imageStyle.getSize()).to.be(null); expect(imageStyle.getSize()).to.be(null);
expect(imageStyle.getScale()).to.be(1);
expect(style.getText()).to.be(ol.format.KML.DEFAULT_TEXT_STYLE_); expect(style.getText()).to.be(ol.format.KML.DEFAULT_TEXT_STYLE_);
expect(style.getZIndex()).to.be(undefined); expect(style.getZIndex()).to.be(undefined);
}); });
@@ -1348,6 +1349,7 @@ describe('ol.format.KML', function() {
' <Placemark>' + ' <Placemark>' +
' <Style>' + ' <Style>' +
' <IconStyle>' + ' <IconStyle>' +
' <scale>3.0</scale>' +
' <Icon>' + ' <Icon>' +
' <href>http://foo.png</href>' + ' <href>http://foo.png</href>' +
' <gx:x>24</gx:x>' + ' <gx:x>24</gx:x>' +
@@ -1380,6 +1382,7 @@ describe('ol.format.KML', function() {
expect(imageStyle.getAnchor()).to.eql([24, 36]); expect(imageStyle.getAnchor()).to.eql([24, 36]);
expect(imageStyle.getOrigin()).to.eql([24, 108]); expect(imageStyle.getOrigin()).to.eql([24, 108]);
expect(imageStyle.getRotation()).to.eql(0); expect(imageStyle.getRotation()).to.eql(0);
expect(imageStyle.getScale()).to.eql(Math.sqrt(3));
expect(style.getText()).to.be(ol.format.KML.DEFAULT_TEXT_STYLE_); expect(style.getText()).to.be(ol.format.KML.DEFAULT_TEXT_STYLE_);
expect(style.getZIndex()).to.be(undefined); expect(style.getZIndex()).to.be(undefined);
}); });