architwin 1.12.2 → 1.12.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.
@@ -1,4 +1,4 @@
1
- import { convertMeasurement, degreesToRadians, radiansToDegrees, useCapitalizeFirstLetter } from "../../../utils";
1
+ import { convertMeasurement, degreesToRadians, percentToScale, radiansToDegrees, scaleToPercent, useCapitalizeFirstLetter } from "../../../utils";
2
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";
@@ -249,7 +249,7 @@ export function getCoordinateValues() {
249
249
  else if (rotationUnit == UNITS.DEGREE) {
250
250
  mpRotation = degreesToRadians(formCoords);
251
251
  }
252
- mpScale = formCoords;
252
+ mpScale = percentToScale(formCoords);
253
253
  if (isToolbarFeatureEnabled('bim')) {
254
254
  setConvertedBimPosition(convertYupToZup(mpPosition, getMPBasepoint(), getBasepoint(), getMeasurementUnit(), parseInt(getScaleFactor())));
255
255
  }
@@ -263,7 +263,7 @@ export function getCoordinateValues() {
263
263
  else if (rotationUnit == UNITS.DEGREE) {
264
264
  mpRotation = degreesToRadians(formCoords);
265
265
  }
266
- mpScale = formCoords;
266
+ mpScale = percentToScale(formCoords);
267
267
  if (isToolbarFeatureEnabled('bim')) {
268
268
  setConvertedBimPosition(convertYupToZup(mpPosition, getMPBasepoint(), getBasepoint(), getMeasurementUnit(), parseInt(getScaleFactor())));
269
269
  }
@@ -488,9 +488,10 @@ export function showCurrentCoordinateValue(payload) {
488
488
  displayMPScaleCoordinates(currentScale);
489
489
  }
490
490
  else {
491
- inputX.value = currentScale.x.toFixed(3).toString();
492
- inputY.value = currentScale.y.toFixed(3).toString();
493
- inputZ.value = currentScale.z.toFixed(3).toString();
491
+ const percentScale = scaleToPercent(currentScale);
492
+ inputX.value = percentScale.x.toFixed(0).toString();
493
+ inputY.value = percentScale.y.toFixed(0).toString();
494
+ inputZ.value = percentScale.z.toFixed(0).toString();
494
495
  }
495
496
  transformValues['scale'].x = inputX.value;
496
497
  transformValues['scale'].y = inputY.value;
@@ -928,10 +929,11 @@ function displayMPPosCoordinates(mpObjectPos) {
928
929
  * @param mpObjectPos Matterport object position
929
930
  */
930
931
  function displayMPScaleCoordinates(mpObjectSCale) {
932
+ const percentScale = scaleToPercent(mpObjectSCale);
931
933
  if (isToolbarFeatureEnabled('bim')) {
932
- document.getElementById("at-mt-coordx").textContent = mpObjectSCale.x.toFixed(3).toString();
933
- document.getElementById("at-mt-coordy").textContent = mpObjectSCale.y.toFixed(3).toString();
934
- document.getElementById("at-mt-coordz").textContent = mpObjectSCale.z.toFixed(3).toString();
934
+ document.getElementById("at-mt-coordx").textContent = percentScale.x.toFixed(0).toString();
935
+ document.getElementById("at-mt-coordy").textContent = percentScale.y.toFixed(0).toString();
936
+ document.getElementById("at-mt-coordz").textContent = percentScale.z.toFixed(0).toString();
935
937
  }
936
938
  }
937
939
  function updateObjectViaInput() {
package/lib/minimap.js CHANGED
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import * as superviz from './superviz';
11
- import { _mpConfig, getCurrentCameraPose, getCurrentSweep, getMapConfig, dispatchSpaceEvent, isCdnMapDataAvailable, getCurrentFloor } from "./architwin";
11
+ import { _mpConfig, getCurrentCameraPose, getCurrentSweep, getMapConfig, dispatchSpaceEvent, isCdnMapDataAvailable, getCurrentFloor, minimap } from "./architwin";
12
12
  import { SPACE_EVENTS, DEGREE, MAP_OPTIONS } from "./types";
13
13
  import { isValidCSSColor } from "./color";
14
14
  import { _participants } from "./participant";
@@ -1060,7 +1060,6 @@ function setupCustomMinimapPane() {
1060
1060
  log.info('setupCustomMinimap');
1061
1061
  log.info("_minimapPosition: ", _minimapPosition);
1062
1062
  return `
1063
- <div id="at-custom-minimap-pane" class="at_overlay_left_minimap ${_minimapPosition}" style="display:none">
1064
1063
  <div>
1065
1064
  ${setMapPositionDropdown()}
1066
1065
  </div>
@@ -1078,9 +1077,27 @@ function setupCustomMinimapPane() {
1078
1077
  </div>
1079
1078
 
1080
1079
  ${setupCustomMinimapSettingUI()}
1081
- </div>
1082
1080
 
1083
1081
  `;
1082
+ // return `
1083
+ // <div id="at-custom-minimap-pane" class="at_overlay_left_minimap ${_minimapPosition}" style="display:none">
1084
+ // <div>
1085
+ // ${setMapPositionDropdown()}
1086
+ // </div>
1087
+ // <div id="at-custom-map-close-btn" class="at_close_minimap">
1088
+ // <span class="mdi mdi-window-close" id="at-close-minimap-btn" data-cy="at-close-minimap-btn"></span>
1089
+ // </div>
1090
+ // <div id="at-custom-map-settings-btn" class="at_setting_icon">
1091
+ // <span class="mdi mdi-cog" id="at-map-setting-btn" data-cy="at-map-setting-btn"></span>
1092
+ // </div>
1093
+ // <div id="at-spinner" class="at_spinner"></div>
1094
+ // <canvas id="at-custom-map-canvas" class="at_custom_map_canvas" width="379" height="379"></canvas>
1095
+ // <div id="at-custom-map" class="at_custom_map">
1096
+ // <img id="at-custom-map-img" src="${getAssetUrl('images/377.png')}" alt="Minimap">
1097
+ // </div>
1098
+ // ${setupCustomMinimapSettingUI()}
1099
+ // </div>
1100
+ // `
1084
1101
  });
1085
1102
  }
1086
1103
  function setMapPositionDropdown() {
@@ -1176,6 +1193,9 @@ function setCustomMap(mpSdk) {
1176
1193
  const minimapElement = yield setupCustomMinimapPane();
1177
1194
  const showcase = document.getElementById('showcase-container');
1178
1195
  const mapContainer = document.createElement('div');
1196
+ mapContainer.setAttribute('id', 'at-custom-minimap-pane');
1197
+ mapContainer.classList.add('at_overlay_left_minimap', `${minimap.getMinimapPosition()}`);
1198
+ mapContainer.style.display = 'none';
1179
1199
  mapContainer.innerHTML = minimapElement;
1180
1200
  // Inject to DOM
1181
1201
  showcase.append(mapContainer);
@@ -1246,13 +1266,14 @@ function generateCustomMinimap(mpSdk) {
1246
1266
  // log.info("You are enabling to show sweep markers by default. You should probably increase the fixedSize to avoid the sweep markers overcrowding the map")
1247
1267
  // document.documentElement.style.setProperty("--map-sweep-display",`inline-block`)
1248
1268
  // }
1249
- // if (_mpConfig.mapConfig.sweepMarker.backgroundColor) {
1250
- // if (isValidCSSColor(_mpConfig.mapConfig.sweepMarker.backgroundColor)) {
1251
- // document.documentElement.style.setProperty("--map-sweep-color",`${_mpConfig.mapConfig.sweepMarker.backgroundColor}`)
1252
- // }else{
1253
- // log.error("Invalid custom color value for sweep marker backgroundColor")
1254
- // }
1255
- // }
1269
+ if (_mpConfig.mapConfig.sweepMarker.backgroundColor) {
1270
+ if (isValidCSSColor(_mpConfig.mapConfig.sweepMarker.backgroundColor)) {
1271
+ document.documentElement.style.setProperty("--map-sweep-color", `${_mpConfig.mapConfig.sweepMarker.backgroundColor}`);
1272
+ }
1273
+ else {
1274
+ log.error("Invalid custom color value for sweep marker backgroundColor");
1275
+ }
1276
+ }
1256
1277
  // if (_mpConfig.mapConfig.sweepMarker.activeColor) {
1257
1278
  // if (isValidCSSColor(_mpConfig.mapConfig.sweepMarker.activeColor)) {
1258
1279
  // document.documentElement.style.setProperty("--map-sweep-active-color",`${_mpConfig.mapConfig.sweepMarker.activeColor}`)
package/lib/utils.d.ts CHANGED
@@ -89,3 +89,5 @@ export declare function getUnitConverter(unit: 'mm' | 'cm' | 'm' | 'ft' | 'in'):
89
89
  export declare function getAssetUrl(filename: string): string;
90
90
  export declare function convertMeasurement(value: any, fromUnit: any, toUnit: any): number;
91
91
  export declare function showLoader(visible: boolean): void;
92
+ export declare function percentToScale(percentValue: Vector3): Vector3;
93
+ export declare function scaleToPercent(scaleValue: Vector3): Vector3;
package/lib/utils.js CHANGED
@@ -433,3 +433,19 @@ export function showLoader(visible) {
433
433
  log.error("Error show loader: ", error);
434
434
  }
435
435
  }
436
+ export function percentToScale(percentValue) {
437
+ const clampMin = (value) => Math.max(0, value);
438
+ return {
439
+ x: parseFloat((clampMin(percentValue.x) / 100).toFixed(4)),
440
+ y: parseFloat((clampMin(percentValue.y) / 100).toFixed(4)),
441
+ z: parseFloat((clampMin(percentValue.z) / 100).toFixed(4)),
442
+ };
443
+ }
444
+ export function scaleToPercent(scaleValue) {
445
+ const clampMin = (value) => Math.max(0, value);
446
+ return {
447
+ x: parseFloat((clampMin(scaleValue.x) * 100).toFixed(2)),
448
+ y: parseFloat((clampMin(scaleValue.y) * 100).toFixed(2)),
449
+ z: parseFloat((clampMin(scaleValue.z) * 100).toFixed(2)),
450
+ };
451
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.12.2",
3
+ "version": "1.12.4",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",
package/static/map.css CHANGED
@@ -163,15 +163,17 @@ display: inline-block;
163
163
  }
164
164
 
165
165
  .at_overlay_left_minimap.topLeft {
166
- bottom: calc(var(--position-top) + 27rem);
167
- /* top: calc(var(--position-top) + 0.5rem); */
168
- left: 0;
166
+ /* bottom: calc(var(--position-bottom) + 48vh);
167
+ left: 0; */
168
+ top: calc(var(--position-top) + 0.5rem);
169
+ left: calc(var(--position-left) + 0.5rem);
169
170
  }
170
171
 
171
172
  .at_overlay_left_minimap.topRight {
172
- /* top: calc(var(--position-top) + 0.5rem); */
173
- bottom: calc(var(--position-top) + 27rem);
174
- right: 0;
173
+ /* bottom: calc(var(--position-bottom) + 48vh);
174
+ right: 0; */
175
+ top: calc(var(--position-top) + 0.5rem);
176
+ right: calc(var(--position-right) + 0.5rem);
175
177
  }
176
178
 
177
179
  .at_overlay_left_minimap.bottomLeft {
@@ -394,7 +396,8 @@ display: inline-block;
394
396
  height: 0.5rem;
395
397
  width: 0.5rem;
396
398
  opacity: var(--map-sweep-opacity);
397
- border: 0.20rem solid rgba(255, 255, 0, 0.79);
399
+ /* border: 0.20rem solid rgba(255, 255, 0, 0.79); */
400
+ border: 0.20rem solid var(--map-sweep-color);
398
401
  border-radius: 50%;
399
402
  box-sizing: content-box;
400
403
  background-color: transparent;
@@ -404,12 +407,15 @@ display: inline-block;
404
407
 
405
408
  .at_custom_sweep.active {
406
409
  background-color: orangered;
410
+ /* background-color: var(--map-sweep-color); */
407
411
  opacity: var(--map-sweep-opacity);
408
412
  border: 0.23rem solid rgba(255, 255, 0, 0.79);
413
+ /* border: 0.23rem solid var(--map-sweep-color); */
409
414
  }
410
415
 
411
416
  .at_custom_sweep:hover {
412
- background-color: rgba(255, 255, 0, 0.79);
417
+ /* background-color: rgba(255, 255, 0, 0.79); */
418
+ background-color: var(--map-sweep-hover-color);
413
419
  }
414
420
 
415
421