architwin 1.2.6 → 1.2.7

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/README.md CHANGED
@@ -3287,6 +3287,45 @@ You can technically forego the at_showcase_container class of the parent div wit
3287
3287
 
3288
3288
  - **zIndex** - (optional) Set the z-index of the map. In cases where you have UI elements that coincide with the position of the minimap. You set the z-index value of the minimap to determine what order the minimap should be rendered.
3289
3289
 
3290
+ **Customizing Individual Minimap Sweep Buttons**
3291
+
3292
+ You may use the `setSweepMarkerColor` method if you need to customize the individual colors of the sweep buttons in the minimap. The method accepts either an object that contains the sweepId of the sweep button and the new background color or an array of said object
3293
+
3294
+ | parameter | type | required | default | values |
3295
+ | :----: | :----: | :---: | :---: | :---: |
3296
+ | payload | SweepColor or Array of SweepColor | yes | |
3297
+
3298
+
3299
+ *Example:*
3300
+ ```typescript
3301
+ import * as atwin from 'architwin'
3302
+
3303
+ const newSweepColor = {
3304
+ sweepId: 'validSweepId',
3305
+ backgroundColor: '#353535'
3306
+ } as SweepColor
3307
+
3308
+ atwin.minimap.setSweepMarkerColor(newSweepColor)
3309
+ ```
3310
+
3311
+ If you want to change the color of multiple sweep buttons when the minimap
3312
+ sweep buttons are rendered, you may subscribe to the `MINIMAP_SWEEPS_RENDERED` event using the `subscribeSpaceEvent` method.
3313
+
3314
+ *Example:*
3315
+ ```typescript
3316
+ import * as atwin from 'architwin'
3317
+
3318
+ const newSweepColors = [
3319
+ {
3320
+ sweepId: 'validSweepId',
3321
+ backgroundColor: '#353535'
3322
+ },
3323
+ //other objects
3324
+ ]
3325
+
3326
+ atwin.subscribeSpaceEvent('MINIMAP_SWEEPS_RENDERED', atwin.minimap.setSweepMarkerColor(newSweepColors))
3327
+ ```
3328
+
3290
3329
  ##### Toolbar Config
3291
3330
 
3292
3331
  To activate a toolbar display within your 3D Space, you can set the following key-value pairs in your configuration object.
@@ -107,7 +107,8 @@ export function renderTagMessage(message, optimisticUpdate = false) {
107
107
  chat.classList.add('at_flex_row');
108
108
  chat.classList.add('at_justify_start');
109
109
  chat.style.display = 'flex';
110
- const dateToString = formatWithOptions({ locale: ja }, 'd MMMM yyyy hh:mm:ss');
110
+ // const dateToString = formatWithOptions({locale: ja},'d MMMM yyyy hh:mm:ss')
111
+ const dateToString = formatWithOptions({ locale: ja }, 'yyyy/MM/dd HH:mm');
111
112
  //const created_on = format(new Date(), 'yyyy-MM-dd HH:mm:ss')
112
113
  const parsedDate = parseISO(message.created_on);
113
114
  const created_on = dateToString(parsedDate);
package/lib/color.js CHANGED
@@ -127,5 +127,7 @@ export function isValidCSSColor(value) {
127
127
  element.style.color = "inherit";
128
128
  element.style.color = value;
129
129
  // Check if the computed color is the same as the input value
130
- return element.style.color !== "inherit";
130
+ const res = element.style.color !== "inherit";
131
+ element.remove();
132
+ return res;
131
133
  }
package/lib/minimap.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { MpSdk } from "../bundle/sdk";
2
- import { ISweep } from "./types";
2
+ import { ISweep, SweepColor } from "./types";
3
3
  import 'notyf/notyf.min.css';
4
4
  declare let isMinimapNavigation: boolean;
5
5
  declare function setMap(mpSdk: MpSdk, appKey: string, mapId: string): Promise<void>;
@@ -14,4 +14,10 @@ declare function showDirection(): void;
14
14
  * finished fetching map data
15
15
  */
16
16
  declare function toggleMinimapVisibility(): void;
17
- export { isMinimapNavigation, setMap, showMinimap, hideMinimap, locateAvatar, resetSweepMarkerColors, renderOverlaySweep, showDirection, toggleMinimapVisibility };
17
+ /**
18
+ * Changes the default color of an individual or multiple sweep buttons inside the minimap
19
+ * @param {SweepColor | Array<SweepColor>} payload - An object or array of objects containing the sweepId and new color of the sweep button
20
+ * @returns {void}
21
+ */
22
+ declare function setSweepMarkerColor(payload: SweepColor | Array<SweepColor>): void;
23
+ export { isMinimapNavigation, setMap, showMinimap, hideMinimap, locateAvatar, resetSweepMarkerColors, renderOverlaySweep, showDirection, toggleMinimapVisibility, setSweepMarkerColor };
package/lib/minimap.js CHANGED
@@ -250,6 +250,7 @@ function setMap(mpSdk, appKey, mapId) {
250
250
  onCollectionUpdated: function (collection) {
251
251
  log.info('the entire up-to-date collection', collection);
252
252
  _minimapSweepCollection = collection;
253
+ dispatchSpaceEvent(SPACE_EVENTS.MINIMAP_SWEEPS_RENDERED);
253
254
  }
254
255
  });
