@panoramax/web-viewer 4.0.2-develop-e389d775 → 4.0.2-develop-4d3bf829

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.
@@ -3,7 +3,7 @@
3
3
  ## Panoramax.components.ui.Photo ⇐ <code>[photo-sphere-viewer.core.Viewer](https://photo-sphere-viewer.js.org/api/classes/Core.Viewer.html)</code>
4
4
  **Kind**: static class of <code>Panoramax.components.ui</code>
5
5
  **Extends**: <code>[photo-sphere-viewer.core.Viewer](https://photo-sphere-viewer.js.org/api/classes/Core.Viewer.html)</code>
6
- **Emits**: [<code>picture-loading</code>](#Panoramax.components.ui.Photo+event_picture-loading), [<code>picture-preview-started</code>](#Panoramax.components.ui.Photo+event_picture-preview-started), [<code>picture-preview-stopped</code>](#Panoramax.components.ui.Photo+event_picture-preview-stopped), [<code>view-rotated</code>](#Panoramax.components.ui.Photo+event_view-rotated), [<code>picture-loaded</code>](#Panoramax.components.ui.Photo+event_picture-loaded), [<code>picture-tiles-loaded</code>](#Panoramax.components.ui.Photo+event_picture-tiles-loaded), [<code>transition-duration-changed</code>](#Panoramax.components.ui.Photo+event_transition-duration-changed), [<code>sequence-playing</code>](#Panoramax.components.ui.Photo+event_sequence-playing), [<code>sequence-stopped</code>](#Panoramax.components.ui.Photo+event_sequence-stopped), [<code>pictures-navigation-changed</code>](#Panoramax.components.ui.Photo+event_pictures-navigation-changed), [<code>ready</code>](#Panoramax.components.ui.Photo+event_ready), [<code>annotations-toggled</code>](#Panoramax.components.ui.Photo+event_annotations-toggled)
6
+ **Emits**: [<code>picture-loading</code>](#Panoramax.components.ui.Photo+event_picture-loading), [<code>picture-preview-started</code>](#Panoramax.components.ui.Photo+event_picture-preview-started), [<code>picture-preview-stopped</code>](#Panoramax.components.ui.Photo+event_picture-preview-stopped), [<code>view-rotated</code>](#Panoramax.components.ui.Photo+event_view-rotated), [<code>picture-loaded</code>](#Panoramax.components.ui.Photo+event_picture-loaded), [<code>picture-tiles-loaded</code>](#Panoramax.components.ui.Photo+event_picture-tiles-loaded), [<code>transition-duration-changed</code>](#Panoramax.components.ui.Photo+event_transition-duration-changed), [<code>sequence-playing</code>](#Panoramax.components.ui.Photo+event_sequence-playing), [<code>sequence-stopped</code>](#Panoramax.components.ui.Photo+event_sequence-stopped), [<code>pictures-navigation-changed</code>](#Panoramax.components.ui.Photo+event_pictures-navigation-changed), [<code>ready</code>](#Panoramax.components.ui.Photo+event_ready), [<code>annotations-toggled</code>](#Panoramax.components.ui.Photo+event_annotations-toggled), [<code>annotation-click</code>](#Panoramax.components.ui.Photo+event_annotation-click), [<code>annotations-unfocused</code>](#Panoramax.components.ui.Photo+event_annotations-unfocused)
7
7
 
8
8
  * [.Photo](#Panoramax.components.ui.Photo) ⇐ <code>[photo-sphere-viewer.core.Viewer](https://photo-sphere-viewer.js.org/api/classes/Core.Viewer.html)</code>
9
9
  * [new Photo(parent, container, [options])](#new_Panoramax.components.ui.Photo_new)
@@ -39,12 +39,14 @@
39
39
  * ["picture-preview-stopped"](#Panoramax.components.ui.Photo+event_picture-preview-stopped)
40
40
  * ["view-rotated"](#Panoramax.components.ui.Photo+event_view-rotated)
41
41
  * ["picture-loaded"](#Panoramax.components.ui.Photo+event_picture-loaded)
42
+ * ["annotation-click"](#Panoramax.components.ui.Photo+event_annotation-click)
42
43
  * ["picture-tiles-loaded"](#Panoramax.components.ui.Photo+event_picture-tiles-loaded)
43
44
  * ["transition-duration-changed"](#Panoramax.components.ui.Photo+event_transition-duration-changed)
44
45
  * ["sequence-playing"](#Panoramax.components.ui.Photo+event_sequence-playing)
45
46
  * ["sequence-stopped"](#Panoramax.components.ui.Photo+event_sequence-stopped)
46
47
  * ["pictures-navigation-changed"](#Panoramax.components.ui.Photo+event_pictures-navigation-changed)
47
48
  * ["annotations-toggled"](#Panoramax.components.ui.Photo+event_annotations-toggled)
49
+ * ["annotations-unfocused"](#Panoramax.components.ui.Photo+event_annotations-unfocused)
48
50
 
49
51
  <a name="new_Panoramax.components.ui.Photo_new"></a>
50
52
 
@@ -375,6 +377,18 @@ Event for picture load (low-resolution image is loaded)
375
377
  | detail.z | <code>number</code> | New z position (0-100) |
376
378
  | detail.first | <code>boolean</code> | True if first picture loaded |
377
379
 
380
+ <a name="Panoramax.components.ui.Photo+event_annotation-click"></a>
381
+
382
+ ### "annotation-click"
383
+ Event launched on annotation click over picture
384
+
385
+ **Kind**: event emitted by [<code>Photo</code>](#Panoramax.components.ui.Photo)
386
+ **Properties**
387
+
388
+ | Name | Type | Description |
389
+ | --- | --- | --- |
390
+ | detail.annotationId | <code>string</code> | The annotation UUID |
391
+
378
392
  <a name="Panoramax.components.ui.Photo+event_picture-tiles-loaded"></a>
379
393
 
380
394
  ### "picture-tiles-loaded"
@@ -435,3 +449,9 @@ Event for pictures annotation visibility change
435
449
  | --- | --- | --- |
436
450
  | detail.visible | <code>boolean</code> | True if they are visible |
437
451
 
452
+ <a name="Panoramax.components.ui.Photo+event_annotations-unfocused"></a>
453
+
454
+ ### "annotations-unfocused"
455
+ Event for pictures annotation unfocus
456
+
457
+ **Kind**: event emitted by [<code>Photo</code>](#Panoramax.components.ui.Photo)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "4.0.2-develop-e389d775",
3
+ "version": "4.0.2-develop-4d3bf829",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -44,10 +44,14 @@ export default class AnnotationsList extends LitElement {
44
44
  this._onPicChange();
45
45
  this._parent?.psv?.addEventListener("picture-loaded", this._onPicChange.bind(this));
46
46
 
47
- this._parent?.psv?._myMarkers?.addEventListener("select-marker", ({ marker }) => {
48
- const aPos = this._meta.properties?.annotations?.findIndex(a => a.id === marker.data.id);
47
+ this._parent?.psv?.addEventListener("annotation-click", e => {
48
+ const aPos = this._meta.properties?.annotations?.findIndex(a => a.id === e.detail.annotationId);
49
49
  if(aPos >= 0) { this._onListItemClick(Object.assign({nb: aPos+1}, this._meta.properties.annotations[aPos])); }
50
50
  });
51
+
52
+ this._parent?.psv?.addEventListener("annotations-unfocused", () => {
53
+ this._onListItemClick(null);
54
+ });
51
55
  }
52
56
 
53
57
  /** @private */
@@ -146,6 +146,9 @@ export default class PictureLegend extends LitElement {
146
146
  this._parent.psv.addEventListener("sequence-stopped", () => {
147
147
  this._onPicChange(this._parent.psv.getPictureMetadata());
148
148
  });
149
+ this._parent.psv.addEventListener("annotation-click", () => {
150
+ this._expanded = true;
151
+ });
149
152
  });
150
153
  }
151
154
 
@@ -82,8 +82,14 @@ export default class PictureMetadata extends LitElement {
82
82
  super.connectedCallback();
83
83
 
84
84
  this._meta = this._parent?.psv?.getPictureMetadata();
85
- this._parent?.psv?.addEventListener("picture-loaded", () => {
86
- this._meta = this._parent?.psv?.getPictureMetadata();
85
+ this._parent?.oncePSVReady?.().then(() => {
86
+ this._parent.psv.addEventListener("picture-loaded", () => {
87
+ this._meta = this._parent.psv.getPictureMetadata();
88
+ });
89
+ this._parent.psv.addEventListener("annotation-click", () => {
90
+ const tabs = this.shadowRoot.querySelector("pnx-tabs");
91
+ if(tabs) { tabs.setAttribute("activeTabIndex", 4); }
92
+ });
87
93
  });
88
94
  }
89
95
 
@@ -79,6 +79,8 @@ PSViewer.useNewAnglesOrder = true;
79
79
  * @fires Panoramax.components.ui.Photo#pictures-navigation-changed
80
80
  * @fires Panoramax.components.ui.Photo#ready
81
81
  * @fires Panoramax.components.ui.Photo#annotations-toggled
82
+ * @fires Panoramax.components.ui.Photo#annotation-click
83
+ * @fires Panoramax.components.ui.Photo#annotations-unfocused
82
84
  * @example
83
85
  * const psv = new Panoramax.components.ui.Photo(viewer, psvNode, {transitionDuration: 500})
84
86
  */
@@ -141,8 +143,10 @@ export default class Photo extends PSViewer {
141
143
  this._myVTour.addEventListener("enter-arrow", this._onEnterArrow.bind(this));
142
144
  this._myVTour.addEventListener("leave-arrow", this._onLeaveArrow.bind(this));
143
145
  this._myVTour.addEventListener("node-changed", this._onNodeChanged.bind(this));
146
+ this._myMarkers.addEventListener("select-marker", this._onSelectMarker.bind(this));
144
147
  this.addEventListener("position-updated", this._onPositionUpdated.bind(this));
145
148
  this.addEventListener("zoom-updated", this._onZoomUpdated.bind(this));
149
+ this.addEventListener("dblclick", this._onDoubleClick.bind(this));
146
150
  this._parent.addEventListener("select", this._onSelect.bind(this));
147
151
 
148
152
  // Fix for loader circle background not showing up
@@ -415,6 +419,14 @@ export default class Photo extends PSViewer {
415
419
  this._onTilesStartLoading();
416
420
  }
417
421
 
422
+ /**
423
+ * Event handler for double click
424
+ * @private
425
+ */
426
+ _onDoubleClick() {
427
+ this.unfocusAnnotation();
428
+ }
429
+
418
430
  /**
419
431
  * Event handler for node change in PSV.
420
432
  * Allows to send a custom "picture-loaded" event.
@@ -478,6 +490,25 @@ export default class Photo extends PSViewer {
478
490
  this._onTilesStartLoading();
479
491
  }
480
492
 
493
+ /**
494
+ * Event handler for marker select
495
+ * @memberof Panoramax.components.ui.Photo#
496
+ * @private
497
+ */
498
+ _onSelectMarker(e) {
499
+ if(!e.marker) { return; }
500
+ if(e.marker.id?.startsWith("annotation-")) {
501
+ /**
502
+ * Event launched on annotation click over picture
503
+ * @event Panoramax.components.ui.Photo#annotation-click
504
+ * @type {CustomEvent}
505
+ * @property {string} detail.annotationId The annotation UUID
506
+ */
507
+ const event = new CustomEvent("annotation-click", { detail: { annotationId: e.marker.data.id }});
508
+ this.dispatchEvent(event);
509
+ }
510
+ }
511
+
481
512
  /**
482
513
  * Event handler for loading a new range of tiles
483
514
  * @memberof Panoramax.components.ui.Photo#
@@ -1000,6 +1031,9 @@ export default class Photo extends PSViewer {
1000
1031
  stroke: "var(--red)",
1001
1032
  strokeWidth: "3px",
1002
1033
  fill: "var(--red-transparent)",
1034
+ },
1035
+ data: {
1036
+ selected: true,
1003
1037
  }
1004
1038
  });
1005
1039
  this._myMarkers.gotoMarker(annotationId, 0);
@@ -1011,18 +1045,31 @@ export default class Photo extends PSViewer {
1011
1045
  * @memberof Panoramax.components.ui.Photo#
1012
1046
  */
1013
1047
  unfocusAnnotation() {
1014
- Object.keys(this._myMarkers.markers)
1015
- .filter(id => id.startsWith("annotation-"))
1016
- .forEach(id => {
1048
+ const selectedAnnotations = Object.keys(this._myMarkers.markers)
1049
+ .filter(id => id.startsWith("annotation-") && this._myMarkers.markers[id]?.config?.data?.selected);
1050
+
1051
+ if(selectedAnnotations.length > 0) {
1052
+ selectedAnnotations.forEach(id => {
1017
1053
  this._myMarkers.updateMarker({
1018
1054
  id,
1019
1055
  svgStyle: {
1020
1056
  stroke: "var(--orange)",
1021
1057
  strokeWidth: "3px",
1022
1058
  fill: "var(--orange-transparent)",
1059
+ },
1060
+ data: {
1061
+ selected: false,
1023
1062
  }
1024
1063
  });
1025
1064
  });
1065
+
1066
+ /**
1067
+ * Event for pictures annotation unfocus
1068
+ * @event Panoramax.components.ui.Photo#annotations-unfocused
1069
+ * @type {Event}
1070
+ */
1071
+ this.dispatchEvent(new Event("annotations-unfocused"));
1072
+ }
1026
1073
  }
1027
1074
 
1028
1075
  /**
@@ -185,7 +185,12 @@
185
185
  "geo_uri": "外部程式",
186
186
  "contribute_id": "透過 iD 編輯器來貢獻 OpenStreetMap",
187
187
  "filter_date_6months": "6 個月",
188
- "picture_all": "全部"
188
+ "picture_all": "全部",
189
+ "metadata_exif_doc": "EXIF 標籤文件",
190
+ "metadata_exif_doc_title": "請參閱 Exiv2 文件以取得 EXIF 和 XMP 標籤定義的完整說明",
191
+ "metadata_location_coordinates": "座標 (經度, 緯度)",
192
+ "metadata_location_copy": "複製 {v}",
193
+ "metadata_location_copy_more": "更多座標複製選項"
189
194
  },
190
195
  "map": {
191
196
  "loading": "正在載入…",