From 4bba13cb218aef6a20705be6c93bf29b47f42191 Mon Sep 17 00:00:00 2001 From: EmeraldBlock Date: Sat, 14 Nov 2020 19:28:30 -0600 Subject: [PATCH] Hide wires layer grid with disable grid option 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,