add select tool
This commit is contained in:
parent
5b1e2d5eeb
commit
ff298e8300
5 changed files with 73 additions and 28 deletions
|
|
@ -430,7 +430,7 @@
|
|||
showDevices();
|
||||
break;
|
||||
case cca('w'): // scale
|
||||
UI.tool.scale();
|
||||
UI.tool.next();
|
||||
break;
|
||||
case cca('o'): // tools
|
||||
showTools();
|
||||
|
|
@ -2722,12 +2722,18 @@
|
|||
// bind tool show buttons
|
||||
UI.tool.show = function(tictac) {
|
||||
if (typeof(tictac) === 'string') {
|
||||
nextool = listool.indexOf(tictac)+1;
|
||||
tictac = $(tictac);
|
||||
}
|
||||
let mover = parentWithClass(tictac.control, 'movable');
|
||||
mover.style.display = 'flex';
|
||||
tictac.control.onclick();
|
||||
}
|
||||
let nextool = 0;
|
||||
let listool = ['ft-scale','ft-mesh','ft-select','ft-rotate'];
|
||||
UI.tool.next = function() {
|
||||
UI.tool.show(listool[nextool++ % 4]);
|
||||
};
|
||||
$('tool-rotate').onclick = () => { UI.tool.show('ft-rotate') };
|
||||
$('tool-scale').onclick = () => { UI.tool.show('ft-scale') };
|
||||
$('tool-mesh').onclick = () => { UI.tool.show('ft-mesh') };
|
||||
|
|
|
|||
|
|
@ -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) })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -477,10 +477,15 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
|||
if (Array.isArray(color)) {
|
||||
color = color[this.getExtruder(settings) % color.length];
|
||||
}
|
||||
this.color = color;
|
||||
let material = this.mesh.material;
|
||||
material.color.set(color);
|
||||
};
|
||||
|
||||
PRO.getColor = function() {
|
||||
return this.color;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue