@shijiu/jsview-vue 2.1.367-test.0 → 2.1.428
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/jsview-vue.mjs +843 -508
- package/package.json +1 -1
- package/tools/config/vite.config.ts +1 -0
- package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +4 -8
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +8 -10
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +194 -167
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.ts +7 -3
- package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +8 -5
- package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +173 -0
- package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +4 -0
- package/utils/JsViewVueTools/JsvTextureDefines.ts +11 -0
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CanvasTexture.ts +27 -3
- package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.ts +1 -1
- package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +0 -28
- package/utils/JsViewVueTools/index.js +1 -0
- package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +118 -0
- package/utils/JsViewVueWidget/JsvFlexCell/index.js +6 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +29 -0
- package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +4 -0
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +26 -25
- package/utils/JsViewVueWidget/JsvPieChart.vue +37 -37
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +29 -9
- package/utils/JsViewVueWidget/JsvSceneTransition.vue +174 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +41 -30
- package/utils/JsViewVueWidget/JsvTextBox.vue +20 -34
- package/utils/JsViewVueWidget/index.js +2 -0
- package/utils/JsViewEngineWidget/MetroWidget/AnimationManager.ts +0 -189
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
|
|
2
|
+
|
|
3
|
+
interface AnimSetting {
|
|
4
|
+
easing?: string | null;
|
|
5
|
+
onStart?: () => void;
|
|
6
|
+
onEnd?: (done: boolean) => void;
|
|
7
|
+
duration?: number,
|
|
8
|
+
speed?: number,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class SlideAnimWrapper {
|
|
12
|
+
private frameCount: number;
|
|
13
|
+
private forgeAnim: any;
|
|
14
|
+
private element: any;
|
|
15
|
+
private animSetting: AnimSetting;
|
|
16
|
+
|
|
17
|
+
constructor(
|
|
18
|
+
frameCount: number,
|
|
19
|
+
element: any,
|
|
20
|
+
from: [number, number],
|
|
21
|
+
to: [number, number],
|
|
22
|
+
setting: AnimSetting) {
|
|
23
|
+
this.frameCount = frameCount;
|
|
24
|
+
this.animSetting = setting;
|
|
25
|
+
this.element = element;
|
|
26
|
+
|
|
27
|
+
let duration = 0;
|
|
28
|
+
if (typeof setting.duration == "number") {
|
|
29
|
+
duration = setting.duration;
|
|
30
|
+
} else if (typeof setting.speed == "number") {
|
|
31
|
+
duration = Math.round(Math.max(Math.abs(to[0] - from[0]), Math.abs(to[1] - from[1])) / setting.speed);
|
|
32
|
+
}
|
|
33
|
+
this.forgeAnim = new Forge.TranslateAnimation(
|
|
34
|
+
from[0],
|
|
35
|
+
to[0],
|
|
36
|
+
from[1],
|
|
37
|
+
to[1],
|
|
38
|
+
duration,
|
|
39
|
+
setting.easing
|
|
40
|
+
);
|
|
41
|
+
this.forgeAnim.SetAnimationListener(
|
|
42
|
+
new Forge.AnimationListener(this.onStart.bind(this), this.onEnd.bind(this), null)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public start() {
|
|
47
|
+
this.element?.jsvGetProxyView(true).StartAnimation(this.forgeAnim);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public removeListener() {
|
|
51
|
+
this.forgeAnim?.RemoveAnimationListener();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public stop() {
|
|
55
|
+
this.element?.jsvGetProxyView(true).StopAnimation();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public getFrameCount() {
|
|
59
|
+
return this.frameCount;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private onStart() {
|
|
63
|
+
this.animSetting?.onStart?.();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private onEnd(done: boolean) {
|
|
67
|
+
this.animSetting?.onEnd?.(done);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export class AnimationManager {
|
|
72
|
+
private animList: Array<SlideAnimWrapper> = [];
|
|
73
|
+
private frameCount: number = 0;
|
|
74
|
+
|
|
75
|
+
public startSlideAnim(element: any, from: [number, number], to: [number, number], setting: AnimSetting) {
|
|
76
|
+
let curFrameCount = Forge.sFrameCount.count;
|
|
77
|
+
if (curFrameCount != this.frameCount) {
|
|
78
|
+
this.tryCleanOldAnim();
|
|
79
|
+
this.frameCount = curFrameCount;
|
|
80
|
+
}
|
|
81
|
+
const obj = new SlideAnimWrapper(curFrameCount, element, from, to, setting);
|
|
82
|
+
this.animList.push(obj);
|
|
83
|
+
obj.start();
|
|
84
|
+
return () => {
|
|
85
|
+
if (obj.getFrameCount() == Forge.sFrameCount.count) {
|
|
86
|
+
obj.removeListener();
|
|
87
|
+
}
|
|
88
|
+
obj.stop();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private tryCleanOldAnim() {
|
|
93
|
+
for (let i = this.animList.length - 1; i >= 0; --i) {
|
|
94
|
+
const anim = this.animList[i];
|
|
95
|
+
if (anim.getFrameCount() != this.frameCount) {
|
|
96
|
+
this.animList.splice(i, 1);
|
|
97
|
+
anim.stop();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type CancelFunc = () => {};
|
|
104
|
+
|
|
105
|
+
export type TaskRunner = () => CancelFunc;
|
|
106
|
+
|
|
107
|
+
class CancellableRunner {
|
|
108
|
+
private cancelHandler: CancelFunc | null = null;
|
|
109
|
+
private runner: TaskRunner | null = null;
|
|
110
|
+
constructor(r: TaskRunner) {
|
|
111
|
+
this.runner = r;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
run() {
|
|
115
|
+
if (this.runner) {
|
|
116
|
+
this.cancelHandler = this.runner();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
cancel() {
|
|
121
|
+
this.cancelHandler?.();
|
|
122
|
+
this.runner = null;
|
|
123
|
+
this.cancelHandler = null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
export enum TaskType {
|
|
129
|
+
RESIZE_ITEM,
|
|
130
|
+
SLIDE,
|
|
131
|
+
ON_FOCUS_CHANGE,
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface Task {
|
|
135
|
+
frameCount: number,
|
|
136
|
+
type: TaskType,
|
|
137
|
+
params: any,
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type AddTaskCallback = (taskList: Array<object>) => void;
|
|
141
|
+
|
|
142
|
+
export class TaskManager {
|
|
143
|
+
private frameCount: number = -1;
|
|
144
|
+
private widgetTaskCacheList: Array<Task> = [];
|
|
145
|
+
private cancellableRunnerList: Array<CancellableRunner> = [];
|
|
146
|
+
|
|
147
|
+
constructor(private onAddTask: AddTaskCallback) { }
|
|
148
|
+
|
|
149
|
+
public addTask(type: TaskType, params: any) {
|
|
150
|
+
if (this.frameCount != Forge.sFrameCount.count) {
|
|
151
|
+
this.widgetTaskCacheList = [];
|
|
152
|
+
this.cancellableRunnerList = [];
|
|
153
|
+
this.frameCount = Forge.sFrameCount.count;
|
|
154
|
+
}
|
|
155
|
+
//取消同帧的旧runner
|
|
156
|
+
this.cancellableRunnerList.forEach(t => {
|
|
157
|
+
t.cancel();
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
this.widgetTaskCacheList.push({
|
|
161
|
+
type,
|
|
162
|
+
params,
|
|
163
|
+
frameCount: Forge.sFrameCount.count,
|
|
164
|
+
});
|
|
165
|
+
this.onAddTask(this.widgetTaskCacheList);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public run(func: TaskRunner) {
|
|
169
|
+
const cancellableRunner = new CancellableRunner(func);
|
|
170
|
+
this.cancellableRunnerList.push(cancellableRunner);
|
|
171
|
+
cancellableRunner.run();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -160,6 +160,10 @@ class ListMetroTemplate extends MetroTemplate {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
public updateItemSize(index: number, newSize: { width: number, height: number }): void {
|
|
163
|
+
const item = this.templateList[index];
|
|
164
|
+
if (!item || (item.width == newSize.width && item.height == newSize.height)) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
163
167
|
const needChangeList = this.templateList.splice(index);
|
|
164
168
|
needChangeList[0].width = newSize.width;
|
|
165
169
|
needChangeList[0].height = newSize.height;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Forge } from "@shijiu/jsview/dom/jsv-forge-define.mjs";
|
|
2
|
+
|
|
3
|
+
class TextureInstantType {
|
|
4
|
+
public static Auto: number = Forge.TextureInstantLoad.AUTO;
|
|
5
|
+
public static Sync: number = Forge.TextureInstantLoad.SYNC;
|
|
6
|
+
public static Async: number = Forge.TextureInstantLoad.ASYNC;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
TextureInstantType,
|
|
11
|
+
}
|
|
@@ -2,10 +2,12 @@ import ForgeHandles from "../../../JsViewVueTools/ForgeHandles.js";
|
|
|
2
2
|
import { TextureBase } from "../Texture"
|
|
3
3
|
import * as Constants from "./CommandList"
|
|
4
4
|
import { RectPath, CirclePath, CustomPath } from "./Path"
|
|
5
|
+
import { TextureInstantType } from "../../JsvTextureDefines";
|
|
5
6
|
|
|
6
7
|
class CanvasTexture extends TextureBase {
|
|
7
8
|
private drawCommands: Array<Object> | null = [];
|
|
8
9
|
private commited: boolean = false; // commit只能执行一次, 执行过后无法再更改texture内容
|
|
10
|
+
private instantLoad: number = TextureInstantType.Sync;
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* canvasTexture
|
|
@@ -134,14 +136,18 @@ class CanvasTexture extends TextureBase {
|
|
|
134
136
|
* @param {Array<String>} colorArray 颜色设定的数组
|
|
135
137
|
* @param {Array<double>} stopsArray 与color数组个数相同,颜色基准点位置
|
|
136
138
|
*/
|
|
137
|
-
|
|
139
|
+
drawLinearGradientRect(
|
|
138
140
|
fromX: Number, fromY: Number,
|
|
139
141
|
toX: Number, toY: Number,
|
|
140
142
|
colorArray: Array<String>,
|
|
141
143
|
stopsArray: Array<Number>,
|
|
142
144
|
) {
|
|
145
|
+
if (!colorArray || !stopsArray || colorArray.length !== stopsArray.length) {
|
|
146
|
+
console.error("CanvasTexture error: drawLinearGradientRect colorArray.length must be equal to stopsArray.length. Current array is:", Array.from(colorArray), Array.from(stopsArray));
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
143
149
|
this.drawCommands?.push({
|
|
144
|
-
"cmd": Constants.
|
|
150
|
+
"cmd": Constants.CMD_DRAW_LINEAR_GRADIENT_RECT,
|
|
145
151
|
"x0": fromX,
|
|
146
152
|
"y0": fromY,
|
|
147
153
|
"x1": toX,
|
|
@@ -151,11 +157,29 @@ class CanvasTexture extends TextureBase {
|
|
|
151
157
|
})
|
|
152
158
|
}
|
|
153
159
|
|
|
160
|
+
/**
|
|
161
|
+
* setAsyncLoad
|
|
162
|
+
* texture异步加载,让界面不会卡顿
|
|
163
|
+
*
|
|
164
|
+
* @param {int} fromX 绘制起点X
|
|
165
|
+
* @param {int} fromY 绘制起点Y
|
|
166
|
+
* @param {int} toX 绘制终点X
|
|
167
|
+
* @param {int} toY 绘制终点Y
|
|
168
|
+
* @param {Array<String>} colorArray 颜色设定的数组
|
|
169
|
+
* @param {Array<double>} stopsArray 与color数组个数相同,颜色基准点位置
|
|
170
|
+
*/
|
|
171
|
+
setAsyncLoad() {
|
|
172
|
+
this.instantLoad = TextureInstantType.Async;
|
|
173
|
+
}
|
|
174
|
+
|
|
154
175
|
// override
|
|
155
176
|
commit(): String {
|
|
156
177
|
if (!this.commited) {
|
|
157
178
|
// 使用当前的指令列表创建CanvasTexture
|
|
158
|
-
this.textureRef = (ForgeHandles.TextureManager as any).GetCanvasTexture(
|
|
179
|
+
this.textureRef = (ForgeHandles.TextureManager as any).GetCanvasTexture(
|
|
180
|
+
JSON.stringify(this.drawCommands),
|
|
181
|
+
this.instantLoad
|
|
182
|
+
);
|
|
159
183
|
this.addToStore();
|
|
160
184
|
this.commited = true;
|
|
161
185
|
|
|
@@ -16,7 +16,7 @@ export const CMD_DRAW_CIRCLE_WITH_PAINT = 12;
|
|
|
16
16
|
export const CMD_DRAW_RECT_WITH_PAINT = 13;
|
|
17
17
|
export const CMD_DRAW_PATH_WITH_PAINT = 14;
|
|
18
18
|
export const CMD_DRAW_LINE = 15;
|
|
19
|
-
export const
|
|
19
|
+
export const CMD_DRAW_LINEAR_GRADIENT_RECT = 16;
|
|
20
20
|
|
|
21
21
|
//! Path的子命令
|
|
22
22
|
export const PATH_CMD_MOVE_TO = 30;
|
|
@@ -40,34 +40,6 @@ let sTextureStoreApi: Object = {
|
|
|
40
40
|
return new CanvasTexture(width, height, baseName);
|
|
41
41
|
},
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
* getLinearGradientTexture
|
|
45
|
-
* 按照要求创建一个绘制渐变色的纹理,
|
|
46
|
-
* 绘制从起始位置到终止位置的一条线,
|
|
47
|
-
* 例如从右边上的中点绘制到上边缘的中点的直线: RIGHT:0.5 -> TOP:0.5
|
|
48
|
-
* 返回值为访问名
|
|
49
|
-
*
|
|
50
|
-
* @param {int} startSide JsvTextureConst的 LEFT/TOP/RIGHT/BOTTOM, 起始位置
|
|
51
|
-
* @param {double} startSidePercent 起始点在所在边的比例位置
|
|
52
|
-
* @param {int} endSide JsvTextureConst的 LEFT/TOP/RIGHT/BOTTOM, 终止位置
|
|
53
|
-
* @param {double} endSidePercent 终止点在所在边的比例位置
|
|
54
|
-
* @param {Array<String>} colorArray 颜色基准点的颜色队列
|
|
55
|
-
* @param {int} stopsDenominator stops信息百分比的分母,值越小其texture越省内存
|
|
56
|
-
* @param {Array<int>} stopsArray 颜色基准点的百分比的分子队列
|
|
57
|
-
*
|
|
58
|
-
* @return {String} 此Texture的访问名,可以在 img.src 或者 div.backgroundImage 通过 "texturestore://访问名"使用
|
|
59
|
-
*/
|
|
60
|
-
getLinearGradientTexture: (
|
|
61
|
-
startSide: Number, startSidePercent: Number,
|
|
62
|
-
endSide: Number, endSidePercent: Number,
|
|
63
|
-
colorArray: Array<String>,
|
|
64
|
-
stopsDenominator: Number, stopsArray: Array<Number>
|
|
65
|
-
): String => {
|
|
66
|
-
// TODO: 仿照ResProvider的GetLinearGradientTexture调用 this.canvasTexture 创建width+x/height+x的的texture
|
|
67
|
-
// 然后进行绘制一个填满整个canvas的texture
|
|
68
|
-
return "";
|
|
69
|
-
},
|
|
70
|
-
|
|
71
43
|
/**
|
|
72
44
|
* deleteTexture
|
|
73
45
|
* 删除commit后的texture
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: donglin.lu@qcast.cn
|
|
3
|
+
* @Date: 2024-01-26 17:24:00
|
|
4
|
+
* @LastEditors: donglin.lu@qcast.cn
|
|
5
|
+
* @Description: file content
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
<!--
|
|
9
|
+
* 【模块 export 内容】
|
|
10
|
+
* JsvFlexDiv: 包装成一个支持flex属性的div
|
|
11
|
+
* props说明:
|
|
12
|
+
* class: 等同于div的class设置(目前未实装,后续支持...)
|
|
13
|
+
* style: 等同于div的style,关于flex的属性支持如下:
|
|
14
|
+
* 作为container:
|
|
15
|
+
* flexDirection: row|row-reverse|column|column-reverse 默认row, 决定主轴为行还是列,正向还是反向
|
|
16
|
+
* flexWrap: nowrap|wrap 默认nowrap, 主轴方向是否换行
|
|
17
|
+
* justifyContent: flex-start|flex-end|center 默认flex-start
|
|
18
|
+
* 主轴对齐方式(与direction相关决定start为左还是右)
|
|
19
|
+
* alignItems: flex-start|flex-end|center|stretch 默认center
|
|
20
|
+
* 副轴方向单行内的对齐方式,例如主轴为行时,项目在每行中竖直方向的对齐
|
|
21
|
+
* alignContent: flex-start|flex-end|center 默认flex-start
|
|
22
|
+
* 副轴方向多行内容总体的对齐方式,例如主轴为行时,项目在每行中竖直方向的对齐
|
|
23
|
+
* 作为item(二级container):
|
|
24
|
+
* alignSelf: auto|flex-start|flex-end|center|stretch 默认auto, 覆盖container的alignItems设置
|
|
25
|
+
* 特别注意: 这些属性会引起位置对齐问题, 所以会自动去掉: "overflow:hidden"
|
|
26
|
+
* askSize: boolean 设置会跟进flex的尺寸变化,但会降低性能
|
|
27
|
+
* onSized: Function 比askSize更进一步,可以通过回调知道尺寸变化后的时机,回调参数(width, height)为flex后的尺寸
|
|
28
|
+
*
|
|
29
|
+
* expose说明:
|
|
30
|
+
* getWidth(): 当askSize或者onSize生效时,获取元素的宽度
|
|
31
|
+
* getHeight(): 当askSize或者onSize生效时,获取元素的高度
|
|
32
|
+
*
|
|
33
|
+
-->
|
|
34
|
+
<script setup>
|
|
35
|
+
import { shallowRef, watchEffect } from "vue";
|
|
36
|
+
|
|
37
|
+
const props = defineProps({
|
|
38
|
+
style: Object,
|
|
39
|
+
askSize: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
onSized: {
|
|
44
|
+
type: Function,
|
|
45
|
+
default: null,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
let config = shallowRef({});
|
|
50
|
+
config.value["data-jsv-flex-container"] = true;
|
|
51
|
+
|
|
52
|
+
watchEffect(() => {
|
|
53
|
+
// 追加一个默认的flexWrap设置,以触发ElementDelegate的flex读取机制
|
|
54
|
+
// flex-div直接设置的属性不能为以下内容,在此进行清理:
|
|
55
|
+
// 1. 不能有 overflow:'hidden' 属性
|
|
56
|
+
config.value.style = { flexWrap: "nowrap", ...props.style, overflow: "" };
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// 尺寸信息记录
|
|
60
|
+
let SizeX = shallowRef(undefined);
|
|
61
|
+
let SizeY = shallowRef(undefined);
|
|
62
|
+
let SizeWidth = shallowRef(undefined);
|
|
63
|
+
let SizeHeight = shallowRef(undefined);
|
|
64
|
+
|
|
65
|
+
// 尺寸信息的回调处理
|
|
66
|
+
let onSizeCallback = (x, y, width, height) => {
|
|
67
|
+
SizeX.value = x;
|
|
68
|
+
SizeY.value = y;
|
|
69
|
+
SizeWidth.value = width;
|
|
70
|
+
SizeHeight.value = height;
|
|
71
|
+
|
|
72
|
+
if (width != 0 && height != 0) {
|
|
73
|
+
// 忽略0尺寸这个中间过程的回调
|
|
74
|
+
props.onSized?.(width, height);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
let containerRef = shallowRef(null);
|
|
78
|
+
let flexCallbackRegisted = false;
|
|
79
|
+
watchEffect(() => {
|
|
80
|
+
if ((props.askSize || props.onSized != null) && containerRef.value != null) {
|
|
81
|
+
if (!flexCallbackRegisted) {
|
|
82
|
+
// 注册只做一次,反复注册会影响性能
|
|
83
|
+
containerRef.value.jsvGetProxyView().RegisterFlexAssigned(onSizeCallback);
|
|
84
|
+
flexCallbackRegisted = true;
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
// 取消注册
|
|
88
|
+
if (flexCallbackRegisted) {
|
|
89
|
+
containerRef.value.jsvGetProxyView().RegisterFlexAssigned(null);
|
|
90
|
+
flexCallbackRegisted = false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
defineExpose({
|
|
96
|
+
// TODO: PC模拟环境中目前没有浏览器的类似ResizeObserver接口
|
|
97
|
+
// 可以监听到left/ top变化,所以先关闭Left / Top的获取
|
|
98
|
+
// getLeft: () => {
|
|
99
|
+
// return SizeX.value;
|
|
100
|
+
// },
|
|
101
|
+
// getTop: () => {
|
|
102
|
+
// return SizeY.value;
|
|
103
|
+
// },
|
|
104
|
+
|
|
105
|
+
getWidth: () => {
|
|
106
|
+
return SizeWidth.value;
|
|
107
|
+
},
|
|
108
|
+
getHeight: () => {
|
|
109
|
+
return SizeHeight.value;
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<template>
|
|
115
|
+
<div ref="containerRef" v-bind="{ ...$attrs, ...config }">
|
|
116
|
+
<slot />
|
|
117
|
+
</div>
|
|
118
|
+
</template>
|
|
@@ -97,6 +97,27 @@ class ConditionPackBuilder {
|
|
|
97
97
|
return this._BuildPack(ConditionSetBuilder.BoxPosition(left, top, right, bottom, this._CommonInfo));
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
offsetPosition(left: UNumber, top: UNumber, right: UNumber, bottom: UNumber): object | null {
|
|
101
|
+
if (!this._CheckCommonInfo()) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
this._CommonInfoValid = false;
|
|
105
|
+
|
|
106
|
+
return this._BuildPack(ConditionSetBuilder.OffsetPosition(left, top, right, bottom, this._CommonInfo));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
startMove(xEnable: boolean, yEnable: boolean) {
|
|
110
|
+
if (!this._CheckCommonInfo()) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
this._CommonInfoValid = false;
|
|
114
|
+
let direction = 0;
|
|
115
|
+
if (xEnable) { direction |= 1; }
|
|
116
|
+
if (yEnable) { direction |= 2; }
|
|
117
|
+
|
|
118
|
+
return this._BuildPack(ConditionSetBuilder.StartMove(direction, this._CommonInfo));
|
|
119
|
+
}
|
|
120
|
+
|
|
100
121
|
/**
|
|
101
122
|
* AcrossPosition
|
|
102
123
|
* 获取 AcrossPosition 的condition
|
|
@@ -230,6 +251,14 @@ class ConditionPackBuilder {
|
|
|
230
251
|
return this._BuildPack(ConditionSetBuilder.OnFlingEnd(this._CommonInfo, this._ContorlSlefNexus.token));
|
|
231
252
|
}
|
|
232
253
|
|
|
254
|
+
onFlingCancel() {
|
|
255
|
+
if (!this._CheckCommonInfo()) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
this._CommonInfoValid = false;
|
|
259
|
+
return this._BuildPack(ConditionSetBuilder.OnFlingCancel(this._CommonInfo, this._ContorlSlefNexus.token));
|
|
260
|
+
}
|
|
261
|
+
|
|
233
262
|
_CheckCommonInfo(): boolean {
|
|
234
263
|
if (!this._CommonInfoValid) {
|
|
235
264
|
console.error("Error: must call from new conditoin()");
|
|
@@ -87,6 +87,10 @@ class StatePackBuilder {
|
|
|
87
87
|
return CmdPackBuilder.InitStateCmdPack(StateCmdBuilder.SetHitWallOverflow());
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
touchLockSwitch(isLock: boolean, direction: number, unlockThreshold: number = -1) {
|
|
91
|
+
return CmdPackBuilder.InitStateCmdPack(StateCmdBuilder.TouchLockSwitch(isLock, direction, unlockThreshold));
|
|
92
|
+
}
|
|
93
|
+
|
|
90
94
|
/*
|
|
91
95
|
* fireNexusEvent 发出Nexus event
|
|
92
96
|
*/
|
|
@@ -109,32 +109,34 @@ export default {
|
|
|
109
109
|
},
|
|
110
110
|
_initForHtml() {
|
|
111
111
|
let _this = this;
|
|
112
|
-
this.$refs.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
.
|
|
119
|
-
|
|
112
|
+
this.$refs.innerViewDiv
|
|
113
|
+
?.jsvGetProxyView(true)
|
|
114
|
+
.RegisterOnProxyReady(() => {
|
|
115
|
+
const canvas = window.originDocument.createElement("canvas");
|
|
116
|
+
canvas.style.width = _this.style.width + "px";
|
|
117
|
+
canvas.style.height = _this.style.height + "px";
|
|
118
|
+
_this.$refs.innerViewDiv
|
|
119
|
+
?.jsvGetProxyView(true)
|
|
120
|
+
.HtmlGetElement()
|
|
121
|
+
.appendChild(canvas);
|
|
120
122
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
const clip_image = new Image();
|
|
124
|
+
const bg_image = new Image();
|
|
125
|
+
clip_image.src = _this.maskSrc;
|
|
126
|
+
bg_image.src = _this.viewSrc;
|
|
127
|
+
let clip_ready = false;
|
|
128
|
+
let bg_ready = false;
|
|
127
129
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
clip_image.onload = () => {
|
|
131
|
+
clip_ready = true;
|
|
132
|
+
_this._drawClip(canvas, clip_image, clip_ready, bg_image, bg_ready);
|
|
133
|
+
};
|
|
132
134
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
bg_image.onload = () => {
|
|
136
|
+
bg_ready = true;
|
|
137
|
+
_this._drawClip(canvas, clip_image, clip_ready, bg_image, bg_ready);
|
|
138
|
+
};
|
|
139
|
+
});
|
|
138
140
|
},
|
|
139
141
|
_updateInnerView() {
|
|
140
142
|
if (this.innerView === null) {
|
|
@@ -205,7 +207,7 @@ export default {
|
|
|
205
207
|
<template>
|
|
206
208
|
<div
|
|
207
209
|
v-if="html"
|
|
208
|
-
ref="
|
|
210
|
+
ref="innerViewDiv"
|
|
209
211
|
:style="{
|
|
210
212
|
top: style.top,
|
|
211
213
|
left: style.left,
|
|
@@ -213,7 +215,6 @@ export default {
|
|
|
213
215
|
></div>
|
|
214
216
|
<div
|
|
215
217
|
v-else
|
|
216
|
-
ref="innerView"
|
|
217
218
|
:data-jsv-vw-innerview="innerViewId"
|
|
218
219
|
:style="{
|
|
219
220
|
top: style.top,
|