add select tool

This commit is contained in:
Stewart Allen 2021-10-09 01:13:41 -04:00
commit ff298e8300
5 changed files with 73 additions and 28 deletions

View file

@ -1985,6 +1985,7 @@
platform.select(widget, shift);
platform.compute_max_z();
API.event.emit('widget.add', widget);
platformChanged();
auto_save();
if (nolayout) {
return;
@ -2057,9 +2058,32 @@
platformUpdateSelected();
if (feature.drop_layout) platform.layout();
API.event.emit('widget.delete', widget);
platformChanged();
auto_save();
}
function platformChanged() {
let fts = $('ft-select');
fts.innerHTML = '';
for (let w of WIDGETS) {
let b = DOC.createElement('button');
fts.appendChild(b);
b.innerText = w.meta.file || 'no name';
let color;
b.onmouseenter = function() {
color = w.getColor();
w.setColor(0x0088ff);
};
b.onmouseleave = function() {
w.setColor(color);
};
b.onclick = function() {
platformSelect(w, true);
color = w.getColor();
};
}
}
function platformSelectAll() {
forAllWidgets(function(w) { platform.select(w, true) })
}