summaryrefslogtreecommitdiff
path: root/rannak/mangud
diff options
context:
space:
mode:
authorRasmus Luha <rasmus.luha@gmail.com>2022-12-26 22:09:08 +0200
committerRasmus Luha <rasmus.luha@gmail.com>2022-12-26 22:09:08 +0200
commit6a9499cea7df279407f61c55d1aa18bc23ff1869 (patch)
tree439a646f0ee00963ff256eff87afdac1d0f6794f /rannak/mangud
parent5346af62569c013049100539f7ed38ef4c34adc1 (diff)
Plakat game
Diffstat (limited to 'rannak/mangud')
-rw-r--r--rannak/mangud/index.html1
-rw-r--r--rannak/mangud/partorg/plakat/img/stalin.jpgbin0 -> 168805 bytes
-rw-r--r--rannak/mangud/partorg/plakat/img/veekogud.jpgbin0 -> 223291 bytes
-rw-r--r--rannak/mangud/partorg/plakat/index.html95
-rw-r--r--rannak/mangud/partorg/plakat/main.js141
-rw-r--r--rannak/mangud/partorg/plakat/style.css132
-rw-r--r--rannak/mangud/uliopilane/utlused/css/utlused.css5
-rw-r--r--rannak/mangud/uliopilane/utlused/js/main.js2
8 files changed, 373 insertions, 3 deletions
diff --git a/rannak/mangud/index.html b/rannak/mangud/index.html
index c7d08a9..d0394bd 100644
--- a/rannak/mangud/index.html
+++ b/rannak/mangud/index.html
@@ -45,6 +45,7 @@
<ol>
<li><a href="partorg/kuulsused">Kuulsused</a></li>
<li><a href="partorg/sonaragastik">Sõnarägastik</a></li>
+ <li><a href="partorg/plakat">Plakat</a></li>
<li></li>
</ol>
</div>
diff --git a/rannak/mangud/partorg/plakat/img/stalin.jpg b/rannak/mangud/partorg/plakat/img/stalin.jpg
new file mode 100644
index 0000000..bc0a3a5
--- /dev/null
+++ b/rannak/mangud/partorg/plakat/img/stalin.jpg
Binary files differ
diff --git a/rannak/mangud/partorg/plakat/img/veekogud.jpg b/rannak/mangud/partorg/plakat/img/veekogud.jpg
new file mode 100644
index 0000000..23f04ab
--- /dev/null
+++ b/rannak/mangud/partorg/plakat/img/veekogud.jpg
Binary files differ
diff --git a/rannak/mangud/partorg/plakat/index.html b/rannak/mangud/partorg/plakat/index.html
new file mode 100644
index 0000000..9d1e89d
--- /dev/null
+++ b/rannak/mangud/partorg/plakat/index.html
@@ -0,0 +1,95 @@
+<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">
+ <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">
+
+</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ägemise järgi</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>
+
+ </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>
+
+ <button id="clear">Puhasta</button>
+
+
+ <!-- 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"/>
+ </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">
+ <h5 class="modal-title" id="myModalLabel">Sissejuhatus</h5>
+ <button type="button" class="closeModalButton" data-bs-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">&times;</span>
+ </button>
+ </div>
+
+ <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!
+
+ </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/main.js b/rannak/mangud/partorg/plakat/main.js
new file mode 100644
index 0000000..6eb9281
--- /dev/null
+++ b/rannak/mangud/partorg/plakat/main.js
@@ -0,0 +1,141 @@
+
+/* 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 isPainting = false;
+let lineWidth = 5;
+let startX;
+let startY;
+
+toolbar.addEventListener('click', e => {
+
+ const stalinImg = document.getElementById("stalin");
+ const veekogudImg = document.getElementById("veekogud");
+
+ const pildid = new Array();
+ pildid.push(stalinImg);
+ pildid.push(veekogudImg);
+
+ if (e.target.id === "stalin" || e.target.id === "veekogud") {
+ 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();
+ }
+
+
+ if (e.target.id === 'clear') {
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ copyImageToCanvas(CurImage, canvasOffsetX, canvasOffsetY);
+ moveOnDisable();
+ }
+
+});
+
+
+
+/* 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();
+
+ 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 = "";
+}
+
+function moveOnDisable(){
+ const btn = document.querySelector(".moveOn");
+ btn.disabled = true;
+}
diff --git a/rannak/mangud/partorg/plakat/style.css b/rannak/mangud/partorg/plakat/style.css
new file mode 100644
index 0000000..8d452ad
--- /dev/null
+++ b/rannak/mangud/partorg/plakat/style.css
@@ -0,0 +1,132 @@
+body {
+ margin: 0 !important;
+ padding: 0 !important;
+ height: 100% !important;
+ overflow: hidden !important;
+ color: white !important;
+}
+
+
+/* Move on ja Sissejuhatus Button */
+
+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) !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;
+}
+
+.modalButton:hover{
+ background-color: rgba(0,136,169,0.8) !important;
+}
+
+
+
+/* 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: #202020;
+}
+
+#clear{
+ background-color: #1565c0;
+ border: none;
+ border-radius: 4px;
+ font-size:1.3rem;
+ color:white;
+ padding: 2px;
+}
+
+#toolbar * {margin-bottom: 6px;}
+#toolbar input {width: 50%;}
+
+form { display: table !important;}
+input { display: table-cell !important;}
+.toolbarDiv {width: 100% !important;}
+label {
+ display: table-cell !important;
+ font-size: 1.2rem !important;
+}
+
+
+
+/* Img Picker */
+.pickingSec {
+ height: 50%;
+ overflow: hidden;
+ overflow-y: scroll;
+}
+
+.valiTxt {
+ border-bottom: 4px solid gray;
+ padding-top: 10px;
+}
+
+.picked{
+ border: 2px solid lime;
+}
+
+.pickImg {
+ width: 50%;
+ height: auto;
+ padding: 10px;
+ margin-left: calc(25% - 5px);
+}
+
+
+
+/* Canvas */
+canvas{
+ display: block;
+ margin: 0 auto;
+}
diff --git a/rannak/mangud/uliopilane/utlused/css/utlused.css b/rannak/mangud/uliopilane/utlused/css/utlused.css
index b479b87..8a226b9 100644
--- a/rannak/mangud/uliopilane/utlused/css/utlused.css
+++ b/rannak/mangud/uliopilane/utlused/css/utlused.css
@@ -18,7 +18,7 @@ body {
display: inline-block;
border: none;
padding: 6px 12px;
- margin-botton: 0;
+ margin-left: 11%;
font-size: 1rem;
font-weight: normal;
text-align: center;
@@ -30,6 +30,7 @@ body {
button:disabled{
opacity: 0.5;
+ cursor: not-allowed;
}
@@ -64,7 +65,7 @@ button:disabled{
/* later added stuff here */
.wrapper {
- outline: 1px solid gold;
+ border-bottom: 3px solid gray;
position: relative;
display: flex;
flex-wrap: wrap;
diff --git a/rannak/mangud/uliopilane/utlused/js/main.js b/rannak/mangud/uliopilane/utlused/js/main.js
index 4a14230..1e19210 100644
--- a/rannak/mangud/uliopilane/utlused/js/main.js
+++ b/rannak/mangud/uliopilane/utlused/js/main.js
@@ -78,7 +78,7 @@ if (`${isMobile() ? 'mobile' : 'not mobile'}` == 'not mobile') {
if (counter == 6){
const btn = document.querySelector(".moveOn");
btn.disabled = false;
- btn.onclick = () => location.href = "../../rolliValik";
+ btn.onclick = () => location.href = "";
}
} // If isCorrectMatchingEnd
} // Drop Func End