very minor unnecessary changes
This commit is contained in:
parent
327e90c88c
commit
bef6b214f4
1 changed files with 17 additions and 32 deletions
49
js/index.js
49
js/index.js
|
@ -623,21 +623,7 @@ function mouseUp(evt) {
|
||||||
initImgData.data[i + 3] = imgChunkData[i + 3]; //it's still RGBA so we can handily do this in nice chunks'o'4
|
initImgData.data[i + 3] = imgChunkData[i + 3]; //it's still RGBA so we can handily do this in nice chunks'o'4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// make a list of all the white pixels to expand so we don't waste time on non-mask pixels
|
// https://stackoverflow.com/a/30204783 ???? !!!!!!!!
|
||||||
let pix = {x: [], y: [], index: []};
|
|
||||||
var x, y, index;
|
|
||||||
for (y = 0; y < drawIt.h; y++) {
|
|
||||||
for (x = 0; x < drawIt.w; x++) {
|
|
||||||
index = (y * drawIt.w + x) * 4;
|
|
||||||
if (overMaskImgData.data[index] > 0) {
|
|
||||||
pix.x.push(x);
|
|
||||||
pix.y.push(y);
|
|
||||||
pix.index.push(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://stackoverflow.com/a/30204783 ????
|
|
||||||
overMaskCanvasCtx.fillStyle = "black";
|
overMaskCanvasCtx.fillStyle = "black";
|
||||||
overMaskCanvasCtx.fillRect(0, 0, drawIt.w, drawIt.h); // fill with black instead of null to start
|
overMaskCanvasCtx.fillRect(0, 0, drawIt.w, drawIt.h); // fill with black instead of null to start
|
||||||
for (i = 0; i < overMaskImgData.data.length; i += 4) {
|
for (i = 0; i < overMaskImgData.data.length; i += 4) {
|
||||||
|
@ -720,21 +706,6 @@ function mouseUp(evt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeScaleFactor = sliderChangeHandlerFactory(
|
|
||||||
"scaleFactor",
|
|
||||||
"scaleFactorTxt",
|
|
||||||
"scaleFactor",
|
|
||||||
8,
|
|
||||||
(k, v) => (scaleFactor = v),
|
|
||||||
(k) => scaleFactor
|
|
||||||
);
|
|
||||||
const changeSteps = sliderChangeHandlerFactory(
|
|
||||||
"steps",
|
|
||||||
"stepsTxt",
|
|
||||||
"steps",
|
|
||||||
30
|
|
||||||
);
|
|
||||||
|
|
||||||
function changePaintMode() {
|
function changePaintMode() {
|
||||||
paintMode = document.getElementById("cbxPaint").checked;
|
paintMode = document.getElementById("cbxPaint").checked;
|
||||||
clearTargetMask();
|
clearTargetMask();
|
||||||
|
@ -742,7 +713,6 @@ function changePaintMode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeEnableErasing() {
|
function changeEnableErasing() {
|
||||||
// yeah because this is for the image layer
|
|
||||||
enableErasing = document.getElementById("cbxEnableErasing").checked;
|
enableErasing = document.getElementById("cbxEnableErasing").checked;
|
||||||
localStorage.setItem("enable_erase", enableErasing);
|
localStorage.setItem("enable_erase", enableErasing);
|
||||||
}
|
}
|
||||||
|
@ -771,6 +741,20 @@ const changeBatchCount = sliderChangeHandlerFactory(
|
||||||
"n_iter",
|
"n_iter",
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
const changeScaleFactor = sliderChangeHandlerFactory(
|
||||||
|
"scaleFactor",
|
||||||
|
"scaleFactorTxt",
|
||||||
|
"scaleFactor",
|
||||||
|
8,
|
||||||
|
(k, v) => (scaleFactor = v),
|
||||||
|
(k) => scaleFactor
|
||||||
|
);
|
||||||
|
const changeSteps = sliderChangeHandlerFactory(
|
||||||
|
"steps",
|
||||||
|
"stepsTxt",
|
||||||
|
"steps",
|
||||||
|
30
|
||||||
|
);
|
||||||
|
|
||||||
function changeSnapMode() {
|
function changeSnapMode() {
|
||||||
snapToGrid = document.getElementById("cbxSnap").checked;
|
snapToGrid = document.getElementById("cbxSnap").checked;
|
||||||
|
@ -823,7 +807,8 @@ function drawBackground() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function preloadImage() {
|
function preloadImage() {
|
||||||
// gonna legit scream
|
// possible firefox-only bug?
|
||||||
|
// attempt to prevent requesting a dream if double-clicking a selected image
|
||||||
document.getElementById("overlayCanvas").onmousemove = null;
|
document.getElementById("overlayCanvas").onmousemove = null;
|
||||||
document.getElementById("overlayCanvas").onmousedown = null;
|
document.getElementById("overlayCanvas").onmousedown = null;
|
||||||
document.getElementById("overlayCanvas").onmouseup = null;
|
document.getElementById("overlayCanvas").onmouseup = null;
|
||||||
|
|
Loading…
Reference in a new issue