detect which handle is being held
This commit is contained in:
@@ -227,6 +227,7 @@
|
|||||||
|
|
||||||
new_profile_image.style.setProperty("--x-offset", "0px");
|
new_profile_image.style.setProperty("--x-offset", "0px");
|
||||||
new_profile_image.style.setProperty("--y-offset", "0px");
|
new_profile_image.style.setProperty("--y-offset", "0px");
|
||||||
|
resize_photo_box.style.setProperty("--size", "350px");
|
||||||
});
|
});
|
||||||
|
|
||||||
confirm_change.addEventListener("click", async () => {
|
confirm_change.addEventListener("click", async () => {
|
||||||
|
|||||||
@@ -57,8 +57,21 @@ document.body.addEventListener("mouseup", () => {
|
|||||||
|
|
||||||
// handle anchors
|
// handle anchors
|
||||||
resize_anchors = document.getElementsByClassName("resize_anchor");
|
resize_anchors = document.getElementsByClassName("resize_anchor");
|
||||||
|
var handleBeingHeld = [false, false, false, false];
|
||||||
for (var i = 0; i < resize_anchors.length; i++) {
|
for (var i = 0; i < resize_anchors.length; i++) {
|
||||||
resize_anchors[i].addEventListener("mousedown", (e) => {
|
const index = i;
|
||||||
|
resize_anchors[index].addEventListener("mousedown", (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
handleBeingHeld[index] = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
document.body.addEventListener("mouseup", () => {
|
||||||
|
handleBeingHeld[index] = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.body.addEventListener("mousemove", () => {
|
||||||
|
for (var i = 0; i < handleBeingHeld.length; i++) {
|
||||||
|
if (!handleBeingHeld[i]) continue;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
+1
-12
@@ -180,18 +180,7 @@
|
|||||||
|
|
||||||
#resize_photo_box {
|
#resize_photo_box {
|
||||||
background-color: rgba(0, 0, 0, 0);
|
background-color: rgba(0, 0, 0, 0);
|
||||||
width: 350px;
|
width: var(--size);
|
||||||
aspect-ratio: 1 / 1;
|
|
||||||
|
|
||||||
border-style: dashed;
|
|
||||||
border-color: black;
|
|
||||||
border-width: 5px;
|
|
||||||
z-index: 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
#resize_photo_box:hover {
|
|
||||||
background-color: rgba(0, 0, 0, 0);
|
|
||||||
width: 350px;
|
|
||||||
aspect-ratio: 1 / 1;
|
aspect-ratio: 1 / 1;
|
||||||
|
|
||||||
border-style: dashed;
|
border-style: dashed;
|
||||||
|
|||||||
Reference in New Issue
Block a user