architwin 1.12.3 → 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
@@ -1266,13 +1266,14 @@ function generateCustomMinimap(mpSdk) {
1266
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")
1267
1267
  // document.documentElement.style.setProperty("--map-sweep-display",`inline-block`)
1268
1268
  // }
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
- // }else{
1273
- // log.error("Invalid custom color value for sweep marker backgroundColor")
1274
- // }
1275
- // }
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
+ }
1276
1277
  // if (_mpConfig.mapConfig.sweepMarker.activeColor) {
1277
1278
  // if (isValidCSSColor(_mpConfig.mapConfig.sweepMarker.activeColor)) {
1278
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.3",
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
@@ -396,7 +396,8 @@ display: inline-block;
396
396
  height: 0.5rem;
397
397
  width: 0.5rem;
398
398
  opacity: var(--map-sweep-opacity);
399
- 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);
400
401
  border-radius: 50%;
401
402
  box-sizing: content-box;
402
403
  background-color: transparent;
@@ -406,12 +407,15 @@ display: inline-block;
406
407
 
407
408
  .at_custom_sweep.active {
408
409
  background-color: orangered;
410
+ /* background-color: var(--map-sweep-color); */
409
411
  opacity: var(--map-sweep-opacity);
410
412
  border: 0.23rem solid rgba(255, 255, 0, 0.79);
413
+ /* border: 0.23rem solid var(--map-sweep-color); */
411
414
  }
412
415
 
413
416
  .at_custom_sweep:hover {
414
- 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);
415
419
  }
416
420
 
417
421