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:
EmeraldBlock 2020-12-07 11:43:58 -06:00 committed by GitHub
parent d0596be38c
commit c0027778ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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,