From 1add8ef6285df97270dae4df9f68591443fc5925 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Fri, 10 Mar 2023 23:59:56 +0200 Subject: sark FIX, Very Nice --- rannak/mangud/uliopilane/tSark/index.html | 6 ++--- rannak/mangud/uliopilane/tSark/main.js | 39 ++++++++++++++++++++----------- rannak/mangud/uliopilane/tSark/style.css | 15 +++++++----- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/rannak/mangud/uliopilane/tSark/index.html b/rannak/mangud/uliopilane/tSark/index.html index b85127e..806303d 100755 --- a/rannak/mangud/uliopilane/tSark/index.html +++ b/rannak/mangud/uliopilane/tSark/index.html @@ -15,7 +15,7 @@ - Tekst + Tekst @@ -109,11 +109,12 @@

Lisa Pilt

+
-

Kirjta tekst

+

Kirjuta tekst

@@ -141,7 +142,6 @@
-
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 diff --git a/rannak/mangud/uliopilane/tSark/style.css b/rannak/mangud/uliopilane/tSark/style.css index fd6c352..808fbb8 100755 --- a/rannak/mangud/uliopilane/tSark/style.css +++ b/rannak/mangud/uliopilane/tSark/style.css @@ -168,10 +168,16 @@ svg { font-size:1.3rem; color:white; padding: 10px; - margin: 0 2px; + margin: .7rem; font-size: 0.9rem; } +.nulliBtn { + margin-top: .7rem !important; + background-color: red !important; +} + + .muutused { margin-top: 10px; border-top: 2px solid gray; @@ -180,7 +186,7 @@ svg { } .muutused h4 { - padding-top: .5rem; + padding-top: 1.7rem; } .fileUpload { @@ -203,10 +209,6 @@ svg { cursor: pointer; } -.nulliBtn { - background-color: red; -} - .textAddWrapper button { background-color: #596B6E; border: none; @@ -229,6 +231,7 @@ svg { background-repeat: no-repeat; background-size: 100%; top: 50vh; + cursor: move; /* top: 50%; right: 50%; -- cgit v1.2.3