Skip to content

Commit

Permalink
undo button for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
viliusle committed Jun 19, 2021
1 parent 43088b1 commit 8884e13
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions images/icons/undo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<div class="submenu">
<a class="logo" href="#">miniPaint</a>
<div class="block attributes" id="action_attributes"></div>
<button class="undo_button" id="undo_button" type="button">
<span class="sr_only">Undo</span>
</button>
</div>

<div class="sidebar_left" id="tools_container"></div>
Expand Down
21 changes: 21 additions & 0 deletions src/css/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,27 @@ body .sp-preview{
font-size:15px;
font-weight:bold;
}
.undo_button {
display: none;
width: 50px;
height: 50px;
top: 0;
border: 0;
outline: none;
cursor: pointer;
filter: var(--mobile-menu-toggle-filter);
background: url(images/icons/undo.svg) no-repeat center center;
background-size: auto 25px;
margin-left: 10px;
}
.undo_button:hover {
background-color: transparent;
}
@media screen and (max-width: 700px){
.undo_button {
display: block;
}
}

/* ========== sub-header ==================================================== */

Expand Down
17 changes: 17 additions & 0 deletions src/js/modules/edit/undo.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
import Base_state_class from './../../core/base-state.js';

var instance = null;

class Edit_undo_class {

constructor() {
//singleton
if (instance) {
return instance;
}
instance = this;

this.Base_state = new Base_state_class();
this.events();
}

events(){
var _this = this;

document.querySelector('#undo_button').addEventListener('click', function (event) {
_this.Base_state.undo();
});
}

undo() {
Expand Down

0 comments on commit 8884e13

Please sign in to comment.