architwin 1.10.23 → 1.11.1

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.
@@ -1,4 +1,7 @@
1
+ export declare let selectedOptionMap: string;
1
2
  export declare function renderGeneralSettingsMenu(): HTMLDivElement;
2
3
  export declare function initGeneralSelectedMap(): void;
3
4
  export declare function toggleGeneralMapOptions(): void;
5
+ export declare function setSelectedMap(id: string): void;
6
+ export declare function getSelectedMapOption(): string;
4
7
  export declare function displayGeneralSettingsMenu(): void;
@@ -1,7 +1,8 @@
1
- import { MAP_OPTIONS } from '../../../types';
1
+ import { MAP_OPTIONS, SPACE_EVENTS } from '../../../types';
2
+ import { dispatchSpaceEvent, getSpaceId } from '../../../architwin';
2
3
  import log from 'loglevel';
3
4
  import i18n from './i18n';
4
- let selectedOptionMap = '';
5
+ export let selectedOptionMap = MAP_OPTIONS.DEFAULT_MAP;
5
6
  export function renderGeneralSettingsMenu() {
6
7
  const element = document.createElement('div');
7
8
  element.classList.add('at_container');
@@ -13,7 +14,7 @@ export function renderGeneralSettingsMenu() {
13
14
  <div id="at-general-setting-container" class="at_flex at_flex_column">
14
15
  <div class="at_form_container">
15
16
  <div class="at_flex at_space_between">
16
- <span class="at_bolder at_text_base">${i18n.t('GeneralSettings')}</span>
17
+ <span class="at_bolder at_text_base">${i18n.t('General Settings')}</span>
17
18
  <span class="mdi mdi-close at_text_base" style="cursor:pointer" id="at-close-general-settings" target-pane="at-general-setting-pane"></span>
18
19
  </div>
19
20
 
@@ -27,17 +28,17 @@ export function renderGeneralSettingsMenu() {
27
28
  <div style="position:absolute;">
28
29
  <div class="at_dropdown_options" id="at-setting-map-filter-options" data-cy="at-setting-map-filter-options">
29
30
  <div class="at_dropdown_option" data-value="${MAP_OPTIONS.DEFAULT_MAP}" data-cy="at-setting-map-option-default" id="at-setting-map-option-default">
30
- <span>${i18n.t(MAP_OPTIONS.DEFAULT_MAP)}</span>
31
+ <span class="at_option">${i18n.t('Default Minimap')}</span>
31
32
  </div>
32
33
  <div class="at_dropdown_option" data-value="${MAP_OPTIONS.CUSTOM_MAP}" data-cy="at-setting-map-option-custom" id="at-setting-map-option-custom">
33
- <span>${i18n.t(MAP_OPTIONS.CUSTOM_MAP)}</span>
34
+ <span class="at_option">${i18n.t('Custom Minimap')}</span>
34
35
  </div>
35
36
  </div>
36
37
  </div>
37
38
  </div>
38
39
 
39
40
  <span class="at_text_xxs at_mx-w-16 mdi mdi-information-slab-circle" id="at-general-settings-note">
40
- ${i18n.t("Due to restrictions, original minimap is unavailable in password protected spaces. Please select and setup a custom minimap instead")}
41
+ ${i18n.t("Due to restrictions, original minimap is unavailable in password protected spaces. Please select and setup a custom minimap instead.")}
41
42
  </span>
42
43
  <div class="at_scrollable_container at_h-min-45"></div>
43
44
  </div>
@@ -48,8 +49,7 @@ export function renderGeneralSettingsMenu() {
48
49
  export function initGeneralSelectedMap() {
49
50
  log.info('initGeneralSelectedMap()');
50
51
  const selectedMap = document.getElementById('at-setting-selected-map');
51
- selectedMap.innerText = i18n.t(MAP_OPTIONS.DEFAULT_MAP);
52
- selectedOptionMap = MAP_OPTIONS.DEFAULT_MAP;
52
+ selectedMap.innerText = i18n.t(selectedOptionMap);
53
53
  }
54
54
  export function toggleGeneralMapOptions() {
55
55
  log.info('toggleGeneralMapOptions()');
@@ -57,35 +57,67 @@ export function toggleGeneralMapOptions() {
57
57
  const defaultOption = document.getElementById('at-setting-map-option-default');
58
58
  const customOption = document.getElementById('at-setting-map-option-custom');
59
59
  const mapOptions = document.getElementById('at-setting-map-filter-options');
60
+ const spaceId = getSpaceId(window.location.href);
60
61
  dropdown.addEventListener('click', () => {
61
62
  mapOptions.classList.toggle('open');
62
63
  defaultOption.addEventListener('click', () => {
63
64
  setSelectedMap(MAP_OPTIONS.DEFAULT_MAP);
65
+ const defaultPayload = {
66
+ minimap: {
67
+ type: MAP_OPTIONS.DEFAULT_MAP,
68
+ custom_floor_data: null
69
+ }
70
+ };
71
+ dispatchSpaceEvent(SPACE_EVENTS.MINIMAP_CHANGED, { space_id: spaceId, payload: defaultPayload });
64
72
  if (mapOptions.classList.contains('open')) {
65
73
  mapOptions.classList.toggle('close');
66
74
  }
67
75
  });
68
76
  customOption.addEventListener('click', () => {
69
77
  setSelectedMap(MAP_OPTIONS.CUSTOM_MAP);
78
+ const custom = {
79
+ minimap: {
80
+ type: MAP_OPTIONS.CUSTOM_MAP,
81
+ custom_floor_data: null
82
+ }
83
+ };
84
+ dispatchSpaceEvent(SPACE_EVENTS.MINIMAP_CHANGED, { space_id: spaceId, payload: custom });
70
85
  if (mapOptions.classList.contains('open')) {
71
86
  mapOptions.classList.toggle('close');
72
87
  }
73
88
  });
74
89
  });
75
90
  }
76
- function setSelectedMap(id) {
91
+ export function setSelectedMap(id) {
77
92
  log.info('setSelectedMap()');
78
93
  const selectedMap = document.getElementById('at-setting-selected-map');
79
94
  if (selectedMap && id) {
80
95
  if (id == MAP_OPTIONS.DEFAULT_MAP) {
81
- selectedMap.innerText = `${i18n.t('Default Map')}`;
96
+ selectedMap.innerText = `${i18n.t('Default Minimap')}`;
82
97
  selectedOptionMap = MAP_OPTIONS.DEFAULT_MAP;
98
+ log.info('initCustomMap ', selectedOptionMap);
83
99
  }
84
100
  else if (id == MAP_OPTIONS.CUSTOM_MAP) {
85
- selectedMap.innerText = `${i18n.t('Custom Map')}`;
101
+ selectedMap.innerText = `${i18n.t('Custom Minimap')}`;
86
102
  selectedOptionMap = MAP_OPTIONS.CUSTOM_MAP;
87
103
  }
104
+ log.info('initCustomMap ', selectedOptionMap);
105
+ getSelectedMapOption();
106
+ // during init()
88
107
  }
108
+ else if (!selectedMap && id) {
109
+ if (id == MAP_OPTIONS.DEFAULT_MAP) {
110
+ selectedOptionMap = `${i18n.t('Default Minimap')}`;
111
+ }
112
+ else if (id == MAP_OPTIONS.CUSTOM_MAP) {
113
+ selectedOptionMap = `${i18n.t('Custom Minimap')}`;
114
+ }
115
+ getSelectedMapOption();
116
+ }
117
+ }
118
+ export function getSelectedMapOption() {
119
+ log.info('getSelectedMapOption()');
120
+ return selectedOptionMap;
89
121
  }
90
122
  export function displayGeneralSettingsMenu() {
91
123
  log.info('displayGeneralSettingsMenu()');
@@ -164,7 +164,9 @@ i18n
164
164
  "Millimeter": "Millimeter",
165
165
  "Centimeter": "Centimeter",
166
166
  "PleaseWaitTagPlacement": "Please wait for the current tag to be placed before placing a new one",
167
- "RotateMinimap": "Rotate Minimap"
167
+ "RotateMinimap": "Rotate Minimap",
168
+ "General Settings": "General Settings",
169
+ "UploadImage": "Upload Image"
168
170
  }
169
171
  },
170
172
  ja: {
@@ -323,13 +325,14 @@ i18n
323
325
  "Millimeter": "ミリメートル",
324
326
  "Centimeter": "センチメートル",
325
327
  "PleaseWaitTagPlacement": "新しいタグを配置する前に、現在のタグが配置されるまでお待ちください。",
326
- "DEFAULT MINIMAP": "デフォルトミニマップ",
327
- "CUSTOM MINIMAP": "カスタムミニマップ",
328
- "GeneralSettings": "一般設定",
328
+ "Default Minimap": "デフォルトミニマップ",
329
+ "Custom Minimap": "カスタムミニマップ",
330
+ "General Settings": "一般設定",
329
331
  "BIM Settings": "BIM設定",
330
- "Due to restrictions, original minimap is unavailable in password protected spaces. Please select and setup a custom minimap instead": "制限事項により、パスワードで保護されたスペースではオリジナルのミニマップはご利用いただけません。代わりにカスタムミニマップを選択して設定してください。",
332
+ "Due to restrictions, original minimap is unavailable in password protected spaces. Please select and setup a custom minimap instead.": "制限事項により、パスワードで保護されたスペースではオリジナルのミニマップはご利用いただけません。代わりにカスタムミニマップを選択して設定してください。",
331
333
  "RotateMinimap": "ミニマップの回転",
332
- "Search...": "検索..."
334
+ "Search...": "検索...",
335
+ "UploadImage": "画像をアップロード"
333
336
  }
334
337
  }
335
338
  },
@@ -5,7 +5,6 @@ import { toggleActionBar } from "../../events";
5
5
  import { getAssetUrl } from "../../../utils";
6
6
  import { toggleBasepointCalibratePane } from "./basepointCalibratePane";
7
7
  import { toggleModelControl } from "./modelControlsPane";
8
- // import { generalSettingsMenuPane } from './generalSettingsMenuPane'
9
8
  export let activeMenu;
10
9
  export let isObjectListEnabled = true;
11
10
  export let isMeetingEnabled = false;
@@ -38,10 +37,6 @@ export function renderMenuBar(iFrame) {
38
37
  <span class="mdi mdi-map" id="at-minimap-btn" data-cy="at-minimap-btn" target-pane="at-map"></span>
39
38
  <div class="at_icon_tooltip" data-cy="at-tooltip-minimap">${i18n.t('Minimap')}</div>
40
39
  </div>
41
- <div class="at_sidebar_button_icon">
42
- <span class="mdi mdi-map" id="at-custom-minimap-btn" data-cy="at-custom-minimap-btn"></span>
43
- <div class="at_icon_tooltip" data-cy="at-tooltip-minimap">Custom Minimap</div>
44
- </div>
45
40
  <div class="at_sidebar_button_icon" style="display:${isMeetingEnabled ? 'block' : 'none'}">
46
41
  <span class="mdi mdi-message-video" id="at-videocall-btn" data-cy="at-videocall-btn" target-pane="at-video-call-pane"></span>
47
42
  <div class="at_icon_tooltip" data-cy="at-tooltip-meeting">${i18n.t('Meeting')}</div>
@@ -64,7 +59,7 @@ export function renderMenuBar(iFrame) {
64
59
  </div>
65
60
  <div class="at_sidebar_button_icon">
66
61
  <span class="mdi mdi-cog-outline" id="at-general-setting-btn" data-cy="at-general-setting-btn" target-pane="at-general-setting-pane"></span>
67
- <div class="at_icon_tooltip" data-cy="at-tooltip-general-setting">${i18n.t('GeneralSettings')}</div>
62
+ <div class="at_icon_tooltip" data-cy="at-tooltip-general-setting">${i18n.t('General Settings')}</div>
68
63
  </div>
69
64
  `;
70
65
  return menuBarElement;
@@ -103,7 +98,7 @@ function setMenuItemsStatus() {
103
98
  isBIMEnabled = _mpConfig.toolbarConfig.menuItems.bim;
104
99
  log.info("__@ isBIMEnabled: ", isBIMEnabled);
105
100
  }
106
- // THEME
101
+ // GENERAL SETTINGS
107
102
  if (menuItems.generalSetting !== undefined) {
108
103
  isThemeEnabled = _mpConfig.toolbarConfig.menuItems.generalSetting;
109
104
  log.info("__@ isGeneralSettingsEnabled: ", isGeneralSettingsEnabled);
@@ -127,7 +122,7 @@ export function setActiveMenu(id) {
127
122
  case 'at-theme-picker-btn':
128
123
  case 'at-room-creation-btn':
129
124
  case 'at-settings-btn':
130
- case 'general-setting':
125
+ case 'at-general-setting-btn':
131
126
  if (parent.classList.contains('at_sidebar_button_icon_active')) {
132
127
  // remove
133
128
  log.info("removing active...");
@@ -1,11 +1,12 @@
1
1
  import { convertMeasurement, degreesToRadians, radiansToDegrees, useCapitalizeFirstLetter } from "../../../utils";
2
- import { getSelectedObject, setObjectTransformation, get3DXObjects, _3DXObjects, isToolbarFeatureEnabled } from "../../../architwin";
2
+ import { getSelectedObject, setObjectTransformation, get3DXObjects, _mpConfig, _3DXObjects, isToolbarFeatureEnabled, actionHistory, transformHistory } from "../../../architwin";
3
3
  import { COORDINATE_SYSTEM, UNITS } from "../../../types";
4
4
  import { convertZupToYup, convertYupToZup, getOffsetPositionFromBasepoint, convertYupScaleToZupScale, convertZupScaleToYupScale } from "../../../worldConversion";
5
5
  import { getScaleFactor, getMeasurementUnit, getBasepoint, getCoordinateSystem, isAdjust, getMPBasepoint, getRotationUnit } from "./actionSettingsPane";
6
6
  import { Notyf } from 'notyf';
7
7
  import log from 'loglevel';
8
8
  import i18n from "./i18n";
9
+ import { toggleActionBarButtons } from "../../components/toolbar";
9
10
  let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500 });
10
11
  export let activeModelControlPane = false;
11
12
  export let modelControlPane;
@@ -213,7 +214,7 @@ export function getCoordinateValues() {
213
214
  y: parseFloat(inputY.value),
214
215
  z: parseFloat(inputZ.value)
215
216
  };
216
- log.info("___caroline formcoords xyz: ", formCoords);
217
+ log.info("___formcoords xyz: ", formCoords);
217
218
  let mpPosition;
218
219
  let mpRotation;
219
220
  let mpScale;
@@ -288,6 +289,24 @@ export function getCoordinateValues() {
288
289
  transform.object_position = transformType === 'translate' ? mpPosition : selectedObject.node.position;
289
290
  transform.object_scale = transformType === 'scale' ? mpScale : selectedObject.node.scale;
290
291
  transform.object_rotation = transformType === 'rotate' ? mpRotation : selectedObject.object.object_rotation;
292
+ console.log("caroline input transform", transform, formCoords);
293
+ if (transform && formCoords) {
294
+ console.log("caroline input undo coordinates", transform, formCoords);
295
+ setObjectTransformation(selectedObject.node, transform);
296
+ //Add to the action history so it can be reverse with undo or redo
297
+ console.log("caroline input undo test", formCoords);
298
+ const currentTransform = JSON.stringify(formCoords);
299
+ if (currentTransform) {
300
+ console.log("caroline input current transform", transform, currentTransform);
301
+ actionHistory.push(currentTransform);
302
+ // @ts-expect-error
303
+ transformHistory.addAction(selectedObject.object.id, transform.object_position, transform.object_rotation, transform.object_scale);
304
+ }
305
+ if (_mpConfig.toolbarConfig) {
306
+ toggleActionBarButtons('at-redo-action-btn', transformHistory.canRedo(selectedObject.object.id));
307
+ toggleActionBarButtons('at-undo-action-btn', transformHistory.canUndo(selectedObject.object.id));
308
+ }
309
+ }
291
310
  console.log("getCoordinateValues rotation quaternion values", selectedObject.node.quaternion);
292
311
  return transform;
293
312
  }
@@ -924,7 +943,6 @@ function updateObjectViaInput() {
924
943
  // }
925
944
  if ((inputX && inputY && inputZ)) {
926
945
  const transform = getCoordinateValues();
927
- console.log("JAMES transform", transform);
928
946
  const selectedObject = getSelectedObject();
929
947
  setObjectTransformation(selectedObject.node, transform);
930
948
  if (transformType == 'translate') {
@@ -11,7 +11,7 @@ import { actionBar, renderObjectCards, renderLibraryCards, renderTags, renderTag
11
11
  import { getTargetPosition, addMediaScreen, _3DXObjects, selectedObject, setTransformControls, copyObject, revertTransform, clearSelectedObject, removeTransformControls, getLibrary, getMpTags, renderTag, captureSpaceScreenshot, moveTag, subscribeSpaceEvent, setModelVisibility, disposeModel, disposeTag, _tags, _tagCategories, dispatchSpaceEvent, editTagLabel, editTagDescription, setTagMessageRecepients, setTagMessages, setSelectedTagUuid, renderMeetingSidebar, setTagIcon, setObjectTransformation, getSelectedObject, _atwin, isCdnMapDataAvailable, captureScreenshotAndCameraDetails, _mpConfig, cancelModelPlacement, _modelDetails, actionHistory, get3DXObjects, transformHistory, goToModel, themeManager, _partitionNodes, setSpacePartitionNodes, getSpaceId, setFloorBaseHeight, toggleWallVisibility, getChildrenOfModel, toggleFloorVisibility, renderPolygon, getCurrentPolygon, getFloorBaseHeight, setSelectedObject, redoDrawAction, undoDrawAction, setWallBaseHeight, clearWallBaseHeight, clearFloorBaseHeight, isToolbarFeatureEnabled, captureCurrentView, getCurrentFloor, } from "../architwin";
12
12
  import { Notyf } from 'notyf';
13
13
  import 'notyf/notyf.min.css';
14
- import { SPACE_EVENTS, COORDINATE_SYSTEM, UNITS } from "../types";
14
+ import { SPACE_EVENTS, COORDINATE_SYSTEM, UNITS, DEGREE, MAP_OPTIONS } from "../types";
15
15
  import { initFormData } from "./components/toolbar/tagFormPane";
16
16
  import { renderObjectList } from "./components/toolbar/objectListPane";
17
17
  import { renderLibraryList } from "./components/toolbar/libraryPane";
@@ -27,7 +27,7 @@ import { getCurrentEditRoomData, displayRoomTree, updatePartitionVisibilityUI, g
27
27
  import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setCurrentPartitionData, getTempCurrentPolygon, clearTempCurrentPolygon } from "./components/toolbar/spacePartition/roomFormPane";
28
28
  import { actionSettingsSelectOption, getTempCoordinateSystem, getTempMeasurementUnit, getTempRotationUnit, setCoordinateSystem, setMeasurementUnit, setRotationUnit, initSettingsValues, setTempCoordinateSystem, setTempMeasurementUnit, setTempRotationUnit, toggleActionSettingsDropdown, toggleCalibrateBasepoint, setScaleFactor, getTempScaleFactor, setTempScaleFactor, setBasepoint, getTempBasepoint, setTempBasepoint, getBasepoint, toggleActionSettings, getBasepointObjectPayload, displayConvertedCoordinates, getCoordinateSystem, getScaleFactor, getMeasurementUnit, getRotationUnit, setBasepointObjectPayload } from "./components/toolbar/actionSettingsPane";
29
29
  import { getBasepointCalibrateBpCoordinateValues, getBasepointCalibrateMpCoordinateValues, initBsepointCalibratePane, toggleBasepointCalibratePane } from "./components/toolbar/basepointCalibratePane";
30
- import { toggleGeneralMapOptions, initGeneralSelectedMap } from './components/toolbar/generalSettingsMenuPane';
30
+ import { toggleGeneralMapOptions, initGeneralSelectedMap, getSelectedMapOption } from './components/toolbar/generalSettingsMenuPane';
31
31
  import { searchTagList, setSearchTagTerm, searchClearfield, getSearchTagTerm } from './components/toolbar/tagListPane';
32
32
  let activeToolbarItem, activeActionItem, activePane, activeActionPane, cancelTagPlacementPrompt, cancelModelPlacementPrompt;
33
33
  let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500, types: [
@@ -253,6 +253,7 @@ function toggleDisplayPane(targetId) {
253
253
  if (paneId === 'at-general-setting-pane') {
254
254
  log.info("General Settings Pane");
255
255
  initGeneralSelectedMap();
256
+ handleCloseActiveMinimap();
256
257
  }
257
258
  return;
258
259
  }
@@ -338,6 +339,7 @@ function setupIndividualEventListeners() {
338
339
  handleShowCustomMinimapSettings();
339
340
  handleCloseCustomMinimap();
340
341
  handleCustomMapControls();
342
+ handleCloseActiveMinimap();
341
343
  }
342
344
  //================ OBJECT EVENT HANDLERS ===============//
343
345
  function handleTranslateObject() {
@@ -1064,7 +1066,19 @@ function handleDeleteModel(objId) {
1064
1066
  });
1065
1067
  }
1066
1068
  function handleShowMinimap() {
1067
- log.info("handleShowMinimap()");
1069
+ log.info("handleShowMinimap()", getSelectedMapOption());
1070
+ const selectedMapOption = getSelectedMapOption();
1071
+ if (selectedMapOption == MAP_OPTIONS.DEFAULT_MAP) {
1072
+ log.info("Default Minimap: ", selectedMapOption == MAP_OPTIONS.DEFAULT_MAP);
1073
+ handleShowDefaultMinimap();
1074
+ }
1075
+ else if (selectedMapOption == MAP_OPTIONS.CUSTOM_MAP) {
1076
+ log.info("Custom Minimap: ", selectedMapOption == MAP_OPTIONS.CUSTOM_MAP);
1077
+ handleShowCustomMinimap();
1078
+ }
1079
+ }
1080
+ function handleShowDefaultMinimap() {
1081
+ log.info("handleShowDefaultMinimap()");
1068
1082
  if (isCdnMapDataAvailable) {
1069
1083
  const map = document.getElementById('at-map');
1070
1084
  const style = window.getComputedStyle(map);
@@ -2489,6 +2503,8 @@ function handleShowCustomMinimap() {
2489
2503
  if (customMapPane) {
2490
2504
  if (customMapPane.style.display === "none") {
2491
2505
  log.info("Showing custom minimap");
2506
+ minimap.mapPositions.forEach(position => customMapPane.classList.remove(position));
2507
+ customMapPane.classList.add(minimap.getMinimapPosition());
2492
2508
  customMapPane.style.display = 'block';
2493
2509
  minimap.showDirection();
2494
2510
  }
@@ -2505,15 +2521,21 @@ function handleShowCustomMinimapSettings() {
2505
2521
  log.info("handleCustomMinimapSettingsToggle()");
2506
2522
  const settingsBtn = document.getElementById('at-custom-map-settings-btn');
2507
2523
  const mapControlsContainer = document.getElementById('at-custom-minimap-settings');
2524
+ const minimapPane = document.getElementById('at-custom-minimap-pane');
2508
2525
  if (settingsBtn) {
2509
2526
  settingsBtn.addEventListener('click', () => {
2510
2527
  isCustomMapControlsVisible = !isCustomMapControlsVisible;
2511
2528
  if (mapControlsContainer) {
2512
2529
  if (isCustomMapControlsVisible) {
2513
2530
  mapControlsContainer.classList.add('show');
2531
+ minimapPane.classList.add('show-settings');
2514
2532
  }
2515
2533
  else {
2516
2534
  mapControlsContainer.classList.remove('show');
2535
+ if (minimap.getMinimapPosition().includes('bottom')) {
2536
+ minimapPane.classList.add('no-transition');
2537
+ }
2538
+ minimapPane.classList.remove('show-settings');
2517
2539
  }
2518
2540
  }
2519
2541
  });
@@ -2529,15 +2551,23 @@ function handleCloseCustomMinimap() {
2529
2551
  if (closeBtn) {
2530
2552
  closeBtn.addEventListener('click', () => {
2531
2553
  customMapPane.style.display = 'none';
2554
+ setActiveMenu('at-minimap-btn');
2532
2555
  });
2533
2556
  }
2534
2557
  }
2558
+ /**
2559
+ * Closes General Settings Menu
2560
+ */
2535
2561
  function handleCloseGeneralSettingsMenu() {
2536
2562
  const closeGeneralSettingsButton = document.getElementById('at-close-general-settings');
2537
2563
  log.info('handleCloseGeneralSettingsMenu()');
2538
2564
  if (closeGeneralSettingsButton) {
2539
2565
  closeGeneralSettingsButton.addEventListener('click', () => {
2540
2566
  toggleDisplayPane('at-close-general-settings');
2567
+ const activeElement = document.querySelector('.at_sidebar_button_icon_active');
2568
+ if (activeElement) {
2569
+ activeElement.classList.remove("at_sidebar_button_icon_active");
2570
+ }
2541
2571
  });
2542
2572
  }
2543
2573
  }
@@ -2547,6 +2577,8 @@ function handleCloseGeneralSettingsMenu() {
2547
2577
  */
2548
2578
  function handleCustomMapControls() {
2549
2579
  log.info("handleCustomMinimapSettingsToggle()");
2580
+ // Upload image
2581
+ handleUploadMinimapImage();
2550
2582
  // Screenshot button
2551
2583
  handleScreenshotMinimap();
2552
2584
  // Rotate minimap button
@@ -2561,6 +2593,7 @@ function handleScreenshotMinimap() {
2561
2593
  log.info("handleScreenshotMinimap()");
2562
2594
  const screenshotBtn = document.getElementById('at-custom-screenshot-btn');
2563
2595
  const customMapImage = document.getElementById('at-custom-map-img');
2596
+ const fileInput = document.getElementById('at-custom-image-input');
2564
2597
  if (screenshotBtn) {
2565
2598
  // Screenshot minimap event listener
2566
2599
  screenshotBtn.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
@@ -2573,13 +2606,23 @@ function handleScreenshotMinimap() {
2573
2606
  // Change the img src to the screenshot (base64 string)
2574
2607
  customMapImage.src = imageURI;
2575
2608
  customMapImage.style.display = 'block';
2576
- showLoader(false);
2609
+ customMapImage.classList.remove('at_rotate-90', 'at_rotate-180', 'at_rotate-270', 'at_rotate-360');
2610
+ minimap.setCustomMinimapRotation(DEGREE.DEG_0);
2611
+ customMapImage.classList.add(`at_rotate-${360}`);
2612
+ dispatchSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_ROTATED, DEGREE.DEG_0);
2613
+ let customMapFloorData = minimap.getCustomMapFloorData();
2577
2614
  const currentFloor = getCurrentFloor();
2615
+ if (Array.isArray(customMapFloorData)) {
2616
+ customMapFloorData[currentFloor.sequence].rotate = DEGREE.DEG_0;
2617
+ }
2618
+ dispatchSpaceEvent(SPACE_EVENTS.CUSTOM_MAP_SETTINGS_UPDATED, customMapFloorData);
2619
+ showLoader(false);
2578
2620
  dispatchSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_SELECTED, {
2579
2621
  imageURI,
2580
2622
  name: `${_modelDetails.name}-${currentFloor.name}-${currentFloor.sequence}.jpg`,
2581
2623
  currentFloor: currentFloor.sequence
2582
2624
  });
2625
+ fileInput.value = ''; // to reset uploaded image
2583
2626
  }
2584
2627
  catch (error) {
2585
2628
  log.error('Screenshot failed', error);
@@ -2828,12 +2871,104 @@ function handleCustomMapFloorImageUploaded(payload) {
2828
2871
  };
2829
2872
  minimap.setCustomMapFloorData(floorData);
2830
2873
  }
2874
+ const updatedFloorData = minimap.getCustomMapFloorData();
2875
+ dispatchSpaceEvent(SPACE_EVENTS.CUSTOM_MAP_SETTINGS_UPDATED, updatedFloorData);
2831
2876
  notyf.success("Saved custom floor image");
2832
2877
  }
2833
2878
  }
2834
2879
  function handleCustomMapFloorUploadFailed() {
2835
2880
  notyf.error("Failed to upload custom floor image. Please try again later");
2836
2881
  }
2882
+ function handleUploadMinimapImage() {
2883
+ log.info('handleUploadMinimapImage()');
2884
+ const uploadImageBtn = document.getElementById('at-custom-upload-image-btn');
2885
+ const fileInput = document.getElementById('at-custom-image-input');
2886
+ const customMapImage = document.getElementById('at-custom-map-img');
2887
+ if (uploadImageBtn && fileInput && customMapImage) {
2888
+ uploadImageBtn.addEventListener('click', () => {
2889
+ log.info('Upload button clicked');
2890
+ fileInput.click();
2891
+ });
2892
+ fileInput.addEventListener('change', (event) => __awaiter(this, void 0, void 0, function* () {
2893
+ var _a;
2894
+ log.info('File input change');
2895
+ const target = event.target;
2896
+ const file = (_a = target.files) === null || _a === void 0 ? void 0 : _a[0];
2897
+ if (file) {
2898
+ const MAX_SIZE = 2.5 * 1024 * 1024; // 2.5MB in bytes
2899
+ if (file.size > MAX_SIZE) {
2900
+ notyf.error(i18n.t('FileTooBig'));
2901
+ log.warn(`Upload failed: image is ${file.size} bytes`);
2902
+ fileInput.value = '';
2903
+ return;
2904
+ }
2905
+ try {
2906
+ showLoader(true);
2907
+ customMapImage.style.display = 'none';
2908
+ const reader = new FileReader();
2909
+ reader.onload = (e) => __awaiter(this, void 0, void 0, function* () {
2910
+ var _b;
2911
+ const imageURI = (_b = e.target) === null || _b === void 0 ? void 0 : _b.result;
2912
+ // Set image preview
2913
+ customMapImage.src = imageURI;
2914
+ customMapImage.style.display = 'block';
2915
+ customMapImage.classList.remove('at_rotate-90', 'at_rotate-180', 'at_rotate-270', 'at_rotate-360');
2916
+ minimap.setCustomMinimapRotation(DEGREE.DEG_0);
2917
+ customMapImage.classList.add(`at_rotate-${360}`);
2918
+ dispatchSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_ROTATED, DEGREE.DEG_0);
2919
+ let customMapFloorData = minimap.getCustomMapFloorData();
2920
+ const currentFloor = getCurrentFloor();
2921
+ if (Array.isArray(customMapFloorData)) {
2922
+ customMapFloorData[currentFloor.sequence].rotate = DEGREE.DEG_0;
2923
+ }
2924
+ dispatchSpaceEvent(SPACE_EVENTS.CUSTOM_MAP_SETTINGS_UPDATED, customMapFloorData);
2925
+ showLoader(false);
2926
+ dispatchSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_SELECTED, {
2927
+ imageURI,
2928
+ name: `${_modelDetails.name}-${currentFloor.name}-${currentFloor.sequence}.jpg`,
2929
+ currentFloor: currentFloor.sequence
2930
+ });
2931
+ });
2932
+ reader.readAsDataURL(file);
2933
+ }
2934
+ catch (error) {
2935
+ log.error('Image upload failed', error);
2936
+ showLoader(false);
2937
+ }
2938
+ }
2939
+ }));
2940
+ }
2941
+ }
2942
+ // This closes active Default/Custom Minimap when General Settings is active
2943
+ function handleCloseActiveMinimap() {
2944
+ log.info('handleCloseActiveMinimap()');
2945
+ const defaultMinimap = document.getElementById('at-map');
2946
+ const customMapPane = document.getElementById('at-custom-minimap-pane');
2947
+ const generalSettingBtn = document.getElementById('at-general-setting-btn');
2948
+ const generalSetting = document.getElementById('at-general-setting-pane');
2949
+ if (generalSettingBtn) {
2950
+ generalSettingBtn.addEventListener('click', () => {
2951
+ const activeElement = document.querySelector('.at_sidebar_button_icon_active');
2952
+ if (customMapPane.style.display == "block") {
2953
+ log.info("Hiding custom minimap");
2954
+ customMapPane.style.display = 'none';
2955
+ }
2956
+ if (defaultMinimap.style.display == "block") {
2957
+ log.info("Hiding default minimap");
2958
+ defaultMinimap.style.display = 'none';
2959
+ }
2960
+ if (activeElement == null && generalSetting.style.display == 'block') {
2961
+ setActiveMenu('at-general-setting-btn');
2962
+ }
2963
+ else if (activeElement != null && generalSetting.style.display == 'block') {
2964
+ setActiveMenu('at-general-setting-btn');
2965
+ }
2966
+ else {
2967
+ activeElement.classList.remove("at_sidebar_button_icon_active");
2968
+ }
2969
+ });
2970
+ }
2971
+ }
2837
2972
  export {
2838
2973
  //state
2839
2974
  activeToolbarItem, activeActionItem, cancelModelPlacementPrompt, isCustomMapControlsVisible,
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { batchAddEventListenerByClassName, batchAddEventListenerById, setActiveToolbarItem, toggleDisplayPane, toggleActionBar, setupIndividualEventListeners, setupSpaceEventSubscriptions, handleShowMinimap, handleRenderMeetingUI, handleShowCustomMinimap } from './events';
10
+ import { batchAddEventListenerByClassName, batchAddEventListenerById, setActiveToolbarItem, toggleDisplayPane, toggleActionBar, setupIndividualEventListeners, setupSpaceEventSubscriptions, handleShowMinimap, handleRenderMeetingUI } from './events';
11
11
  import '../../static/atwinui.css';
12
12
  import { renderToolbarUI, setActiveMenu, setActiveActionBtn, setActiveThemeCard, toggleModelControl, toggleModal, setModalAction, toggleActionBarButtons } from './components/toolbar';
13
13
  import { SPACE_EVENTS } from '../types';
@@ -56,12 +56,6 @@ function initToolbarUI(payload) {
56
56
  }
57
57
  else if (event.target.id === 'at-videocall-btn') {
58
58
  handleRenderMeetingUI();
59
- //@ts-ignore
60
- }
61
- else if (event.target.id === 'at-custom-minimap-btn') {
62
- handleShowCustomMinimap();
63
- //@ts-ignore
64
- setActiveMenu(event.target.id);
65
59
  }
66
60
  else {
67
61
  //@ts-expect-error
package/lib/minimap.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { MpSdk } from "../bundle/sdk";
2
- import { ISweep, SweepColor, DEGREE, MAP_OPTIONS, CustomMapFloorData } from "./types";
2
+ import { ISweep, SweepColor, DEGREE, CustomMapFloorData } from "./types";
3
3
  import 'notyf/notyf.min.css';
4
4
  declare let isMinimapNavigation: boolean;
5
5
  interface FloorData {
@@ -7,13 +7,14 @@ interface FloorData {
7
7
  label: string;
8
8
  sequence: number;
9
9
  }
10
+ declare const mapPositions: string[];
10
11
  declare function setMap(mpSdk: MpSdk, appKey: string, mapId: string, openOnLoad?: boolean): Promise<void>;
11
12
  declare function locateAvatar(): Promise<void>;
12
13
  declare function showMinimap(): void;
13
14
  declare function hideMinimap(): void;
14
15
  declare function resetSweepMarkerColors(): void;
15
16
  declare function renderOverlaySweep(item: ISweep, socketId: string, color: string): void;
16
- declare function showDirection(mapType?: MAP_OPTIONS): void;
17
+ declare function showDirection(): void;
17
18
  /**
18
19
  * Toggles the visibility of the minimap. This will display a toast notification if the CDN is unavailable or has not
19
20
  * finished fetching map data
@@ -49,7 +50,7 @@ declare function createDropdown(mapPositions: string[]): Promise<HTMLDivElement>
49
50
  * Sets Minimap Position anywhere inside Space as selected by User
50
51
  * @param position Accepts a string (bottomLeft/bottomRight/topRight/topLeft)
51
52
  * */
52
- declare function setMinimapPosition(position: string): Promise<void>;
53
+ declare function setMinimapPosition(mapContainer: HTMLElement, position: string): Promise<void>;
53
54
  /**
54
55
  * Creates and returns a custom minimap DOM element containing a canvas.
55
56
  * @returns {HTMLDivElement} The custom minimap element.
@@ -95,6 +96,7 @@ declare function setCustomMapXOffset(xOffset: number): void;
95
96
  declare function getCustomMapXOffset(): number;
96
97
  declare function setCustomMapYOffset(yOffset: number): void;
97
98
  declare function getCustomMapYOffset(): number;
99
+ declare function getMinimapPosition(): string;
98
100
  /**
99
101
  * Sets an individual or entire floor data array of custom minimap
100
102
  * @param payload
@@ -110,4 +112,4 @@ declare function getCustomMapFloorData(index?: number): CustomMapFloorData[] | C
110
112
  * Resets the custom map setting to its defaults values
111
113
  */
112
114
  declare function resetCustomMapSettingValues(): void;
113
- export { isMinimapNavigation, setMap, showMinimap, hideMinimap, locateAvatar, resetSweepMarkerColors, renderOverlaySweep, showDirection, toggleMinimapVisibility, setSweepMarkerColor, setStandaloneMap, toggleMinimapFloor, getFloorsInSpace, createDropdown, setMinimapPosition, setCustomMap, setupCustomMinimapPane, setCustomMinimapRotation, getCustomMinimapRotation, generateCustomMinimap, setCustomMapScale, setCustomMapTranslate, setCustomMapXOffset, setCustomMapYOffset, getCustomMapScale, getCustomMapTranslate, getCustomMapXOffset, getCustomMapYOffset, setMinAndMax, setCustomMapFloorData, getCustomMapFloorData, resetCustomMapSettingValues };
115
+ export { isMinimapNavigation, mapPositions, setMap, showMinimap, hideMinimap, locateAvatar, resetSweepMarkerColors, renderOverlaySweep, showDirection, toggleMinimapVisibility, setSweepMarkerColor, setStandaloneMap, toggleMinimapFloor, getFloorsInSpace, createDropdown, setMinimapPosition, setCustomMap, setupCustomMinimapPane, setCustomMinimapRotation, getCustomMinimapRotation, generateCustomMinimap, setCustomMapScale, setCustomMapTranslate, setCustomMapXOffset, setCustomMapYOffset, getCustomMapScale, getCustomMapTranslate, getCustomMapXOffset, getCustomMapYOffset, setMinAndMax, setCustomMapFloorData, getCustomMapFloorData, resetCustomMapSettingValues, getMinimapPosition, };