1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-02-18 22:09:20 +00:00

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.
This commit is contained in:
EmeraldBlock 2020-11-14 19:28:30 -06:00
parent d33a72202a
commit 4bba13cb21

View File

@ -117,7 +117,8 @@ export class HUDWiresOverlay extends BaseHUDPart {
return; return;
} }
if (!this.cachedPatternBackground) { const hasTileGrid = !this.root.app.settings.getAllSettings().disableTileGrid;
if (hasTileGrid && !this.cachedPatternBackground) {
this.cachedPatternBackground = parameters.context.createPattern(this.tilePatternCanvas, "repeat"); this.cachedPatternBackground = parameters.context.createPattern(this.tilePatternCanvas, "repeat");
} }
@ -132,7 +133,9 @@ export class HUDWiresOverlay extends BaseHUDPart {
parameters.context.globalCompositeOperation = "source-over"; parameters.context.globalCompositeOperation = "source-over";
parameters.context.scale(scaleFactor, scaleFactor); 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( parameters.context.fillRect(
bounds.x / scaleFactor, bounds.x / scaleFactor,
bounds.y / scaleFactor, bounds.y / scaleFactor,