Add new function for editor selection click handling and update viewport logic
This commit is contained in:
@@ -207,6 +207,26 @@ export function applySameKindSelectionClick(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function applyEditorSelectionClick(
|
||||||
|
currentSelection: EditorSelection,
|
||||||
|
clickedSelection: EditorSelection | null,
|
||||||
|
shiftKey: boolean
|
||||||
|
): EditorSelection {
|
||||||
|
if (clickedSelection === null) {
|
||||||
|
return shiftKey
|
||||||
|
? cloneEditorSelection(currentSelection)
|
||||||
|
: {
|
||||||
|
kind: "none"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return applySameKindSelectionClick(
|
||||||
|
currentSelection,
|
||||||
|
clickedSelection,
|
||||||
|
shiftKey
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function getSingleSelectedBrushId(selection: EditorSelection): string | null {
|
export function getSingleSelectedBrushId(selection: EditorSelection): string | null {
|
||||||
if (selection.kind === "brushFace" || selection.kind === "brushEdge" || selection.kind === "brushVertex") {
|
if (selection.kind === "brushFace" || selection.kind === "brushEdge" || selection.kind === "brushVertex") {
|
||||||
return selection.brushId;
|
return selection.brushId;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import {
|
|||||||
import { EffectComposer } from "postprocessing";
|
import { EffectComposer } from "postprocessing";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
applyEditorSelectionClick,
|
||||||
applySameKindSelectionClick,
|
applySameKindSelectionClick,
|
||||||
areEditorSelectionsEqual,
|
areEditorSelectionsEqual,
|
||||||
isBrushEdgeSelected,
|
isBrushEdgeSelected,
|
||||||
@@ -6838,12 +6839,9 @@ export class ViewportHost {
|
|||||||
if (candidates.length === 0) {
|
if (candidates.length === 0) {
|
||||||
this.lastClickPointer = null;
|
this.lastClickPointer = null;
|
||||||
this.lastClickSelectionKey = null;
|
this.lastClickSelectionKey = null;
|
||||||
|
this.brushSelectionChangeHandler?.(
|
||||||
if (!event.shiftKey) {
|
applyEditorSelectionClick(this.currentSelection, null, event.shiftKey)
|
||||||
this.brushSelectionChangeHandler?.({
|
);
|
||||||
kind: "none"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -6872,7 +6870,7 @@ export class ViewportHost {
|
|||||||
const chosen = candidates[candidateIndex];
|
const chosen = candidates[candidateIndex];
|
||||||
this.lastClickSelectionKey = chosen.key;
|
this.lastClickSelectionKey = chosen.key;
|
||||||
this.brushSelectionChangeHandler?.(
|
this.brushSelectionChangeHandler?.(
|
||||||
applySameKindSelectionClick(
|
applyEditorSelectionClick(
|
||||||
this.currentSelection,
|
this.currentSelection,
|
||||||
chosen.selection,
|
chosen.selection,
|
||||||
event.shiftKey
|
event.shiftKey
|
||||||
|
|||||||
Reference in New Issue
Block a user