Skip to content

Commit

Permalink
activate switch for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Lubin Pappalardo committed Sep 29, 2023
1 parent fed4948 commit 2672b20
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
12 changes: 5 additions & 7 deletions assets/board.css
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,13 @@
opacity: 0;
}

.selection-tools button:nth-child(1) {
transition: background-color .5s, transform .5s, opacity .5s;
}
.selection-tools button:nth-child(1) { transition: background-color .5s, transform .5s, opacity .5s; }

.selection-tools button:nth-child(2) {
transition: background-color .5s, transform .5s .1s, opacity .5s .1s;
}
.selection-tools button:nth-child(2) { transition: background-color .5s, transform .5s .1s, opacity .5s .1s; }

.selection-tools button:nth-child(3) { transition: background-color .5s, transform .5s .2s, opacity .5s .2s; }

body:has(.component.selected) .selection-tools button {
body:has(.component.selected) .selection-tools button:not(.ignored) {
transform: translateY(0);
opacity: 1;
}
Expand Down
10 changes: 10 additions & 0 deletions assets/scripts/components-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,19 @@ $(document).on('mousedown', '.component', function (e) {
$('.selected').removeClass('selected');
$(this).addClass('selected');
SelectedComponent = $(this);
if (SelectedComponent.hasClass('switch')) {
$('#activateSwitchComponent').removeClass('ignored');
} else {
$('#activateSwitchComponent').addClass('ignored');
}
}
}
});

$('#activateSwitchComponent').click(function (e) {
activateSwitch(SelectedComponent);
})


/* unselect on click on void */
$('#board').on('click', function (e) {
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ <h1>Are you sure ?</h1>
<div class='toolbar selection-tools'>
<button onclick='deleteComponent()' id="deleteComponent"><span class="material-symbols-outlined">delete</span><span class='alt'>delete</span></button>
<button onclick='rotateComponent()' id="rotateComponent"><span class="material-symbols-outlined">rotate_90_degrees_cw</span><span class='alt'>rotate</span></button>
<button id="activateSwitchComponent"><span class="material-symbols-outlined">touch_app</span><span class='alt'>Activate</span></button>
</div>

<div class='toolbar workspace-tools'>
Expand Down

0 comments on commit 2672b20

Please sign in to comment.