feat: Remove operation button by simple click

This commit is contained in:
Fabrice Marlboro 2022-09-06 03:48:06 +00:00
parent 037590f831
commit d4a8ffa679
3 changed files with 15 additions and 0 deletions

View File

@ -85,6 +85,7 @@ class HTMLOperation {
<div class="recip-icons"> <div class="recip-icons">
<i class="material-icons breakpoint" title="Set breakpoint" break="false">pause</i> <i class="material-icons breakpoint" title="Set breakpoint" break="false">pause</i>
<i class="material-icons disable-icon" title="Disable operation" disabled="false">not_interested</i> <i class="material-icons disable-icon" title="Disable operation" disabled="false">not_interested</i>
<i class="material-icons remove" title="Remove operation" disabled="false">close</i>
</div> </div>
<div class="clearfix">&nbsp;</div>`; <div class="clearfix">&nbsp;</div>`;

View File

@ -137,6 +137,7 @@ class Manager {
this.addDynamicListener(".arg[type=checkbox], .arg[type=radio], select.arg", "change", this.recipe.ingChange, this.recipe); this.addDynamicListener(".arg[type=checkbox], .arg[type=radio], select.arg", "change", this.recipe.ingChange, this.recipe);
this.addDynamicListener(".disable-icon", "click", this.recipe.disableClick, this.recipe); this.addDynamicListener(".disable-icon", "click", this.recipe.disableClick, this.recipe);
this.addDynamicListener(".breakpoint", "click", this.recipe.breakpointClick, this.recipe); this.addDynamicListener(".breakpoint", "click", this.recipe.breakpointClick, this.recipe);
this.addDynamicListener(".remove", "click", this.recipe.removeClick, this.recipe);
this.addDynamicListener("#rec-list li.operation", "dblclick", this.recipe.operationDblclick, this.recipe); this.addDynamicListener("#rec-list li.operation", "dblclick", this.recipe.operationDblclick, this.recipe);
this.addDynamicListener("#rec-list li.operation > div", "dblclick", this.recipe.operationChildDblclick, this.recipe); this.addDynamicListener("#rec-list li.operation > div", "dblclick", this.recipe.operationChildDblclick, this.recipe);
this.addDynamicListener("#rec-list .dropdown-menu.toggle-dropdown a", "click", this.recipe.dropdownToggleClick, this.recipe); this.addDynamicListener("#rec-list .dropdown-menu.toggle-dropdown a", "click", this.recipe.dropdownToggleClick, this.recipe);

View File

@ -262,6 +262,19 @@ class RecipeWaiter {
} }
/**
* Handler for remove click events.
* Updates the icon status.
*
* @fires Manager#statechange
* @param {event} e
*/
removeClick(e) {
e.target.parentNode.parentNode.remove(e)
this.opRemove(e);
}
/** /**
* Handler for operation doubleclick events. * Handler for operation doubleclick events.
* Removes the operation from the recipe and auto bakes. * Removes the operation from the recipe and auto bakes.