fixes #427 now scale prevented below threshold

This commit is contained in:
Stewart Allen 2025-09-21 17:13:57 -04:00
commit 1501d33c70

View file

@ -1323,7 +1323,8 @@ function init_one() {
yr = ((tl && yc) || (!tl && yt) ? ra : 1), yr = ((tl && yc) || (!tl && yt) ? ra : 1),
zr = ((tl && zc) || (!tl && zt) ? ra : 1); zr = ((tl && zc) || (!tl && zt) ? ra : 1);
// prevent null scale // prevent null scale
if (xr * yr * zr === 0) { if (xv * xr < 0.1 || yv * yr < 0.1 || zv * zr < 0.1) {
api.alerts.show('invalid scale value');
return; return;
} }
selection.scale(xr,yr,zr); selection.scale(xr,yr,zr);
@ -1350,7 +1351,11 @@ function init_one() {
xr = ((tl && xc) || (!tl && xt) ? ra : 1), xr = ((tl && xc) || (!tl && xt) ? ra : 1),
yr = ((tl && yc) || (!tl && yt) ? ra : 1), yr = ((tl && yc) || (!tl && yt) ? ra : 1),
zr = ((tl && zc) || (!tl && zt) ? ra : 1); zr = ((tl && zc) || (!tl && zt) ? ra : 1);
// prevent null scale
if (xv * xr < 0.1 || yv * yr < 0.1 || zv * zr < 0.1) {
api.alerts.show('invalid scale value');
return;
}
selection.scale(xr,yr,zr); selection.scale(xr,yr,zr);
ui.scaleX.was = ui.scaleX.value = xv * xr; ui.scaleX.was = ui.scaleX.value = xv * xr;
ui.scaleY.was = ui.scaleY.value = yv * yr; ui.scaleY.was = ui.scaleY.value = yv * yr;
@ -1362,6 +1367,7 @@ function init_one() {
e.target.value = val; e.target.value = val;
} }
// on enter but not on blur
space.event.onEnterKey([ space.event.onEnterKey([
ui.scaleX, selectionScale, ui.scaleX, selectionScale,
ui.scaleY, selectionScale, ui.scaleY, selectionScale,
@ -1369,6 +1375,9 @@ function init_one() {
ui.sizeX, selectionSize, ui.sizeX, selectionSize,
ui.sizeY, selectionSize, ui.sizeY, selectionSize,
ui.sizeZ, selectionSize, ui.sizeZ, selectionSize,
]);
// on enter and blur
space.event.onEnterKey([
ui.toolName, updateTool, ui.toolName, updateTool,
ui.toolNum, updateTool, ui.toolNum, updateTool,
ui.toolFluteDiam, updateTool, ui.toolFluteDiam, updateTool,