prevent dragging parts beyond boundaries
This commit is contained in:
parent
eada77bd9c
commit
f581e2f89f
4 changed files with 18 additions and 8 deletions
|
|
@ -1531,8 +1531,22 @@ var gs_kiri_init = exports;
|
|||
});
|
||||
|
||||
SPACE.mouse.onDrag(function(delta) {
|
||||
let dev = settings().device;
|
||||
let bmaxx = dev.bedWidth/2;
|
||||
let bminx = -bmaxx;
|
||||
let bmaxy = dev.bedDepth/2;
|
||||
let bminy = -bmaxy
|
||||
if (delta && UI.freeLayout.checked) {
|
||||
API.selection.for_widgets(function(widget) {
|
||||
let wbnd = widget.getBoundingBox();
|
||||
let wwid = wbnd.max.x - wbnd.min.x;
|
||||
let wminx = widget.orient.pos.x + delta.x - wwid / 2;
|
||||
let wmaxx = wminx + wwid + delta.x;
|
||||
if (wminx < bminx || wmaxx > bmaxx) return;
|
||||
let whei = wbnd.max.y - wbnd.min.y;
|
||||
let wminy = widget.orient.pos.y + delta.y - whei / 2;
|
||||
let wmaxy = wminy + whei + delta.y;
|
||||
if (wminy < bminy || wmaxy > bmaxy) return;
|
||||
widget.move(delta.x, delta.y, 0);
|
||||
});
|
||||
platform.update_stock();
|
||||
|
|
|
|||
|
|
@ -425,8 +425,9 @@ var gs_kiri_widget = exports;
|
|||
* @param {number} z
|
||||
*/
|
||||
PRO.scale = function(x, y, z) {
|
||||
var mesh = this.mesh,
|
||||
let mesh = this.mesh,
|
||||
scale = this.orient.scale;
|
||||
this.bounds = null;
|
||||
this.setWireframe(false);
|
||||
this.clearSlices();
|
||||
mesh.geometry.applyMatrix(new THREE.Matrix4().makeScale(x, y, z));
|
||||
|
|
@ -443,11 +444,12 @@ var gs_kiri_widget = exports;
|
|||
* @param {number} z
|
||||
*/
|
||||
PRO.rotate = function(x, y, z) {
|
||||
this.bounds = null;
|
||||
this.setWireframe(false);
|
||||
this.clearSlices();
|
||||
this.mesh.geometry.applyMatrix(new THREE.Matrix4().makeRotationFromEuler(new THREE.Euler(x || 0, y || 0, z || 0)));
|
||||
this.center();
|
||||
var rot = this.orient.rot;
|
||||
let rot = this.orient.rot;
|
||||
rot.x += (x || 0);
|
||||
rot.y += (y || 0);
|
||||
rot.z += (z || 0);
|
||||
|
|
|
|||
|
|
@ -707,8 +707,6 @@ self.kiri.license = exports.LICENSE;
|
|||
|
||||
setViewMode(VIEWS.SLICE);
|
||||
|
||||
var selectSave = selectedMeshes.slice();
|
||||
|
||||
clearPrint();
|
||||
saveSettings();
|
||||
platform.deselect();
|
||||
|
|
@ -733,9 +731,6 @@ self.kiri.license = exports.LICENSE;
|
|||
startTime,
|
||||
lastMsg;
|
||||
|
||||
// skip non-selected widgets in CAM mode when any widget is selected
|
||||
if (MODE === MODES.CAM && selectSave.length > 0 && selectSave.indexOf(widget.mesh) < 0) return --countdown;
|
||||
|
||||
widget.stats.progress = 0;
|
||||
widget.setColor(widget_slicing_color);
|
||||
widget.slice(settings, function(sliced, error) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue