Rename _ol_style_Icon_ to Icon
This commit is contained in:
@@ -15,7 +15,7 @@ import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
|
||||
import {remove as removeTransform} from '../../../../src/ol/proj/transforms.js';
|
||||
import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js';
|
||||
import Fill from '../../../../src/ol/style/Fill.js';
|
||||
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
|
||||
import Icon from '../../../../src/ol/style/Icon.js';
|
||||
import IconAnchorUnits from '../../../../src/ol/style/IconAnchorUnits.js';
|
||||
import IconOrigin from '../../../../src/ol/style/IconOrigin.js';
|
||||
import Stroke from '../../../../src/ol/style/Stroke.js';
|
||||
@@ -1756,7 +1756,7 @@ describe('ol.format.KML', function() {
|
||||
expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_);
|
||||
expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_);
|
||||
var imageStyle = style.getImage();
|
||||
expect(imageStyle).to.be.an(_ol_style_Icon_);
|
||||
expect(imageStyle).to.be.an(Icon);
|
||||
expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://foo.png').href);
|
||||
expect(imageStyle.getAnchor()).to.be(null);
|
||||
expect(imageStyle.getOrigin()).to.be(null);
|
||||
@@ -1836,7 +1836,7 @@ describe('ol.format.KML', function() {
|
||||
expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_);
|
||||
expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_);
|
||||
var imageStyle = style.getImage();
|
||||
expect(imageStyle).to.be.an(_ol_style_Icon_);
|
||||
expect(imageStyle).to.be.an(Icon);
|
||||
expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://foo.png').href);
|
||||
expect(imageStyle.anchor_).to.be.an(Array);
|
||||
expect(imageStyle.anchor_).to.have.length(2);
|
||||
@@ -2265,7 +2265,7 @@ describe('ol.format.KML', function() {
|
||||
|
||||
it('can write an feature\'s icon style', function() {
|
||||
var style = new Style({
|
||||
image: new _ol_style_Icon_({
|
||||
image: new Icon({
|
||||
anchor: [0.25, 36],
|
||||
anchorOrigin: 'top-left',
|
||||
anchorXUnits: 'fraction',
|
||||
@@ -2314,7 +2314,7 @@ describe('ol.format.KML', function() {
|
||||
it('does not write styles when writeStyles option is false', function() {
|
||||
format = new KML({writeStyles: false});
|
||||
var style = new Style({
|
||||
image: new _ol_style_Icon_({
|
||||
image: new Icon({
|
||||
src: 'http://foo.png'
|
||||
})
|
||||
});
|
||||
@@ -3209,7 +3209,7 @@ describe('ol.format.KML', function() {
|
||||
var style = styleArray[0];
|
||||
expect(style).to.be.an(Style);
|
||||
var imageStyle = style.getImage();
|
||||
expect(imageStyle).to.be.an(_ol_style_Icon_);
|
||||
expect(imageStyle).to.be.an(Icon);
|
||||
expect(imageStyle.getSrc()).to.eql('http://maps.google.com/mapfiles/kml/shapes/star.png');
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import VectorLayer from '../../../../../src/ol/layer/Vector.js';
|
||||
import CanvasLayerRenderer from '../../../../../src/ol/renderer/canvas/Layer.js';
|
||||
import CanvasMapRenderer from '../../../../../src/ol/renderer/canvas/Map.js';
|
||||
import VectorSource from '../../../../../src/ol/source/Vector.js';
|
||||
import _ol_style_Icon_ from '../../../../../src/ol/style/Icon.js';
|
||||
import Icon from '../../../../../src/ol/style/Icon.js';
|
||||
import Style from '../../../../../src/ol/style/Style.js';
|
||||
|
||||
describe('ol.renderer.canvas.Map', function() {
|
||||
@@ -59,7 +59,7 @@ describe('ol.renderer.canvas.Map', function() {
|
||||
]
|
||||
}),
|
||||
style: new Style({
|
||||
image: new _ol_style_Icon_({
|
||||
image: new Icon({
|
||||
img: img,
|
||||
imgSize: [1, 1]
|
||||
})
|
||||
|
||||
@@ -9,7 +9,7 @@ import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
import _ol_render_canvas_ReplayGroup_ from '../../../../src/ol/render/canvas/ReplayGroup.js';
|
||||
import _ol_renderer_vector_ from '../../../../src/ol/renderer/vector.js';
|
||||
import Fill from '../../../../src/ol/style/Fill.js';
|
||||
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
|
||||
import Icon from '../../../../src/ol/style/Icon.js';
|
||||
import Stroke from '../../../../src/ol/style/Stroke.js';
|
||||
import Style from '../../../../src/ol/style/Style.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
@@ -24,7 +24,7 @@ describe('ol.renderer.vector', function() {
|
||||
beforeEach(function() {
|
||||
replayGroup = new _ol_render_canvas_ReplayGroup_(1);
|
||||
feature = new Feature();
|
||||
iconStyle = new _ol_style_Icon_({
|
||||
iconStyle = new Icon({
|
||||
src: 'http://example.com/icon.png'
|
||||
});
|
||||
style = new Style({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {getUid} from '../../../../src/ol/index.js';
|
||||
import {iconImageCache} from '../../../../src/ol/style.js';
|
||||
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
|
||||
import Icon from '../../../../src/ol/style/Icon.js';
|
||||
import _ol_style_IconImage_ from '../../../../src/ol/style/IconImage.js';
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ describe('ol.style.Icon', function() {
|
||||
|
||||
it('caches canvas images with a uid as src', function() {
|
||||
var canvas = document.createElement('canvas');
|
||||
new _ol_style_Icon_({
|
||||
new Icon({
|
||||
img: canvas,
|
||||
imgSize: size
|
||||
});
|
||||
@@ -22,7 +22,7 @@ describe('ol.style.Icon', function() {
|
||||
});
|
||||
|
||||
it('imgSize overrides img.width and img.height', function(done) {
|
||||
var style = new _ol_style_Icon_({
|
||||
var style = new Icon({
|
||||
src: src,
|
||||
imgSize: size
|
||||
});
|
||||
@@ -39,17 +39,17 @@ describe('ol.style.Icon', function() {
|
||||
describe('#clone', function() {
|
||||
|
||||
it('creates a new ol.style.Icon', function() {
|
||||
var original = new _ol_style_Icon_({
|
||||
var original = new Icon({
|
||||
src: src
|
||||
});
|
||||
var clone = original.clone();
|
||||
expect(clone).to.be.an(_ol_style_Icon_);
|
||||
expect(clone).to.be.an(Icon);
|
||||
expect(clone).to.not.be(original);
|
||||
});
|
||||
|
||||
it('copies all values ', function() {
|
||||
var canvas = document.createElement('canvas');
|
||||
var original = new _ol_style_Icon_({
|
||||
var original = new Icon({
|
||||
anchor: [1, 0],
|
||||
anchorOrigin: 'bottom-right',
|
||||
anchorXUnits: 'pixels',
|
||||
@@ -85,7 +85,7 @@ describe('ol.style.Icon', function() {
|
||||
expect(original.getRotateWithView()).to.eql(clone.getRotateWithView());
|
||||
expect(original.getSnapToPixel()).to.eql(clone.getSnapToPixel());
|
||||
|
||||
var original2 = new _ol_style_Icon_({
|
||||
var original2 = new Icon({
|
||||
src: src
|
||||
});
|
||||
var clone2 = original2.clone();
|
||||
@@ -95,7 +95,7 @@ describe('ol.style.Icon', function() {
|
||||
});
|
||||
|
||||
it('the clone does not reference the same objects as the original', function() {
|
||||
var original = new _ol_style_Icon_({
|
||||
var original = new Icon({
|
||||
anchor: [1, 0],
|
||||
color: [1, 2, 3, 0.4],
|
||||
src: src,
|
||||
@@ -123,7 +123,7 @@ describe('ol.style.Icon', function() {
|
||||
var fractionAnchor = [0.25, 0.25];
|
||||
|
||||
it('uses fractional units by default', function() {
|
||||
var iconStyle = new _ol_style_Icon_({
|
||||
var iconStyle = new Icon({
|
||||
src: 'test.png',
|
||||
size: size,
|
||||
anchor: fractionAnchor
|
||||
@@ -132,7 +132,7 @@ describe('ol.style.Icon', function() {
|
||||
});
|
||||
|
||||
it('uses pixels units', function() {
|
||||
var iconStyle = new _ol_style_Icon_({
|
||||
var iconStyle = new Icon({
|
||||
src: 'test.png',
|
||||
size: size,
|
||||
anchor: [2, 18],
|
||||
@@ -143,7 +143,7 @@ describe('ol.style.Icon', function() {
|
||||
});
|
||||
|
||||
it('uses a bottom left anchor origin', function() {
|
||||
var iconStyle = new _ol_style_Icon_({
|
||||
var iconStyle = new Icon({
|
||||
src: 'test.png',
|
||||
size: size,
|
||||
anchor: fractionAnchor,
|
||||
@@ -153,7 +153,7 @@ describe('ol.style.Icon', function() {
|
||||
});
|
||||
|
||||
it('uses a bottom right anchor origin', function() {
|
||||
var iconStyle = new _ol_style_Icon_({
|
||||
var iconStyle = new Icon({
|
||||
src: 'test.png',
|
||||
size: size,
|
||||
anchor: fractionAnchor,
|
||||
@@ -163,7 +163,7 @@ describe('ol.style.Icon', function() {
|
||||
});
|
||||
|
||||
it('uses a top right anchor origin', function() {
|
||||
var iconStyle = new _ol_style_Icon_({
|
||||
var iconStyle = new Icon({
|
||||
src: 'test.png',
|
||||
size: size,
|
||||
anchor: fractionAnchor,
|
||||
@@ -178,7 +178,7 @@ describe('ol.style.Icon', function() {
|
||||
var imageSize = [144, 192];
|
||||
|
||||
it('uses a top left offset origin (default)', function() {
|
||||
var iconStyle = new _ol_style_Icon_({
|
||||
var iconStyle = new Icon({
|
||||
src: 'test.png',
|
||||
size: size,
|
||||
offset: offset
|
||||
@@ -187,7 +187,7 @@ describe('ol.style.Icon', function() {
|
||||
});
|
||||
|
||||
it('uses a bottom left offset origin', function() {
|
||||
var iconStyle = new _ol_style_Icon_({
|
||||
var iconStyle = new Icon({
|
||||
src: 'test.png',
|
||||
size: size,
|
||||
offset: offset,
|
||||
@@ -198,7 +198,7 @@ describe('ol.style.Icon', function() {
|
||||
});
|
||||
|
||||
it('uses a bottom right offset origin', function() {
|
||||
var iconStyle = new _ol_style_Icon_({
|
||||
var iconStyle = new Icon({
|
||||
src: 'test.png',
|
||||
size: size,
|
||||
offset: offset,
|
||||
@@ -209,7 +209,7 @@ describe('ol.style.Icon', function() {
|
||||
});
|
||||
|
||||
it('uses a top right offset origin', function() {
|
||||
var iconStyle = new _ol_style_Icon_({
|
||||
var iconStyle = new Icon({
|
||||
src: 'test.png',
|
||||
size: size,
|
||||
offset: offset,
|
||||
@@ -230,14 +230,14 @@ describe('ol.style.Icon', function() {
|
||||
var iconImage = new _ol_style_IconImage_(null, 'test.png', imgSize);
|
||||
iconImageCache.set(src, null, null, iconImage);
|
||||
|
||||
var iconStyle = new _ol_style_Icon_({
|
||||
var iconStyle = new Icon({
|
||||
src: 'test.png'
|
||||
});
|
||||
expect(iconStyle.getImageSize()).to.eql(imgSize);
|
||||
});
|
||||
|
||||
it('uses the given image size', function() {
|
||||
var iconStyle = new _ol_style_Icon_({
|
||||
var iconStyle = new Icon({
|
||||
img: {src: 'test.png'},
|
||||
imgSize: imgSize
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user