Sfoglia il codice sorgente

Add a button to delete the current entity; make the clear button more obvious

tags/v0.1.0
Fen Dweller 6 anni fa
parent
commit
dd668ef0be
3 ha cambiato i file con 24 aggiunte e 1 eliminazioni
  1. +5
    -0
      macrovision.css
  2. +6
    -0
      macrovision.html
  3. +13
    -1
      macrovision.js

+ 5
- 0
macrovision.css Vedi File

@@ -295,6 +295,11 @@ body.toggle-scale #display {
font-size: 150%; font-size: 150%;
} }


.options-row .symbol-button {
height: 75px;
width: 75px;
font-size: 70px;
}
.options-row .options-button { .options-row .options-button {
flex: 1; flex: 1;
width: 100%; width: 100%;


+ 6
- 0
macrovision.html Vedi File

@@ -152,6 +152,12 @@
<option id="options-selected-entity-none">None</option> <option id="options-selected-entity-none">None</option>
</select> </select>
</div> </div>
<div class="options-row">
<button id="delete-entity">
<i class="fas fa-trash-alt symbol-button"></i>
<span class="sr-only">Delete Entity</span>
</button>
</div>
<h3 class="options-header" id="entity-category-header">Entity options</h3> <h3 class="options-header" id="entity-category-header">Entity options</h3>
<div class="options-category" id="entity-category"> <div class="options-category" id="entity-category">
<div class="options-label"> <div class="options-label">


+ 13
- 1
macrovision.js Vedi File

@@ -416,6 +416,8 @@ function deselect() {
clearViewList(); clearViewList();
clearEntityOptions(); clearEntityOptions();
clearViewOptions(); clearViewOptions();
document.querySelector("#delete-entity").disabled = true;
} }


function select(target) { function select(target) {
@@ -432,6 +434,8 @@ function select(target) {
configViewList(selectedEntity, selectedEntity.view); configViewList(selectedEntity, selectedEntity.view);
configEntityOptions(selectedEntity, selectedEntity.view); configEntityOptions(selectedEntity, selectedEntity.view);
configViewOptions(selectedEntity, selectedEntity.view); configViewOptions(selectedEntity, selectedEntity.view);
document.querySelector("#delete-entity").disabled = false;
} }


function configViewList(entity, selectedView) { function configViewList(entity, selectedView) {
@@ -1083,7 +1087,7 @@ function prepareMenu() {
{ {
name: "Clear", name: "Clear",
id: "menu-clear", id: "menu-clear",
icon: "fas fa-trash-alt"
icon: "fas fa-file"
} }
], ],
[ [
@@ -1473,6 +1477,14 @@ document.addEventListener("DOMContentLoaded", () => {
document.querySelector("#menu-clear").addEventListener("click", e => { document.querySelector("#menu-clear").addEventListener("click", e => {
removeAllEntities(); removeAllEntities();
}); });
document.querySelector("#delete-entity").disabled = true;
document.querySelector("#delete-entity").addEventListener("click", e => {
if (selected) {
removeEntity(selected);
selected = null;
}
});


document.querySelector("#menu-order-height").addEventListener("click", e => { document.querySelector("#menu-order-height").addEventListener("click", e => {
const order = Object.keys(entities).sort((a, b) => { const order = Object.keys(entities).sort((a, b) => {


Loading…
Annulla
Salva