Support declutter mode for image styles
Allows to specify for each image style, whether the image should be decluttered, always drawn but still serving as obstacle, or drawn without being an obstacle for other images/texts. The layer must still have declutter = true set for this property to have any effect.
This commit is contained in:
@@ -92,6 +92,12 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
*/
|
||||
this.width_ = undefined;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {"declutter"|"obstacle"|"none"|undefined}
|
||||
*/
|
||||
this.declutterMode_ = undefined;
|
||||
|
||||
/**
|
||||
* Data shared with a text builder for combined decluttering.
|
||||
* @private
|
||||
@@ -132,6 +138,7 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
(this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,
|
||||
],
|
||||
Math.ceil(this.width_ * this.imagePixelRatio_),
|
||||
this.declutterMode_,
|
||||
this.declutterImageWithText_,
|
||||
]);
|
||||
this.hitDetectionInstructions.push([
|
||||
@@ -150,6 +157,7 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
this.rotation_,
|
||||
this.scale_,
|
||||
this.width_,
|
||||
this.declutterMode_,
|
||||
this.declutterImageWithText_,
|
||||
]);
|
||||
this.endGeometry(feature);
|
||||
@@ -187,6 +195,7 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
(this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,
|
||||
],
|
||||
Math.ceil(this.width_ * this.imagePixelRatio_),
|
||||
this.declutterMode_,
|
||||
this.declutterImageWithText_,
|
||||
]);
|
||||
this.hitDetectionInstructions.push([
|
||||
@@ -205,6 +214,7 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
this.rotation_,
|
||||
this.scale_,
|
||||
this.width_,
|
||||
this.declutterMode_,
|
||||
this.declutterImageWithText_,
|
||||
]);
|
||||
this.endGeometry(feature);
|
||||
@@ -255,6 +265,7 @@ class CanvasImageBuilder extends CanvasBuilder {
|
||||
this.rotation_ = imageStyle.getRotation();
|
||||
this.scale_ = imageStyle.getScaleArray();
|
||||
this.width_ = size[0];
|
||||
this.declutterMode_ = imageStyle.getDeclutterMode();
|
||||
this.declutterImageWithText_ = opt_sharedData;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user