@shijiu/jsview-vue 2.2.35 → 2.2.201
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/bin/browser/BrowserApic.vue.mjs +4 -3
- package/bin/browser/BrowserApic2.vue.mjs +4 -3
- package/bin/browser/BrowserApicLib.mjs +10 -3
- package/bin/browser/BrowserJsvFragShaderView.vue.mjs +63 -0
- package/bin/browser/BrowserQrcode.vue.mjs +3 -1
- package/bin/browser/BrowserTextureAnim.vue.mjs +7 -6
- package/bin/jsview-vue.mjs +2990 -1146
- package/bin/types/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +8 -6
- package/bin/types/JsViewEngineWidget/MetroWidget/Dispatcher.d.ts +10 -12
- package/bin/types/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +3 -3
- package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +3 -3
- package/bin/types/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +2 -2
- package/bin/types/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +3 -0
- package/bin/types/JsViewEngineWidget/MetroWidget/Slide.d.ts +21 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/ListMetroTemplate.d.ts +1 -0
- package/bin/types/JsViewEngineWidget/TemplateParser/MetroTemplate.d.ts +2 -8
- package/bin/types/JsViewEngineWidget/TemplateParser/TemplateItemAdder.d.ts +1 -1
- package/bin/types/JsViewEngineWidget/WidgetCommon.d.ts +9 -3
- package/bin/types/JsViewEngineWidget/index.d.ts +10 -1
- package/bin/types/JsViewVueTools/ConstSymbol.d.ts +2 -0
- package/bin/types/JsViewVueTools/ForgeConstDefine.d.ts +11 -0
- package/bin/types/JsViewVueTools/JsvFederationTools.d.ts +16 -0
- package/bin/types/JsViewVueTools/JsvPerformance.d.ts +5 -0
- package/bin/types/JsViewVueTools/JsvPreDownloader.d.ts +33 -0
- package/bin/types/JsViewVueTools/JsvRuntimeBridge.d.ts +113 -57
- package/bin/types/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +11 -0
- package/bin/types/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +45 -1
- package/bin/types/JsViewVueTools/JsvTextureStore/Texture.d.ts +8 -0
- package/bin/types/JsViewVueTools/index.d.ts +19 -11
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.d.ts +2 -1
- package/bin/types/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue.d.ts +70 -0
- package/bin/types/JsViewVueWidget/JsvClipDiv/index.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +104 -0
- package/bin/types/JsViewVueWidget/JsvDriftScope/index.d.ts +1 -0
- package/bin/types/JsViewVueWidget/JsvFragShaderView/BrowserJsvFragShaderView.vue.d.ts +13 -0
- package/bin/types/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +13 -0
- package/bin/types/JsViewVueWidget/JsvFragShaderView/index.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActionRefObject.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +91 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ActorState.d.ts +6 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.d.ts +11 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.d.ts +15 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +6 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetAction.d.ts +71 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +97 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +62 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/SyncLinkManager.d.ts +18 -0
- package/bin/types/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +4 -1
- package/bin/types/JsViewVueWidget/JsvLine/JsvLine.vue.d.ts +1 -1
- package/bin/types/JsViewVueWidget/JsvNativeSharedDiv.vue.d.ts +66 -28
- package/bin/types/JsViewVueWidget/JsvNinePatch.vue.d.ts +2 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue.d.ts +236 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue.d.ts +153 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollInnerSymbol.d.ts +4 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/ScrollSymbol.d.ts +12 -0
- package/bin/types/JsViewVueWidget/JsvScrollBox/index.d.ts +3 -0
- package/bin/types/JsViewVueWidget/JsvTextBox.vue.d.ts +3 -3
- package/bin/types/JsViewVueWidget/index.d.ts +4 -0
- package/package.json +1 -1
- package/tools/config/rollup.config.mjs +1 -0
- package/utils/JsViewEngineWidget/JsvFocus/{JsvFocusManager.js → JsvFocusManager.ts} +12 -12
- package/utils/JsViewEngineWidget/MetroWidget/Dispatcher.ts +20 -0
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +27 -10
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +52 -11
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +686 -480
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +13 -1
- package/utils/JsViewEngineWidget/MetroWidget/Slide.ts +56 -0
- package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +59 -10
- package/utils/JsViewEngineWidget/MetroWidget/TokenGenerator.ts +10 -0
- package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +20 -10
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +27 -3
- package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +25 -35
- package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +7 -0
- package/utils/JsViewEngineWidget/WidgetCommon.ts +20 -7
- package/utils/JsViewEngineWidget/{index.js → index.ts} +1 -1
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +21 -2
- package/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue +13 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +470 -338
- package/utils/JsViewVueTools/ConstSymbol.ts +3 -0
- package/utils/JsViewVueTools/ForgeConstDefine.ts +11 -0
- package/utils/JsViewVueTools/JsvPreDownloader.ts +3 -3
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +172 -50
- package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +62 -0
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +42 -8
- package/utils/JsViewVueTools/JsvTextureStore/Texture.ts +15 -1
- package/utils/JsViewVueTools/index.js +19 -17
- package/utils/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue +8 -8
- package/utils/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue +3 -3
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue +7 -8
- package/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue +3 -3
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/ApicDataBase.js +5 -1
- package/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.js +8 -3
- package/utils/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue +42 -0
- package/utils/JsViewVueWidget/JsvClipDiv/index.ts +1 -0
- package/utils/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue +5 -1
- package/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue +82 -0
- package/utils/JsViewVueWidget/JsvDriftScope/index.ts +1 -0
- package/utils/JsViewVueWidget/JsvFragShaderView/BrowserJsvFragShaderView.vue +48 -0
- package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +145 -0
- package/utils/JsViewVueWidget/JsvFragShaderView/index.js +18 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActionRefObject.ts +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +156 -55
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorState.ts +4 -4
- package/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.ts +6 -6
- package/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.ts +1 -1
- package/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue +43 -9
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +33 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +69 -8
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +60 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SyncLinkManager.ts +120 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +7 -0
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +6 -1
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +121 -68
- package/utils/JsViewVueWidget/JsvNinePatch.vue +17 -2
- package/utils/JsViewVueWidget/JsvPosterImage.vue +22 -9
- package/utils/JsViewVueWidget/JsvQrcode/BrowserQrcode.vue +6 -2
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue +518 -0
- package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue +468 -0
- package/utils/JsViewVueWidget/JsvScrollBox/ScrollInnerSymbol.ts +9 -0
- package/utils/JsViewVueWidget/JsvScrollBox/ScrollSymbol.ts +24 -0
- package/utils/JsViewVueWidget/JsvScrollBox/index.ts +3 -0
- package/utils/JsViewVueWidget/JsvTextBox.vue +12 -4
- package/utils/JsViewVueWidget/JsvTextureAnim/BrowserTextureAnim.vue +9 -6
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +2 -0
- package/utils/JsViewVueWidget/index.js +4 -0
- package/utils/JsViewEngineWidget/MetroWidget/Dispatcher.js +0 -19
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ref, computed } from "vue";
|
|
2
2
|
import type { Ref } from "vue";
|
|
3
3
|
import { TemplateItem } from "../TemplateParser/MetroTemplate"
|
|
4
|
+
import { ForgeConst } from "../../JsViewVueTools/ForgeConstDefine";
|
|
4
5
|
|
|
5
6
|
interface RenderItemStyle {
|
|
6
7
|
zIndex: number,
|
|
@@ -15,6 +16,7 @@ interface ItemConfig {
|
|
|
15
16
|
normalZIndex: number,
|
|
16
17
|
itemSlide: number,
|
|
17
18
|
permanent: boolean,
|
|
19
|
+
showSkeleton: boolean,
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
interface CustomerCallbackMap {
|
|
@@ -37,6 +39,7 @@ export class RenderItem {
|
|
|
37
39
|
public touchInit: boolean = false;
|
|
38
40
|
public rootDiv: HTMLDivElement | null = null;
|
|
39
41
|
public enableTap: boolean = false;
|
|
42
|
+
public renderKey: Ref<number> = ref(0);
|
|
40
43
|
|
|
41
44
|
private customerCallbackMap: CustomerCallbackMap = {};
|
|
42
45
|
private onRef: (() => void) | null;
|
|
@@ -69,6 +72,14 @@ export class RenderItem {
|
|
|
69
72
|
return this.templateInfo.index;
|
|
70
73
|
}
|
|
71
74
|
|
|
75
|
+
public updateCustomData(newCustomData: object, newItemConfig: ItemConfig) {
|
|
76
|
+
this.customerData = newCustomData;
|
|
77
|
+
this.itemConfig = newItemConfig;
|
|
78
|
+
this.customerCallbackMap = {};
|
|
79
|
+
this.mounted.value = false;
|
|
80
|
+
this.renderKey.value++;
|
|
81
|
+
}
|
|
82
|
+
|
|
72
83
|
//TODO item的div ref 会调用多次, 待调查
|
|
73
84
|
public divRef = (ele: HTMLDivElement | null) => {
|
|
74
85
|
this.rootDiv = ele;
|
|
@@ -154,12 +165,13 @@ export class RenderItem {
|
|
|
154
165
|
this.divMountedCallback.clear();
|
|
155
166
|
if (this.enableTap && this.rootDiv) {
|
|
156
167
|
const divView = (this.rootDiv as any).jsvGetProxyView();
|
|
157
|
-
divView.DragEnables?.(
|
|
168
|
+
divView.DragEnables?.(ForgeConst.DragFlags.TOUCH_RECV_CLICK_BIT); // 只激活tap
|
|
158
169
|
}
|
|
159
170
|
}
|
|
160
171
|
|
|
161
172
|
private onDivUnmounted(): void {
|
|
162
173
|
this.touchInit = false;
|
|
163
174
|
this.divMountedCallback.clear();
|
|
175
|
+
this.customerCallbackMap = {};
|
|
164
176
|
}
|
|
165
177
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getCurFrameCount } from "../WidgetCommon";
|
|
2
|
+
|
|
3
|
+
export interface TargetRectInfo {
|
|
4
|
+
left: number,
|
|
5
|
+
top: number,
|
|
6
|
+
width: number,
|
|
7
|
+
height: number,
|
|
8
|
+
frameCount: number,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class RectCache {
|
|
12
|
+
private preRect: TargetRectInfo | null = null;
|
|
13
|
+
private curRect: TargetRectInfo | null = null;
|
|
14
|
+
|
|
15
|
+
public cache(rect: TargetRectInfo) {
|
|
16
|
+
if (this.curRect && this.curRect.frameCount < rect?.frameCount) {
|
|
17
|
+
this.preRect = this.curRect;
|
|
18
|
+
}
|
|
19
|
+
this.curRect = rect;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public cacheManually() {
|
|
23
|
+
if (this.curRect && this.curRect.frameCount < getCurFrameCount()) {
|
|
24
|
+
this.preRect = this.curRect;
|
|
25
|
+
this.curRect = null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public getCurRect(): TargetRectInfo | null {
|
|
30
|
+
return this.curRect ? { ...this.curRect } : null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public getPreRect(): TargetRectInfo | null {
|
|
34
|
+
return this.preRect ? { ...this.preRect } : null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public updatePre(key: "left" | "top" | "width" | "height", value: number) {
|
|
38
|
+
if (this.preRect) {
|
|
39
|
+
let p = this.preRect[key];
|
|
40
|
+
this.preRect[key] = value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public clean() {
|
|
45
|
+
this.preRect = null;
|
|
46
|
+
this.curRect = null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const getDirectionByRect = (curRect: TargetRectInfo, preRect: TargetRectInfo) => {
|
|
51
|
+
if (!preRect || !curRect) return { horizontal: 0, vertical: 0 };
|
|
52
|
+
return {
|
|
53
|
+
horizontal: curRect.left < preRect.left ? -1 : (curRect.left > preRect.left ? 1 : 0),
|
|
54
|
+
vertical: curRect.top < preRect.top ? -1 : (curRect.top > preRect.top ? 1 : 0),
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -107,7 +107,7 @@ export type TaskRunner = () => CancelFunc;
|
|
|
107
107
|
class CancellableRunner {
|
|
108
108
|
private cancelHandler: CancelFunc | null = null;
|
|
109
109
|
private runner: TaskRunner | null = null;
|
|
110
|
-
constructor(r: TaskRunner) {
|
|
110
|
+
constructor(r: TaskRunner) {
|
|
111
111
|
this.runner = r;
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -126,29 +126,55 @@ class CancellableRunner {
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
export enum TaskType {
|
|
129
|
-
RESIZE_ITEM,
|
|
129
|
+
RESIZE_ITEM = 1,
|
|
130
130
|
SLIDE,
|
|
131
131
|
ON_FOCUS_CHANGE,
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
export enum SlideTaskType {
|
|
135
|
+
SLIDE_BY_POS = 1,
|
|
136
|
+
SLIDE_BY_ITEM,
|
|
137
|
+
SLIDE_BY_DIV,
|
|
138
|
+
SLIDE_BY_RECT,
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
type SubType = SlideTaskType | null;
|
|
142
|
+
|
|
134
143
|
interface Task {
|
|
135
144
|
frameCount: number,
|
|
136
145
|
type: TaskType,
|
|
146
|
+
subType: SubType,
|
|
137
147
|
params: any,
|
|
138
148
|
}
|
|
139
149
|
|
|
140
|
-
export
|
|
141
|
-
|
|
150
|
+
export interface AllTaskList {
|
|
151
|
+
slide: Array<Task>,
|
|
152
|
+
focus: Array<Task>,
|
|
153
|
+
resize: Array<Task>,
|
|
154
|
+
}
|
|
155
|
+
export type AddTaskCallback = (taskList: AllTaskList) => void;
|
|
142
156
|
export class TaskManager {
|
|
143
157
|
private frameCount: number = -1;
|
|
144
|
-
private widgetTaskCacheList: Array<Task> = [];
|
|
145
158
|
private cancellableRunnerList: Array<CancellableRunner> = [];
|
|
146
159
|
|
|
160
|
+
//三类task: 1.slide, 2.resize, 3.focus
|
|
161
|
+
private allTaskList: AllTaskList = {
|
|
162
|
+
slide: [],
|
|
163
|
+
focus: [],
|
|
164
|
+
resize: [],
|
|
165
|
+
}
|
|
166
|
+
|
|
147
167
|
constructor(private onAddTask: AddTaskCallback) { }
|
|
148
168
|
|
|
149
|
-
|
|
169
|
+
private cleanTaskCache(): void {
|
|
170
|
+
this.allTaskList.slide = [];
|
|
171
|
+
this.allTaskList.focus = [];
|
|
172
|
+
this.allTaskList.resize = [];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
public addTask(type: TaskType, params: any, subtype: SubType = null) {
|
|
150
176
|
if (this.frameCount != Forge.sFrameCount.count) {
|
|
151
|
-
this.
|
|
177
|
+
this.cleanTaskCache();
|
|
152
178
|
this.cancellableRunnerList = [];
|
|
153
179
|
this.frameCount = Forge.sFrameCount.count;
|
|
154
180
|
}
|
|
@@ -157,12 +183,27 @@ export class TaskManager {
|
|
|
157
183
|
t.cancel();
|
|
158
184
|
});
|
|
159
185
|
|
|
160
|
-
|
|
186
|
+
const tObj = {
|
|
161
187
|
type,
|
|
188
|
+
subType: subtype,
|
|
162
189
|
params,
|
|
163
190
|
frameCount: Forge.sFrameCount.count,
|
|
164
|
-
}
|
|
165
|
-
|
|
191
|
+
}
|
|
192
|
+
switch (type) {
|
|
193
|
+
case TaskType.SLIDE:
|
|
194
|
+
this.allTaskList.slide.push(tObj)
|
|
195
|
+
break;
|
|
196
|
+
case TaskType.ON_FOCUS_CHANGE:
|
|
197
|
+
this.allTaskList.focus.push(tObj)
|
|
198
|
+
break;
|
|
199
|
+
case TaskType.RESIZE_ITEM:
|
|
200
|
+
this.allTaskList.resize.push(tObj)
|
|
201
|
+
break;
|
|
202
|
+
default:
|
|
203
|
+
console.error("undefined type")
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
this.onAddTask(this.allTaskList);
|
|
166
207
|
}
|
|
167
208
|
|
|
168
209
|
public run(func: TaskRunner) {
|
|
@@ -170,4 +211,12 @@ export class TaskManager {
|
|
|
170
211
|
this.cancellableRunnerList.push(cancellableRunner);
|
|
171
212
|
cancellableRunner.run();
|
|
172
213
|
}
|
|
214
|
+
|
|
215
|
+
public cancelAllTask() {
|
|
216
|
+
this.cleanTaskCache();
|
|
217
|
+
this.cancellableRunnerList.forEach(t => {
|
|
218
|
+
t.cancel();
|
|
219
|
+
});
|
|
220
|
+
this.cancellableRunnerList = [];
|
|
221
|
+
}
|
|
173
222
|
}
|
|
@@ -794,18 +794,28 @@ class CommonMetroTemplate extends MetroTemplate {
|
|
|
794
794
|
endIndex = baseItem.index;
|
|
795
795
|
}
|
|
796
796
|
if (Math.abs(startIndex - endIndex) <= 1) {
|
|
797
|
-
const
|
|
798
|
-
|
|
799
|
-
if (
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
797
|
+
const startItem = this.templateList[startIndex];
|
|
798
|
+
const endItem = this.templateList[endIndex];
|
|
799
|
+
if (visible(startItem[posKey], startItem[posKey] + startItem[sizeKey])) {
|
|
800
|
+
baseItem = startItem;
|
|
801
|
+
break;
|
|
802
|
+
} else if (visible(endItem[posKey], endItem[posKey] + endItem[sizeKey])) {
|
|
803
|
+
baseItem = endItem;
|
|
804
|
+
break;
|
|
805
|
+
} else {
|
|
806
|
+
const tailItem = this.templateList[this.getTailItemIndex()];
|
|
807
|
+
let tailInfo: any = null;
|
|
808
|
+
if (tailItem) {
|
|
809
|
+
tailInfo = {
|
|
810
|
+
left: tailItem.left,
|
|
811
|
+
top: tailItem.top,
|
|
812
|
+
width: tailItem.width,
|
|
813
|
+
height: tailItem.height,
|
|
814
|
+
}
|
|
805
815
|
}
|
|
816
|
+
console.log("MetroWidget: can not find visible item", visibleStart, visibleEnd, tailInfo);
|
|
817
|
+
return [-1, -1];
|
|
806
818
|
}
|
|
807
|
-
console.log("MetroWidget: can not find visible item", visibleStart, visibleEnd, tailInfo);
|
|
808
|
-
return [-1, -1];
|
|
809
819
|
} else {
|
|
810
820
|
baseItem = this.templateList[Math.round((startIndex + endIndex) / 2)];
|
|
811
821
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MetroTemplate, TemplateItem, MeasureInfo } from "./MetroTemplate"
|
|
2
|
-
import { VERTICAL, HORIZONTAL, FocusMoveType } from "../WidgetCommon";
|
|
2
|
+
import { VERTICAL, HORIZONTAL, FocusMoveType, getCurFrameCount } from "../WidgetCommon";
|
|
3
3
|
|
|
4
4
|
const TAG = "ListMetroTemplate";
|
|
5
5
|
|
|
@@ -123,8 +123,6 @@ class ListMetroTemplate extends MetroTemplate {
|
|
|
123
123
|
return [-1, -1]
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
126
|
let item = this.getItemById(baseId);
|
|
129
127
|
const startIndex = item ? item.index : Math.round(this.size / 2);
|
|
130
128
|
let start = -1, end = -1;
|
|
@@ -159,6 +157,23 @@ class ListMetroTemplate extends MetroTemplate {
|
|
|
159
157
|
return [start, end];
|
|
160
158
|
}
|
|
161
159
|
|
|
160
|
+
private cleanResizeChangeItem(i: TemplateItem) {
|
|
161
|
+
i.neighborIndexList.left = [];
|
|
162
|
+
i.neighborIndexList.top = [];
|
|
163
|
+
i.neighborIndexList.right = [];
|
|
164
|
+
i.neighborIndexList.bottom = [];
|
|
165
|
+
|
|
166
|
+
i.tmpNeighborIndexList.left = [];
|
|
167
|
+
i.tmpNeighborIndexList.top = [];
|
|
168
|
+
i.tmpNeighborIndexList.right = [];
|
|
169
|
+
i.tmpNeighborIndexList.bottom = [];
|
|
170
|
+
|
|
171
|
+
i.pathHistory.left = -1;
|
|
172
|
+
i.pathHistory.top = -1;
|
|
173
|
+
i.pathHistory.right = -1;
|
|
174
|
+
i.pathHistory.bottom = -1;
|
|
175
|
+
}
|
|
176
|
+
|
|
162
177
|
public updateItemSize(index: number, newSize: { width: number, height: number }): void {
|
|
163
178
|
const item = this.templateList[index];
|
|
164
179
|
if (!item || (item.width == newSize.width && item.height == newSize.height)) {
|
|
@@ -173,8 +188,17 @@ class ListMetroTemplate extends MetroTemplate {
|
|
|
173
188
|
break;
|
|
174
189
|
}
|
|
175
190
|
}
|
|
191
|
+
//TODO 不是一次性加载全部, 可视区域外的懒惰加载
|
|
176
192
|
for (let i of needChangeList) {
|
|
193
|
+
this.cleanResizeChangeItem(i);
|
|
177
194
|
this._addTemplateItem(i);
|
|
195
|
+
i.layoutCache.cache({
|
|
196
|
+
left: i.left,
|
|
197
|
+
top: i.top,
|
|
198
|
+
width: i.width,
|
|
199
|
+
height: i.height,
|
|
200
|
+
frameCount: getCurFrameCount(),
|
|
201
|
+
})
|
|
178
202
|
}
|
|
179
203
|
}
|
|
180
204
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { checkType, toRawType, getTypeName } from "../CheckType.js";
|
|
2
2
|
import { METRO_WIDGET } from "../MetroWidget/Const";
|
|
3
|
-
import { VERTICAL } from "../WidgetCommon";
|
|
3
|
+
import { VERTICAL, getCurFrameCount } from "../WidgetCommon";
|
|
4
|
+
import { RectCache } from "../MetroWidget/Slide";
|
|
4
5
|
|
|
5
6
|
const TAG = "MetroTemplate";
|
|
6
7
|
|
|
@@ -160,7 +161,7 @@ interface TemplateItem {
|
|
|
160
161
|
bottom: number,
|
|
161
162
|
}
|
|
162
163
|
findNextAnchor: FindNextAnchor | null,
|
|
163
|
-
layoutCache:
|
|
164
|
+
layoutCache: RectCache,
|
|
164
165
|
uid?: string,
|
|
165
166
|
}
|
|
166
167
|
|
|
@@ -266,6 +267,14 @@ abstract class MetroTemplate {
|
|
|
266
267
|
if (itemObj.uid) {
|
|
267
268
|
(this.uidMap as any)[itemObj.uid] = item;
|
|
268
269
|
}
|
|
270
|
+
//初次缓存rect, 为resize准备
|
|
271
|
+
item.layoutCache.cache({
|
|
272
|
+
left: item.left,
|
|
273
|
+
top: item.top,
|
|
274
|
+
width: item.width,
|
|
275
|
+
height: item.height,
|
|
276
|
+
frameCount: getCurFrameCount(),
|
|
277
|
+
})
|
|
269
278
|
return item;
|
|
270
279
|
}
|
|
271
280
|
|
|
@@ -278,15 +287,22 @@ abstract class MetroTemplate {
|
|
|
278
287
|
|
|
279
288
|
public getBoundingBoxSize() {
|
|
280
289
|
const lastItem = this.templateList[this.templateList.length - 1];
|
|
281
|
-
if (
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
290
|
+
if (lastItem) {
|
|
291
|
+
if (this.direction == VERTICAL) {
|
|
292
|
+
return {
|
|
293
|
+
width: this.lineMax,
|
|
294
|
+
height: lastItem.height + lastItem.top - 1,
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
297
|
+
return {
|
|
298
|
+
height: this.lineMax,
|
|
299
|
+
width: lastItem.width + lastItem.left - 1,
|
|
300
|
+
}
|
|
285
301
|
}
|
|
286
302
|
} else {
|
|
287
303
|
return {
|
|
288
|
-
|
|
289
|
-
|
|
304
|
+
width: 0,
|
|
305
|
+
height: 0,
|
|
290
306
|
}
|
|
291
307
|
}
|
|
292
308
|
}
|
|
@@ -295,32 +311,6 @@ abstract class MetroTemplate {
|
|
|
295
311
|
return this.tailItemIndex;
|
|
296
312
|
}
|
|
297
313
|
|
|
298
|
-
public cacheLayout(start: number, end: number) {
|
|
299
|
-
if (typeof end == "undefined") {
|
|
300
|
-
end = this.templateList.length;
|
|
301
|
-
}
|
|
302
|
-
end = Math.min(end, this.templateList.length);
|
|
303
|
-
for (let i = start; i < end; ++i) {
|
|
304
|
-
let item = this.templateList[i];
|
|
305
|
-
item.layoutCache = {
|
|
306
|
-
left: item.left,
|
|
307
|
-
top: item.top,
|
|
308
|
-
width: item.width,
|
|
309
|
-
height: item.height,
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
this.cachedLayoutRange.push([start, end]);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
public cleanLayoutCache() {
|
|
316
|
-
for (let r of this.cachedLayoutRange) {
|
|
317
|
-
for (let i = r[0]; i < r[1]; ++i) {
|
|
318
|
-
this.templateList[i].layoutCache = null;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
this.cachedLayoutRange = [];
|
|
322
|
-
}
|
|
323
|
-
|
|
324
314
|
protected static getTemplateItem(itemObj: MeasureInfo): TemplateItem {
|
|
325
315
|
const valid = this.checkMeasureObject(itemObj);
|
|
326
316
|
if (!valid) {
|
|
@@ -362,7 +352,7 @@ abstract class MetroTemplate {
|
|
|
362
352
|
top: -1,
|
|
363
353
|
bottom: -1,
|
|
364
354
|
},
|
|
365
|
-
layoutCache:
|
|
355
|
+
layoutCache: new RectCache(),
|
|
366
356
|
}
|
|
367
357
|
}
|
|
368
358
|
|
|
@@ -55,6 +55,8 @@ class TemplateItemAdder {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
public tryAddItem(cur_item: TemplateItem | null = null, page_num: number = 1) {
|
|
58
|
+
if (!this._Data || this._Data.length <= 0) { return; }
|
|
59
|
+
|
|
58
60
|
let added = false;
|
|
59
61
|
if (
|
|
60
62
|
this._CurIndex < this._Data.length &&
|
|
@@ -86,6 +88,8 @@ class TemplateItemAdder {
|
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
tryAddItemByPosition(position: number) {
|
|
91
|
+
if (!this._Data || this._Data.length <= 0) { return; }
|
|
92
|
+
|
|
89
93
|
const page_num = Math.ceil(position / this._PageRange + 1);
|
|
90
94
|
if (page_num > this._CurPage) {
|
|
91
95
|
this.tryAddItem(null, page_num - this._CurPage);
|
|
@@ -94,6 +98,7 @@ class TemplateItemAdder {
|
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
tryAddItemByIndex(index: number) {
|
|
101
|
+
if (!this._Data || this._Data.length <= 0) { return; }
|
|
97
102
|
let _index = Math.min(index, this._Data.length - 1);
|
|
98
103
|
let added = false;
|
|
99
104
|
while (this._CurIndex <= _index) {
|
|
@@ -121,6 +126,7 @@ class TemplateItemAdder {
|
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
tryAddItemById(id: number) {
|
|
129
|
+
if (!this._Data || this._Data.length <= 0) { return; }
|
|
124
130
|
let _id = Math.min(id, this._Data.length - 1); // id小于等于index, 因此为了避免过界取小值
|
|
125
131
|
const last_id = this._MetroTemplate.focusableSize - 1;
|
|
126
132
|
if (last_id < _id) {
|
|
@@ -153,6 +159,7 @@ class TemplateItemAdder {
|
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
tryAddItemByUid(uid: string) {
|
|
162
|
+
if (!this._Data || this._Data.length <= 0) { return; }
|
|
156
163
|
if (this._MetroTemplate.getItemByUid(uid)) {
|
|
157
164
|
//已经添加
|
|
158
165
|
return;
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
* @LastEditTime: 2022-12-01 16:49:21
|
|
6
6
|
* @Description: file content
|
|
7
7
|
*/
|
|
8
|
+
import { Forge } from "@shijiu/jsview/dom/jsv-forge-define.mjs";
|
|
9
|
+
|
|
10
|
+
export const getCurFrameCount = () => {
|
|
11
|
+
return Forge.sFrameCount.count;
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
export class BaseDispatcher {
|
|
9
15
|
private _Component: any;
|
|
10
16
|
|
|
@@ -92,8 +98,7 @@ export const SlideStyle = {
|
|
|
92
98
|
endBoundaryProtect: 2,
|
|
93
99
|
};
|
|
94
100
|
|
|
95
|
-
export
|
|
96
|
-
export const HORIZONTAL = Symbol("horizontal");
|
|
101
|
+
export { VERTICAL, HORIZONTAL } from "../JsViewVueTools/ConstSymbol";
|
|
97
102
|
|
|
98
103
|
const defaultSpeed = 1.5;
|
|
99
104
|
const defaultEasing = "";
|
|
@@ -159,6 +164,8 @@ export class WholePageSlide extends SlideSetting {
|
|
|
159
164
|
* endPercennt: 右/下侧触发滚动的比例 0-1
|
|
160
165
|
* headRange: 左/上按键触发滚动的区域比例 0-1
|
|
161
166
|
* tailRange: 右/下按键触发滚动的区域比例 0-1
|
|
167
|
+
* headSafeArea: 保证头部item完整显示的安全区域大小
|
|
168
|
+
* tailSafeArea: 保证尾部item完整显示的安全区域大小
|
|
162
169
|
* speed: 滚动速度, 像素/毫秒
|
|
163
170
|
* easing: 滚动动画的easing
|
|
164
171
|
* boundaryProtect: 确定滚动位置能否小于0或者大于最大长度
|
|
@@ -169,12 +176,16 @@ export class SeamlessSlide extends SlideSetting {
|
|
|
169
176
|
public readonly StartPercent: number;
|
|
170
177
|
public readonly EndPercent: number;
|
|
171
178
|
public readonly FixFirstPage: boolean;
|
|
179
|
+
public readonly HeadSafeArea: number;
|
|
180
|
+
public readonly TailSafeArea: number;
|
|
172
181
|
|
|
173
182
|
constructor({
|
|
174
183
|
startPercent = 0.2,
|
|
175
184
|
endPercent = 0.8,
|
|
176
185
|
headRange = undefined,
|
|
177
186
|
tailRange = undefined,
|
|
187
|
+
headSafeArea = 0.1,
|
|
188
|
+
tailSafeArea = 0.1,
|
|
178
189
|
speed = defaultSpeed,
|
|
179
190
|
duration = null,
|
|
180
191
|
easing = defaultEasing,
|
|
@@ -188,14 +199,16 @@ export class SeamlessSlide extends SlideSetting {
|
|
|
188
199
|
this.StartPercent = headRange;
|
|
189
200
|
}
|
|
190
201
|
if (typeof tailRange !== "undefined") {
|
|
191
|
-
this.EndPercent = tailRange;
|
|
202
|
+
this.EndPercent = 1 - tailRange;
|
|
192
203
|
}
|
|
193
|
-
|
|
204
|
+
|
|
194
205
|
if (this.StartPercent < 0 || this.StartPercent > 1 || this.EndPercent < 0 || this.EndPercent > 1) {
|
|
195
206
|
console.error(`SeamlessSlideSetting error: invalide value, startPercent(${this.StartPercent}) and endPercent(${this.EndPercent}) must between 0 and 1.`);
|
|
196
|
-
this.StartPercent = 0.
|
|
197
|
-
this.EndPercent = 0.
|
|
207
|
+
this.StartPercent = 0.3;
|
|
208
|
+
this.EndPercent = 0.7;
|
|
198
209
|
}
|
|
210
|
+
this.HeadSafeArea = headSafeArea;
|
|
211
|
+
this.TailSafeArea = tailSafeArea;
|
|
199
212
|
this.FixFirstPage = fixFirstPage;
|
|
200
213
|
}
|
|
201
214
|
}
|
|
@@ -240,4 +253,4 @@ export const FocusMoveType = {
|
|
|
240
253
|
ROW_FIND_NEAR: 0x00000001 << 3,
|
|
241
254
|
};
|
|
242
255
|
|
|
243
|
-
export const RENDER_ITEM_BREAK_KEY = "__QcodeJsviewMetroWidgetSlot";
|
|
256
|
+
export const RENDER_ITEM_BREAK_KEY = "__QcodeJsviewMetroWidgetSlot";
|
|
@@ -11,7 +11,7 @@ export * from "./MetroWidget/Dispatcher";
|
|
|
11
11
|
export { default as SimpleWidget } from "./MetroWidget/MetroWidget.vue";
|
|
12
12
|
export { default as MetroWidget } from "./MetroWidget/MetroWidget.vue";
|
|
13
13
|
export { default as ListWidget } from "./MetroWidget/ListWidget.vue";
|
|
14
|
-
export { METRO_WIDGET, METRO_WIDGET_CONST } from "./MetroWidget/Const
|
|
14
|
+
export { METRO_WIDGET, METRO_WIDGET_CONST } from "./MetroWidget/Const";
|
|
15
15
|
|
|
16
16
|
export { default as JsvFocusBlock } from "./JsvFocus/JsvFocusBlock.vue";
|
|
17
17
|
export { jsvCreateFocusManager, useFocusHub } from "./JsvFocus/JsvFocusManager";
|
|
@@ -11,7 +11,7 @@ import { ScreenLockManager } from "./ScreenLockManager.js";
|
|
|
11
11
|
|
|
12
12
|
let sPluginLoader = GetPluginLoader();
|
|
13
13
|
|
|
14
|
-
const TAG = "JsvAudio";
|
|
14
|
+
const TAG = "JsvAudio:";
|
|
15
15
|
|
|
16
16
|
let keyToken = 0;
|
|
17
17
|
const getKeyToken = () => {
|
|
@@ -77,6 +77,8 @@ class AudioProxy {
|
|
|
77
77
|
this._created = false;
|
|
78
78
|
this._eventListener = {};
|
|
79
79
|
this._propCache = {};
|
|
80
|
+
this._unloaded = false;
|
|
81
|
+
this._visibility = window.JsView?.getVisibility();
|
|
80
82
|
this._onVisibilityChange = this.onVisibilityChange.bind(this);
|
|
81
83
|
window.JsView?.onVisibilityChange(this._onVisibilityChange);
|
|
82
84
|
}
|
|
@@ -207,18 +209,33 @@ class AudioProxy {
|
|
|
207
209
|
|
|
208
210
|
/** control */
|
|
209
211
|
load() {
|
|
212
|
+
if (this._unloaded) {
|
|
213
|
+
console.warn(TAG, "Instead of calling load() after unload(), please update component's key to create a new JsvAudio.");
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
210
216
|
this.setProperty("enablePlayer", true);
|
|
211
217
|
}
|
|
212
218
|
|
|
213
219
|
play() {
|
|
214
|
-
this.
|
|
220
|
+
if (this._visibility) {
|
|
221
|
+
this.setProperty("paused", false);
|
|
222
|
+
if (typeof this._propCache["customerPause"] !== "undefined") {
|
|
223
|
+
this._propCache["customerPause"] = false;
|
|
224
|
+
}
|
|
225
|
+
} else {
|
|
226
|
+
console.warn(TAG, "JsvAudio can not play when it is invisible.");
|
|
227
|
+
}
|
|
215
228
|
}
|
|
216
229
|
|
|
217
230
|
pause() {
|
|
218
231
|
this.setProperty("paused", true);
|
|
232
|
+
if (typeof this._propCache["customerPause"] !== "undefined") {
|
|
233
|
+
this._propCache["customerPause"] = true;
|
|
234
|
+
}
|
|
219
235
|
}
|
|
220
236
|
|
|
221
237
|
unload() {
|
|
238
|
+
this._unloaded = true;
|
|
222
239
|
this.pause();
|
|
223
240
|
this.setProperty("enablePlayer", false);
|
|
224
241
|
}
|
|
@@ -321,6 +338,7 @@ class AudioProxy {
|
|
|
321
338
|
onVisibilityChange(state) {
|
|
322
339
|
console.log(TAG, "audio visibility change", JSON.stringify(state));
|
|
323
340
|
if (state.status == "show") {
|
|
341
|
+
this._visibility = true;
|
|
324
342
|
if (typeof this._propCache["customerPause"] != "undefined") {
|
|
325
343
|
const customerPause = this._propCache["customerPause"];
|
|
326
344
|
delete this._propCache["customerPause"];
|
|
@@ -330,6 +348,7 @@ class AudioProxy {
|
|
|
330
348
|
}
|
|
331
349
|
} else {
|
|
332
350
|
// pause when invisible
|
|
351
|
+
this._visibility = false;
|
|
333
352
|
this._propCache["customerPause"] = this._propCache["paused"];
|
|
334
353
|
this.pause();
|
|
335
354
|
}
|
|
@@ -270,6 +270,11 @@ export default {
|
|
|
270
270
|
* 视频显示在活跃JsvPlayer设置的显示区域内,事件通知也只会送给活跃的JsvPlayer组件注册的回调函数。
|
|
271
271
|
*/
|
|
272
272
|
active: { type: Boolean, default: true },
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* 属性,Number,视频播放窗的圆角设置
|
|
276
|
+
*/
|
|
277
|
+
corner: { type: Number, default: 0 },
|
|
273
278
|
},
|
|
274
279
|
components: {},
|
|
275
280
|
watch: {
|
|
@@ -366,6 +371,7 @@ export default {
|
|
|
366
371
|
// 创建PC版本的video标签
|
|
367
372
|
this.video = window.originDocument.createElement("video");
|
|
368
373
|
this._extendsApi(this.video);
|
|
374
|
+
this.video.style.borderRadius = this.corner + "px";
|
|
369
375
|
} else {
|
|
370
376
|
this.video.setRef();
|
|
371
377
|
first_create = false;
|
|
@@ -489,7 +495,13 @@ export default {
|
|
|
489
495
|
</script>
|
|
490
496
|
|
|
491
497
|
<template>
|
|
492
|
-
<div
|
|
498
|
+
<div
|
|
499
|
+
:style="{
|
|
500
|
+
...holeStyle,
|
|
501
|
+
backgroundColor: 'rgba(0,0,0,1)',
|
|
502
|
+
borderRadius: corner,
|
|
503
|
+
}"
|
|
504
|
+
>
|
|
493
505
|
<div
|
|
494
506
|
:style="{
|
|
495
507
|
left: holeStyle.left,
|