mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
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.
This commit is contained in:
parent
d0596be38c
commit
c0027778ef
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user