@panoramax/web-viewer 5.3.0-develop-75794ff1 → 5.3.0-develop-0f16c3a8

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.
@@ -9,7 +9,7 @@ import BasicStyles from "./Basic.css" with { type: "css" };
9
9
  document.adoptedStyleSheets.push(AtkinsonStyles);
10
10
  document.adoptedStyleSheets.push(BasicStyles);
11
11
 
12
- const __COMMIT_HASH__ = "75794ff";
12
+ const __COMMIT_HASH__ = "0f16c3a";
13
13
  const __PACKAGE_VERSION__ = "5.3.0";
14
14
  const __PACKAGE_ISSUES_URL__ = "https://gitlab.com/panoramax/clients/web-viewer/-/work_items";
15
15
 
@@ -164,7 +164,7 @@ export default class Photo extends PSViewer {
164
164
  this._myMarkers = this.getPlugin(MarkersPlugin);
165
165
  this._annotationsVisible = this._options.displayAnnotations === true;
166
166
  this._drawingAnnotation = null;
167
- this._sequencePlaying = false;
167
+ this._sequencePlaying = 0;
168
168
  this._picturesNavigation = this._options.picturesNavigation || "any";
169
169
 
170
170
  // Cache to find sequence ID for a single picture
@@ -933,18 +933,20 @@ export default class Photo extends PSViewer {
933
933
 
934
934
  /**
935
935
  * Goes continuously to next picture in sequence as long as possible
936
+ * @param {boolean} [backward=false] Set true to play in reverse order.
936
937
  * @memberof Panoramax.components.ui.Photo#
937
938
  */
938
- playSequence() {
939
- this._sequencePlaying = true;
939
+ playSequence(backward = false) {
940
+ this._sequencePlaying = backward ? -1 : 1;
940
941
  this.container.classList.add("pnx-psv-playing");
941
942
 
942
943
  /**
943
944
  * Event for sequence starting to play
944
945
  * @event Panoramax.components.ui.Photo#sequence-playing
945
946
  * @type {CustomEvent}
947
+ * @property {boolean} detail.backward True if sequence is playing backwards
946
948
  */
947
- const event = new Event("sequence-playing", {bubbles: true, composed: true});
949
+ const event = new CustomEvent("sequence-playing", { detail: { backward }, bubbles: true, composed: true});
948
950
  this.dispatchEvent(event);
949
951
 
950
952
  const nextPicturePlay = () => {
@@ -956,7 +958,11 @@ export default class Photo extends PSViewer {
956
958
  }, { once: true });
957
959
 
958
960
  try {
959
- this.goToNextPicture();
961
+ if(this._sequencePlaying === 1) {
962
+ this.goToNextPicture();
963
+ } else if(this._sequencePlaying === -1) {
964
+ this.goToPrevPicture();
965
+ }
960
966
  }
961
967
  catch(e) {
962
968
  this.stopSequence();
@@ -975,7 +981,7 @@ export default class Photo extends PSViewer {
975
981
  * @memberof Panoramax.components.ui.Photo#
976
982
  */
977
983
  stopSequence() {
978
- this._sequencePlaying = false;
984
+ this._sequencePlaying = 0;
979
985
  this.container.classList.remove("pnx-psv-playing");
980
986
 
981
987
  // Next picture timer is pending
@@ -1002,7 +1008,7 @@ export default class Photo extends PSViewer {
1002
1008
  * @returns {boolean} True if sequence is playing
1003
1009
  */
1004
1010
  isSequencePlaying() {
1005
- return this._sequencePlaying;
1011
+ return this._sequencePlaying !== 0;
1006
1012
  }
1007
1013
 
1008
1014
  /**
@@ -21,15 +21,16 @@ export default class Player extends LitElement {
21
21
  * Component properties.
22
22
  * @memberof Panoramax.components.ui.widgets.Player#
23
23
  * @type {Object}
24
- * @property {boolean} [playing=false] Is sequence currently playing ?
24
+ * @property {number} [playing=0] Is sequence currently playing ? 0 = no, 1 = plays forward, -1 = plays backward
25
25
  * @property {string} [size=xl] Group size (md, xl)
26
26
  * @property {string} [more=depends] Should we display the "more options" button ("always", "never", "depends" = only on large screens (default))
27
27
  */
28
28
  static properties = {
29
- playing: {type: Boolean, reflect: true},
29
+ playing: {type: Number, reflect: true},
30
30
  size: {type: String},
31
31
  more: {type: String},
32
32
  _activePrev: {state: true},
33
+ _activePlayBack: {state: true},
33
34
  _activePlay: {state: true},
34
35
  _activeNext: {state: true},
35
36
  };
@@ -37,10 +38,11 @@ export default class Player extends LitElement {
37
38
  constructor() {
38
39
  super();
39
40
 
40
- this.playing = false;
41
+ this.playing = 0;
41
42
  this.size = "xl";
42
43
  this.more = "depends";
43
44
  this._activePrev = true;
45
+ this._activePlayBack = true;
44
46
  this._activePlay = true;
45
47
  this._activeNext = true;
46
48
  }
@@ -55,8 +57,8 @@ export default class Player extends LitElement {
55
57
  super.connectedCallback();
56
58
 
57
59
  onceParentAvailable(this).then(() => this._parent?.oncePSVReady?.().then(() => {
58
- this._parent.psv.addEventListener("sequence-playing", () => this.playing = true);
59
- this._parent.psv.addEventListener("sequence-stopped", () => this.playing = false);
60
+ this._parent.psv.addEventListener("sequence-playing", e => this.playing = e.detail.backward ? -1 : 1);
61
+ this._parent.psv.addEventListener("sequence-stopped", () => this.playing = 0);
60
62
  this._parent.psv.addEventListener("picture-loaded", this._changeActiveStates.bind(this));
61
63
  this._parent.psv.addEventListener("pictures-navigation-changed", this._changeActiveStates.bind(this));
62
64
  this._changeActiveStates();
@@ -67,38 +69,46 @@ export default class Player extends LitElement {
67
69
  _changeActiveStates() {
68
70
  if(this._parent.psv.getPicturesNavigation?.() === "pic") {
69
71
  this._activeNext = false;
72
+ this._activePlayBack = false;
70
73
  this._activePlay = false;
71
74
  this._activePrev = false;
72
75
  }
73
76
  else {
74
77
  // eslint-disable-next-line eqeqeq
75
78
  this._activePrev = this._parent.psv.getPictureMetadata()?.sequence?.prevPic != null;
79
+ this._activePlayBack = this._activePrev;
76
80
 
77
81
  // eslint-disable-next-line eqeqeq
78
- if(this._parent.psv.getPictureMetadata()?.sequence?.nextPic != null) {
79
- this._activeNext = true;
80
- this._activePlay = true;
81
- }
82
- else {
83
- this._activeNext = false;
84
- this._activePlay = false;
85
- }
82
+ this._activeNext = this._parent.psv.getPictureMetadata()?.sequence?.nextPic != null;
83
+ this._activePlay = this._activeNext;
86
84
  }
87
85
  this.requestUpdate();
88
86
  }
89
87
 
90
88
  /** @private */
91
89
  _onPlayClick() {
92
- if(this._parent?.psv?.isSequencePlaying()) {
93
- this.playing = false;
90
+ if(this._parent?.psv?.isSequencePlaying() && this.playing === 1) {
91
+ this.playing = 0;
94
92
  this._parent?.psv?.stopSequence();
95
93
  }
96
94
  else {
97
- this.playing = true;
95
+ this.playing = 1;
98
96
  this._parent?.psv?.playSequence();
99
97
  }
100
98
  }
101
99
 
100
+ /** @private */
101
+ _onPlayBackClick() {
102
+ if(this._parent?.psv?.isSequencePlaying() && this.playing === -1) {
103
+ this.playing = 0;
104
+ this._parent?.psv?.stopSequence();
105
+ }
106
+ else {
107
+ this.playing = -1;
108
+ this._parent?.psv?.playSequence(true);
109
+ }
110
+ }
111
+
102
112
  /** @private */
103
113
  render() {
104
114
  if(!this._parent?.psv?.addEventListener) { return nothing; }
@@ -119,13 +129,21 @@ export default class Player extends LitElement {
119
129
  .disabled=${!this._activePrev}
120
130
  >${fa(faBackward)}</pnx-button>
121
131
 
132
+ <pnx-button
133
+ kind="superflat"
134
+ id="pnx-player-play-backward"
135
+ title=${this.playing === -1 ? this._parent?._t.pnx.sequence_pause : this._parent?._t.pnx.sequence_play_backwards}
136
+ .disabled=${!this._activePlayBack}
137
+ @click=${this._onPlayBackClick.bind(this)}
138
+ >${this.playing === -1 ? fa(faPause) : fa(faPlay, {transform: {rotate: 180}})}</pnx-button>
139
+
122
140
  <pnx-button
123
141
  kind="superflat"
124
142
  id="pnx-player-play"
125
- title=${this.playing ? this._parent?._t.pnx.sequence_pause : this._parent?._t.pnx.sequence_play}
143
+ title=${this.playing === 1 ? this._parent?._t.pnx.sequence_pause : this._parent?._t.pnx.sequence_play}
126
144
  .disabled=${!this._activePlay}
127
145
  @click=${this._onPlayClick.bind(this)}
128
- >${this.playing ? fa(faPause) : fa(faPlay)}</pnx-button>
146
+ >${this.playing === 1 ? fa(faPause) : fa(faPlay)}</pnx-button>
129
147
 
130
148
  <pnx-button
131
149
  kind="superflat"
@@ -50,6 +50,7 @@
50
50
  "error_retry": "Please retry later",
51
51
  "sequence_next": "Next picture in sequence",
52
52
  "sequence_play": "Play along this sequence",
53
+ "sequence_play_backwards": "Play along this sequence, backwards",
53
54
  "sequence_pause": "Pause sequence",
54
55
  "sequence_prev": "Previous picture in sequence",
55
56
  "sequence_more": "More play options",
@@ -50,6 +50,7 @@
50
50
  "error_retry": "Merci de réessayer plus tard",
51
51
  "sequence_next": "Photo suivante dans la séquence",
52
52
  "sequence_play": "Parcourir cette séquence",
53
+ "sequence_play_backwards": "Parcourir cette séquence, à l'envers",
53
54
  "sequence_pause": "Mettre en pause la séquence",
54
55
  "sequence_prev": "Photo précédente dans la séquence",
55
56
  "sequence_more": "Plus d'options de lecture",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "5.3.0-develop-75794ff1",
3
+ "version": "5.3.0-develop-0f16c3a8",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "./build/cjs/index.js",
6
6
  "module": "./build/esm/index.js",