255
256
  // On click - move
@@ -522,6 +523,38 @@ function toggleMinimapVisibility() {
522
523
  log.error("Matterport CDN content is unavailable. Architwin package tried to fetch map data from CDN but got an empty response. Please try again later");
523
524
  }
524
525
  }
526
+ /**
527
+ * Changes the default color of an individual or multiple sweep buttons inside the minimap
528
+ * @param {SweepColor | Array<SweepColor>} payload - An object or array of objects containing the sweepId and new color of the sweep button
529
+ * @returns {void}
530
+ */
531
+ function setSweepMarkerColor(payload) {
532
+ console.log("setSweepMarkerColor()");
533
+ if (!payload) {
534
+ console.error("payload is undefined");
535
+ return;
536
+ }
537
+ if (Array.isArray(payload)) {
538
+ payload.forEach((p, i) => {
539
+ if (isValidCSSColor(p.backgroundColor)) {
540
+ const sweepButton = document.getElementById(`p${p.sweepId}`);
541
+ if (sweepButton) {
542
+ sweepButton.style.background = p.backgroundColor;
543
+ }
544
+ }
545
+ });
546
+ }
547
+ else {
548
+ if (isValidCSSColor(payload.backgroundColor) == false) {
549
+ console.error("Invalid color value");
550
+ return;
551
+ }
552
+ const sweepButton = document.getElementById(`p${payload.sweepId}`);
553
+ if (sweepButton) {
554
+ sweepButton.style.background = payload.backgroundColor;
555
+ }
556
+ }
557
+ }
525
558
  export {
526
559
  // _miniMapData as minimapData,
527
- isMinimapNavigation, setMap, showMinimap, hideMinimap, locateAvatar, resetSweepMarkerColors, renderOverlaySweep, showDirection, toggleMinimapVisibility };
560
+ isMinimapNavigation, setMap, showMinimap, hideMinimap, locateAvatar, resetSweepMarkerColors, renderOverlaySweep, showDirection, toggleMinimapVisibility, setSweepMarkerColor };
package/lib/types.d.ts CHANGED
@@ -631,7 +631,8 @@ export declare enum SPACE_EVENTS {
631
631
  VIEW_TAG_MESSAGE = "VIEW_TAG_MESSAGE",
632
632
  TOOLBAR_LOADED = "TOOLBAR_LOADED",
633
633
  SWEEP_COLLECTION_UPDATED = "SWEEP_COLLECTION_UPDATED",
634
- MINIMAP_SWEEP_CLICK = "MINIMAP_SWEEP_CLICK"
634
+ MINIMAP_SWEEP_CLICK = "MINIMAP_SWEEP_CLICK",
635
+ MINIMAP_SWEEPS_RENDERED = "MINIMAP_SWEEPS_RENDERED"
635
636
  }
636
637
  export declare const enum TAG_COLOR {
637
638
  MAROON = "MAROON",
@@ -777,6 +778,10 @@ export interface ModalContent {
777
778
  description: string;
778
779
  buttonLabel?: string;
779
780
  }
781
+ export interface SweepColor {
782
+ sweepId: string;
783
+ backgroundColor: string;
784
+ }
780
785
  export declare const enum IO_ROLE {
781
786
  HOST = "host",
782
787
  GUEST = "guest"
package/lib/types.js CHANGED
@@ -43,6 +43,7 @@ export var SPACE_EVENTS;
43
43
  SPACE_EVENTS["TOOLBAR_LOADED"] = "TOOLBAR_LOADED";
44
44
  SPACE_EVENTS["SWEEP_COLLECTION_UPDATED"] = "SWEEP_COLLECTION_UPDATED";
45
45
  SPACE_EVENTS["MINIMAP_SWEEP_CLICK"] = "MINIMAP_SWEEP_CLICK";
46
+ SPACE_EVENTS["MINIMAP_SWEEPS_RENDERED"] = "MINIMAP_SWEEPS_RENDERED";
46
47
  })(SPACE_EVENTS || (SPACE_EVENTS = {}));
47
48
  export var MEETING_SIDEBAR;
48
49
  (function (MEETING_SIDEBAR) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",
package/pre_deploy.sh CHANGED
@@ -32,7 +32,7 @@ fi
32
32
 
33
33
  echo "\n=> TAG to publish...$TAG"
34
34
  # Pause the script
35
- read -p "Press Enter to continue..."
35
+ # read -p "Press Enter to continue..."
36
36
 
37
37
  echo "\n=> Force PUSH TAGS to Origin..."
38
38
  git push -f --tags -v