@shijiu/jsview-vue-samples 2.1.448-test.0 → 2.1.482-test.0
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/BasicFocusControl/App.vue +4 -10
- package/DemoHomepage/components/BodyFrame.vue +2 -0
- package/DemoHomepage/components/Item.vue +1 -0
- package/DemoHomepage/components/TabFrame.vue +25 -7
- package/DemoHomepage/router.js +7 -1
- package/DemoHomepage/views/Homepage.vue +9 -0
- package/FilterDemo/VideoLayer.vue +7 -4
- package/MindMap/App.vue +10 -1
- package/SceneTransition/App.vue +24 -111
- package/SceneTransition/JsvSceneTransition.vue +61 -19
- package/SpriteImage/App.vue +137 -16
- package/TouchWidget/App.vue +2 -2
- package/TouchWidget/Item.vue +1 -1
- package/TouchWidget/WidgetItem.vue +4 -1
- package/package.json +1 -1
|
@@ -35,9 +35,8 @@
|
|
|
35
35
|
|
|
36
36
|
<script setup>
|
|
37
37
|
import { useRouter } from "vue-router";
|
|
38
|
-
import { onMounted } from "vue"
|
|
39
38
|
import MainArea from "./components/MainArea.vue";
|
|
40
|
-
import { useFocusHub } from "jsview"
|
|
39
|
+
import { useFocusHub } from "jsview";
|
|
41
40
|
|
|
42
41
|
const router = useRouter();
|
|
43
42
|
const onKeyDown = (ev) => {
|
|
@@ -51,12 +50,7 @@ const onKeyDown = (ev) => {
|
|
|
51
50
|
};
|
|
52
51
|
|
|
53
52
|
window.DebugMyHub = useFocusHub();
|
|
54
|
-
|
|
55
|
-
onMounted(()=>{
|
|
56
|
-
// 通过NameSpace进行全局设置
|
|
57
|
-
window.DebugMyHub.setFocus("main.R1C1");
|
|
58
|
-
});
|
|
59
|
-
|
|
53
|
+
window.DebugMyHub.enableFocusTrace(); // 激活焦点变化堆栈
|
|
60
54
|
</script>
|
|
61
55
|
|
|
62
56
|
<template>
|
|
@@ -64,7 +58,7 @@ onMounted(()=>{
|
|
|
64
58
|
<jsv-focus-block :onKeyDown="onKeyDown">
|
|
65
59
|
<div class="title">可上下左右切换焦点</div>
|
|
66
60
|
<div class="body">
|
|
67
|
-
<MainArea/>
|
|
61
|
+
<MainArea />
|
|
68
62
|
</div>
|
|
69
63
|
</jsv-focus-block>
|
|
70
64
|
</template>
|
|
@@ -86,4 +80,4 @@ onMounted(()=>{
|
|
|
86
80
|
left: 100;
|
|
87
81
|
top: 120;
|
|
88
82
|
}
|
|
89
|
-
</style>
|
|
83
|
+
</style>
|
|
@@ -22,6 +22,7 @@ const measures = (item) => {
|
|
|
22
22
|
width: item.width,
|
|
23
23
|
height: item.height,
|
|
24
24
|
focusable: item.focusable,
|
|
25
|
+
enableTap: true,
|
|
25
26
|
};
|
|
26
27
|
};
|
|
27
28
|
|
|
@@ -65,6 +66,7 @@ watch(
|
|
|
65
66
|
:padding="{ left: 10, top: 10, right: 10, bottom: 10 }"
|
|
66
67
|
:onEdge="props.onEdge"
|
|
67
68
|
:initFocusId="initFocusId"
|
|
69
|
+
:touchFlag="1"
|
|
68
70
|
>
|
|
69
71
|
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
70
72
|
<Item
|
|
@@ -7,15 +7,17 @@ const measures = (item) => {
|
|
|
7
7
|
width: item.width,
|
|
8
8
|
height: item.height,
|
|
9
9
|
focusable: item.focusable,
|
|
10
|
+
enableTap: true,
|
|
10
11
|
};
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
const props = defineProps({
|
|
14
15
|
name: String,
|
|
15
16
|
itemFocus: Function,
|
|
17
|
+
itemClick: Function,
|
|
16
18
|
onEdge: Function,
|
|
17
19
|
initId: Number,
|
|
18
|
-
})
|
|
20
|
+
});
|
|
19
21
|
|
|
20
22
|
const width = 1280;
|
|
21
23
|
const height = 100;
|
|
@@ -47,22 +49,38 @@ const data = [
|
|
|
47
49
|
name: "游戏实例",
|
|
48
50
|
focusable: true,
|
|
49
51
|
id: 3,
|
|
50
|
-
}
|
|
52
|
+
},
|
|
51
53
|
];
|
|
52
54
|
const direction = VERTICAL;
|
|
53
|
-
|
|
54
55
|
</script>
|
|
55
56
|
|
|
56
57
|
<template>
|
|
57
|
-
<metro-widget
|
|
58
|
-
:
|
|
58
|
+
<metro-widget
|
|
59
|
+
:name="props.name"
|
|
60
|
+
:width="width"
|
|
61
|
+
:height="height"
|
|
62
|
+
:direction="direction"
|
|
63
|
+
:data="data"
|
|
64
|
+
:measures="measures"
|
|
65
|
+
:padding="{ left: 10, top: 10, right: 10, bottom: 10 }"
|
|
66
|
+
:onEdge="props.onEdge"
|
|
67
|
+
:initFocusId="props.initId"
|
|
68
|
+
>
|
|
59
69
|
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
60
|
-
<Item
|
|
70
|
+
<Item
|
|
71
|
+
:style="{
|
|
61
72
|
width: data.width,
|
|
62
73
|
height: data.height,
|
|
63
74
|
backgroundColor: '#00AA00',
|
|
64
75
|
color: '#FFFFFF',
|
|
65
|
-
}"
|
|
76
|
+
}"
|
|
77
|
+
:data="data"
|
|
78
|
+
:query="query"
|
|
79
|
+
:onEdge="onEdge"
|
|
80
|
+
:onAction="onAction"
|
|
81
|
+
:itemFocus="props.itemFocus"
|
|
82
|
+
:itemClick="props.itemClick"
|
|
83
|
+
>
|
|
66
84
|
{{ data.name }}
|
|
67
85
|
</Item>
|
|
68
86
|
</template>
|
package/DemoHomepage/router.js
CHANGED
|
@@ -298,7 +298,13 @@ let routeList = [
|
|
|
298
298
|
name: 'latex公式',
|
|
299
299
|
path: '/feature/LatexFormula',
|
|
300
300
|
component: () => import('jsview-vue-samples/LatexFormula/App.vue'),
|
|
301
|
-
},
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
name: '触控示例',
|
|
304
|
+
path: '/feature/TouchWidget',
|
|
305
|
+
component: () => import('jsview-vue-samples/TouchWidget/App.vue'),
|
|
306
|
+
},
|
|
307
|
+
{
|
|
302
308
|
name: 'Swiper3dTest',
|
|
303
309
|
path: '/Operations/Swiper3D',
|
|
304
310
|
component: () => import('jsview-vue-samples/SwiperTest/App.vue'),
|
|
@@ -102,6 +102,14 @@ let tabItemFocus = (data) => {
|
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
+
let tabItemClick = (id, data) => {
|
|
106
|
+
console.log("testtest", "tabItemClick");
|
|
107
|
+
if (data.id != tabId.value) {
|
|
108
|
+
tabId.value = data.id;
|
|
109
|
+
contentData.value = dataList[data.id];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
105
113
|
let onDialogAction = (msg) => {
|
|
106
114
|
showExitDialog.value = false;
|
|
107
115
|
changeFocus(preFocusName);
|
|
@@ -156,6 +164,7 @@ onDeactivated(() => {
|
|
|
156
164
|
:onEdge="onTabEdge"
|
|
157
165
|
:itemFocus="tabItemFocus"
|
|
158
166
|
:initId="tabId"
|
|
167
|
+
:itemClick="tabItemClick"
|
|
159
168
|
/>
|
|
160
169
|
</div>
|
|
161
170
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
JsvPlayer,
|
|
4
|
+
globalLoadJsvPlayerPlugin,
|
|
5
|
+
} from "@shijiu/jsview-vue/utils/JsViewPlugin/JsvPlayer";
|
|
3
6
|
|
|
4
7
|
const props = defineProps({
|
|
5
8
|
top: {
|
|
@@ -20,9 +23,9 @@ const props = defineProps({
|
|
|
20
23
|
},
|
|
21
24
|
});
|
|
22
25
|
|
|
23
|
-
globalLoadJsvPlayerPlugin((status)=>{
|
|
26
|
+
globalLoadJsvPlayerPlugin((status) => {
|
|
24
27
|
console.log("JsvPlayer plugin load status: " + status);
|
|
25
|
-
})
|
|
28
|
+
});
|
|
26
29
|
|
|
27
30
|
// const video_url = "http://qcast-image.oss-cn-qingdao.aliyuncs.com/homepage/20210207/52fae4231350c85fec605b47bbe479c5.mp4";
|
|
28
31
|
const video_url =
|
|
@@ -63,4 +66,4 @@ const video_url =
|
|
|
63
66
|
}"
|
|
64
67
|
/>
|
|
65
68
|
</div>
|
|
66
|
-
</template>
|
|
69
|
+
</template>
|
package/MindMap/App.vue
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { onMounted } from "vue"
|
|
3
|
+
import { JsvMindMap, useFocusHub } from "jsview";
|
|
3
4
|
import Item from "./Item.vue";
|
|
4
5
|
import { data } from "./data"
|
|
5
6
|
|
|
@@ -7,6 +8,8 @@ const provideData = () => {
|
|
|
7
8
|
return data;
|
|
8
9
|
};
|
|
9
10
|
|
|
11
|
+
const focusHub = useFocusHub();
|
|
12
|
+
|
|
10
13
|
const lineColor = {
|
|
11
14
|
0: "#ff0000",
|
|
12
15
|
1: "#00ff00",
|
|
@@ -33,10 +36,16 @@ const formatNode = (item, depth) => {
|
|
|
33
36
|
const onEdge = (info) => {
|
|
34
37
|
console.log("onEdge ", info);
|
|
35
38
|
};
|
|
39
|
+
|
|
40
|
+
const componentName = "mindMapDemo";
|
|
41
|
+
onMounted(() => {
|
|
42
|
+
focusHub.setFocus(componentName);
|
|
43
|
+
})
|
|
36
44
|
</script>
|
|
37
45
|
|
|
38
46
|
<template>
|
|
39
47
|
<jsv-mind-map
|
|
48
|
+
:name="componentName"
|
|
40
49
|
:left="200"
|
|
41
50
|
:top="100"
|
|
42
51
|
:width="500"
|
package/SceneTransition/App.vue
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
<div class="bgStyle">
|
|
8
8
|
<div :style="{ width: 640, height: 360, backgroundImage: bg, top: 100 }">
|
|
9
9
|
<JsvSceneTransition
|
|
10
|
+
ref="control"
|
|
10
11
|
v-show="isShow"
|
|
11
12
|
:imageUrl="fly1"
|
|
12
13
|
:ArraySet="SelectArray"
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
</div>
|
|
22
23
|
<div class="text" :style="{ left: 810, top: 20 }">{{ "素材展示" }}</div>
|
|
23
24
|
<div class="text" :style="{ left: 400, top: 500 }">
|
|
24
|
-
{{ "
|
|
25
|
+
{{ "按需采用碎片式的图片来进行遮罩,此例只展示当前随机这组遮罩素材。" }}
|
|
25
26
|
</div>
|
|
26
27
|
<!-- 报错小框 -->
|
|
27
28
|
<div v-if="boxSwitch" class="smallBox">
|
|
@@ -49,111 +50,13 @@
|
|
|
49
50
|
}"
|
|
50
51
|
></div>
|
|
51
52
|
<div
|
|
53
|
+
v-for="(item, index) in SelectArray"
|
|
52
54
|
:style="{
|
|
53
|
-
width:
|
|
54
|
-
height:
|
|
55
|
-
backgroundImage:
|
|
56
|
-
top: 500,
|
|
57
|
-
left: 700,
|
|
58
|
-
}"
|
|
59
|
-
></div>
|
|
60
|
-
<div
|
|
61
|
-
:style="{
|
|
62
|
-
width: 100,
|
|
63
|
-
height: 60,
|
|
64
|
-
backgroundImage: ArraySet1[1].url,
|
|
65
|
-
top: 500,
|
|
66
|
-
left: 800,
|
|
67
|
-
}"
|
|
68
|
-
></div>
|
|
69
|
-
<div
|
|
70
|
-
:style="{
|
|
71
|
-
width: 100,
|
|
72
|
-
height: 60,
|
|
73
|
-
backgroundImage: ArraySet1[2].url,
|
|
74
|
-
top: 500,
|
|
75
|
-
left: 920,
|
|
76
|
-
}"
|
|
77
|
-
></div>
|
|
78
|
-
<div
|
|
79
|
-
:style="{
|
|
80
|
-
width: 100,
|
|
81
|
-
height: 60,
|
|
82
|
-
backgroundImage: ArraySet1[3].url,
|
|
83
|
-
top: 550,
|
|
84
|
-
left: 700,
|
|
85
|
-
}"
|
|
86
|
-
></div>
|
|
87
|
-
<div
|
|
88
|
-
:style="{
|
|
89
|
-
width: 100,
|
|
90
|
-
height: 60,
|
|
91
|
-
backgroundImage: ArraySet1[4].url,
|
|
92
|
-
top: 550,
|
|
93
|
-
left: 820,
|
|
94
|
-
}"
|
|
95
|
-
></div>
|
|
96
|
-
<div
|
|
97
|
-
:style="{
|
|
98
|
-
width: 100,
|
|
99
|
-
height: 60,
|
|
100
|
-
backgroundImage: ArraySet1[5].url,
|
|
101
|
-
top: 550,
|
|
102
|
-
left: 920,
|
|
103
|
-
}"
|
|
104
|
-
></div>
|
|
105
|
-
<div
|
|
106
|
-
:style="{
|
|
107
|
-
width: 100,
|
|
108
|
-
height: 60,
|
|
109
|
-
backgroundImage: ArraySet1[6].url,
|
|
110
|
-
top: 600,
|
|
111
|
-
left: 700,
|
|
112
|
-
}"
|
|
113
|
-
></div>
|
|
114
|
-
<div
|
|
115
|
-
:style="{
|
|
116
|
-
width: 100,
|
|
117
|
-
height: 60,
|
|
118
|
-
backgroundImage: ArraySet1[7].url,
|
|
119
|
-
top: 600,
|
|
120
|
-
left: 770,
|
|
121
|
-
}"
|
|
122
|
-
></div>
|
|
123
|
-
<div
|
|
124
|
-
:style="{
|
|
125
|
-
width: 80,
|
|
126
|
-
height: 60,
|
|
127
|
-
backgroundImage: ArraySet1[8].url,
|
|
128
|
-
top: 600,
|
|
129
|
-
left: 860,
|
|
130
|
-
}"
|
|
131
|
-
></div>
|
|
132
|
-
<div
|
|
133
|
-
:style="{
|
|
134
|
-
width: 60,
|
|
135
|
-
height: 60,
|
|
136
|
-
backgroundImage: ArraySet1[9].url,
|
|
137
|
-
top: 600,
|
|
138
|
-
left: 930,
|
|
139
|
-
}"
|
|
140
|
-
></div>
|
|
141
|
-
<div
|
|
142
|
-
:style="{
|
|
143
|
-
width: 30,
|
|
144
|
-
height: 30,
|
|
145
|
-
backgroundImage: ArraySet1[10].url,
|
|
146
|
-
top: 590,
|
|
147
|
-
left: 950,
|
|
148
|
-
}"
|
|
149
|
-
></div>
|
|
150
|
-
<div
|
|
151
|
-
:style="{
|
|
152
|
-
width: 40,
|
|
153
|
-
height: 60,
|
|
154
|
-
backgroundImage: ArraySet1[11].url,
|
|
155
|
-
top: 600,
|
|
156
|
-
left: 980,
|
|
55
|
+
width: Math.round((item.width / 1280) * 320),
|
|
56
|
+
height: Math.round((item.height / 720) * 180),
|
|
57
|
+
backgroundImage: item.url,
|
|
58
|
+
top: 500 + Math.round(((item.top * 1.05) / 720) * 180),
|
|
59
|
+
left: 700 + Math.round(((item.left * 1.05) / 1280) * 320),
|
|
157
60
|
}"
|
|
158
61
|
></div>
|
|
159
62
|
</div>
|
|
@@ -163,7 +66,7 @@
|
|
|
163
66
|
<script setup>
|
|
164
67
|
import { shallowRef, onBeforeUnmount } from "vue";
|
|
165
68
|
import { JsvPreload, buildPreloadInfo } from "jsview";
|
|
166
|
-
import JsvSceneTransition from "./
|
|
69
|
+
import JsvSceneTransition from "./JsvSceneTransition.vue";
|
|
167
70
|
import { ArraySet1 } from "./maskConfig/config1";
|
|
168
71
|
import { ArraySet2 } from "./maskConfig/config2";
|
|
169
72
|
import { ArraySet3 } from "./maskConfig/config3";
|
|
@@ -213,15 +116,18 @@ const randomSelect = () => {
|
|
|
213
116
|
}
|
|
214
117
|
};
|
|
215
118
|
const SelectArray = randomSelect();
|
|
216
|
-
|
|
119
|
+
let control = shallowRef(null);
|
|
120
|
+
let down = shallowRef(false);
|
|
217
121
|
const onKeyDown = (ev) => {
|
|
218
122
|
switch (ev.keyCode) {
|
|
219
|
-
|
|
220
|
-
|
|
123
|
+
//按方向键下,开始调用下垂运动状态的函数
|
|
124
|
+
case 40:
|
|
125
|
+
if (isDone.value == true && down.value == false) {
|
|
221
126
|
bg.value = fly2;
|
|
222
|
-
onOff.value = true;
|
|
223
127
|
isShow.value = true;
|
|
224
|
-
|
|
128
|
+
control.value.sag();
|
|
129
|
+
down.value = true;
|
|
130
|
+
} else if (isDone.value == false) {
|
|
225
131
|
boxSwitch.value = true;
|
|
226
132
|
timer.id = setTimeout(() => {
|
|
227
133
|
boxSwitch.value = false;
|
|
@@ -230,6 +136,13 @@ const onKeyDown = (ev) => {
|
|
|
230
136
|
|
|
231
137
|
break;
|
|
232
138
|
|
|
139
|
+
//按方向键上调用组件的恢复函数
|
|
140
|
+
case 38:
|
|
141
|
+
if (down.value == true) {
|
|
142
|
+
control.value.fireNeEvent();
|
|
143
|
+
down.value = false;
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
233
146
|
default:
|
|
234
147
|
break;
|
|
235
148
|
}
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* displayWidth {Number} (必填) 想要展示的宽度
|
|
7
7
|
* ArraySet {Array} (必填) 模板配置项,包括:每个模块的width,height,left,top,url
|
|
8
8
|
* style {Object} (必填) 模板配置总长度和总宽度。(width,height)
|
|
9
|
-
*
|
|
9
|
+
* defineExpose说明:
|
|
10
|
+
* sag {Function} 控制组件变成碎片进行下垂运动的方法
|
|
11
|
+
* recover {Function} 控制碎片还原的方法
|
|
10
12
|
-->
|
|
11
13
|
|
|
12
14
|
<template>
|
|
@@ -47,16 +49,17 @@
|
|
|
47
49
|
</template>
|
|
48
50
|
|
|
49
51
|
<script setup>
|
|
50
|
-
import { JsvMaskClipDiv, JsvFreeMoveActor } from "jsview";
|
|
51
|
-
import { onMounted
|
|
52
|
+
import { JsvMaskClipDiv, JsvFreeMoveActor, FreeMoveFunc } from "jsview";
|
|
53
|
+
import { onMounted } from "vue";
|
|
52
54
|
|
|
53
55
|
const props = defineProps({
|
|
54
56
|
imageUrl: { type: String, require: true },
|
|
55
57
|
displayWidth: { type: Number, require: true },
|
|
56
58
|
ArraySet: { type: Array, require: true },
|
|
57
59
|
style: { type: Object, require: true },
|
|
58
|
-
onOff: { type: Boolean, require: true },
|
|
59
60
|
});
|
|
61
|
+
|
|
62
|
+
let interactNexus = FreeMoveFunc.newNexus();
|
|
60
63
|
//FreeMove引用
|
|
61
64
|
const refArray = [];
|
|
62
65
|
const controlArray = new Array(props.ArraySet.length).fill(null);
|
|
@@ -76,16 +79,9 @@ props.ArraySet.forEach((item, index) => {
|
|
|
76
79
|
y: centerY,
|
|
77
80
|
});
|
|
78
81
|
});
|
|
82
|
+
//召回点坐标队列
|
|
83
|
+
let recallArray = new Array(props.ArraySet.length);
|
|
79
84
|
|
|
80
|
-
//监听控制开关的值
|
|
81
|
-
watch(
|
|
82
|
-
() => props.onOff,
|
|
83
|
-
(n, o) => {
|
|
84
|
-
if (n == true) {
|
|
85
|
-
MoveFunc();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
85
|
//Y轴方向随机初速度
|
|
90
86
|
const randomYArray = [-60, -70, -80];
|
|
91
87
|
const randomSelect = () => {
|
|
@@ -98,8 +94,8 @@ const randomSelect = () => {
|
|
|
98
94
|
return randomYArray[2];
|
|
99
95
|
}
|
|
100
96
|
};
|
|
101
|
-
|
|
102
|
-
const
|
|
97
|
+
//往下运动函数
|
|
98
|
+
const sag = () => {
|
|
103
99
|
centerItemArray.forEach((item, index) => {
|
|
104
100
|
if (center.x - item.x <= Math.abs(60)) {
|
|
105
101
|
controlArray[index].run([
|
|
@@ -149,19 +145,65 @@ const MoveFunc = () => {
|
|
|
149
145
|
controlArray[index]
|
|
150
146
|
.condition()
|
|
151
147
|
.reachPosition(undefined, 1380)
|
|
152
|
-
.then([
|
|
148
|
+
.then([
|
|
149
|
+
controlArray[index].action().stopMoving(),
|
|
150
|
+
]),
|
|
153
151
|
]);
|
|
154
152
|
}
|
|
153
|
+
//给所有运动物体创建onNexusEvent条件以便召回
|
|
154
|
+
controlArray[index].run([
|
|
155
|
+
controlArray[index]
|
|
156
|
+
.condition()
|
|
157
|
+
.onNexusEvent(interactNexus, 1001 + index)
|
|
158
|
+
.then([
|
|
159
|
+
(a) => {
|
|
160
|
+
//给还原数组赋值
|
|
161
|
+
recallArray[index] = {
|
|
162
|
+
x: a.xPos,
|
|
163
|
+
y: a.yPos,
|
|
164
|
+
};
|
|
165
|
+
recover(index);
|
|
166
|
+
},
|
|
167
|
+
]),
|
|
168
|
+
]);
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const fireNeEvent = () => {
|
|
173
|
+
controlArray.forEach((item, index) => {
|
|
174
|
+
item.run([
|
|
175
|
+
item.action().stopMoving(),
|
|
176
|
+
item.state().fireNexusEvent(interactNexus, 1001 + index),
|
|
177
|
+
]);
|
|
155
178
|
});
|
|
156
179
|
};
|
|
180
|
+
//往回恢复的函数
|
|
181
|
+
const recover = (index) => {
|
|
182
|
+
controlArray[index].run([
|
|
183
|
+
controlArray[index]
|
|
184
|
+
.action()
|
|
185
|
+
.moveTo(
|
|
186
|
+
0,
|
|
187
|
+
0,
|
|
188
|
+
(Math.abs(recallArray[index].x) * (recallArray[index].y / 15)) /
|
|
189
|
+
Math.abs(recallArray[index].y),
|
|
190
|
+
recallArray[index].y / 15,
|
|
191
|
+
() => {
|
|
192
|
+
controlArray[index].run([
|
|
193
|
+
controlArray[index].action().teleportTo(0, 0),
|
|
194
|
+
controlArray[index].state().clearAllConditions(),
|
|
195
|
+
]);
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
]);
|
|
199
|
+
};
|
|
200
|
+
|
|
157
201
|
onMounted(() => {
|
|
158
202
|
for (let i = 0; i < refArray.length; i++) {
|
|
159
203
|
controlArray[i] = refArray[i].control;
|
|
160
204
|
}
|
|
161
|
-
if (props.onOff == true) {
|
|
162
|
-
MoveFunc();
|
|
163
|
-
}
|
|
164
205
|
});
|
|
206
|
+
defineExpose({ sag, fireNeEvent });
|
|
165
207
|
</script>
|
|
166
208
|
|
|
167
209
|
<style scoped></style>
|
package/SpriteImage/App.vue
CHANGED
|
@@ -23,10 +23,15 @@
|
|
|
23
23
|
-->
|
|
24
24
|
|
|
25
25
|
<script setup>
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
JsvSpriteAnim,
|
|
28
|
+
JsvSpriteLoader,
|
|
29
|
+
JsvSpriteStatic,
|
|
30
|
+
JsvSpriteTools,
|
|
31
|
+
} from "jsview";
|
|
27
32
|
import localSpriteImage from "./images/egg_break.png";
|
|
28
33
|
import localConfigJson from "./images/egg_break.json";
|
|
29
|
-
import { shallowRef } from "vue";
|
|
34
|
+
import { shallowRef, watchEffect } from "vue";
|
|
30
35
|
import { useRouter } from "vue-router";
|
|
31
36
|
|
|
32
37
|
console.log(
|
|
@@ -40,7 +45,11 @@ let useLocalData = shallowRef(true);
|
|
|
40
45
|
let animateImage = shallowRef(null);
|
|
41
46
|
let preloadJsonUrl = shallowRef(null);
|
|
42
47
|
let preloadCallback = shallowRef(null);
|
|
43
|
-
let
|
|
48
|
+
let spriteJsonInfo = shallowRef(null);
|
|
49
|
+
let spriteOriginSize = shallowRef(null);
|
|
50
|
+
let spriteStaticJsonInfo1 = shallowRef(null);
|
|
51
|
+
let spriteStaticJsonInfo2 = shallowRef(null);
|
|
52
|
+
let spriteStaticJsonInfo3 = shallowRef(null);
|
|
44
53
|
|
|
45
54
|
const _UseLocalData = () => {
|
|
46
55
|
console.log("using local data");
|
|
@@ -48,19 +57,29 @@ const _UseLocalData = () => {
|
|
|
48
57
|
animateImage.value = `url(${localSpriteImage})`;
|
|
49
58
|
preloadJsonUrl.value = null;
|
|
50
59
|
preloadCallback.value = null;
|
|
51
|
-
|
|
60
|
+
spriteJsonInfo.value = _formatInfo(localConfigJson).info;
|
|
61
|
+
_applyStaticInfo(spriteJsonInfo.value, currentStatiIndex);
|
|
62
|
+
|
|
63
|
+
// 调整设置的原图尺寸设置
|
|
64
|
+
const guessSize = JsvSpriteTools.guessOriginSize(spriteJsonInfo.value);
|
|
65
|
+
spriteOriginSize.value = guessSize;
|
|
52
66
|
};
|
|
53
67
|
|
|
54
68
|
const _UseRemoteData = () => {
|
|
55
69
|
const testRemoteImageUrl = "http://192.168.2.179:8077/images/egg_break.png";
|
|
56
70
|
const testRemoteConfigUrl = "http://192.168.2.179:8077/images/egg_break.json";
|
|
57
71
|
|
|
58
|
-
console.log("using remote data");
|
|
59
72
|
useLocalData.value = false;
|
|
60
73
|
animateImage.value = testRemoteImageUrl;
|
|
61
74
|
preloadJsonUrl.value = testRemoteConfigUrl;
|
|
62
75
|
preloadCallback.value = (config_json, resolve_set) => {
|
|
63
|
-
|
|
76
|
+
spriteJsonInfo.value = _formatInfo(config_json).info;
|
|
77
|
+
_applyStaticInfo(spriteJsonInfo.value, currentStatiIndex);
|
|
78
|
+
|
|
79
|
+
// 调整设置的原图尺寸设置
|
|
80
|
+
const guessSize = JsvSpriteTools.guessOriginSize(spriteJsonInfo.value);
|
|
81
|
+
spriteOriginSize.value = guessSize;
|
|
82
|
+
|
|
64
83
|
resolve_set(); // 通知loader数组设置完成
|
|
65
84
|
};
|
|
66
85
|
};
|
|
@@ -82,9 +101,51 @@ const _formatInfo = (config_json) => {
|
|
|
82
101
|
source: config_json.frames[i].frame,
|
|
83
102
|
});
|
|
84
103
|
}
|
|
104
|
+
|
|
85
105
|
return { info };
|
|
86
106
|
};
|
|
87
107
|
|
|
108
|
+
const _applyStaticInfo = (wholeJsonInfo, index) => {
|
|
109
|
+
let length = wholeJsonInfo.frames.length;
|
|
110
|
+
// 设置第一张静图
|
|
111
|
+
let useIndex = index % length;
|
|
112
|
+
spriteStaticJsonInfo1.value = {
|
|
113
|
+
frames: [wholeJsonInfo.frames[useIndex]],
|
|
114
|
+
meta: {
|
|
115
|
+
size: wholeJsonInfo.meta.size,
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// 设置第二张静图
|
|
120
|
+
useIndex = (index + 1) % length;
|
|
121
|
+
spriteStaticJsonInfo2.value = {
|
|
122
|
+
frames: [wholeJsonInfo.frames[useIndex]],
|
|
123
|
+
meta: {
|
|
124
|
+
size: wholeJsonInfo.meta.size,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// 设置第三张静图
|
|
129
|
+
useIndex = (index + 2) % length;
|
|
130
|
+
spriteStaticJsonInfo3.value = {
|
|
131
|
+
frames: [wholeJsonInfo.frames[useIndex]],
|
|
132
|
+
meta: {
|
|
133
|
+
size: wholeJsonInfo.meta.size,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
let staticFromIndex = shallowRef(0);
|
|
139
|
+
let currentStatiIndex = 0;
|
|
140
|
+
watchEffect(() => {
|
|
141
|
+
if (staticFromIndex.value != currentStatiIndex) {
|
|
142
|
+
currentStatiIndex = staticFromIndex.value;
|
|
143
|
+
if (spriteJsonInfo.value != null) {
|
|
144
|
+
_applyStaticInfo(spriteJsonInfo.value, currentStatiIndex);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
88
149
|
const spriteController = shallowRef(null);
|
|
89
150
|
|
|
90
151
|
let show = shallowRef(true);
|
|
@@ -96,6 +157,9 @@ const onKeyDown = (ev) => {
|
|
|
96
157
|
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
97
158
|
router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
98
159
|
return true;
|
|
160
|
+
} else if (ev.keyCode == 13) {
|
|
161
|
+
// 静态引用信息变化
|
|
162
|
+
staticFromIndex.value++;
|
|
99
163
|
}
|
|
100
164
|
return true;
|
|
101
165
|
};
|
|
@@ -114,28 +178,75 @@ _UseLocalData();
|
|
|
114
178
|
onKeyDown: onKeyDown,
|
|
115
179
|
}"
|
|
116
180
|
>
|
|
181
|
+
<div class="bgStyle" />
|
|
182
|
+
|
|
183
|
+
<!-- 静态精灵图测试 -->
|
|
184
|
+
<div
|
|
185
|
+
:style="{
|
|
186
|
+
textAlign: 'center',
|
|
187
|
+
fontSize: 30,
|
|
188
|
+
lineHeight: 50,
|
|
189
|
+
color: '#ffffff',
|
|
190
|
+
left: 100,
|
|
191
|
+
top: 75,
|
|
192
|
+
width: 280,
|
|
193
|
+
height: 100,
|
|
194
|
+
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
195
|
+
}"
|
|
196
|
+
>
|
|
197
|
+
{{ "精灵图效果(静态)\nOK键切换图组" }}
|
|
198
|
+
</div>
|
|
199
|
+
<JsvSpriteLoader
|
|
200
|
+
:imageUrl="animateImage"
|
|
201
|
+
:configUrl="preloadJsonUrl"
|
|
202
|
+
:noNeedResource="useLocalData"
|
|
203
|
+
>
|
|
204
|
+
<div :style="{ left: 140, top: 175 }">
|
|
205
|
+
<JsvSpriteStatic
|
|
206
|
+
:spriteInfo="spriteStaticJsonInfo1"
|
|
207
|
+
:viewSize="{ w: 200 }"
|
|
208
|
+
:spriteFrameSize="spriteOriginSize"
|
|
209
|
+
:imageUrl="animateImage"
|
|
210
|
+
/>
|
|
211
|
+
</div>
|
|
212
|
+
<div :style="{ left: 140, top: 325 }">
|
|
213
|
+
<JsvSpriteStatic
|
|
214
|
+
:spriteInfo="spriteStaticJsonInfo2"
|
|
215
|
+
:viewSize="{ w: 200 }"
|
|
216
|
+
:spriteFrameSize="spriteOriginSize"
|
|
217
|
+
:imageUrl="animateImage"
|
|
218
|
+
/>
|
|
219
|
+
</div>
|
|
220
|
+
<div :style="{ left: 140, top: 505 }">
|
|
221
|
+
<JsvSpriteStatic
|
|
222
|
+
:spriteInfo="spriteStaticJsonInfo3"
|
|
223
|
+
:viewSize="{ w: 200 }"
|
|
224
|
+
:spriteFrameSize="spriteOriginSize"
|
|
225
|
+
:imageUrl="animateImage"
|
|
226
|
+
/>
|
|
227
|
+
</div>
|
|
228
|
+
</JsvSpriteLoader>
|
|
229
|
+
|
|
230
|
+
<!-- 动态精灵图测试 -->
|
|
117
231
|
<div
|
|
118
232
|
:style="{
|
|
119
233
|
textAlign: 'center',
|
|
120
234
|
fontSize: 30,
|
|
121
235
|
lineHeight: 50,
|
|
122
236
|
color: '#ffffff',
|
|
123
|
-
left:
|
|
237
|
+
left: 460,
|
|
124
238
|
top: 100,
|
|
125
|
-
width:
|
|
239
|
+
width: 280,
|
|
126
240
|
height: 50,
|
|
127
241
|
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
128
242
|
}"
|
|
129
243
|
>
|
|
130
|
-
精灵图效果
|
|
244
|
+
精灵图效果(动态)
|
|
131
245
|
</div>
|
|
132
246
|
<!--
|
|
133
247
|
通过show进行 清理精灵图,用于验证精灵图清理后,StyleSheet中cssRules的keyFrame清理工作能正常完成
|
|
134
248
|
-->
|
|
135
|
-
<div
|
|
136
|
-
v-if="show"
|
|
137
|
-
:style="{ left: 200, top: 150, transform: 'scale3d(2.5, 2.5, 1)' }"
|
|
138
|
-
>
|
|
249
|
+
<div v-show="show" :style="{ left: 460, top: 150 }">
|
|
139
250
|
<JsvSpriteLoader
|
|
140
251
|
:imageUrl="animateImage"
|
|
141
252
|
:configUrl="preloadJsonUrl"
|
|
@@ -144,9 +255,11 @@ _UseLocalData();
|
|
|
144
255
|
>
|
|
145
256
|
<JsvSpriteAnim
|
|
146
257
|
ref="spriteController"
|
|
147
|
-
:spriteInfo="
|
|
258
|
+
:spriteInfo="spriteJsonInfo"
|
|
148
259
|
:loop="3"
|
|
149
260
|
:duration="0.8"
|
|
261
|
+
:viewSize="{ w: 280 }"
|
|
262
|
+
:spriteFrameSize="spriteOriginSize"
|
|
150
263
|
:autostart="true"
|
|
151
264
|
:onAnimEnd="spriteAnimEnd"
|
|
152
265
|
:imageUrl="animateImage"
|
|
@@ -160,7 +273,7 @@ _UseLocalData();
|
|
|
160
273
|
fontSize: 30,
|
|
161
274
|
lineHeight: 50,
|
|
162
275
|
color: '#ffffff',
|
|
163
|
-
left:
|
|
276
|
+
left: 800,
|
|
164
277
|
top: 100,
|
|
165
278
|
width: 434,
|
|
166
279
|
height: 50,
|
|
@@ -171,7 +284,7 @@ _UseLocalData();
|
|
|
171
284
|
</div>
|
|
172
285
|
<div
|
|
173
286
|
:style="{
|
|
174
|
-
left:
|
|
287
|
+
left: 800,
|
|
175
288
|
top: 150,
|
|
176
289
|
width: 434,
|
|
177
290
|
height: 372,
|
|
@@ -180,3 +293,11 @@ _UseLocalData();
|
|
|
180
293
|
/>
|
|
181
294
|
</jsv-focus-block>
|
|
182
295
|
</template>
|
|
296
|
+
|
|
297
|
+
<style scoped>
|
|
298
|
+
.bgStyle {
|
|
299
|
+
width: 1280;
|
|
300
|
+
height: 720;
|
|
301
|
+
background-color: #4d5e8c;
|
|
302
|
+
}
|
|
303
|
+
</style>
|
package/TouchWidget/App.vue
CHANGED
|
@@ -12,7 +12,7 @@ const focusHub = useFocusHub();
|
|
|
12
12
|
|
|
13
13
|
const provideData = () => {
|
|
14
14
|
const data = [];
|
|
15
|
-
for (let i = 0; i <
|
|
15
|
+
for (let i = 0; i < 30; i++) {
|
|
16
16
|
data.push({
|
|
17
17
|
width: 500,
|
|
18
18
|
height: 190,
|
|
@@ -57,7 +57,7 @@ onMounted(() => {
|
|
|
57
57
|
<!-- 为了保证边缘的item缩放后依旧完整显示, 需要设置padding, 注意width/height是包含padding的 -->
|
|
58
58
|
<metro-widget
|
|
59
59
|
name="mwWidget"
|
|
60
|
-
:top="
|
|
60
|
+
:top="50"
|
|
61
61
|
:left="50"
|
|
62
62
|
:width="660"
|
|
63
63
|
:height="600"
|
package/TouchWidget/Item.vue
CHANGED
|
@@ -21,7 +21,7 @@ const onBlur = () => {
|
|
|
21
21
|
focused.value = false;
|
|
22
22
|
};
|
|
23
23
|
const onClick = () => {
|
|
24
|
-
console.log("testtest item onclick ", props.data);
|
|
24
|
+
console.log("testtest item onclick ", props.data.content);
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
// 一般在create的时候进行回调的注册, 使用 option api的可以在created时进行注册
|
|
@@ -12,7 +12,10 @@ const focusHub = useFocusHub();
|
|
|
12
12
|
const mwRef = shallowRef(null);
|
|
13
13
|
|
|
14
14
|
const measures = (item) => {
|
|
15
|
-
return
|
|
15
|
+
return {
|
|
16
|
+
...item,
|
|
17
|
+
enableTap: true,
|
|
18
|
+
};
|
|
16
19
|
};
|
|
17
20
|
const randomColor = () => {
|
|
18
21
|
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|