Remove redundant size properties / getter
This commit is contained in:
@@ -341,13 +341,6 @@ class Icon extends ImageStyle {
|
|||||||
return this.iconImage_.getSize();
|
return this.iconImage_.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {import("../size.js").Size} Size of the hit-detection image.
|
|
||||||
*/
|
|
||||||
getHitDetectionImageSize() {
|
|
||||||
return this.getImageSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {import("../ImageState.js").default} Image state.
|
* @return {import("../ImageState.js").default} Image state.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -185,14 +185,6 @@ class ImageStyle {
|
|||||||
return abstract();
|
return abstract();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @abstract
|
|
||||||
* @return {import("../size.js").Size} Size of the hit-detection image.
|
|
||||||
*/
|
|
||||||
getHitDetectionImageSize() {
|
|
||||||
return abstract();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the origin of the symbolizer.
|
* Get the origin of the symbolizer.
|
||||||
* @abstract
|
* @abstract
|
||||||
|
|||||||
@@ -140,18 +140,6 @@ class RegularShape extends ImageStyle {
|
|||||||
*/
|
*/
|
||||||
this.size_ = null;
|
this.size_ = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {import("../size.js").Size}
|
|
||||||
*/
|
|
||||||
this.imageSize_ = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {import("../size.js").Size}
|
|
||||||
*/
|
|
||||||
this.hitDetectionImageSize_ = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {RenderOptions}
|
* @type {RenderOptions}
|
||||||
@@ -257,14 +245,7 @@ class RegularShape extends ImageStyle {
|
|||||||
* @return {import("../size.js").Size} Image size.
|
* @return {import("../size.js").Size} Image size.
|
||||||
*/
|
*/
|
||||||
getImageSize() {
|
getImageSize() {
|
||||||
return this.imageSize_;
|
return this.size_;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {import("../size.js").Size} Size of the hit-detection image.
|
|
||||||
*/
|
|
||||||
getHitDetectionImageSize() {
|
|
||||||
return this.hitDetectionImageSize_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -498,8 +479,6 @@ class RegularShape extends ImageStyle {
|
|||||||
this.canvas_ = {};
|
this.canvas_ = {};
|
||||||
this.anchor_ = [size / 2 - displacement[0], size / 2 + displacement[1]];
|
this.anchor_ = [size / 2 - displacement[0], size / 2 + displacement[1]];
|
||||||
this.size_ = [size, size];
|
this.size_ = [size, size];
|
||||||
this.imageSize_ = [size, size];
|
|
||||||
this.hitDetectionImageSize_ = [size, size];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ describe('ol.style.Circle', function () {
|
|||||||
// no hit-detection image is created, because no fill style is set
|
// no hit-detection image is created, because no fill style is set
|
||||||
expect(style.getImage(1)).to.be(style.getHitDetectionImage());
|
expect(style.getImage(1)).to.be(style.getHitDetectionImage());
|
||||||
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
||||||
expect(style.getHitDetectionImageSize()).to.eql([20, 20]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('creates a canvas (transparent fill-style)', function () {
|
it('creates a canvas (transparent fill-style)', function () {
|
||||||
@@ -32,7 +31,6 @@ describe('ol.style.Circle', function () {
|
|||||||
// hit-detection image is created, because transparent fill style is set
|
// hit-detection image is created, because transparent fill style is set
|
||||||
expect(style.getImage(1)).to.not.be(style.getHitDetectionImage());
|
expect(style.getImage(1)).to.not.be(style.getHitDetectionImage());
|
||||||
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
||||||
expect(style.getHitDetectionImageSize()).to.eql([20, 20]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('creates a canvas (non-transparent fill-style)', function () {
|
it('creates a canvas (non-transparent fill-style)', function () {
|
||||||
@@ -50,7 +48,6 @@ describe('ol.style.Circle', function () {
|
|||||||
// no hit-detection image is created, because non-transparent fill style is set
|
// no hit-detection image is created, because non-transparent fill style is set
|
||||||
expect(style.getImage(1)).to.be(style.getHitDetectionImage());
|
expect(style.getImage(1)).to.be(style.getHitDetectionImage());
|
||||||
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
||||||
expect(style.getHitDetectionImageSize()).to.eql([20, 20]);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ describe('ol.style.RegularShape', function () {
|
|||||||
// no hit-detection image is created, because no fill style is set
|
// no hit-detection image is created, because no fill style is set
|
||||||
expect(style.getImage(1)).to.be(style.getHitDetectionImage());
|
expect(style.getImage(1)).to.be(style.getHitDetectionImage());
|
||||||
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
||||||
expect(style.getHitDetectionImageSize()).to.eql([20, 20]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('creates a canvas (transparent fill-style)', function () {
|
it('creates a canvas (transparent fill-style)', function () {
|
||||||
@@ -61,7 +60,6 @@ describe('ol.style.RegularShape', function () {
|
|||||||
// hit-detection image is created, because transparent fill style is set
|
// hit-detection image is created, because transparent fill style is set
|
||||||
expect(style.getImage(1)).to.not.be(style.getHitDetectionImage());
|
expect(style.getImage(1)).to.not.be(style.getHitDetectionImage());
|
||||||
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
||||||
expect(style.getHitDetectionImageSize()).to.eql([20, 20]);
|
|
||||||
expect(style.getHitDetectionImage().width).to.be(20);
|
expect(style.getHitDetectionImage().width).to.be(20);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -80,7 +78,6 @@ describe('ol.style.RegularShape', function () {
|
|||||||
// no hit-detection image is created, because non-transparent fill style is set
|
// no hit-detection image is created, because non-transparent fill style is set
|
||||||
expect(style.getImage(1)).to.be(style.getHitDetectionImage());
|
expect(style.getImage(1)).to.be(style.getHitDetectionImage());
|
||||||
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
expect(style.getHitDetectionImage()).to.be.an(HTMLCanvasElement);
|
||||||
expect(style.getHitDetectionImageSize()).to.eql([20, 20]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sets default displacement [0, 0]', function () {
|
it('sets default displacement [0, 0]', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user