set background fill style for each label

add check for declutter
This commit is contained in:
mike-000
2020-05-05 16:22:58 +01:00
committed by GitHub
parent d72c7fdc13
commit 7f99ce46bb
+10 -4
View File
@@ -262,6 +262,7 @@ class Executor {
* @param {import("../../coordinate.js").Coordinate} p4 4th point of the background box. * @param {import("../../coordinate.js").Coordinate} p4 4th point of the background box.
* @param {Array<*>} fillInstruction Fill instruction. * @param {Array<*>} fillInstruction Fill instruction.
* @param {Array<*>} strokeInstruction Stroke instruction. * @param {Array<*>} strokeInstruction Stroke instruction.
* @param {boolean} declutter Declutter.
*/ */
replayTextBackground_( replayTextBackground_(
context, context,
@@ -270,7 +271,8 @@ class Executor {
p3, p3,
p4, p4,
fillInstruction, fillInstruction,
strokeInstruction strokeInstruction,
declutter
) { ) {
context.beginPath(); context.beginPath();
context.moveTo.apply(context, p1); context.moveTo.apply(context, p1);
@@ -280,7 +282,9 @@ class Executor {
context.lineTo.apply(context, p1); context.lineTo.apply(context, p1);
if (fillInstruction) { if (fillInstruction) {
this.alignFill_ = /** @type {boolean} */ (fillInstruction[2]); 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); this.fill_(context);
} }
if (strokeInstruction) { if (strokeInstruction) {
@@ -450,7 +454,8 @@ class Executor {
p3, p3,
p4, p4,
/** @type {Array<*>} */ (fillInstruction), /** @type {Array<*>} */ (fillInstruction),
/** @type {Array<*>} */ (strokeInstruction) /** @type {Array<*>} */ (strokeInstruction),
false
); );
} }
drawImageOrLabel( drawImageOrLabel(
@@ -543,7 +548,8 @@ class Executor {
declutterData[15], declutterData[15],
declutterData[16], declutterData[16],
declutterData[11], declutterData[11],
declutterData[12] declutterData[12],
true
); );
} }
drawImageOrLabel.apply(undefined, declutterData); drawImageOrLabel.apply(undefined, declutterData);