Checkerboard background to signal transparency
This commit is contained in:
parent
32904051aa
commit
4381642e88
1 changed files with 9 additions and 13 deletions
22
js/index.js
22
js/index.js
|
@ -429,7 +429,7 @@ function mouseMove(evt) {
|
||||||
ovCtx.drawImage(arbitraryImage, finalX, finalY);
|
ovCtx.drawImage(arbitraryImage, finalX, finalY);
|
||||||
} else if (!paintMode) {
|
} else if (!paintMode) {
|
||||||
// draw targeting square reticle thingy cursor
|
// draw targeting square reticle thingy cursor
|
||||||
ovCtx.strokeStyle = "#00000077";
|
ovCtx.strokeStyle = "#FFFFFF";
|
||||||
snapOffsetX = 0;
|
snapOffsetX = 0;
|
||||||
snapOffsetY = 0;
|
snapOffsetY = 0;
|
||||||
if (snapToGrid) {
|
if (snapToGrid) {
|
||||||
|
@ -816,18 +816,14 @@ function isCanvasBlank(x, y, w, h, specifiedCanvas) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawBackground() {
|
function drawBackground() {
|
||||||
bgCtx.lineWidth = 1;
|
// Checkerboard
|
||||||
bgCtx.strokeStyle = "#999";
|
let darkTileColor = "#333";
|
||||||
var gridbox = bgCanvas.getBoundingClientRect();
|
let lightTileColor = "#555";
|
||||||
for (var i = 0; i < gridbox.width; i += 64) {
|
for (var x = 0; x < bgCanvas.width; x += 64) {
|
||||||
bgCtx.moveTo(i, 0);
|
for (var y = 0; y < bgCanvas.height; y += 64) {
|
||||||
bgCtx.lineTo(i, bgCanvas.height);
|
bgCtx.fillStyle = (x + y) % 128 === 0 ? lightTileColor : darkTileColor;
|
||||||
bgCtx.stroke();
|
bgCtx.fillRect(x, y, 64, 64);
|
||||||
}
|
}
|
||||||
for (var i = 0; i < gridbox.height; i += 64) {
|
|
||||||
bgCtx.moveTo(0, i);
|
|
||||||
bgCtx.lineTo(gridbox.width, i);
|
|
||||||
bgCtx.stroke();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue