add unlocked / single axis scale / sizing. add label action for locking and scale

This commit is contained in:
Stewart Allen 2021-01-27 11:23:39 -05:00
commit e8ce2f66d1
4 changed files with 51 additions and 10 deletions

View file

@ -99,8 +99,9 @@
* `P` common part pre-analyze to speed up 'slice' and improve shadow (overhangs)
* `P` redo all path route / planning in prepare to account for terrain before camOut
* `P` detect render message backlog and pause or warn
* `P` detect render message backlog and pause or warn?
* `P` allow faster z movements when contouring (not plunging)
* `P` common / faster shadow generator using vertices shared with ledges
# Laser

View file

@ -1999,9 +1999,17 @@
xv = parseFloat(UI.sizeX.was),
yv = parseFloat(UI.sizeY.was),
zv = parseFloat(UI.sizeZ.was),
xr = (UI.lockX.checked ? ra : 1),
yr = (UI.lockY.checked ? ra : 1),
zr = (UI.lockZ.checked ? ra : 1);
ta = e.target,
xc = UI.lockX.checked,
yc = UI.lockY.checked,
zc = UI.lockZ.checked,
xt = ta === UI.sizeX,
yt = ta === UI.sizeY,
zt = ta === UI.sizeZ,
tl = (xt && xc) || (yt && yc) || (zt && zc),
xr = ((tl && xc) || (!tl && xt) ? ra : 1),
yr = ((tl && yc) || (!tl && yt) ? ra : 1),
zr = ((tl && zc) || (!tl && zt) ? ra : 1);
API.selection.scale(xr,yr,zr);
UI.sizeX.was = UI.sizeX.value = xv * xr;
UI.sizeY.was = UI.sizeY.value = yv * yr;
@ -2015,9 +2023,17 @@
xv = parseFloat(UI.scaleX.was),
yv = parseFloat(UI.scaleY.was),
zv = parseFloat(UI.scaleZ.was),
xr = (UI.lockX.checked ? ra : 1),
yr = (UI.lockY.checked ? ra : 1),
zr = (UI.lockZ.checked ? ra : 1);
ta = e.target,
xc = UI.lockX.checked,
yc = UI.lockY.checked,
zc = UI.lockZ.checked,
xt = ta === UI.scaleX,
yt = ta === UI.scaleY,
zt = ta === UI.scaleZ,
tl = (xt && xc) || (yt && yc) || (zt && zc),
xr = ((tl && xc) || (!tl && xt) ? ra : 1),
yr = ((tl && yc) || (!tl && yt) ? ra : 1),
zr = ((tl && zc) || (!tl && zt) ? ra : 1);
API.selection.scale(xr,yr,zr);
UI.scaleX.was = UI.scaleX.value = xv * xr;
UI.scaleY.was = UI.scaleY.value = yv * yr;
@ -2053,6 +2069,22 @@
$('rot_z'), selectionRotate
]);
$('lab-axis').onclick = () => {
UI.lockX.checked =
UI.lockY.checked =
UI.lockZ.checked = !(
UI.lockX.checked ||
UI.lockY.checked ||
UI.lockZ.checked
);
};
$('lab-scale').onclick = () => {
API.selection.scale(1 / UI.scaleX.was, 1 / UI.scaleY.was, 1 / UI.scaleZ.was);
UI.scaleX.value = UI.scaleY.value = UI.scaleZ.value =
UI.scaleX.was = UI.scaleY.was = UI.scaleZ.was = 1;
};
UC.onBlur([
UI.toolName,
UI.toolNum,

View file

@ -1500,3 +1500,11 @@ th, tr, td, label {
border-top: 1px solid #ddd;
margin: 5px 0 5px 0;
}
#lab-axis, #lab-scale {
padding: 0 6px 0 6px;
border-radius: 3px;
}
#lab-axis:hover, #lab-scale:hover {
background-color: rgba(0,0,0,0.2);
}

View file

@ -222,9 +222,9 @@
<div><input id="scale_z" xsize="8" class="value" value="1"/></div>
</div>
<div class="f-col j-center">
<div><label>axis</label></div>
<div><label>size</label></div>
<div><label>scale</label></div>
<div><label id="lab-axis">axis</label></div>
<div><label id="lab-size">size</label></div>
<div><label id="lab-scale">scale</label></div>
</div>
</div>
</div>