refactor offset to displacement
This commit is contained in:
committed by
Andreas Hocevar
parent
4c7f52c8a4
commit
78378f0253
@@ -82,23 +82,23 @@ describe('ol.style.RegularShape', function() {
|
||||
expect(style.getHitDetectionImageSize()).to.eql([21, 21]);
|
||||
});
|
||||
|
||||
it('sets default offset [0, 0]', function() {
|
||||
it('sets default displacement [0, 0]', function() {
|
||||
const style = new RegularShape({
|
||||
radius: 5
|
||||
});
|
||||
expect(style.getOffset()).to.an('array');
|
||||
expect(style.getOffset()[0]).to.eql(0);
|
||||
expect(style.getOffset()[1]).to.eql(0);
|
||||
expect(style.getDisplacement()).to.an('array');
|
||||
expect(style.getDisplacement()[0]).to.eql(0);
|
||||
expect(style.getDisplacement()[1]).to.eql(0);
|
||||
});
|
||||
|
||||
it('can use offset', function() {
|
||||
const style = new RegularShape({
|
||||
radius: 5,
|
||||
offset: [10, 20]
|
||||
displacement: [10, 20]
|
||||
});
|
||||
expect(style.getOffset()).to.an('array');
|
||||
expect(style.getOffset()[0]).to.eql(10);
|
||||
expect(style.getOffset()[1]).to.eql(20);
|
||||
expect(style.getDisplacement()).to.an('array');
|
||||
expect(style.getDisplacement()[0]).to.eql(10);
|
||||
expect(style.getDisplacement()[1]).to.eql(20);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -127,7 +127,7 @@ describe('ol.style.RegularShape', function() {
|
||||
}),
|
||||
rotation: 2,
|
||||
rotateWithView: true,
|
||||
offest: [10, 20]
|
||||
displacement: [10, 20]
|
||||
});
|
||||
original.setOpacity(0.5);
|
||||
original.setScale(1.5);
|
||||
@@ -142,8 +142,8 @@ describe('ol.style.RegularShape', function() {
|
||||
expect(original.getRotateWithView()).to.eql(clone.getRotateWithView());
|
||||
expect(original.getScale()).to.eql(clone.getScale());
|
||||
expect(original.getStroke().getColor()).to.eql(clone.getStroke().getColor());
|
||||
expect(original.getOffset()[0]).to.eql(clone.getOffset()[0]);
|
||||
expect(original.getOffset()[1]).to.eql(clone.getOffset()[1]);
|
||||
expect(original.getDisplacement()[0]).to.eql(clone.getDisplacement()[0]);
|
||||
expect(original.getDisplacement()[1]).to.eql(clone.getDisplacement()[1]);
|
||||
});
|
||||
|
||||
it('the clone does not reference the same objects as the original', function() {
|
||||
@@ -153,11 +153,13 @@ describe('ol.style.RegularShape', function() {
|
||||
}),
|
||||
stroke: new Stroke({
|
||||
color: '#319FD3'
|
||||
})
|
||||
}),
|
||||
displacement: [0, 5]
|
||||
});
|
||||
const clone = original.clone();
|
||||
expect(original.getFill()).to.not.be(clone.getFill());
|
||||
expect(original.getStroke()).to.not.be(clone.getStroke());
|
||||
expect(original.getDisplacement()).to.not.be(clone.getDisplacement());
|
||||
|
||||
clone.getFill().setColor('#012345');
|
||||
clone.getStroke().setColor('#012345');
|
||||
|
||||
Reference in New Issue
Block a user