diff options
author | Rasmus Luha <rasmus.luha@gmail.com> | 2023-02-05 20:43:17 +0200 |
---|---|---|
committer | Rasmus Luha <rasmus.luha@gmail.com> | 2023-02-05 20:43:17 +0200 |
commit | 209b1915b0f1879d0055ea17f76464dddcf8089b (patch) | |
tree | a7b4077a0c239dba3f0e40b6463e2fb368b65eb3 /rannak/mangud/partorg/plakat | |
parent | ea90f1c8a5fb5b666113ee21f81a5530127a0517 (diff) |
Hinnad mäng for Arimees + fonts
Diffstat (limited to 'rannak/mangud/partorg/plakat')
-rw-r--r-- | rannak/mangud/partorg/plakat/img/lenin.png | bin | 0 -> 37366 bytes | |||
-rw-r--r-- | rannak/mangud/partorg/plakat/img/nazi.png | bin | 0 -> 20381 bytes | |||
-rw-r--r-- | rannak/mangud/partorg/plakat/img/normalSelect.cur | bin | 0 -> 4286 bytes | |||
-rw-r--r-- | rannak/mangud/partorg/plakat/img/redStar.png | bin | 0 -> 39590 bytes | |||
-rw-r--r-- | rannak/mangud/partorg/plakat/img/stalinAddOn.png | bin | 0 -> 976997 bytes | |||
-rw-r--r-- | rannak/mangud/partorg/plakat/index.html | 64 | ||||
-rw-r--r-- | rannak/mangud/partorg/plakat/main.js | 83 | ||||
-rw-r--r-- | rannak/mangud/partorg/plakat/style.css | 93 |
8 files changed, 194 insertions, 46 deletions
diff --git a/rannak/mangud/partorg/plakat/img/lenin.png b/rannak/mangud/partorg/plakat/img/lenin.png Binary files differnew file mode 100644 index 0000000..e36df3d --- /dev/null +++ b/rannak/mangud/partorg/plakat/img/lenin.png diff --git a/rannak/mangud/partorg/plakat/img/nazi.png b/rannak/mangud/partorg/plakat/img/nazi.png Binary files differnew file mode 100644 index 0000000..87e616e --- /dev/null +++ b/rannak/mangud/partorg/plakat/img/nazi.png diff --git a/rannak/mangud/partorg/plakat/img/normalSelect.cur b/rannak/mangud/partorg/plakat/img/normalSelect.cur Binary files differnew file mode 100644 index 0000000..fdd943c --- /dev/null +++ b/rannak/mangud/partorg/plakat/img/normalSelect.cur diff --git a/rannak/mangud/partorg/plakat/img/redStar.png b/rannak/mangud/partorg/plakat/img/redStar.png Binary files differnew file mode 100644 index 0000000..b6eee79 --- /dev/null +++ b/rannak/mangud/partorg/plakat/img/redStar.png diff --git a/rannak/mangud/partorg/plakat/img/stalinAddOn.png b/rannak/mangud/partorg/plakat/img/stalinAddOn.png Binary files differnew file mode 100644 index 0000000..d3e05fd --- /dev/null +++ b/rannak/mangud/partorg/plakat/img/stalinAddOn.png diff --git a/rannak/mangud/partorg/plakat/index.html b/rannak/mangud/partorg/plakat/index.html index a15849e..9f1416b 100644 --- a/rannak/mangud/partorg/plakat/index.html +++ b/rannak/mangud/partorg/plakat/index.html @@ -3,12 +3,11 @@ <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <link rel="stylesheet" href="style.css"> <title>Plakat</title> - <!-- Bootstrap - CSS only --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous"> + <link rel="stylesheet" href="style.css"> </head> <body> <section class="wrapper"> @@ -17,7 +16,7 @@ <div class="intro"> <h1>Kujunda Plakatit</h1> - <p>Vali Välja Üks plakat ja muuda/lisa selle kujundust vastavalt enda äranägemise järgi</p> + <p>Vali välja üks plakat ja muuda/lisa selle kujundust vastavalt enda äranägemisele.</p> <button class="moveOn" disabled>Liigu Edasi</button> <!-- Button trigger modal --> @@ -25,22 +24,27 @@ Sissejuhatus </button> + <button id="clear">Puhasta</button> </div> - <form> - <p class="toolbarDiv"> - <label for="stroke">Värv</label> - <input id="stroke" name='stroke' type="color"> - </p> - - <p class="toolbarDiv"> - <label for="lineWidth">Joone Paksus</label> - <input id="lineWidth" name='lineWidth' type="number" value="5"> - </p> - - </form> + <div class="inputs"> + <form> + <p class="toolbarDiv"> + <label for="stroke">Värv</label> + <input id="stroke" name='stroke' type="color"> + </p> + + <p class="toolbarDiv"> + <label for="lineWidth">Joone Paksus</label> + <input id="lineWidth" name='lineWidth' type="number" value="5" maxlength="1"> + </p> + + <!-- + <button id="clear">Puhasta</button> + --> + </form> + </div> - <button id="clear">Puhasta</button> <!-- Image Pick--> @@ -50,8 +54,21 @@ <img id="veekogud" class="pickImg" alt="Veekogude Plakat" src="img/veekogud.jpg"/> </div> + + <!-- Add-Ons Pick--> + <h2 class="ValiTxt"> Vali Lisasid </h2> + <div class="pickingSec"> + <img id="redStar" class="pickImg" alt="red star" src="img/redStar.png"/> + <img id="lenin" class="pickImg" alt="lenin" src="img/lenin.png"/> + <img id="nazi" class="pickImg" alt="Nazi Flag" src="img/nazi.png"/> + <img id="stalinAddOn" class="pickImg" alt="Stalin" src="img/stalinAddOn.png"/> + </div> + </div> - + + + + <div class="canvasWrap"> <canvas id="drawing-board"></canvas> </div> @@ -76,7 +93,18 @@ <div class="modal-body"> - Fames ac turpis egestas maecenas pharetra convallis posuere morbi leo urna, molestie at elementum eu, facilisis sed odio morbi quis commodo odio aenean sed adipiscing! + Peale ajalehe väljalõigete olen aastate jooksul kogunud ja säilitanud meeleolukaid plakateid nõukogudeaja kuldsest elust. + <br/> + Jagan siinkohal teiega, seltsimehed noored, nelja nendest. Plakatid on pärit erinevatest aastakümnetest: <br/>1950ndad, 1960ndad, 1970ndad ja 1980ndad aastad. + <br/> + <br/> + Palun uurige nende plakatite sisu ja vormi. + <br/> + Õppige, õppige, õppige! Kas tajute, millisesse kümnendisse iga plakat kuulub? + <br/> <br/> + <strong> + Mõelge plakatitele välja uus, kaasaega sobiv lööklause. Samuti kaunistage ja täiendage plakatit kaasaegsete kunsiliste detailidega. Ka huumor on lubatud! + </strong> </div> diff --git a/rannak/mangud/partorg/plakat/main.js b/rannak/mangud/partorg/plakat/main.js index 48626c6..9ae8e54 100644 --- a/rannak/mangud/partorg/plakat/main.js +++ b/rannak/mangud/partorg/plakat/main.js @@ -4,6 +4,7 @@ document.addEventListener('DOMContentLoaded', () => { }); +console.log("FAAAAK"); /* Inital Setup*/ @@ -25,12 +26,16 @@ 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; @@ -44,20 +49,45 @@ window.onresize = () => { /* 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 pildid = new Array(); pildid.push(stalinImg); pildid.push(veekogudImg); + + //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") { for (el in pildid) { pildid[el].classList.remove("picked"); @@ -72,17 +102,60 @@ toolbar.addEventListener('click', e => { } - if (e.target.id === 'clear') { + 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; @@ -108,7 +181,9 @@ const draw = (e) => { //ctx.lineTo(e.clientX - abiOffset, e.clientY); ctx.stroke(); - moveOnEnable(); + hasPainted = true; + if (addOnHasBeenAdded) + moveOnEnable(); } @@ -132,8 +207,8 @@ canvas.addEventListener('mousemove', draw); -// Move On Stuff +// Move On Stuff function moveOnEnable(){ const btn = document.querySelector(".moveOn"); diff --git a/rannak/mangud/partorg/plakat/style.css b/rannak/mangud/partorg/plakat/style.css index bc5c2c4..215c073 100644 --- a/rannak/mangud/partorg/plakat/style.css +++ b/rannak/mangud/partorg/plakat/style.css @@ -1,7 +1,13 @@ body { - height: 100% !important; - overflow: hidden !important; - color: white !important; + height: 100%; + overflow: hidden; + color: white; + background-color: #43464b; +} + +h1 { + color: #a1000e; + font-weight: bold; } @@ -9,15 +15,15 @@ body { .avatar { border-radius: 20px; - width: 100% !important; - max-width: 15rem !important; + width: 100%; + max-width: 15rem; } .modalHeaderWrapper{ text-align: center; - margin: 0 !important; - width: 100% !important; + margin: 0; + width: 100%; } button:disabled{ @@ -47,18 +53,18 @@ button:disabled{ } .modalButton{ - background-color: rgba(0,136,169,1) !important; - border: none !important; - border-radius: 50px !important; - cursor: pointer !important; - transition: all 0.3 ease 0 !important; - font-size: 1.2rem !important; - text-align: center !important; - margin-left: 30px !important; + 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) !important; + background-color: rgba(0,136,169,0.8); } @@ -71,7 +77,6 @@ button:disabled{ } /* Toolbar */ - .intro{ text-align: center; border-bottom: 2px solid gray; @@ -86,7 +91,7 @@ button:disabled{ padding: 5px; width: 20%; min-width:350px; - background-color: #202020; + background-color: #43464b; } #clear{ @@ -99,14 +104,18 @@ button:disabled{ } #toolbar * {margin-bottom: 6px;} -#toolbar input {width: 50%;} +#toolbar input {width: 4rem;} + +.toolbarDiv {width: 100%;} + +form { + display: flex; + align-items: center; +} -form { display: table !important;} -input { display: table-cell !important;} -.toolbarDiv {width: 100% !important;} label { - display: table-cell !important; - font-size: 1.2rem !important; + display: table-cell; + font-size: 1.2rem; } @@ -118,15 +127,24 @@ label { 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; @@ -141,3 +159,30 @@ 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); + } + +} |