feat: button to go back to edit another image
This commit is contained in:
parent
bd7ae62180
commit
a4af4cc514
27
index.html
27
index.html
|
@ -11,14 +11,14 @@
|
|||
<link rel="stylesheet" href="style.css">
|
||||
<title>Imagine - Image Editor</title>
|
||||
</head>
|
||||
<body style="padding-top: 100dvh; ">
|
||||
<body style="padding-top: 100dvh; " class="">
|
||||
<div class="navbar columns is-mobile is-fixed-top">
|
||||
<div class="column">
|
||||
<div class="hero is-fullheight" style="min-height: 100dvh;">
|
||||
<div class="hero-body">
|
||||
<div class="container">
|
||||
<canvas id="myCanvas" class="is-hidden" width="300" height="300"></canvas>
|
||||
<div id="imports" class="columns is-mobile">
|
||||
<canvas id="myCanvas" class="is-visible-editor" width="300" height="300"></canvas>
|
||||
<div class="columns is-mobile is-hidden-editor">
|
||||
<div class="column">
|
||||
<button id="take-picture"
|
||||
class="button is-large is-responsive is-fullwidth py-6"
|
||||
|
@ -42,18 +42,24 @@
|
|||
</div>
|
||||
</div>
|
||||
</div><br>
|
||||
<a href="#settings" class="button is-hidden-desktop" style="position: absolute; right: 30px;
|
||||
<a href="#settings" class="button is-hidden-desktop is-visible-editor" style="position: absolute; right: 30px;
|
||||
bottom: 30px">
|
||||
<i class="fa-solid fa-sliders mr-2"></i> Settings
|
||||
</a>
|
||||
<button id="back" class="button is-visible-editor" style="position: absolute; left: 30px;
|
||||
top: 30px">
|
||||
<i class="fa-solid fa-arrow-left mr-2"></i> Back
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-narrow has-background-black-ter is-hidden-mobile is-hidden-tablet-only">
|
||||
<div class="column is-narrow has-background-black-ter is-hidden-mobile is-hidden-tablet-only is-visible-editor">
|
||||
<aside class="menu" style="width: 300px">
|
||||
<h1 class="title">Imagine</h1>
|
||||
<h2 class="subtitle">Image Editor</h2>
|
||||
|
||||
<!-- autocomplete off prevents browsers from remebering the value on page reloads -->
|
||||
<form autocomplete="off">
|
||||
<button id="save" class="button is-primary">
|
||||
Save Image
|
||||
</button>
|
||||
|
@ -121,10 +127,18 @@
|
|||
min="0" max="1" value="0" step="0.05">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
<div class="notification is-fullwidth is-hidden-desktop" style="z-index: 200">
|
||||
<div class="notification is-fullwidth is-hidden-desktop is-visible-editor" style="z-index: 200">
|
||||
<!-- #settings is an anhor to scroll to when clicked on the settings-button -->
|
||||
<span id="settings"></span>
|
||||
<!-- #top is an anchor provided by the browser to go to the top of the page -->
|
||||
<a href="#top" class="delete"></a>
|
||||
|
||||
<!-- autocomplete off prevents browsers from remebering the value on page reloads -->
|
||||
<form autocomplete="off">
|
||||
<button id="save" class="button is-primary">
|
||||
Save Image
|
||||
</button>
|
||||
|
@ -192,6 +206,7 @@
|
|||
min="0" max="1" value="0" step="0.05">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
10
main.js
10
main.js
|
@ -1,6 +1,5 @@
|
|||
let canvas;
|
||||
let ctx;
|
||||
let imports;
|
||||
let settings = {
|
||||
brightness: {},
|
||||
saturate: {},
|
||||
|
@ -13,7 +12,7 @@ const img = new Image();
|
|||
document.addEventListener("DOMContentLoaded", function() {
|
||||
canvas = document.getElementById("myCanvas");
|
||||
ctx = canvas.getContext("2d");
|
||||
imports = document.getElementById("imports");
|
||||
document.getElementById("back").addEventListener("click", () => document.body.classList.remove("editor-enabled"));
|
||||
|
||||
// bind listeners
|
||||
document.getElementById("take-picture").addEventListener("click", take_picture);
|
||||
|
@ -38,14 +37,13 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
})
|
||||
|
||||
function take_picture() {
|
||||
canvas.classList.remove("is-hidden");
|
||||
imports.classList.add("is-hidden");
|
||||
document.body.classList.add("editor-enabled");
|
||||
|
||||
}
|
||||
|
||||
function upload_image() {
|
||||
canvas.classList.remove("is-hidden");
|
||||
imports.classList.add("is-hidden");
|
||||
document.body.classList.add("editor-enabled");
|
||||
|
||||
console.log(this.files[0]);
|
||||
|
||||
img.src = URL.createObjectURL(this.files[0]);
|
||||
|
|
Loading…
Reference in a new issue