architwin 1.5.2 → 1.5.4
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/lib/actionHistory.d.ts +24 -0
- package/lib/actionHistory.js +71 -0
- package/lib/architwin.d.ts +5 -2
- package/lib/architwin.js +1 -1
- package/lib/atwinui/components/toolbar/actionBar.d.ts +6 -0
- package/lib/atwinui/components/toolbar/actionBar.js +50 -1
- package/lib/atwinui/components/toolbar/card.js +1 -1
- package/lib/atwinui/components/toolbar/i18n.js +6 -2
- package/lib/atwinui/components/toolbar/index.d.ts +2 -2
- package/lib/atwinui/components/toolbar/index.js +2 -2
- package/lib/atwinui/components/toolbar/modelControlsPane.js +2 -0
- package/lib/atwinui/components/toolbar/objectListPane.js +27 -2
- package/lib/atwinui/events.js +76 -50
- package/lib/loaders/viewpointLoader.js +19 -18
- package/lib/minimap.js +1 -1
- package/lib/utils.js +1 -1
- package/package.json +2 -1
- package/static/atwinui.css +109 -97
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Vector3 } from "../bundle/sdk";
|
|
2
|
+
import { Object3DPosition } from "./types";
|
|
3
|
+
export declare class ActionHistory {
|
|
4
|
+
history: {
|
|
5
|
+
[objectId: number]: string[];
|
|
6
|
+
};
|
|
7
|
+
currentIndex: {
|
|
8
|
+
[objectId: number]: number;
|
|
9
|
+
};
|
|
10
|
+
constructor();
|
|
11
|
+
addAction(objectId: number, position: Vector3, rotation: Vector3, scale: Vector3): void;
|
|
12
|
+
undo(objectId: number): {
|
|
13
|
+
canUndo: boolean;
|
|
14
|
+
action: Object3DPosition;
|
|
15
|
+
};
|
|
16
|
+
redo(objectId: number): {
|
|
17
|
+
canRedo: boolean;
|
|
18
|
+
action: Object3DPosition;
|
|
19
|
+
};
|
|
20
|
+
getCurrentAction(objectId: number): any;
|
|
21
|
+
canUndo(objectId: number): boolean;
|
|
22
|
+
canRedo(objectId: number): boolean;
|
|
23
|
+
clearHistory(): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import log from 'loglevel';
|
|
2
|
+
export class ActionHistory {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.history = {};
|
|
5
|
+
this.currentIndex = {};
|
|
6
|
+
}
|
|
7
|
+
// Add a new action for an object
|
|
8
|
+
addAction(objectId, position, rotation, scale) {
|
|
9
|
+
if (!this.history[objectId]) {
|
|
10
|
+
this.history[objectId] = [];
|
|
11
|
+
this.currentIndex[objectId] = -1;
|
|
12
|
+
}
|
|
13
|
+
const action = JSON.stringify({ object_position: position, object_rotation: rotation, object_scale: scale });
|
|
14
|
+
log.info("addAction ", action);
|
|
15
|
+
// Remove any actions after the current index
|
|
16
|
+
this.history[objectId] = this.history[objectId].slice(0, this.currentIndex[objectId] + 1);
|
|
17
|
+
// Add the new action
|
|
18
|
+
this.history[objectId].push(action);
|
|
19
|
+
this.currentIndex[objectId]++;
|
|
20
|
+
}
|
|
21
|
+
// Undo the last action for an object
|
|
22
|
+
undo(objectId) {
|
|
23
|
+
log.info("actionHistory ", this.history[objectId], this.currentIndex[objectId]);
|
|
24
|
+
if (!this.history[objectId] || this.currentIndex[objectId] < 0) {
|
|
25
|
+
return { canUndo: false, action: null };
|
|
26
|
+
}
|
|
27
|
+
if (this.currentIndex[objectId] !== 0) {
|
|
28
|
+
this.currentIndex[objectId]--;
|
|
29
|
+
}
|
|
30
|
+
const action = JSON.parse(this.history[objectId][this.currentIndex[objectId]]);
|
|
31
|
+
// const eulerRotation:EulerCoordinates = action.object_rotation
|
|
32
|
+
// action.object_rotation = convertToEuler(eulerRotation)
|
|
33
|
+
return {
|
|
34
|
+
canUndo: this.currentIndex[objectId] > 0,
|
|
35
|
+
action
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// Redo the next action for an object
|
|
39
|
+
redo(objectId) {
|
|
40
|
+
if (!this.history[objectId] || this.currentIndex[objectId] >= this.history[objectId].length - 1) {
|
|
41
|
+
return { canRedo: false, action: null };
|
|
42
|
+
}
|
|
43
|
+
this.currentIndex[objectId]++;
|
|
44
|
+
const action = JSON.parse(this.history[objectId][this.currentIndex[objectId]]);
|
|
45
|
+
// const eulerRotation:EulerCoordinates = action.object_rotation
|
|
46
|
+
// action.object_rotation = convertToEuler(eulerRotation)
|
|
47
|
+
return {
|
|
48
|
+
canRedo: this.currentIndex[objectId] < this.history[objectId].length - 1,
|
|
49
|
+
action
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Get the current action for an object
|
|
53
|
+
getCurrentAction(objectId) {
|
|
54
|
+
if (!this.history[objectId] || this.currentIndex[objectId] === -1) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return JSON.parse(this.history[objectId][this.currentIndex[objectId]]);
|
|
58
|
+
}
|
|
59
|
+
// Check if undo is possible for an object
|
|
60
|
+
canUndo(objectId) {
|
|
61
|
+
return this.history[objectId] && this.currentIndex[objectId] >= 0;
|
|
62
|
+
}
|
|
63
|
+
// Check if redo is possible for an object
|
|
64
|
+
canRedo(objectId) {
|
|
65
|
+
return this.history[objectId] && this.currentIndex[objectId] < this.history[objectId].length - 1;
|
|
66
|
+
}
|
|
67
|
+
clearHistory() {
|
|
68
|
+
this.history = {};
|
|
69
|
+
this.currentIndex = {};
|
|
70
|
+
}
|
|
71
|
+
}
|
package/lib/architwin.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ import '../static/map.css';
|
|
|
8
8
|
import '../static/media_screen.css';
|
|
9
9
|
import { isMeetingInitialized, getMeetingParticipants, createMeeting, startMeeting, stopMeeting, generateMeetingURL, updateMeetingTitle, updateMeetingStart, updateMeetingStatus, updateMeetingSpace, getMeeting, getSpaceMeetings, isMeetingExists, isMeetingActive } from './superviz';
|
|
10
10
|
import { createMeetingTemplate, joinMeetingTemplate } from "./meeting/templates";
|
|
11
|
+
import { ActionHistory } from "./actionHistory";
|
|
11
12
|
import * as meet from './zoom';
|
|
13
|
+
declare const transformHistory: ActionHistory;
|
|
12
14
|
declare const _config: {
|
|
13
15
|
mp: {
|
|
14
16
|
urlParams: string[];
|
|
@@ -133,9 +135,10 @@ declare function setTransformMode(mode: TRANSFORM_TYPE | string): Promise<void>;
|
|
|
133
135
|
/**
|
|
134
136
|
* This function either reverts or restores an transformation action done on an object
|
|
135
137
|
* @param action Accepts either undo or redo. undo is the default value if none is set
|
|
138
|
+
* @param useNewHistory - Flag to set if user wants to use new history method. Defaults to true
|
|
136
139
|
* @returns {boolean} Returns false if you can still undo/redo and true if not.
|
|
137
140
|
*/
|
|
138
|
-
declare function revertTransform(action?: string): boolean;
|
|
141
|
+
declare function revertTransform(action?: string, useNewHistory?: boolean): boolean;
|
|
139
142
|
/**
|
|
140
143
|
* Clears the action history of all objects
|
|
141
144
|
* @returns {void}
|
|
@@ -503,4 +506,4 @@ declare function getMediaScreenHUDs(): {
|
|
|
503
506
|
declare function getParticipants(): Promise<import("./types").IO_Participant[]>;
|
|
504
507
|
declare function followParticipant(followParticipant: any): void;
|
|
505
508
|
declare function unFollowParticipant(unFollowParticipant: any): void;
|
|
506
|
-
export { _atwin, _config, _mpConfig, tags, sweeps, selectedObject, previousObjTransform, currentObjTransform, actionHistory, state, _tags, _tagCategories, _tagMessageRecepients, _space, _spaceId, _api, _pointerCoord, _3DXObjects, _meetingParticipants, _generatedObjectIds, tagColors, domMousePosition, isFitScreenOccupied, isCdnMapDataAvailable, minimap, _modelDetails, _onMouseClickInstance, initAtwinApi, getAtwinSdk, connectSpace, disconnectSpace, clearActionHistory, getSweeps, getCurrentSweep, getCurrentSweepPosition, moveToSweep, getNearbySweeps, getAllSweeps, getCurrentCameraPose, getCameraPosition, moveInDirection, cameraLookAt, cameraPan, cameraRotate, getViewMode, setViewMode, captureSpaceScreenshot, captureScreenshotAndCameraDetails, getNearbyObjects, setTransformMode, setSelectedObject, clearSelectedObject, revertTransform, setTransformControls, removeTransformControls, setRenderDistance, addObject, getObject, addObjectToSpace, addMediaScreen, attachMediaScreenContent, updateObject, updateShowcaseObject, deleteObject, deleteShowcaseObject, copyObject, replaceObject, getTargetPosition, setObjectTransformation, setPointerCoordinates, addTextMarkupScreen, setTextMarkupScreenContent, goTo3dx, goToModel, hasTimeElapsed, getSelectedObject, renderAvatar, setSpaceAvatar, get3DXObjects, setLibrary, getLibrary, disposeModel, renderInSpaceMediaScreen, goToPosition, goToParticipant, getNearestSweepFromObject, cancelModelPlacement, renderViewpointMarker, toggleViewpointVisibility, pauseVideo, playVideo, setVideoPlayback, setAnimationState, showMinimap, hideMinimap, getMapConfig, addTag, getTags, gotoTag, renderTag, disposeTag, disposeTags, getMpTags, getMpTag, showTags, attachTagMedia, detachTagMedia, moveTag, editTagLabel, editTagDescription, editTagStem, editTagIcon, editTagColor, saveTag, rotateCameraToObject, setModelVisibility, tagStateSubscriber, setTagIcon, setTagCategories, setUserAssignedCategories, getUserAssignedCategories, setTagMessageRecepients, getTagMessageRecepients, setTagMessages, getTagMessages, setSelectedTagUuid, getSelectedTagUuid, toggleFitToScreen, getFloors, getLabels, renderMeetingSidebar, createMeetingTemplate, joinMeetingTemplate, meet, dispatchSpaceEvent, subscribeSpaceEvent, unsubscribeSpaceEvent, registerCustomSpaceEvent, isMeetingInitialized, getMeetingParticipants, createMeeting, startMeeting, stopMeeting, generateMeetingURL, updateMeetingTitle, updateMeetingStart, updateMeetingStatus, updateMeetingSpace, getMeeting, getSpaceMeetings, isMeetingExists, isMeetingActive, initSocketIo, socketEmit, getParticipants, followParticipant, unFollowParticipant, enableHUD, disableHUD, getMediaScreenHUDs, canSetHud, saveMediaScreenHud, removeMediaScreenHud, enableFitScreen, disableFitScreen, initToolbarUI, convertToEuler };
|
|
509
|
+
export { _atwin, _config, _mpConfig, tags, sweeps, selectedObject, previousObjTransform, currentObjTransform, actionHistory, state, _tags, _tagCategories, _tagMessageRecepients, _space, _spaceId, _api, _pointerCoord, _3DXObjects, _meetingParticipants, _generatedObjectIds, tagColors, domMousePosition, isFitScreenOccupied, isCdnMapDataAvailable, minimap, _modelDetails, _onMouseClickInstance, transformHistory, initAtwinApi, getAtwinSdk, connectSpace, disconnectSpace, clearActionHistory, getSweeps, getCurrentSweep, getCurrentSweepPosition, moveToSweep, getNearbySweeps, getAllSweeps, getCurrentCameraPose, getCameraPosition, moveInDirection, cameraLookAt, cameraPan, cameraRotate, getViewMode, setViewMode, captureSpaceScreenshot, captureScreenshotAndCameraDetails, getNearbyObjects, setTransformMode, setSelectedObject, clearSelectedObject, revertTransform, setTransformControls, removeTransformControls, setRenderDistance, addObject, getObject, addObjectToSpace, addMediaScreen, attachMediaScreenContent, updateObject, updateShowcaseObject, deleteObject, deleteShowcaseObject, copyObject, replaceObject, getTargetPosition, setObjectTransformation, setPointerCoordinates, addTextMarkupScreen, setTextMarkupScreenContent, goTo3dx, goToModel, hasTimeElapsed, getSelectedObject, renderAvatar, setSpaceAvatar, get3DXObjects, setLibrary, getLibrary, disposeModel, renderInSpaceMediaScreen, goToPosition, goToParticipant, getNearestSweepFromObject, cancelModelPlacement, renderViewpointMarker, toggleViewpointVisibility, pauseVideo, playVideo, setVideoPlayback, setAnimationState, showMinimap, hideMinimap, getMapConfig, addTag, getTags, gotoTag, renderTag, disposeTag, disposeTags, getMpTags, getMpTag, showTags, attachTagMedia, detachTagMedia, moveTag, editTagLabel, editTagDescription, editTagStem, editTagIcon, editTagColor, saveTag, rotateCameraToObject, setModelVisibility, tagStateSubscriber, setTagIcon, setTagCategories, setUserAssignedCategories, getUserAssignedCategories, setTagMessageRecepients, getTagMessageRecepients, setTagMessages, getTagMessages, setSelectedTagUuid, getSelectedTagUuid, toggleFitToScreen, getFloors, getLabels, renderMeetingSidebar, createMeetingTemplate, joinMeetingTemplate, meet, dispatchSpaceEvent, subscribeSpaceEvent, unsubscribeSpaceEvent, registerCustomSpaceEvent, isMeetingInitialized, getMeetingParticipants, createMeeting, startMeeting, stopMeeting, generateMeetingURL, updateMeetingTitle, updateMeetingStart, updateMeetingStatus, updateMeetingSpace, getMeeting, getSpaceMeetings, isMeetingExists, isMeetingActive, initSocketIo, socketEmit, getParticipants, followParticipant, unFollowParticipant, enableHUD, disableHUD, getMediaScreenHUDs, canSetHud, saveMediaScreenHud, removeMediaScreenHud, enableFitScreen, disableFitScreen, initToolbarUI, convertToEuler };
|