From 7f99ce46bb3e381550a8f9cbced947c0199aec42 Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Tue, 5 May 2020 16:22:58 +0100 Subject: [PATCH] set background fill style for each label add check for declutter --- src/ol/render/canvas/Executor.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ol/render/canvas/Executor.js b/src/ol/render/canvas/Executor.js index 6ed960c37d..26943c576e 100644 --- a/src/ol/render/canvas/Executor.js +++ b/src/ol/render/canvas/Executor.js @@ -262,6 +262,7 @@ class Executor { * @param {import("../../coordinate.js").Coordinate} p4 4th point of the background box. * @param {Array<*>} fillInstruction Fill instruction. * @param {Array<*>} strokeInstruction Stroke instruction. + * @param {boolean} declutter Declutter. */ replayTextBackground_( context, @@ -270,7 +271,8 @@ class Executor { p3, p4, fillInstruction, - strokeInstruction + strokeInstruction, + declutter ) { context.beginPath(); context.moveTo.apply(context, p1); @@ -280,7 +282,9 @@ class Executor { context.lineTo.apply(context, p1); if (fillInstruction) { this.alignFill_ = /** @type {boolean} */ (fillInstruction[2]); - context.fillStyle = /** @type {import("../../colorlike.js").ColorLike} */ (fillInstruction[1]); + if (declutter) { + context.fillStyle = /** @type {import("../../colorlike.js").ColorLike} */ (fillInstruction[1]); + } this.fill_(context); } if (strokeInstruction) { @@ -450,7 +454,8 @@ class Executor { p3, p4, /** @type {Array<*>} */ (fillInstruction), - /** @type {Array<*>} */ (strokeInstruction) + /** @type {Array<*>} */ (strokeInstruction), + false ); } drawImageOrLabel( @@ -543,7 +548,8 @@ class Executor { declutterData[15], declutterData[16], declutterData[11], - declutterData[12] + declutterData[12], + true ); } drawImageOrLabel.apply(undefined, declutterData);