change select / drag behavior
This commit is contained in:
parent
be8247c1a6
commit
a0c2f8ffae
3 changed files with 18 additions and 12 deletions
|
|
@ -371,11 +371,7 @@ function space_init(data) {
|
|||
let obj = int?.object;
|
||||
if (obj) api.selection.drag({ start: int.object });
|
||||
if (obj) obj.sketch_item?.sketch.drag({ start: int.object });
|
||||
if (event?.shiftKey) {
|
||||
return api.objects();
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
return event?.shiftKey ? undefined : api.objects(selection.count() ? true : false);
|
||||
});
|
||||
|
||||
// called two ways:
|
||||
|
|
@ -477,7 +473,8 @@ function space_init(data) {
|
|||
space.mouse.onDrag((delta, offset, up = false) => {
|
||||
let { mode, modes } = api;
|
||||
if (delta) {
|
||||
if (delta.event?.shiftKey && selection.count()) {
|
||||
// if (delta.event?.shiftKey && selection.count()) {
|
||||
if (selection.count()) {
|
||||
selection.drag({ delta, offset });
|
||||
}
|
||||
} else if (up) {
|
||||
|
|
|
|||
|
|
@ -1597,12 +1597,19 @@ const api = {
|
|||
prefs.save( prefs.map.space.norm = norm );
|
||||
},
|
||||
|
||||
objects() {
|
||||
objects(selected = false) {
|
||||
// return model objects suitable for finding ray intersections
|
||||
return [
|
||||
...group.list().map(o => o.models).flat().map(o => o.mesh),
|
||||
...sketches.map(s => s.meshes).flat()
|
||||
];
|
||||
if (selected) {
|
||||
return [
|
||||
...selection.models().map(o => o.mesh),
|
||||
...selection.sketches().map(s => s.meshes).flat()
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
...group.list().map(o => o.models).flat().map(o => o.mesh),
|
||||
...sketches.map(s => s.meshes).flat()
|
||||
];
|
||||
}
|
||||
},
|
||||
|
||||
add,
|
||||
|
|
|
|||
|
|
@ -865,7 +865,9 @@ function onMouseDown(event) {
|
|||
let selection = null,
|
||||
trackTo = alignedTracking ? trackPlane : platform,
|
||||
isVis = trackTo.visible;
|
||||
if (mouseDownSelect) selection = mouseDownSelect(undefined, event);
|
||||
if (mouseDownSelect) {
|
||||
selection = mouseDownSelect(undefined, event);
|
||||
}
|
||||
if (selection && selection.length > 0) {
|
||||
// selection = selection.map(o => o.isGroup ? o.children : o).flat();
|
||||
// console.log({ selection });
|
||||
|
|
|
|||
Loading…
Reference in a new issue