From c525b29ceb91c0abacfe9916aafb1b0b48d47880 Mon Sep 17 00:00:00 2001 From: Rasmus Luha Date: Fri, 24 Feb 2023 17:31:06 +0200 Subject: =?UTF-8?q?Soome=20m=C3=A4ng=20added?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rannak/mangud/partorg/plakat.bak/img/avatar.png | Bin 0 -> 657556 bytes rannak/mangud/partorg/plakat.bak/img/lenin.png | Bin 0 -> 37366 bytes rannak/mangud/partorg/plakat.bak/img/nazi.png | Bin 0 -> 20381 bytes .../mangud/partorg/plakat.bak/img/normalSelect.cur | Bin 0 -> 4286 bytes rannak/mangud/partorg/plakat.bak/img/redStar.png | Bin 0 -> 39590 bytes rannak/mangud/partorg/plakat.bak/img/stalin.jpg | Bin 0 -> 168805 bytes .../mangud/partorg/plakat.bak/img/stalinAddOn.png | Bin 0 -> 976997 bytes rannak/mangud/partorg/plakat.bak/img/testImg.jpg | Bin 0 -> 498451 bytes rannak/mangud/partorg/plakat.bak/img/veekogud.jpg | Bin 0 -> 223291 bytes rannak/mangud/partorg/plakat.bak/index.html | 125 ++++++++++++ rannak/mangud/partorg/plakat.bak/main.js | 224 +++++++++++++++++++++ rannak/mangud/partorg/plakat.bak/style.css | 188 +++++++++++++++++ 12 files changed, 537 insertions(+) create mode 100644 rannak/mangud/partorg/plakat.bak/img/avatar.png create mode 100644 rannak/mangud/partorg/plakat.bak/img/lenin.png create mode 100644 rannak/mangud/partorg/plakat.bak/img/nazi.png create mode 100644 rannak/mangud/partorg/plakat.bak/img/normalSelect.cur create mode 100644 rannak/mangud/partorg/plakat.bak/img/redStar.png create mode 100644 rannak/mangud/partorg/plakat.bak/img/stalin.jpg create mode 100644 rannak/mangud/partorg/plakat.bak/img/stalinAddOn.png create mode 100644 rannak/mangud/partorg/plakat.bak/img/testImg.jpg create mode 100644 rannak/mangud/partorg/plakat.bak/img/veekogud.jpg create mode 100644 rannak/mangud/partorg/plakat.bak/index.html create mode 100644 rannak/mangud/partorg/plakat.bak/main.js create mode 100644 rannak/mangud/partorg/plakat.bak/style.css (limited to 'rannak/mangud/partorg/plakat.bak') diff --git a/rannak/mangud/partorg/plakat.bak/img/avatar.png b/rannak/mangud/partorg/plakat.bak/img/avatar.png new file mode 100644 index 0000000..485a70c Binary files /dev/null and b/rannak/mangud/partorg/plakat.bak/img/avatar.png differ diff --git a/rannak/mangud/partorg/plakat.bak/img/lenin.png b/rannak/mangud/partorg/plakat.bak/img/lenin.png new file mode 100644 index 0000000..e36df3d Binary files /dev/null and b/rannak/mangud/partorg/plakat.bak/img/lenin.png differ diff --git a/rannak/mangud/partorg/plakat.bak/img/nazi.png b/rannak/mangud/partorg/plakat.bak/img/nazi.png new file mode 100644 index 0000000..87e616e Binary files /dev/null and b/rannak/mangud/partorg/plakat.bak/img/nazi.png differ diff --git a/rannak/mangud/partorg/plakat.bak/img/normalSelect.cur b/rannak/mangud/partorg/plakat.bak/img/normalSelect.cur new file mode 100644 index 0000000..fdd943c Binary files /dev/null and b/rannak/mangud/partorg/plakat.bak/img/normalSelect.cur differ diff --git a/rannak/mangud/partorg/plakat.bak/img/redStar.png b/rannak/mangud/partorg/plakat.bak/img/redStar.png new file mode 100644 index 0000000..b6eee79 Binary files /dev/null and b/rannak/mangud/partorg/plakat.bak/img/redStar.png differ diff --git a/rannak/mangud/partorg/plakat.bak/img/stalin.jpg b/rannak/mangud/partorg/plakat.bak/img/stalin.jpg new file mode 100644 index 0000000..bc0a3a5 Binary files /dev/null and b/rannak/mangud/partorg/plakat.bak/img/stalin.jpg differ diff --git a/rannak/mangud/partorg/plakat.bak/img/stalinAddOn.png b/rannak/mangud/partorg/plakat.bak/img/stalinAddOn.png new file mode 100644 index 0000000..d3e05fd Binary files /dev/null and b/rannak/mangud/partorg/plakat.bak/img/stalinAddOn.png differ diff --git a/rannak/mangud/partorg/plakat.bak/img/testImg.jpg b/rannak/mangud/partorg/plakat.bak/img/testImg.jpg new file mode 100644 index 0000000..d88d950 Binary files /dev/null and b/rannak/mangud/partorg/plakat.bak/img/testImg.jpg differ diff --git a/rannak/mangud/partorg/plakat.bak/img/veekogud.jpg b/rannak/mangud/partorg/plakat.bak/img/veekogud.jpg new file mode 100644 index 0000000..23f04ab Binary files /dev/null and b/rannak/mangud/partorg/plakat.bak/img/veekogud.jpg differ diff --git a/rannak/mangud/partorg/plakat.bak/index.html b/rannak/mangud/partorg/plakat.bak/index.html new file mode 100644 index 0000000..4754c9b --- /dev/null +++ b/rannak/mangud/partorg/plakat.bak/index.html @@ -0,0 +1,125 @@ + + + + + + Plakat + + + + + + +
+ +
+ +
+

Kujunda Plakatit

+

Vali välja üks plakat ja muuda/lisa selle kujundust vastavalt enda äranägemisele.

+ + + + + + +
+ +
+
+

+ + +

+ +

+ + +

+ + +
+
+ + + + +

Vali Plakat

+
+ Jossup Saloninjo Plakat + Veekogude Plakat + Veekogude Plakat +
+ + + + +
+ + + + +
+ +
+ + +
+ + + + + + + + + + + + + + + + diff --git a/rannak/mangud/partorg/plakat.bak/main.js b/rannak/mangud/partorg/plakat.bak/main.js new file mode 100644 index 0000000..11809cb --- /dev/null +++ b/rannak/mangud/partorg/plakat.bak/main.js @@ -0,0 +1,224 @@ +document.addEventListener('DOMContentLoaded', () => { + let btn = document.querySelector('.modalButton'); + btn.click(); +}); + + +console.log("FAAAAK"); + +/* Inital Setup*/ + +const canvas = document.getElementById('drawing-board'); +const toolbar = document.getElementById('toolbar'); +const ctx = canvas.getContext('2d'); + +let canvasOffsetX = canvas.offsetLeft; +let canvasOffsetY = canvas.offsetTop; + +let CurImage = document.getElementById("stalin"); + +canvas.width = window.innerWidth - canvasOffsetX; +canvas.height = window.innerHeight - canvasOffsetY; + + + +function copyImageToCanvas(image, x, y) { + ctx.drawImage(image, 0, 0, canvas.width, canvas.height) +} + + + + +// Initial Drawring +setTimeout(() => { + copyImageToCanvas(CurImage, canvasOffsetX, canvasOffsetY); +}, 300); + + + +window.onresize = () => { + canvasOffsetX = canvas.offsetLeft; + canvasOffsetY = canvas.offsetTop; + canvas.width = window.innerWidth - canvasOffsetX; + canvas.height = window.innerHeight - canvasOffsetY; + copyImageToCanvas(CurImage, canvasOffsetX, canvasOffsetY); +} + + + + +/* EventHandlers and stuff*/ + +let addOnHasBeenAdded = false; +let addOnActive = false; +let newAddOn; +let hasPainted = false; + +let isPainting = false; +let lineWidth = 5; +let startX; +let startY; + +const pildid = new Array(); +const addOns = new Array(); + +toolbar.addEventListener('click', e => { + + + //Plakatid + const stalinImg = document.getElementById("stalin"); + const veekogudImg = document.getElementById("veekogud"); + const testing = document.getElementById("testing"); + + pildid.push(stalinImg); + pildid.push(veekogudImg); + pildid.push(testing); + + + //Addons + + const naziImg = document.getElementById("nazi"); + const lenin = document.getElementById("lenin"); + const redStar = document.getElementById("redStar"); + const stalinAddOn = document.getElementById("stalinAddOn"); + + addOns.push(naziImg); + addOns.push(lenin); + addOns.push(redStar); + addOns.push(stalinAddOn); + + + + + if (e.target.id === "stalin" || e.target.id === "veekogud" || e.target.id === "testing") { + for (el in pildid) { + pildid[el].classList.remove("picked"); + } + let newPicked = document.getElementById(e.target.id); + newPicked.classList.add("picked"); + + // Draw New Pick + CurImage = newPicked; + copyImageToCanvas(CurImage, canvasOffsetX, canvasOffsetY); + moveOnDisable(); + } + + + else if (e.target.id === 'clear') { + ctx.clearRect(0, 0, canvas.width, canvas.height); + copyImageToCanvas(CurImage, canvasOffsetX, canvasOffsetY); + moveOnDisable(); + } + + + else if (e.target.id === 'nazi' || e.target.id === 'lenin' || e.target.id === 'redStar' || e.target.id === 'stalinAddOn') { + addOnActive = true; + document.body.style.cursor = "url('img/normalSelect.cur'), auto"; + + for (el in addOns) { + addOns[el].classList.remove("addOnPicked"); + } + + newAddOn = document.getElementById(e.target.id); + newAddOn.classList.add("addOnPicked"); + } + + +}); + + + +canvas.addEventListener('click', e => { + + if(addOnActive == true){ + addOnActive = false; + document.body.style.cursor = "auto"; + + for (el in addOns) { + addOns[el].classList.remove("addOnPicked"); + } + + let xCord = e.offsetX - (newAddOn.clientWidth / 2) + let yCord = e.offsetY - (newAddOn.clientHeight / 2) + ctx.drawImage(newAddOn, xCord, yCord, newAddOn.clientWidth, newAddOn.clientHeight); + + + addOnHasBeenAdded = true; + if (hasPainted) + moveOnEnable(); + } +}); + + + + + + + + +/* Drawing stuff from here */ + +toolbar.addEventListener('change', e => { + if(e.target.id === 'stroke') { + ctx.strokeStyle = e.target.value; + } + + if(e.target.id === 'lineWidth') { + lineWidth = e.target.value; + } + +}); + + + +const draw = (e) => { + if(!isPainting) { + return; + } + + ctx.lineWidth = lineWidth; + ctx.lineCap = 'round'; + + ctx.lineTo(e.clientX - canvasOffsetX, e.clientY); + //ctx.lineTo(e.clientX - abiOffset, e.clientY); + ctx.stroke(); + + hasPainted = true; + if (addOnHasBeenAdded) + moveOnEnable(); +} + + + +canvas.addEventListener('mousedown', (e) => { + isPainting = true; + startX = e.clientX; + startY = e.clientY; +}); + + + +canvas.addEventListener('mouseup', e => { + isPainting = false; + ctx.stroke(); + ctx.beginPath(); +}); + + +canvas.addEventListener('mousemove', draw); + + + + +// Move On Stuff + +function moveOnEnable(){ + const btn = document.querySelector(".moveOn"); + btn.disabled = false; + btn.onclick = () => location.href = "../sonaragastik"; +} + +function moveOnDisable(){ + const btn = document.querySelector(".moveOn"); + btn.disabled = true; +} diff --git a/rannak/mangud/partorg/plakat.bak/style.css b/rannak/mangud/partorg/plakat.bak/style.css new file mode 100644 index 0000000..215c073 --- /dev/null +++ b/rannak/mangud/partorg/plakat.bak/style.css @@ -0,0 +1,188 @@ +body { + height: 100%; + overflow: hidden; + color: white; + background-color: #43464b; +} + +h1 { + color: #a1000e; + font-weight: bold; +} + + +/* Move on ja Sissejuhatus Button */ + +.avatar { + border-radius: 20px; + width: 100%; + max-width: 15rem; +} + + +.modalHeaderWrapper{ + text-align: center; + margin: 0; + width: 100%; +} + +button:disabled{ + opacity: 0.5; + cursor: not-allowed; +} + +.moveOn{ + display: inline-block; + border: none; + padding: 6px 12px; + margin-botton: 0; + font-size: 1rem; + font-weight: normal; + text-align: center; + cursor: pointer; + border-radius: 4px; + background-color: #4BB543; + color: white; +} + +/* Modal Stuff */ + + +.closeModalButton { + border-radius: 50px; +} + +.modalButton{ + background-color: rgba(0,136,169,1); + border: none; + border-radius: 50px; + cursor: pointer; + transition: all 0.3 ease 0; + font-size: 1.2rem; + text-align: center; + margin-left: 30px; +} + +.modalButton:hover{ + background-color: rgba(0,136,169,0.8); +} + + + +/* Main */ + +.wrapper { + height: 100%; + display: flex; +} + +/* Toolbar */ +.intro{ + text-align: center; + border-bottom: 2px solid gray; + padding: 7px; +} + + +#toolbar { + display: flex; + flex-direction: column; + align-items: center; + padding: 5px; + width: 20%; + min-width:350px; + background-color: #43464b; +} + +#clear{ + background-color: #1565c0; + border: none; + border-radius: 4px; + font-size:1.3rem; + color:white; + padding: 2px; +} + +#toolbar * {margin-bottom: 6px;} +#toolbar input {width: 4rem;} + +.toolbarDiv {width: 100%;} + +form { + display: flex; + align-items: center; +} + +label { + display: table-cell; + font-size: 1.2rem; +} + + + +/* Img Picker */ +.pickingSec { + height: 50%; + overflow: hidden; + overflow-y: scroll; +} + + +.valiTxt { + border-bottom: 4px solid gray; + padding-top: 10px; +} + + +.picked{ + border: 2px solid lime; +} + + +.addOnPicked{ + border: 2px solid aqua; +} + + + +.pickImg { + width: 50%; + height: auto; + padding: 10px; + margin-left: calc(25% - 5px); +} + + + +/* Canvas */ +canvas{ + display: block; + margin: 0 auto; +} + + + + + +/* Responsivness */ + +@media screen and (max-width: 1400px) { + .pickImg { + width: 30%; + height: auto; + padding: 7px; + margin-left: calc(7% - 21px); + } + +} + + +@media screen and (max-width: 900px) { + .pickImg { + width: 24%; + height: auto; + padding: 3px; + margin-left: calc(1% - 10px); + } + +} -- cgit v1.2.3