Implement selection change handling in ViewportHost, triggering refresh of paths, markers, and model instances, and update related integration tests.
This commit is contained in:
@@ -6887,6 +6887,21 @@ export class ViewportHost {
|
|||||||
this.whiteboxHoverLabelChangeHandler?.(label);
|
this.whiteboxHoverLabelChangeHandler?.(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private refreshSelectionPresentation() {
|
||||||
|
if (this.currentDocument === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.refreshBrushPresentation();
|
||||||
|
this.refreshTerrainPresentation();
|
||||||
|
this.rebuildPaths(this.currentDocument, this.currentSelection);
|
||||||
|
this.rebuildEntityMarkers(this.currentDocument, this.currentSelection);
|
||||||
|
this.rebuildModelInstances(this.currentDocument, this.currentSelection);
|
||||||
|
this.applyTransformPreview();
|
||||||
|
this.syncTransformGizmo();
|
||||||
|
this.syncTerrainBrushPreview();
|
||||||
|
}
|
||||||
|
|
||||||
private setHoveredSelection(selection: EditorSelection) {
|
private setHoveredSelection(selection: EditorSelection) {
|
||||||
if (areEditorSelectionsEqual(this.hoveredSelection, selection)) {
|
if (areEditorSelectionsEqual(this.hoveredSelection, selection)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation: ReturnType<typeof vi.fn>;
|
updateSimulation: ReturnType<typeof vi.fn>;
|
||||||
updateAssets: ReturnType<typeof vi.fn>;
|
updateAssets: ReturnType<typeof vi.fn>;
|
||||||
updateDocument: ReturnType<typeof vi.fn>;
|
updateDocument: ReturnType<typeof vi.fn>;
|
||||||
|
updateSelection: ReturnType<typeof vi.fn>;
|
||||||
setPanelId: ReturnType<typeof vi.fn>;
|
setPanelId: ReturnType<typeof vi.fn>;
|
||||||
setViewMode: ReturnType<typeof vi.fn>;
|
setViewMode: ReturnType<typeof vi.fn>;
|
||||||
setDisplayMode: ReturnType<typeof vi.fn>;
|
setDisplayMode: ReturnType<typeof vi.fn>;
|
||||||
@@ -40,6 +41,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation = vi.fn();
|
updateSimulation = vi.fn();
|
||||||
updateAssets = vi.fn();
|
updateAssets = vi.fn();
|
||||||
updateDocument = vi.fn();
|
updateDocument = vi.fn();
|
||||||
|
updateSelection = vi.fn();
|
||||||
setViewMode = vi.fn();
|
setViewMode = vi.fn();
|
||||||
setDisplayMode = vi.fn();
|
setDisplayMode = vi.fn();
|
||||||
setGridVisible = vi.fn();
|
setGridVisible = vi.fn();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateWorld: ReturnType<typeof vi.fn>;
|
updateWorld: ReturnType<typeof vi.fn>;
|
||||||
updateAssets: ReturnType<typeof vi.fn>;
|
updateAssets: ReturnType<typeof vi.fn>;
|
||||||
updateDocument: ReturnType<typeof vi.fn>;
|
updateDocument: ReturnType<typeof vi.fn>;
|
||||||
|
updateSelection: ReturnType<typeof vi.fn>;
|
||||||
updateSimulation: ReturnType<typeof vi.fn>;
|
updateSimulation: ReturnType<typeof vi.fn>;
|
||||||
setPanelId: ReturnType<typeof vi.fn>;
|
setPanelId: ReturnType<typeof vi.fn>;
|
||||||
setViewMode: ReturnType<typeof vi.fn>;
|
setViewMode: ReturnType<typeof vi.fn>;
|
||||||
@@ -48,6 +49,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateWorld = vi.fn();
|
updateWorld = vi.fn();
|
||||||
updateAssets = vi.fn();
|
updateAssets = vi.fn();
|
||||||
updateDocument = vi.fn();
|
updateDocument = vi.fn();
|
||||||
|
updateSelection = vi.fn();
|
||||||
updateSimulation = vi.fn();
|
updateSimulation = vi.fn();
|
||||||
setViewMode = vi.fn();
|
setViewMode = vi.fn();
|
||||||
setDisplayMode = vi.fn();
|
setDisplayMode = vi.fn();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation: ReturnType<typeof vi.fn>;
|
updateSimulation: ReturnType<typeof vi.fn>;
|
||||||
updateAssets: ReturnType<typeof vi.fn>;
|
updateAssets: ReturnType<typeof vi.fn>;
|
||||||
updateDocument: ReturnType<typeof vi.fn>;
|
updateDocument: ReturnType<typeof vi.fn>;
|
||||||
|
updateSelection: ReturnType<typeof vi.fn>;
|
||||||
setPanelId: ReturnType<typeof vi.fn>;
|
setPanelId: ReturnType<typeof vi.fn>;
|
||||||
setRenderEnabled: ReturnType<typeof vi.fn>;
|
setRenderEnabled: ReturnType<typeof vi.fn>;
|
||||||
setViewMode: ReturnType<typeof vi.fn>;
|
setViewMode: ReturnType<typeof vi.fn>;
|
||||||
@@ -39,6 +40,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation = vi.fn();
|
updateSimulation = vi.fn();
|
||||||
updateAssets = vi.fn();
|
updateAssets = vi.fn();
|
||||||
updateDocument = vi.fn();
|
updateDocument = vi.fn();
|
||||||
|
updateSelection = vi.fn();
|
||||||
setPanelId = vi.fn();
|
setPanelId = vi.fn();
|
||||||
setRenderEnabled = vi.fn();
|
setRenderEnabled = vi.fn();
|
||||||
setViewMode = vi.fn();
|
setViewMode = vi.fn();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation: ReturnType<typeof vi.fn>;
|
updateSimulation: ReturnType<typeof vi.fn>;
|
||||||
updateAssets: ReturnType<typeof vi.fn>;
|
updateAssets: ReturnType<typeof vi.fn>;
|
||||||
updateDocument: ReturnType<typeof vi.fn>;
|
updateDocument: ReturnType<typeof vi.fn>;
|
||||||
|
updateSelection: ReturnType<typeof vi.fn>;
|
||||||
setRenderEnabled: ReturnType<typeof vi.fn>;
|
setRenderEnabled: ReturnType<typeof vi.fn>;
|
||||||
setGridVisible: ReturnType<typeof vi.fn>;
|
setGridVisible: ReturnType<typeof vi.fn>;
|
||||||
setViewMode: ReturnType<typeof vi.fn>;
|
setViewMode: ReturnType<typeof vi.fn>;
|
||||||
@@ -48,6 +49,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation = vi.fn();
|
updateSimulation = vi.fn();
|
||||||
updateAssets = vi.fn();
|
updateAssets = vi.fn();
|
||||||
updateDocument = vi.fn();
|
updateDocument = vi.fn();
|
||||||
|
updateSelection = vi.fn();
|
||||||
setRenderEnabled = vi.fn();
|
setRenderEnabled = vi.fn();
|
||||||
setGridVisible = vi.fn();
|
setGridVisible = vi.fn();
|
||||||
setViewMode = vi.fn();
|
setViewMode = vi.fn();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation: ReturnType<typeof vi.fn>;
|
updateSimulation: ReturnType<typeof vi.fn>;
|
||||||
updateAssets: ReturnType<typeof vi.fn>;
|
updateAssets: ReturnType<typeof vi.fn>;
|
||||||
updateDocument: ReturnType<typeof vi.fn>;
|
updateDocument: ReturnType<typeof vi.fn>;
|
||||||
|
updateSelection: ReturnType<typeof vi.fn>;
|
||||||
setPanelId: ReturnType<typeof vi.fn>;
|
setPanelId: ReturnType<typeof vi.fn>;
|
||||||
setRenderEnabled: ReturnType<typeof vi.fn>;
|
setRenderEnabled: ReturnType<typeof vi.fn>;
|
||||||
setViewMode: ReturnType<typeof vi.fn>;
|
setViewMode: ReturnType<typeof vi.fn>;
|
||||||
@@ -38,6 +39,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation = vi.fn();
|
updateSimulation = vi.fn();
|
||||||
updateAssets = vi.fn();
|
updateAssets = vi.fn();
|
||||||
updateDocument = vi.fn();
|
updateDocument = vi.fn();
|
||||||
|
updateSelection = vi.fn();
|
||||||
setPanelId = vi.fn();
|
setPanelId = vi.fn();
|
||||||
setRenderEnabled = vi.fn();
|
setRenderEnabled = vi.fn();
|
||||||
setViewMode = vi.fn();
|
setViewMode = vi.fn();
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation: ReturnType<typeof vi.fn>;
|
updateSimulation: ReturnType<typeof vi.fn>;
|
||||||
updateAssets: ReturnType<typeof vi.fn>;
|
updateAssets: ReturnType<typeof vi.fn>;
|
||||||
updateDocument: ReturnType<typeof vi.fn>;
|
updateDocument: ReturnType<typeof vi.fn>;
|
||||||
|
updateSelection: ReturnType<typeof vi.fn>;
|
||||||
setPanelId: ReturnType<typeof vi.fn>;
|
setPanelId: ReturnType<typeof vi.fn>;
|
||||||
setRenderEnabled: ReturnType<typeof vi.fn>;
|
setRenderEnabled: ReturnType<typeof vi.fn>;
|
||||||
setViewMode: ReturnType<typeof vi.fn>;
|
setViewMode: ReturnType<typeof vi.fn>;
|
||||||
@@ -50,6 +51,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation = vi.fn();
|
updateSimulation = vi.fn();
|
||||||
updateAssets = vi.fn();
|
updateAssets = vi.fn();
|
||||||
updateDocument = vi.fn();
|
updateDocument = vi.fn();
|
||||||
|
updateSelection = vi.fn();
|
||||||
setPanelId = vi.fn((panelId: string) => {
|
setPanelId = vi.fn((panelId: string) => {
|
||||||
this.panelId = panelId;
|
this.panelId = panelId;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation: ReturnType<typeof vi.fn>;
|
updateSimulation: ReturnType<typeof vi.fn>;
|
||||||
updateAssets: ReturnType<typeof vi.fn>;
|
updateAssets: ReturnType<typeof vi.fn>;
|
||||||
updateDocument: ReturnType<typeof vi.fn>;
|
updateDocument: ReturnType<typeof vi.fn>;
|
||||||
|
updateSelection: ReturnType<typeof vi.fn>;
|
||||||
setPanelId: ReturnType<typeof vi.fn>;
|
setPanelId: ReturnType<typeof vi.fn>;
|
||||||
setRenderEnabled: ReturnType<typeof vi.fn>;
|
setRenderEnabled: ReturnType<typeof vi.fn>;
|
||||||
setViewMode: ReturnType<typeof vi.fn>;
|
setViewMode: ReturnType<typeof vi.fn>;
|
||||||
@@ -39,6 +40,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation = vi.fn();
|
updateSimulation = vi.fn();
|
||||||
updateAssets = vi.fn();
|
updateAssets = vi.fn();
|
||||||
updateDocument = vi.fn();
|
updateDocument = vi.fn();
|
||||||
|
updateSelection = vi.fn();
|
||||||
setPanelId = vi.fn();
|
setPanelId = vi.fn();
|
||||||
setRenderEnabled = vi.fn();
|
setRenderEnabled = vi.fn();
|
||||||
setViewMode = vi.fn();
|
setViewMode = vi.fn();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation: ReturnType<typeof vi.fn>;
|
updateSimulation: ReturnType<typeof vi.fn>;
|
||||||
updateAssets: ReturnType<typeof vi.fn>;
|
updateAssets: ReturnType<typeof vi.fn>;
|
||||||
updateDocument: ReturnType<typeof vi.fn>;
|
updateDocument: ReturnType<typeof vi.fn>;
|
||||||
|
updateSelection: ReturnType<typeof vi.fn>;
|
||||||
setPanelId: ReturnType<typeof vi.fn>;
|
setPanelId: ReturnType<typeof vi.fn>;
|
||||||
setRenderEnabled: ReturnType<typeof vi.fn>;
|
setRenderEnabled: ReturnType<typeof vi.fn>;
|
||||||
setViewMode: ReturnType<typeof vi.fn>;
|
setViewMode: ReturnType<typeof vi.fn>;
|
||||||
@@ -38,6 +39,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation = vi.fn();
|
updateSimulation = vi.fn();
|
||||||
updateAssets = vi.fn();
|
updateAssets = vi.fn();
|
||||||
updateDocument = vi.fn();
|
updateDocument = vi.fn();
|
||||||
|
updateSelection = vi.fn();
|
||||||
setPanelId = vi.fn();
|
setPanelId = vi.fn();
|
||||||
setRenderEnabled = vi.fn();
|
setRenderEnabled = vi.fn();
|
||||||
setViewMode = vi.fn();
|
setViewMode = vi.fn();
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation: ReturnType<typeof vi.fn>;
|
updateSimulation: ReturnType<typeof vi.fn>;
|
||||||
updateAssets: ReturnType<typeof vi.fn>;
|
updateAssets: ReturnType<typeof vi.fn>;
|
||||||
updateDocument: ReturnType<typeof vi.fn>;
|
updateDocument: ReturnType<typeof vi.fn>;
|
||||||
|
updateSelection: ReturnType<typeof vi.fn>;
|
||||||
setViewMode: ReturnType<typeof vi.fn>;
|
setViewMode: ReturnType<typeof vi.fn>;
|
||||||
setDisplayMode: ReturnType<typeof vi.fn>;
|
setDisplayMode: ReturnType<typeof vi.fn>;
|
||||||
setCameraState: ReturnType<typeof vi.fn>;
|
setCameraState: ReturnType<typeof vi.fn>;
|
||||||
@@ -61,6 +62,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation = vi.fn();
|
updateSimulation = vi.fn();
|
||||||
updateAssets = vi.fn();
|
updateAssets = vi.fn();
|
||||||
updateDocument = vi.fn();
|
updateDocument = vi.fn();
|
||||||
|
updateSelection = vi.fn();
|
||||||
setViewMode = vi.fn();
|
setViewMode = vi.fn();
|
||||||
setDisplayMode = vi.fn();
|
setDisplayMode = vi.fn();
|
||||||
setCameraState = vi.fn();
|
setCameraState = vi.fn();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation: ReturnType<typeof vi.fn>;
|
updateSimulation: ReturnType<typeof vi.fn>;
|
||||||
updateAssets: ReturnType<typeof vi.fn>;
|
updateAssets: ReturnType<typeof vi.fn>;
|
||||||
updateDocument: ReturnType<typeof vi.fn>;
|
updateDocument: ReturnType<typeof vi.fn>;
|
||||||
|
updateSelection: ReturnType<typeof vi.fn>;
|
||||||
setViewMode: ReturnType<typeof vi.fn>;
|
setViewMode: ReturnType<typeof vi.fn>;
|
||||||
setDisplayMode: ReturnType<typeof vi.fn>;
|
setDisplayMode: ReturnType<typeof vi.fn>;
|
||||||
setCameraState: ReturnType<typeof vi.fn>;
|
setCameraState: ReturnType<typeof vi.fn>;
|
||||||
@@ -63,6 +64,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation = vi.fn();
|
updateSimulation = vi.fn();
|
||||||
updateAssets = vi.fn();
|
updateAssets = vi.fn();
|
||||||
updateDocument = vi.fn();
|
updateDocument = vi.fn();
|
||||||
|
updateSelection = vi.fn();
|
||||||
setViewMode = vi.fn();
|
setViewMode = vi.fn();
|
||||||
setDisplayMode = vi.fn();
|
setDisplayMode = vi.fn();
|
||||||
setCameraState = vi.fn();
|
setCameraState = vi.fn();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation: ReturnType<typeof vi.fn>;
|
updateSimulation: ReturnType<typeof vi.fn>;
|
||||||
updateAssets: ReturnType<typeof vi.fn>;
|
updateAssets: ReturnType<typeof vi.fn>;
|
||||||
updateDocument: ReturnType<typeof vi.fn>;
|
updateDocument: ReturnType<typeof vi.fn>;
|
||||||
|
updateSelection: ReturnType<typeof vi.fn>;
|
||||||
setRenderEnabled: ReturnType<typeof vi.fn>;
|
setRenderEnabled: ReturnType<typeof vi.fn>;
|
||||||
setGridVisible: ReturnType<typeof vi.fn>;
|
setGridVisible: ReturnType<typeof vi.fn>;
|
||||||
setViewMode: ReturnType<typeof vi.fn>;
|
setViewMode: ReturnType<typeof vi.fn>;
|
||||||
@@ -45,6 +46,7 @@ const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => {
|
|||||||
updateSimulation = vi.fn();
|
updateSimulation = vi.fn();
|
||||||
updateAssets = vi.fn();
|
updateAssets = vi.fn();
|
||||||
updateDocument = vi.fn();
|
updateDocument = vi.fn();
|
||||||
|
updateSelection = vi.fn();
|
||||||
setRenderEnabled = vi.fn();
|
setRenderEnabled = vi.fn();
|
||||||
setGridVisible = vi.fn();
|
setGridVisible = vi.fn();
|
||||||
setViewMode = vi.fn();
|
setViewMode = vi.fn();
|
||||||
|
|||||||
Reference in New Issue
Block a user