@netless/slide 0.2.2 → 0.2.6
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/lib/PlayerController.js +22 -10
- package/lib/Slide.d.ts +6 -3
- package/lib/Slide.js +1 -1
- package/package.json +2 -2
package/lib/PlayerController.js
CHANGED
|
@@ -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.
|
|
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
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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 */
|
|
@@ -170,7 +168,8 @@ export declare class Slide extends Slide_base {
|
|
|
170
168
|
private needClearCacheImage;
|
|
171
169
|
private version?;
|
|
172
170
|
private __slideState;
|
|
173
|
-
private
|
|
171
|
+
private userInputTime;
|
|
172
|
+
private isSyncingSlideState;
|
|
174
173
|
private resize;
|
|
175
174
|
private isAnimating;
|
|
176
175
|
private renderingTaskManager;
|
|
@@ -198,6 +197,8 @@ export declare class Slide extends Slide_base {
|
|
|
198
197
|
private config;
|
|
199
198
|
private isFrowning;
|
|
200
199
|
private isReleasing;
|
|
200
|
+
private isTouchStart;
|
|
201
|
+
private touchStartId;
|
|
201
202
|
private designWidth;
|
|
202
203
|
private designHeight;
|
|
203
204
|
private _slideCount;
|
|
@@ -205,6 +206,8 @@ export declare class Slide extends Slide_base {
|
|
|
205
206
|
private initPlayer;
|
|
206
207
|
private userInputHandle;
|
|
207
208
|
private handleViewClick;
|
|
209
|
+
private handleViewTouchStart;
|
|
210
|
+
private handleViewTouchEnd;
|
|
208
211
|
private createController;
|
|
209
212
|
private persistLog;
|
|
210
213
|
private handleSlideRef;
|