add X button to delete selection
This commit is contained in:
parent
4d174169fe
commit
0fba74763b
4 changed files with 21 additions and 2 deletions
|
|
@ -1268,6 +1268,7 @@
|
||||||
|
|
||||||
container: container,
|
container: container,
|
||||||
back: $('lt-back'),
|
back: $('lt-back'),
|
||||||
|
trash: $('lt-trash'),
|
||||||
rotate: $('lt-rotate'),
|
rotate: $('lt-rotate'),
|
||||||
scale: $('lt-scale'),
|
scale: $('lt-scale'),
|
||||||
nozzle: $('lt-nozzle'),
|
nozzle: $('lt-nozzle'),
|
||||||
|
|
@ -2160,6 +2161,7 @@
|
||||||
$('file-recent').onclick = () => { API.modal.show('files') };
|
$('file-recent').onclick = () => { API.modal.show('files') };
|
||||||
$('file-import').onclick = () => { API.event.import() };
|
$('file-import').onclick = () => { API.event.import() };
|
||||||
UI.back.onclick = API.platform.layout;
|
UI.back.onclick = API.platform.layout;
|
||||||
|
UI.trash.onclick = API.selection.delete;
|
||||||
UI.func.slice.onclick = (ev) => { ev.stopPropagation(); API.function.slice() };
|
UI.func.slice.onclick = (ev) => { ev.stopPropagation(); API.function.slice() };
|
||||||
UI.func.preview.onclick = (ev) => { ev.stopPropagation(); API.function.print() };
|
UI.func.preview.onclick = (ev) => { ev.stopPropagation(); API.function.print() };
|
||||||
UI.func.export.onclick = (ev) => { ev.stopPropagation(); API.function.export() };
|
UI.func.export.onclick = (ev) => { ev.stopPropagation(); API.function.export() };
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,8 @@
|
||||||
widgets: function() { return selectedMeshes.slice().map(m => m.widget) },
|
widgets: function() { return selectedMeshes.slice().map(m => m.widget) },
|
||||||
for_groups: forSelectedGroups,
|
for_groups: forSelectedGroups,
|
||||||
for_meshes: forSelectedMeshes,
|
for_meshes: forSelectedMeshes,
|
||||||
for_widgets: forSelectedWidgets
|
for_widgets: forSelectedWidgets,
|
||||||
|
delete: function() { platform.delete(selection.widgets()) }
|
||||||
};
|
};
|
||||||
|
|
||||||
const platform = {
|
const platform = {
|
||||||
|
|
@ -1160,6 +1161,7 @@
|
||||||
UI.scale.classList.add('lt-enabled');
|
UI.scale.classList.add('lt-enabled');
|
||||||
UI.rotate.classList.add('lt-enabled');
|
UI.rotate.classList.add('lt-enabled');
|
||||||
UI.nozzle.classList.add('lt-enabled');
|
UI.nozzle.classList.add('lt-enabled');
|
||||||
|
UI.trash.style.display = 'flex';
|
||||||
if (feature.meta && selcount === 1) {
|
if (feature.meta && selcount === 1) {
|
||||||
let sel = selection.widgets()[0];
|
let sel = selection.widgets()[0];
|
||||||
let name = sel.meta.file || sel.meta.url;
|
let name = sel.meta.file || sel.meta.url;
|
||||||
|
|
@ -1180,6 +1182,7 @@
|
||||||
UI.scale.classList.remove('lt-enabled');
|
UI.scale.classList.remove('lt-enabled');
|
||||||
UI.rotate.classList.remove('lt-enabled');
|
UI.rotate.classList.remove('lt-enabled');
|
||||||
UI.nozzle.classList.remove('lt-enabled');
|
UI.nozzle.classList.remove('lt-enabled');
|
||||||
|
UI.trash.style.display = '';
|
||||||
}
|
}
|
||||||
UI.nozzle.style.display = extruders && extruders.length > 1 ? 'flex' : '';
|
UI.nozzle.style.display = extruders && extruders.length > 1 ? 'flex' : '';
|
||||||
if (extruders) {
|
if (extruders) {
|
||||||
|
|
@ -1705,6 +1708,9 @@
|
||||||
newWidgets.push(widget.id);
|
newWidgets.push(widget.id);
|
||||||
oldWidgets.remove(widget.id);
|
oldWidgets.remove(widget.id);
|
||||||
widget.saveState();
|
widget.saveState();
|
||||||
|
let ann = API.widgets.annotate(widget.id);
|
||||||
|
ann.file = widget.meta.file;
|
||||||
|
ann.url = widget.meta.url;
|
||||||
});
|
});
|
||||||
SDB.setItem('ws-widgets', o2js(newWidgets));
|
SDB.setItem('ws-widgets', o2js(newWidgets));
|
||||||
oldWidgets.forEach(function(wid) {
|
oldWidgets.forEach(function(wid) {
|
||||||
|
|
@ -1776,9 +1782,17 @@
|
||||||
platform.delete(widget);
|
platform.delete(widget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// remove widget keys if they are not going to be restored
|
||||||
|
Object.keys(settings.widget).filter(k => toload.indexOf(k) < 0).forEach(k => {
|
||||||
|
delete settings.widget[k];
|
||||||
|
});
|
||||||
|
|
||||||
// load any widget by name that was saved to the workspace
|
// load any widget by name that was saved to the workspace
|
||||||
toload.forEach(function(widgetid) {
|
toload.forEach(function(widgetid) {
|
||||||
Widget.loadFromState(widgetid, function(widget) {
|
Widget.loadFromState(widgetid, function(widget) {
|
||||||
|
let ann = API.widgets.annotate(widget.id);
|
||||||
|
widget.meta.file = ann.file;
|
||||||
|
widget.meta.url = ann.url;
|
||||||
if (widget) {
|
if (widget) {
|
||||||
platform.add(widget, 0, position);
|
platform.add(widget, 0, position);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -356,7 +356,7 @@ th, tr, td, label {
|
||||||
left: -5px;
|
left: -5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#lt-back {
|
#lt-back, #lt-trash {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: none;
|
display: none;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,9 @@
|
||||||
<div id="lt-back" class="lt-menu lt-enabled">
|
<div id="lt-back" class="lt-menu lt-enabled">
|
||||||
<i class="fas fa-arrow-circle-left"></i>
|
<i class="fas fa-arrow-circle-left"></i>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="lt-trash" class="lt-menu lt-enabled">
|
||||||
|
<i class="fas fa-times-circle"></i>
|
||||||
|
</div>
|
||||||
<div id="lt-top"></div>
|
<div id="lt-top"></div>
|
||||||
<div id="lt-setup" class="lt-menu lt-enabled">
|
<div id="lt-setup" class="lt-menu lt-enabled">
|
||||||
<i class="fas fa-cogs"></i>
|
<i class="fas fa-cogs"></i>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue