diff options
Diffstat (limited to 'rannak/mangud/uliopilane/tSark/main.js')
-rwxr-xr-x | rannak/mangud/uliopilane/tSark/main.js | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/rannak/mangud/uliopilane/tSark/main.js b/rannak/mangud/uliopilane/tSark/main.js index cc7ef3a..a91fbec 100755 --- a/rannak/mangud/uliopilane/tSark/main.js +++ b/rannak/mangud/uliopilane/tSark/main.js @@ -64,6 +64,7 @@ function nextText() { let gi6 = document.querySelector("g") newText.classList.add("sarkTekst") + newText.id = 'sarkTekst'; newText.innerHTML = "Uus Tekst"; // Move a little, so that new txt isnt exatly on top of old. @@ -277,14 +278,13 @@ function mousedown(e) { let posers4 = document.elementFromPoint(rect.left, rect.bottom).id; // /// ///// - console.log(posers, posers2, posers3, posers4); - item.style.pointerEvents = ""; - - if (posers != "sark" || posers2 != "sark" || posers3 != "sark" || posers4 != "sark"){ + //if ( posers != "sark" || posers2 != "sark" || posers3 != "sark" || posers4 != "sark") { + if ( !(posers == "sark" || posers == "sarkTekst") || !(posers2 == "sark" || posers2 == "sarkTekst") || + !(posers3 == "sark" || posers3 == "sarkTekst") || !(posers4 == "sark" || posers4 == "sarkTekst")) { let newX = prevX - e.clientX; let newY = prevY - e.clientY; @@ -327,6 +327,8 @@ function mousedown(e) { + + const resizers = document.querySelectorAll(".resizer"); let currentResizer; let isResizing = false; @@ -421,6 +423,7 @@ for (let resizer of resizers) { } + // Seting up resize Pic Pos let brr = document.querySelector("#sark").getBoundingClientRect(); let it = document.querySelector(".item").getBoundingClientRect(); @@ -431,6 +434,9 @@ Boop.style.top = brr.top + (brr.bottom - brr.top)/2 - (it.bottom - it.top)/2 + + + + /* Move on Button*/ function message(msg, color){ messageBox = document.querySelector(".messageBox"); @@ -440,11 +446,9 @@ function message(msg, color){ let stuffDone = new Array(); - const chkBtn = document.querySelector(".checkMoveOn"); chkBtn.addEventListener("click", (e) => { - if (stuffDone.length >= 3){ message("Korras! Soovi korral tee screenshot (Win+Shift+S)", "#4BB543"); moveOnEnable(); @@ -453,6 +457,7 @@ chkBtn.addEventListener("click", (e) => { message("valikuid kasutatud " + stuffDone.length + "/" + "3.", "Red"); }); + function moveOnEnable(){ const btn = document.querySelector(".moveOn"); btn.disabled = false; @@ -466,7 +471,20 @@ function moveOnEnable(){ } -// 6 + + + + +// Pic back to Center +function imgToCenter(){ + let brr = document.querySelector("#sark").getBoundingClientRect(); + let rect = document.querySelector(".item").getBoundingClientRect(); + el.style.left = brr.left + (brr.right - brr.left)/2 - (rect.right - rect.left)/2 + "px"; + el.style.top = brr.top + (brr.bottom - brr.top)/2 - (rect.bottom - rect.top)/2 + "px"; +} + + + @@ -509,13 +527,8 @@ nulliBtn.addEventListener("click", () => { document.querySelector(".sarkTekst").style.fill = "black"; - // Pic back to Center - let brr = document.querySelector("#sark").getBoundingClientRect(); - let rect = document.querySelector(".item").getBoundingClientRect(); - el.style.left = brr.left + (brr.right - brr.left)/2 - (rect.right - rect.left)/2 + "px"; - el.style.top = brr.top + (brr.bottom - brr.top)/2 - (rect.bottom - rect.top)/2 + "px"; - + imgToCenter(); // Moving IMg Corners |