@netless/app-slide 0.0.24 → 0.0.25

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/dist/main.es.js CHANGED
@@ -20636,7 +20636,12 @@ var Slide = function(t2) {
20636
20636
  }
20637
20637
  dispose() {
20638
20638
  var t4, e4, n3;
20639
- this.isPlaying = false, (t4 = this.preset) === null || t4 === void 0 || t4.dispose(), (e4 = this.prevTexture) === null || e4 === void 0 || e4.dispose(), (n3 = this.nextTexture) === null || n3 === void 0 || n3.dispose();
20639
+ this.renderer.clear(), this.isPlaying = false, (t4 = this.preset) === null || t4 === void 0 || t4.dispose(), (e4 = this.prevTexture) === null || e4 === void 0 || e4.dispose(), (n3 = this.nextTexture) === null || n3 === void 0 || n3.dispose();
20640
+ for (let t5 = this.scene.children.length - 1; t5 >= 0; t5--) {
20641
+ const e5 = this.scene.children[t5];
20642
+ this.scene.remove(e5);
20643
+ }
20644
+ this.scene.background = null;
20640
20645
  }
20641
20646
  destroy() {
20642
20647
  this.dispose(), this.renderer.forceContextLoss(), this.renderer.dispose();
@@ -30765,7 +30770,7 @@ void main() {
30765
30770
  t4.stopPropagation(), this.mediaController.style.display = "none";
30766
30771
  }, this.mediaTimeUpdate = () => Qu(this, void 0, void 0, function* () {
30767
30772
  const t4 = this.media.currentTime - this.start;
30768
- (t4 > this.duration || this.media.ended) && (yield this.pauseMedia(), this.jumpToTime()), this.currentTime.innerText = el.formatTime(t4), this.currentProgress.style.flex = (t4 / this.duration).toString();
30773
+ this.duration > 0 && (t4 > this.duration || this.media.ended) && (yield this.pauseMedia(), this.jumpToTime()), this.currentTime.innerText = el.formatTime(t4), this.currentProgress.style.flex = (t4 / this.duration).toString();
30769
30774
  }), this.onPauseMedia = () => {
30770
30775
  this.playButton.style.display = "block", this.pauseButton.style.display = "none";
30771
30776
  }, this.onPlayMedia = () => {
@@ -33125,7 +33130,9 @@ void main() {
33125
33130
  if (t3 && e3 && i2 && Mh[n2.type] && this.transactionPlayer) {
33126
33131
  this.transactionSprite.zIndex = 999, this.app.stage.addChild(this.transactionSprite);
33127
33132
  const i3 = this.transactionPlayer.renderer.domElement, r3 = wn.from(i3), o3 = () => r3.update();
33128
- return this.app.ticker.add(o3), this.transactionSprite.texture = r3, new Promise((i4) => {
33133
+ return setTimeout(() => {
33134
+ this.app.ticker.add(o3);
33135
+ }), this.transactionSprite.texture = r3, new Promise((i4) => {
33129
33136
  var r4, s3, a2;
33130
33137
  (r4 = this.transactionPlayer) === null || r4 === void 0 || r4.play({ reverse: !this.isForward, prevTextureUrl: t3, nextTextureUrl: e3, textureWidth: this.designWidth, textureHeight: this.designHeight, presetType: Mh[n2.type], stageWidth: this.designWidth, stageHeight: this.designHeight, duration: (a2 = (s3 = this.currentStage) === null || s3 === void 0 ? void 0 : s3.json.transition) === null || a2 === void 0 ? void 0 : a2.dur, delay: 0, clearColor: this.config.transactionBgColor, onTransactionEnd: () => {
33131
33138
  i4(), this.app.stage.removeChild(this.transactionSprite), this.app.ticker.remove(o3);
@@ -35032,19 +35039,28 @@ void main() {
35032
35039
  });
35033
35040
  });
35034
35041
  }, e3.prototype.frozen = function() {
35042
+ var t4;
35035
35043
  if (this.view && this.player) {
35036
- var t4 = this.view.getBoundingClientRect(), e4 = this.player.getSnapshot() || "";
35037
- this.cacheImage.src = e4, this.cacheImage.style.width = t4.width + "px", this.cacheImage.style.height = t4.height + "px", this.frame.appendChild(this.cacheImage), this.player.destroy(), this.player = void 0;
35044
+ var e4 = this.view.getBoundingClientRect(), n2 = this.player.getSnapshot() || "";
35045
+ for (var i2 in this.cacheImage.src = n2, this.cacheImage.style.width = e4.width + "px", this.cacheImage.style.height = e4.height + "px", this.cacheImage.style.position = "absolute", this.cacheImage.style.zIndex = "999", this.frame.appendChild(this.cacheImage), this.player.destroy(), (t4 = this.playerController) === null || t4 === void 0 || t4.destroy(), this.player = void 0, this.__slideState.mediaState) {
35046
+ var r3 = this.__slideState.mediaState[i2];
35047
+ this.__slideState.mediaState[i2] = Id(Id({}, r3), { frozenTime: this.timestamp() });
35048
+ }
35038
35049
  }
35039
35050
  }, e3.prototype.release = function() {
35051
+ var t4;
35040
35052
  return Ld(this, void 0, void 0, function() {
35041
- var t4;
35042
- return Od(this, function(e4) {
35043
- switch (e4.label) {
35053
+ var e4, n2, i2, r3;
35054
+ return Od(this, function(o3) {
35055
+ switch (o3.label) {
35044
35056
  case 0:
35045
- return this.initPlayer(this.config), t4 = this.__slideState, this.__slideState = Object(a.cloneDeep)(Bd), [4, this.setSlideState(t4)];
35057
+ for (n2 in this.initPlayer(this.config), this.player.view && (this.player.view.style.visibility = "hidden"), e4 = this.__slideState, this.__slideState = Object(a.cloneDeep)(Bd), e4.mediaState)
35058
+ (i2 = e4.mediaState[n2]).type === "play" && (r3 = Math.max((t4 = i2.frozenTime) !== null && t4 !== void 0 ? t4 : 0, i2.time), i2.time = this.timestamp() - (r3 - i2.time), i2.frozenTime = void 0);
35059
+ return [4, this.setSlideState(e4)];
35046
35060
  case 1:
35047
- e4.sent();
35061
+ return o3.sent(), [4, this.player.clock.delay(333)];
35062
+ case 2:
35063
+ o3.sent(), this.player.view && (this.player.view.style.visibility = "visible");
35048
35064
  try {
35049
35065
  this.frame.removeChild(this.cacheImage);
35050
35066
  } catch (t5) {
@@ -35096,7 +35112,13 @@ function syncSceneWithSlide(room, context, slide, baseScenePath) {
35096
35112
  scenes.push({ name: `${i}` });
35097
35113
  room.putScenes(baseScenePath, scenes);
35098
35114
  }
35099
- if (((_a = context.getView()) == null ? void 0 : _a.focusScenePath) !== scenePath) {
35115
+ let currentScenePath;
35116
+ if (context.getBox().focus) {
35117
+ currentScenePath = room.state.sceneState.scenePath;
35118
+ } else {
35119
+ currentScenePath = ((_a = context.getView()) == null ? void 0 : _a.focusScenePath) || "";
35120
+ }
35121
+ if (currentScenePath !== scenePath) {
35100
35122
  context.setScenePath(scenePath);
35101
35123
  }
35102
35124
  }