@netless/slide 0.2.1 → 0.2.5

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.
@@ -17,7 +17,8 @@ var PlayerController = /** @class */ (function () {
17
17
  var _this = this;
18
18
  this.stateId = setInterval(function () {
19
19
  if (_this.player.view) {
20
- _this.controller.runTimeFps.setValue(_this.player.runtime.fps);
20
+ _this.controller.runTimeFps.setValue(_this.player.fps.value);
21
+ _this.controller.drawCall.setValue(_this.player.runtime.drawCall);
21
22
  _this.controller.runTimeResolution.setValue(_this.player.view.width + "*" + _this.player.view.height);
22
23
  }
23
24
  }, 500);
@@ -30,21 +31,28 @@ var PlayerController = /** @class */ (function () {
30
31
  });
31
32
  gui.domElement.style.opacity = ".6";
32
33
  gui.domElement.style.transformOrigin = "100% 0";
33
- gui.domElement.style.transform = "scale(1.4)";
34
+ gui.domElement.style.transform = "scale(1)";
34
35
  this.target.appendChild(gui.domElement);
35
36
  gui.domElement.style.position = "absolute";
36
37
  gui.domElement.style.right = "0";
37
38
  gui.domElement.style.top = "0";
38
39
  gui.domElement.style.zIndex = "2";
40
+ var runTimeFps = gui.add({ "FPS": 0 }, "FPS", 0);
41
+ var drawCall = gui.add({ "drawCall": 0 }, "drawCall", 0);
42
+ var runTimeResolution = gui.add({ "分辨率": "" }, "分辨率", "");
43
+ var moreCalculation = gui.add({ "额外计算": 0 }, "额外计算", 0, 200);
44
+ var renderOptions = gui.addFolder("renderOptions");
39
45
  this.controller = {
40
- runTimeFps: gui.add({ "FPS": 0 }, "FPS", 0),
41
- runTimeResolution: gui.add({ "分辨率": "" }, "分辨率", ""),
42
- autoResolution: gui.add({ "自动分辨率": (_a = this.data.autoResolution) !== null && _a !== void 0 ? _a : false }, "自动分辨率", true),
43
- autoFps: gui.add({ "自动fps": (_b = this.data.autoFPS) !== null && _b !== void 0 ? _b : true }, "自动fps", true),
44
- moreCalculation: gui.add({ "额外计算": 0 }, "额外计算", 0, 100),
45
- minFPS: gui.add({ "最低fps": (_c = this.data.minFPS) !== null && _c !== void 0 ? _c : 40 }, "最低fps", 0, 60),
46
- maxFPS: gui.add({ "最高fps": (_d = this.data.maxFPS) !== null && _d !== void 0 ? _d : 50 }, "最高fps", 0, 60),
47
- resolution: gui.add({ "目标分辨倍率": (_e = this.data.resolution) !== null && _e !== void 0 ? _e : window.devicePixelRatio }, "目标分辨倍率", 0.5, 4),
46
+ runTimeResolution: runTimeResolution,
47
+ runTimeFps: runTimeFps,
48
+ drawCall: drawCall,
49
+ moreCalculation: moreCalculation,
50
+ minFPS: renderOptions.add({ "最低fps": (_a = this.data.minFPS) !== null && _a !== void 0 ? _a : 40 }, "最低fps", 0, 60),
51
+ maxFPS: renderOptions.add({ "最高fps": (_b = this.data.maxFPS) !== null && _b !== void 0 ? _b : 50 }, "最高fps", 0, 60),
52
+ resolution: renderOptions.add({ "目标分辨倍率": (_c = this.data.resolution) !== null && _c !== void 0 ? _c : window.devicePixelRatio }, "目标分辨倍率", 0.5, 6),
53
+ autoResolution: renderOptions.add({ "自动分辨率": (_d = this.data.autoResolution) !== null && _d !== void 0 ? _d : false }, "自动分辨率", true),
54
+ autoFps: renderOptions.add({ "自动fps": (_e = this.data.autoFPS) !== null && _e !== void 0 ? _e : true }, "自动fps", true),
55
+ transactionBgColor: renderOptions.addColor({ "切页背景色": this.data.transactionBgColor }, "切页背景色"),
48
56
  };
49
57
  this.controller.runTimeFps.disabled = true;
50
58
  this.controller.runTimeResolution.disabled = true;
@@ -72,6 +80,10 @@ var PlayerController = /** @class */ (function () {
72
80
  _this.data.resolution = value;
73
81
  _this.player.updateConfig(_this.data);
74
82
  });
83
+ this.controller.transactionBgColor.onChange(function (value) {
84
+ _this.data.transactionBgColor = value;
85
+ _this.player.updateConfig(_this.data);
86
+ });
75
87
  var md5Value;
76
88
  this.controller.moreCalculation.onChange(function (value) {
77
89
  var calc = function () {
package/lib/Slide.d.ts CHANGED
@@ -29,8 +29,6 @@ export interface ISlideRenderOptions {
29
29
  maxFPS?: number;
30
30
  /** 渲染分辨倍率, 整数, 默认为 window.devicePixelRatio */
31
31
  resolution?: number;
32
- /** 最小分辨倍率, 默认为 1 */
33
- minResolution?: number;
34
32
  /** 是否根据 fps, 自动调整分辨率, 默认为 false */
35
33
  autoResolution?: boolean;
36
34
  /** 是否自动降低渲染 fps */
@@ -59,6 +57,12 @@ export interface ISlideConfig {
59
57
  * "local" 本地模式, 不会触发任意同步事件
60
58
  */
61
59
  mode: "interactive" | "sync" | "local";
60
+ /**
61
+ * 是否启用全局点击, 开启后, 只要点击到 ppt 视口范围,
62
+ * 并且没有触发 ppt 内部可互动元素, 就会触发下一步动作.
63
+ * 默认为 false
64
+ */
65
+ enableGlobalClick?: boolean;
62
66
  }
63
67
  interface MediaState {
64
68
  type: "pause" | "play";
@@ -164,6 +168,8 @@ export declare class Slide extends Slide_base {
164
168
  private needClearCacheImage;
165
169
  private version?;
166
170
  private __slideState;
171
+ private userInputTime;
172
+ private isSyncingSlideState;
167
173
  private resize;
168
174
  private isAnimating;
169
175
  private renderingTaskManager;
@@ -178,6 +184,7 @@ export declare class Slide extends Slide_base {
178
184
  private frameResizeObserver;
179
185
  private timestamp;
180
186
  private mode;
187
+ private enableGlobalClick;
181
188
  private log;
182
189
  private logId;
183
190
  private lastEmitedState;
@@ -190,11 +197,17 @@ export declare class Slide extends Slide_base {
190
197
  private config;
191
198
  private isFrowning;
192
199
  private isReleasing;
200
+ private isTouchStart;
201
+ private touchStartId;
193
202
  private designWidth;
194
203
  private designHeight;
195
204
  private _slideCount;
196
205
  constructor(config: ISlideConfig);
197
206
  private initPlayer;
207
+ private userInputHandle;
208
+ private handleViewClick;
209
+ private handleViewTouchStart;
210
+ private handleViewTouchEnd;
198
211
  private createController;
199
212
  private persistLog;
200
213
  private handleSlideRef;