From c0027778ef1815653240033dbf90add76258bbe2 Mon Sep 17 00:00:00 2001 From: EmeraldBlock <69981203+EmeraldBlock@users.noreply.github.com> Date: Mon, 7 Dec 2020 11:43:58 -0600 Subject: [PATCH] Hide wires layer grid with disable grid option (#991) When the Disable Grid option is on, the grid shown on the wires layer also disappears. This is done by replacing the wires tile grid pattern with a pure color that is the average color of the tile image. The color also has the same transparency as the tile image. The use of a pure color loses the grainy look of the image. --- src/js/game/hud/parts/wires_overlay.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/js/game/hud/parts/wires_overlay.js b/src/js/game/hud/parts/wires_overlay.js index 752d9cb3..2fd3092c 100644 --- a/src/js/game/hud/parts/wires_overlay.js +++ b/src/js/game/hud/parts/wires_overlay.js @@ -117,7 +117,8 @@ export class HUDWiresOverlay extends BaseHUDPart { return; } - if (!this.cachedPatternBackground) { + const hasTileGrid = !this.root.app.settings.getAllSettings().disableTileGrid; + if (hasTileGrid && !this.cachedPatternBackground) { this.cachedPatternBackground = parameters.context.createPattern(this.tilePatternCanvas, "repeat"); } @@ -132,7 +133,9 @@ export class HUDWiresOverlay extends BaseHUDPart { parameters.context.globalCompositeOperation = "source-over"; parameters.context.scale(scaleFactor, scaleFactor); - parameters.context.fillStyle = this.cachedPatternBackground; + parameters.context.fillStyle = hasTileGrid + ? this.cachedPatternBackground + : "rgba(78, 137, 125, 0.75)"; parameters.context.fillRect( bounds.x / scaleFactor, bounds.y / scaleFactor,