architwin 1.6.8 → 1.6.9
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/atwinui/events.js +3 -0
- package/lib/map.js +1 -2
- package/lib/minimap.d.ts +12 -1
- package/lib/minimap.js +73 -1
- package/package.json +1 -1
- package/static/map.css +4 -2
package/lib/atwinui/events.js
CHANGED
|
@@ -906,15 +906,18 @@ function handleShowMinimap() {
|
|
|
906
906
|
if (isCdnMapDataAvailable) {
|
|
907
907
|
const map = document.getElementById('at-map');
|
|
908
908
|
const style = window.getComputedStyle(map);
|
|
909
|
+
const dropdown = document.getElementById('at-map-dropdown');
|
|
909
910
|
log.info("Minimap width", style.display);
|
|
910
911
|
if (style.display === "none") {
|
|
911
912
|
log.info("Showing minimap");
|
|
912
913
|
map.style.display = 'block';
|
|
914
|
+
dropdown.style.display = 'block';
|
|
913
915
|
minimap.showDirection();
|
|
914
916
|
}
|
|
915
917
|
else {
|
|
916
918
|
log.info("Hiding minimap");
|
|
917
919
|
map.style.display = 'none';
|
|
920
|
+
dropdown.style.display = 'none';
|
|
918
921
|
}
|
|
919
922
|
}
|
|
920
923
|
else {
|
package/lib/map.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//import { _mpSdk } from './architwin'
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -34,7 +33,7 @@ export function setMap() {
|
|
|
34
33
|
var yOffset = newHeight < canvas.height ? ((canvas.height - newHeight) / 2) : 0;
|
|
35
34
|
canvasContext.drawImage(img, xOffset, yOffset, newWidth, newHeight);
|
|
36
35
|
// sweepToMap()
|
|
37
|
-
// sweeps.map((swp)=> sweepToMap(swp));
|
|
36
|
+
// sweeps.map((swp)=> sweepToMap(swp));
|
|
38
37
|
};
|
|
39
38
|
});
|
|
40
39
|
}
|
package/lib/minimap.d.ts
CHANGED
|
@@ -39,4 +39,15 @@ declare function getFloorsInSpace(): FloorData[];
|
|
|
39
39
|
* @returns
|
|
40
40
|
*/
|
|
41
41
|
declare function setStandaloneMap(modelId: string, appKey: string, mapId: string): Promise<void>;
|
|
42
|
-
|
|
42
|
+
/**
|
|
43
|
+
* This function creates the dropdown (HTLMElement) for available positions that Minimap can be set
|
|
44
|
+
* @param options An array of strings representing the minimap positions (e.g., 'topLeft','bottomRight').
|
|
45
|
+
* @returns HTLMElement with the specified position options.
|
|
46
|
+
*/
|
|
47
|
+
declare function createDropdown(options: string[]): Promise<HTMLDivElement>;
|
|
48
|
+
/**
|
|
49
|
+
* Sets Minimap Position anywhere inside Space as selected by User
|
|
50
|
+
* @param position Accepts a string (bottomLeft/bottomRight/topRight/topLeft)
|
|
51
|
+
* */
|
|
52
|
+
declare function setMinimapPosition(position: string): Promise<void>;
|
|
53
|
+
export { isMinimapNavigation, setMap, showMinimap, hideMinimap, locateAvatar, resetSweepMarkerColors, renderOverlaySweep, showDirection, toggleMinimapVisibility, setSweepMarkerColor, setStandaloneMap, toggleMinimapFloor, getFloorsInSpace, createDropdown, setMinimapPosition };
|
package/lib/minimap.js
CHANGED
|
@@ -124,31 +124,42 @@ function setMap(mpSdk, appKey, mapId, openOnLoad) {
|
|
|
124
124
|
// Render Minimap
|
|
125
125
|
_mapContainer = document.getElementById(mapId);
|
|
126
126
|
_mapBox = _mapContainer.parentNode;
|
|
127
|
+
// Setup minimap position dropdown
|
|
128
|
+
_mapBox.setAttribute('id', 'at-map-box');
|
|
129
|
+
const dropDownElement = yield createDropdown(mapPositions);
|
|
130
|
+
_mapBox.insertBefore(dropDownElement, _mapBox.firstChild);
|
|
127
131
|
// Apply custom values from mapConfig
|
|
128
132
|
if (_mpConfig.mapConfig) {
|
|
129
133
|
if (_mpConfig.mapConfig.position && mapPositions.includes(_mpConfig.mapConfig.position)) {
|
|
130
134
|
log.info("Setting map position to ", _mpConfig.mapConfig.position);
|
|
131
135
|
_mapBox.classList.add(_mpConfig.mapConfig.position);
|
|
136
|
+
log.info("This is log from minimap.ts, first if");
|
|
132
137
|
}
|
|
133
138
|
else {
|
|
134
139
|
//Set map to top right if no custom position is set
|
|
135
140
|
log.warn("Empty or invalid map position passed, defaulting to topRight");
|
|
136
141
|
_mapBox.classList.add('topRight');
|
|
142
|
+
log.info("This is log from minimap.ts, inside else");
|
|
137
143
|
}
|
|
138
144
|
}
|
|
145
|
+
// show minimap position dropdown
|
|
146
|
+
const dropdown = document.getElementById('at-map-dropdown');
|
|
139
147
|
//show map config
|
|
140
148
|
if (_mpConfig.mapConfig) {
|
|
141
149
|
if (_mpConfig.mapConfig.isShow) {
|
|
142
150
|
log.info("Showing minimap at default..");
|
|
143
151
|
_mapContainer.style.display = 'block';
|
|
152
|
+
dropdown.style.display = 'block';
|
|
144
153
|
}
|
|
145
154
|
else {
|
|
146
155
|
log.info("Hiding minimap at default..");
|
|
147
156
|
_mapContainer.style.display = 'none';
|
|
157
|
+
dropdown.style.display = 'none';
|
|
148
158
|
}
|
|
149
159
|
}
|
|
150
160
|
else {
|
|
151
161
|
_mapContainer.style.display = 'block';
|
|
162
|
+
dropdown.style.display = 'block';
|
|
152
163
|
}
|
|
153
164
|
if (_mpConfig.mapConfig && _mpConfig.mapConfig.fixedSized) {
|
|
154
165
|
//If there is a fixed width of the map and we do not want the hover to expand effect. We update the CSS variable
|
|
@@ -507,14 +518,17 @@ function toggleMinimapVisibility() {
|
|
|
507
518
|
if (isCdnMapDataAvailable) {
|
|
508
519
|
const minimap = document.getElementById('at-map');
|
|
509
520
|
const style = window.getComputedStyle(minimap);
|
|
521
|
+
const dropdown = document.getElementById('at-map-dropdown');
|
|
510
522
|
log.info("Minimap width", style.display);
|
|
511
523
|
if (style.display === "none") {
|
|
512
524
|
log.info("Showing minimap");
|
|
513
525
|
minimap.style.display = 'block';
|
|
526
|
+
dropdown.style.display = 'block';
|
|
514
527
|
}
|
|
515
528
|
else {
|
|
516
529
|
log.info("Hiding minimap");
|
|
517
530
|
minimap.style.display = 'none';
|
|
531
|
+
dropdown.style.display = 'none';
|
|
518
532
|
}
|
|
519
533
|
}
|
|
520
534
|
else {
|
|
@@ -849,6 +863,64 @@ function setStandaloneMap(modelId, appKey, mapId) {
|
|
|
849
863
|
toggleSweepMarkerFloors(0);
|
|
850
864
|
});
|
|
851
865
|
}
|
|
866
|
+
/**
|
|
867
|
+
* This function creates the dropdown (HTLMElement) for available positions that Minimap can be set
|
|
868
|
+
* @param options An array of strings representing the minimap positions (e.g., 'topLeft','bottomRight').
|
|
869
|
+
* @returns HTLMElement with the specified position options.
|
|
870
|
+
*/
|
|
871
|
+
function createDropdown(options) {
|
|
872
|
+
var _a;
|
|
873
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
874
|
+
const element = document.createElement('div');
|
|
875
|
+
element.classList.add('at_flex', 'at_justify_end');
|
|
876
|
+
log.info('createDropdown');
|
|
877
|
+
const dropdown = document.createElement('select');
|
|
878
|
+
dropdown.classList.add('at_dropdown');
|
|
879
|
+
dropdown.setAttribute('id', 'at-map-dropdown');
|
|
880
|
+
options.forEach(optionText => {
|
|
881
|
+
const option = document.createElement('option');
|
|
882
|
+
option.value = optionText;
|
|
883
|
+
option.textContent = optionText.replace(/([A-Z])/g, ' $1').trim().toUpperCase();
|
|
884
|
+
dropdown.appendChild(option);
|
|
885
|
+
});
|
|
886
|
+
dropdown.value = (_a = _mpConfig.mapConfig.position) !== null && _a !== void 0 ? _a : 'bottomRight';
|
|
887
|
+
dropdown.addEventListener('change', () => {
|
|
888
|
+
const selectedValue = dropdown.value;
|
|
889
|
+
log.info('addEvent: ', selectedValue);
|
|
890
|
+
mapPositions.forEach(position => _mapBox.classList.remove(position));
|
|
891
|
+
setMinimapPosition(selectedValue);
|
|
892
|
+
});
|
|
893
|
+
element.appendChild(dropdown);
|
|
894
|
+
return element;
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Sets Minimap Position anywhere inside Space as selected by User
|
|
899
|
+
* @param position Accepts a string (bottomLeft/bottomRight/topRight/topLeft)
|
|
900
|
+
* */
|
|
901
|
+
function setMinimapPosition(position) {
|
|
902
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
903
|
+
log.info('Selected Minimap Position: ', position);
|
|
904
|
+
if (position) {
|
|
905
|
+
log.info("Setting map position to ", position);
|
|
906
|
+
_mapBox.classList.add(position);
|
|
907
|
+
log.info("This is log from minimap.ts, first if");
|
|
908
|
+
}
|
|
909
|
+
else {
|
|
910
|
+
if (_mpConfig.mapConfig.position) {
|
|
911
|
+
//Set map to top right if no custom position is set
|
|
912
|
+
log.warn("Empty or invalid map position passed, defaulting to mapConfig");
|
|
913
|
+
_mapBox.classList.add(_mpConfig.mapConfig.position);
|
|
914
|
+
log.info("This is log from minimap.ts, inside else");
|
|
915
|
+
}
|
|
916
|
+
else {
|
|
917
|
+
log.warn("Empty or invalid map position passed, defaulting to mapConfig");
|
|
918
|
+
_mapBox.classList.add('bottomRight');
|
|
919
|
+
log.info("This is log from minimap.ts, inside else");
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
}
|
|
852
924
|
export {
|
|
853
925
|
// _miniMapData as minimapData,
|
|
854
|
-
isMinimapNavigation, setMap, showMinimap, hideMinimap, locateAvatar, resetSweepMarkerColors, renderOverlaySweep, showDirection, toggleMinimapVisibility, setSweepMarkerColor, setStandaloneMap, toggleMinimapFloor, getFloorsInSpace };
|
|
926
|
+
isMinimapNavigation, setMap, showMinimap, hideMinimap, locateAvatar, resetSweepMarkerColors, renderOverlaySweep, showDirection, toggleMinimapVisibility, setSweepMarkerColor, setStandaloneMap, toggleMinimapFloor, getFloorsInSpace, createDropdown, setMinimapPosition };
|
package/package.json
CHANGED
package/static/map.css
CHANGED