fix multi object drag bounding
This commit is contained in:
parent
75bc3936cb
commit
d270de3a92
3 changed files with 14 additions and 14 deletions
|
|
@ -1697,22 +1697,17 @@ 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) {
|
||||
let set = settings();
|
||||
let dev = set.device;
|
||||
let bound = set.bounds;
|
||||
let width = dev.bedWidth/2;
|
||||
let depth = dev.bedDepth/2;
|
||||
if (bound.min.x + delta.x <= -width) return;
|
||||
if (bound.min.y + delta.y <= -depth) return;
|
||||
if (bound.max.x + delta.x >= width) return;
|
||||
if (bound.max.y + delta.y >= depth) return;
|
||||
API.selection.for_widgets(function(widget) {
|
||||
let wbnd = widget.getBoundingBox();
|
||||
let wwid = wbnd.max.x - wbnd.min.x;
|
||||
let wminx = widget.track.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.track.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);
|
||||
API.event.emit('widget.move', {widget, delta});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -964,6 +964,10 @@ self.kiri.copyright = exports.COPYRIGHT;
|
|||
forAllWidgets(function(widget) {
|
||||
let wp = widget.track.pos;
|
||||
let wb = widget.mesh.getBoundingBox().clone();
|
||||
wb.min.x += wp.x;
|
||||
wb.max.x += wp.x;
|
||||
wb.min.y += wp.y;
|
||||
wb.max.y += wp.y;
|
||||
bounds.union(wb);
|
||||
});
|
||||
return settings.bounds = bounds;
|
||||
|
|
|
|||
1
notes.md
1
notes.md
|
|
@ -11,6 +11,7 @@
|
|||
* `P` server-side processing (determine protocol and storage)
|
||||
* `P` refactor / simplify POLY.expand (put onus on collector)
|
||||
* `P` duplicate objects should share same slice data unless rotated or scaled
|
||||
* `F` https://poeditor.com/projects/view_terms?id=336467&per_page=20
|
||||
|
||||
# FDM
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue