fixes issue 6
This commit is contained in:
parent
bcb4593d44
commit
085aa5a33a
2 changed files with 13 additions and 6 deletions
|
@ -103,7 +103,7 @@ please do! kindly indicate your OS, browser, versions of both, any errors in dev
|
|||
## known bugs :(
|
||||
- generated images display +1px on x/y during approve/reject state, doesn't affect output, just annoying
|
||||
- erase mask is like entirely broken
|
||||
- odd-numbered scale factors don't snap correctly
|
||||
- ~~odd-numbered scale factors don't snap correctly~~
|
||||
- ~~arbitrary "pasted" images require clicking twice to place them and i _don't know why_ [(yes i do)](#terrible), just getting them to be arbitrarily placable was a giant pain because i'm not got the smarts~~
|
||||
- selecting an aribtrary image by double-clicking it in the file picker can sometimes trigger a dream request that errors out if your file picker is "above" the canvas; i tried to alleviate that by temporarily removing the mouse(move/down/up) handlers for the canvas context on selection of a file, but i'm POSITIVE it's an improper solution and not quite sure if it's even fully effective
|
||||
|
||||
|
|
17
js/index.js
17
js/index.js
|
@ -414,9 +414,13 @@ function mouseDown(evt) {
|
|||
clicked = true;
|
||||
} else {
|
||||
//const rect = ovCanvas.getBoundingClientRect()
|
||||
var oddOffset = 0;
|
||||
if (scaleFactor % 2 != 0) {
|
||||
oddOffset = basePixelCount / 2;
|
||||
}
|
||||
var nextBox = {};
|
||||
nextBox.x = evt.clientX - ((basePixelCount * scaleFactor) / 2) - rect.left; //origin is middle of the frame
|
||||
nextBox.y = evt.clientY - ((basePixelCount * scaleFactor) / 2) - rect.top; //TODO make a way to set the origin to numpad dirs?
|
||||
nextBox.x = evt.clientX - ((basePixelCount * scaleFactor) / 2) - rect.left + oddOffset; //origin is middle of the frame
|
||||
nextBox.y = evt.clientY - ((basePixelCount * scaleFactor) / 2) - rect.top + oddOffset; //TODO make a way to set the origin to numpad dirs?
|
||||
nextBox.w = basePixelCount * scaleFactor;
|
||||
nextBox.h = basePixelCount * scaleFactor;
|
||||
drawTargets.push(nextBox);
|
||||
|
@ -463,15 +467,18 @@ function mouseUp(evt) {
|
|||
tgtCtx.strokeStyle = "#55000077";
|
||||
var drawIt = {}; //why am i doing this????
|
||||
var target = drawTargets[drawTargets.length - 1]; //get the last one... why am i storing all of them?
|
||||
|
||||
var oddOffset = 0;
|
||||
if (scaleFactor % 2 != 0) {
|
||||
oddOffset = basePixelCount / 2;
|
||||
}
|
||||
snapOffsetX = 0;
|
||||
snapOffsetY = 0;
|
||||
if (snapToGrid) {
|
||||
snapOffsetX = snap(target.x);
|
||||
snapOffsetY = snap(target.y);
|
||||
}
|
||||
finalX = snapOffsetX + target.x;
|
||||
finalY = snapOffsetY + target.y;
|
||||
finalX = snapOffsetX + target.x - oddOffset;
|
||||
finalY = snapOffsetY + target.y - oddOffset;
|
||||
|
||||
drawThis.x = finalX;
|
||||
drawThis.y = finalY;
|
||||
|
|
Loading…
Reference in a new issue