summaryrefslogtreecommitdiff
path: root/rannak/mangud/partorg/plakat.bak
diff options
context:
space:
mode:
Diffstat (limited to 'rannak/mangud/partorg/plakat.bak')
-rw-r--r--rannak/mangud/partorg/plakat.bak/img/avatar.pngbin0 -> 657556 bytes
-rw-r--r--rannak/mangud/partorg/plakat.bak/img/lenin.pngbin0 -> 37366 bytes
-rw-r--r--rannak/mangud/partorg/plakat.bak/img/nazi.pngbin0 -> 20381 bytes
-rw-r--r--rannak/mangud/partorg/plakat.bak/img/normalSelect.curbin0 -> 4286 bytes
-rw-r--r--rannak/mangud/partorg/plakat.bak/img/redStar.pngbin0 -> 39590 bytes
-rw-r--r--rannak/mangud/partorg/plakat.bak/img/stalin.jpgbin0 -> 168805 bytes
-rw-r--r--rannak/mangud/partorg/plakat.bak/img/stalinAddOn.pngbin0 -> 976997 bytes
-rw-r--r--rannak/mangud/partorg/plakat.bak/img/testImg.jpgbin0 -> 498451 bytes
-rw-r--r--rannak/mangud/partorg/plakat.bak/img/veekogud.jpgbin0 -> 223291 bytes
-rw-r--r--rannak/mangud/partorg/plakat.bak/index.html125
-rw-r--r--rannak/mangud/partorg/plakat.bak/main.js224
-rw-r--r--rannak/mangud/partorg/plakat.bak/style.css188
12 files changed, 537 insertions, 0 deletions
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
--- /dev/null
+++ b/rannak/mangud/partorg/plakat.bak/img/avatar.png
Binary files 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
--- /dev/null
+++ b/rannak/mangud/partorg/plakat.bak/img/lenin.png
Binary files 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
--- /dev/null
+++ b/rannak/mangud/partorg/plakat.bak/img/nazi.png
Binary files 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
--- /dev/null
+++ b/rannak/mangud/partorg/plakat.bak/img/normalSelect.cur
Binary files 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
--- /dev/null
+++ b/rannak/mangud/partorg/plakat.bak/img/redStar.png
Binary files 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
--- /dev/null
+++ b/rannak/mangud/partorg/plakat.bak/img/stalin.jpg
Binary files 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
--- /dev/null
+++ b/rannak/mangud/partorg/plakat.bak/img/stalinAddOn.png
Binary files 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
--- /dev/null
+++ b/rannak/mangud/partorg/plakat.bak/img/testImg.jpg
Binary files 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
--- /dev/null
+++ b/rannak/mangud/partorg/plakat.bak/img/veekogud.jpg
Binary files 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 @@
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <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">
+
+ <div id="toolbar">
+
+ <div class="intro">
+ <h1>Kujunda Plakatit</h1>
+ <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 -->
+ <button type="button" class="btn btn-primary modalButton" data-bs-toggle="modal" data-bs-target="#myModal">
+ Sissejuhatus
+ </button>
+
+ <button id="clear">Puhasta</button>
+ </div>
+
+ <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>
+
+
+
+ <!-- Image Pick-->
+ <h2 class="ValiTxt"> Vali Plakat </h2>
+ <div class="pickingSec">
+ <img id="stalin" class="pickImg picked" alt="Jossup Saloninjo Plakat" src="img/stalin.jpg"/>
+ <img id="veekogud" class="pickImg" alt="Veekogude Plakat" src="img/veekogud.jpg"/>
+ <img id="testing" class="pickImg" alt="Veekogude Plakat" src="img/testImg.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>
+
+
+ </section>
+
+
+
+
+ <!-- Modal -->
+ <div class="modal fade text-black" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+
+ <div class="modal-header">
+ <div class="modalHeaderWrapper">
+ <h3 class="modal-title" id="myModalLabel">Sissejuhatus</h5>
+ </div>
+ <img class="avatar" alt="avatar" src="img/avatar.png"/>
+ </div>
+
+ <div class="modal-body">
+
+ 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>
+
+ </div>
+ </div>
+ </div>
+
+
+
+
+ <script src="./main.js"></script>
+
+ <!-- JavaScript Bundle with Popper -->
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
+</body>
+</html>
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);
+ }
+
+}