storysplat-viewer 2.3.2 → 2.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/storysplat-viewer.umd.js +1 -1
- package/dist/storysplat-viewer.umd.js.map +1 -1
- package/dist/types/dynamic-viewer/viewerUI.d.ts +4 -0
- package/dist/types/editor/GizmoManager.d.ts +98 -0
- package/dist/types/editor/SelectionManager.d.ts +77 -0
- package/dist/types/editor/index.d.ts +10 -0
- package/dist/types/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -101,6 +101,10 @@ export declare function setJoystickVisible(elements: UIElements, visible: boolea
|
|
|
101
101
|
* Update joystick thumb position based on touch input
|
|
102
102
|
*/
|
|
103
103
|
export declare function updateJoystickPosition(elements: UIElements, active: boolean, dx: number, dy: number, maxRadius: number): void;
|
|
104
|
+
/**
|
|
105
|
+
* Update look zone visual state based on touch input
|
|
106
|
+
*/
|
|
107
|
+
export declare function updateLookZoneState(elements: UIElements, active: boolean): void;
|
|
104
108
|
/**
|
|
105
109
|
* Show/hide camera mode toggle button (mobile-only, explore mode only)
|
|
106
110
|
*/
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GizmoManager - PlayCanvas Gizmo wrapper for editor
|
|
3
|
+
*
|
|
4
|
+
* Provides translate, rotate, and scale gizmos for 3D object manipulation.
|
|
5
|
+
* API modeled after BabylonJS GizmoManager for easier migration.
|
|
6
|
+
*/
|
|
7
|
+
import * as pc from 'playcanvas';
|
|
8
|
+
export type GizmoMode = 'translate' | 'rotate' | 'scale' | 'none';
|
|
9
|
+
export interface GizmoManagerConfig {
|
|
10
|
+
snap?: boolean;
|
|
11
|
+
snapIncrement?: number;
|
|
12
|
+
coordSpace?: 'world' | 'local';
|
|
13
|
+
}
|
|
14
|
+
export interface TransformEvent {
|
|
15
|
+
entity: pc.Entity | null;
|
|
16
|
+
position?: pc.Vec3;
|
|
17
|
+
rotation?: pc.Quat;
|
|
18
|
+
scale?: pc.Vec3;
|
|
19
|
+
}
|
|
20
|
+
export declare class GizmoManager {
|
|
21
|
+
private app;
|
|
22
|
+
private camera;
|
|
23
|
+
private gizmoLayer;
|
|
24
|
+
private translateGizmo;
|
|
25
|
+
private rotateGizmo;
|
|
26
|
+
private scaleGizmo;
|
|
27
|
+
private activeGizmo;
|
|
28
|
+
private attachedEntity;
|
|
29
|
+
private _mode;
|
|
30
|
+
private onTransformStart?;
|
|
31
|
+
private onTransformMove?;
|
|
32
|
+
private onTransformEnd?;
|
|
33
|
+
constructor(app: pc.Application, camera: pc.CameraComponent, config?: GizmoManagerConfig);
|
|
34
|
+
private setupEvents;
|
|
35
|
+
/**
|
|
36
|
+
* Get current gizmo mode
|
|
37
|
+
*/
|
|
38
|
+
get mode(): GizmoMode;
|
|
39
|
+
/**
|
|
40
|
+
* Set the active gizmo mode
|
|
41
|
+
*/
|
|
42
|
+
setMode(mode: GizmoMode): void;
|
|
43
|
+
/**
|
|
44
|
+
* Attach gizmo to an entity
|
|
45
|
+
*/
|
|
46
|
+
attach(entity: pc.Entity | null): void;
|
|
47
|
+
/**
|
|
48
|
+
* Attach to mesh by finding the parent entity
|
|
49
|
+
* (Compatibility with BabylonJS pattern)
|
|
50
|
+
*/
|
|
51
|
+
attachToMesh(mesh: pc.Entity | null): void;
|
|
52
|
+
/**
|
|
53
|
+
* Detach gizmo from current entity
|
|
54
|
+
*/
|
|
55
|
+
detach(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Enable/disable position gizmo
|
|
58
|
+
* (BabylonJS compatibility)
|
|
59
|
+
*/
|
|
60
|
+
set positionGizmoEnabled(enabled: boolean);
|
|
61
|
+
get positionGizmoEnabled(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Enable/disable rotation gizmo
|
|
64
|
+
* (BabylonJS compatibility)
|
|
65
|
+
*/
|
|
66
|
+
set rotationGizmoEnabled(enabled: boolean);
|
|
67
|
+
get rotationGizmoEnabled(): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Enable/disable scale gizmo
|
|
70
|
+
* (BabylonJS compatibility)
|
|
71
|
+
*/
|
|
72
|
+
set scaleGizmoEnabled(enabled: boolean);
|
|
73
|
+
get scaleGizmoEnabled(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Set snap enabled and increment
|
|
76
|
+
*/
|
|
77
|
+
setSnap(enabled: boolean, increment?: number): void;
|
|
78
|
+
/**
|
|
79
|
+
* Set coordinate space (world or local)
|
|
80
|
+
*/
|
|
81
|
+
setCoordSpace(space: 'world' | 'local'): void;
|
|
82
|
+
/**
|
|
83
|
+
* Set transform event callbacks
|
|
84
|
+
*/
|
|
85
|
+
onTransform(callbacks: {
|
|
86
|
+
start?: (event: TransformEvent) => void;
|
|
87
|
+
move?: (event: TransformEvent) => void;
|
|
88
|
+
end?: (event: TransformEvent) => void;
|
|
89
|
+
}): void;
|
|
90
|
+
/**
|
|
91
|
+
* Update gizmo (call each frame if needed)
|
|
92
|
+
*/
|
|
93
|
+
update(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Destroy the gizmo manager and clean up resources
|
|
96
|
+
*/
|
|
97
|
+
destroy(): void;
|
|
98
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SelectionManager - PlayCanvas entity selection for editor
|
|
3
|
+
*
|
|
4
|
+
* Handles raycasting, selection state, and visual feedback.
|
|
5
|
+
*/
|
|
6
|
+
import * as pc from 'playcanvas';
|
|
7
|
+
export interface SelectionEvent {
|
|
8
|
+
entity: pc.Entity | null;
|
|
9
|
+
previousEntity: pc.Entity | null;
|
|
10
|
+
}
|
|
11
|
+
export interface SelectionManagerConfig {
|
|
12
|
+
highlightColor?: pc.Color;
|
|
13
|
+
multiSelect?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class SelectionManager {
|
|
16
|
+
private app;
|
|
17
|
+
private camera;
|
|
18
|
+
private picker;
|
|
19
|
+
private selectedEntities;
|
|
20
|
+
private highlightedEntity;
|
|
21
|
+
private config;
|
|
22
|
+
private originalMaterials;
|
|
23
|
+
private onSelectionChange?;
|
|
24
|
+
constructor(app: pc.Application, camera: pc.Entity, config?: SelectionManagerConfig);
|
|
25
|
+
/**
|
|
26
|
+
* Pick entity at screen coordinates
|
|
27
|
+
*/
|
|
28
|
+
pickAtScreenPosition(x: number, y: number): Promise<pc.Entity | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Get world point at screen coordinates (for double-click focus)
|
|
31
|
+
*/
|
|
32
|
+
getWorldPointAtScreen(x: number, y: number): Promise<pc.Vec3 | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Select an entity
|
|
35
|
+
*/
|
|
36
|
+
select(entity: pc.Entity | null, additive?: boolean): void;
|
|
37
|
+
/**
|
|
38
|
+
* Deselect a specific entity
|
|
39
|
+
*/
|
|
40
|
+
deselect(entity: pc.Entity): void;
|
|
41
|
+
/**
|
|
42
|
+
* Deselect all entities
|
|
43
|
+
*/
|
|
44
|
+
deselectAll(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Check if an entity is selected
|
|
47
|
+
*/
|
|
48
|
+
isSelected(entity: pc.Entity): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Get the first selected entity (for single selection mode)
|
|
51
|
+
*/
|
|
52
|
+
getSelectedEntity(): pc.Entity | null;
|
|
53
|
+
/**
|
|
54
|
+
* Get all selected entities
|
|
55
|
+
*/
|
|
56
|
+
getSelectedEntities(): pc.Entity[];
|
|
57
|
+
/**
|
|
58
|
+
* Apply visual highlight to entity
|
|
59
|
+
*/
|
|
60
|
+
private applyHighlight;
|
|
61
|
+
/**
|
|
62
|
+
* Remove visual highlight from entity
|
|
63
|
+
*/
|
|
64
|
+
private removeHighlight;
|
|
65
|
+
/**
|
|
66
|
+
* Set selection change callback
|
|
67
|
+
*/
|
|
68
|
+
onSelect(callback: (event: SelectionEvent) => void): void;
|
|
69
|
+
/**
|
|
70
|
+
* Handle pointer down event for selection
|
|
71
|
+
*/
|
|
72
|
+
handlePointerDown(event: MouseEvent | TouchEvent, additive?: boolean): Promise<pc.Entity | null>;
|
|
73
|
+
/**
|
|
74
|
+
* Destroy the selection manager
|
|
75
|
+
*/
|
|
76
|
+
destroy(): void;
|
|
77
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StorySplat Viewer Editor Extensions
|
|
3
|
+
*
|
|
4
|
+
* Provides editing capabilities on top of the base viewer.
|
|
5
|
+
* Used by the StorySplat editor application.
|
|
6
|
+
*/
|
|
7
|
+
export { GizmoManager } from './GizmoManager';
|
|
8
|
+
export type { GizmoMode, GizmoManagerConfig, TransformEvent } from './GizmoManager';
|
|
9
|
+
export { SelectionManager } from './SelectionManager';
|
|
10
|
+
export type { SelectionEvent, SelectionManagerConfig } from './SelectionManager';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,3 +21,9 @@ export { transformSceneToExportProps, exportPropsToViewerConfig } from './transf
|
|
|
21
21
|
export type { ExportProps, TemplateType, SceneData, WaypointData, HotspotData, ViewerInstance, ViewerOptions, ViewerEvent, ViewerFromSceneIdOptions } from './types';
|
|
22
22
|
export type { RevealPreset, RevealPresetConfig } from './effects';
|
|
23
23
|
export { REVEAL_PRESETS, getRevealPreset } from './effects';
|
|
24
|
+
export { GizmoManager } from './editor/GizmoManager';
|
|
25
|
+
export type { GizmoMode, GizmoManagerConfig, TransformEvent } from './editor/GizmoManager';
|
|
26
|
+
export { SelectionManager } from './editor/SelectionManager';
|
|
27
|
+
export type { SelectionEvent, SelectionManagerConfig } from './editor/SelectionManager';
|
|
28
|
+
export { CameraControls } from './dynamic-viewer/CameraControls';
|
|
29
|
+
export type { CameraControlsConfig } from './dynamic-viewer/CameraControls';
|
package/package.json
CHANGED