@shijiu/jsview-vue-samples 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/BakeViewDemo/AnimatePic.vue +93 -0
- package/BakeViewDemo/App.vue +109 -0
- package/ClickDivDemo/App.vue +150 -0
- package/CoupletsTest/widget/Banger/Maroon.vue +4 -6
- package/CoupletsTest/widget/Fireworks/Fireworks.vue +52 -42
- package/CustomShader/App.vue +157 -0
- package/CustomShader/gaussianBlur.glsl +27 -0
- package/CustomShader/pageFlip.glsl +40 -0
- package/CustomShader/sdf.glsl +22 -0
- package/CustomShader/test.glsl +8 -0
- package/CustomShader/vortex.glsl +38 -0
- package/DemoHomepage/App.vue +36 -27
- package/DemoHomepage/components/Dialog.vue +37 -11
- package/DemoHomepage/components/TabFrame.vue +8 -1
- package/DemoHomepage/router.js +71 -26
- package/DemoHomepage/views/Homepage.vue +30 -13
- package/DriftScopeTest/App.vue +128 -0
- package/FocusMoveStyle/App.vue +21 -4
- package/FocusMoveStyle/FoldableItem.vue +39 -12
- package/FreeMove/App.vue +62 -64
- package/FreeMoveChildAttract/App.vue +105 -0
- package/FreeMoveLink/App.vue +55 -0
- package/FreeMoveResize/App.vue +102 -0
- package/ImpactStop/App.vue +45 -45
- package/LongImage/App.vue +1 -2
- package/LongText/App.vue +3 -5
- package/LongText/LongTextScroll.vue +83 -38
- package/LongText/Scroll.vue +28 -9
- package/LongTextLatex/App.vue +93 -0
- package/LongTextLatex/Button.vue +50 -0
- package/LongTextLatex/ButtonItem.vue +44 -0
- package/LongTextLatex/LongTextScroll.vue +189 -0
- package/LongTextLatex/Scroll.vue +14 -0
- package/MetroWidgetDemos/MassiveItems/App.vue +87 -0
- package/MetroWidgetDemos/MassiveItems/ContentItem.vue +388 -0
- package/MetroWidgetDemos/MassiveItems/Item.vue +203 -0
- package/MetroWidgetDemos/MassiveItems/WidgetItem.vue +101 -0
- package/MetroWidgetDemos/MassiveItems/data.js +17 -0
- package/MetroWidgetDemos/PingPong/AppPage.vue +19 -9
- package/MetroWidgetDemos/RefreshDemo/App.vue +172 -56
- package/MetroWidgetDemos/RefreshDemo/ControlItem.vue +45 -0
- package/MetroWidgetDemos/RefreshDemo/Item.vue +20 -4
- package/MetroWidgetDemos/routeList.js +6 -0
- package/SceneTransition/JsvSceneTransition.vue +30 -42
- package/ScrollBoxTest/App.vue +109 -0
- package/ScrollBoxTest/ClipBar.vue +153 -0
- package/ScrollBoxTest/DrawCircle.ts +25 -0
- package/ScrollBoxTest/NinePatchBar.vue +187 -0
- package/ScrollBoxTest/NoBackgroundBar.vue +125 -0
- package/ScrollBoxTest/SizeDivBar.vue +138 -0
- package/TestNativeSharedView/App.vue +166 -73
- package/TextureAnimation/App2.vue +17 -6
- package/TombSweepingDayTest/Raining/Rain.vue +8 -8
- package/TombSweepingDayTest/Raining/RainScene.vue +36 -24
- package/package.json +1 -1
- package/MetroWidgetDemos/RefreshDemo/data.js +0 -16
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script setup>
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
VERTICAL,
|
|
11
|
+
MetroWidget,
|
|
12
|
+
METRO_WIDGET_CONST,
|
|
13
|
+
SeamlessSlide,
|
|
14
|
+
} from "jsview";
|
|
10
15
|
import WidgetItem from "./WidgetItem.vue";
|
|
11
16
|
import { shallowRef, watch, onBeforeUnmount } from "vue";
|
|
12
17
|
|
|
@@ -26,11 +31,17 @@ const props = defineProps({
|
|
|
26
31
|
|
|
27
32
|
const widgetRef = shallowRef(null);
|
|
28
33
|
|
|
29
|
-
const slideSetting =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
const slideSetting =
|
|
35
|
+
props.data.tabIndex == 0
|
|
36
|
+
? new SeamlessSlide({
|
|
37
|
+
startPercent: 0.5,
|
|
38
|
+
endPercent: 0.5,
|
|
39
|
+
fixFirstPage: true,
|
|
40
|
+
})
|
|
41
|
+
: new SeamlessSlide({
|
|
42
|
+
startPercent: 0.5,
|
|
43
|
+
endPercent: 0.5,
|
|
44
|
+
});
|
|
34
45
|
|
|
35
46
|
const provideData = () => {
|
|
36
47
|
return props.data.data;
|
|
@@ -52,8 +63,7 @@ const watcher = watch(
|
|
|
52
63
|
|
|
53
64
|
onBeforeUnmount(() => {
|
|
54
65
|
watcher();
|
|
55
|
-
})
|
|
56
|
-
|
|
66
|
+
});
|
|
57
67
|
</script>
|
|
58
68
|
|
|
59
69
|
<template>
|
|
@@ -77,4 +87,4 @@ onBeforeUnmount(() => {
|
|
|
77
87
|
></widget-item>
|
|
78
88
|
</template>
|
|
79
89
|
</metro-widget>
|
|
80
|
-
</template>
|
|
90
|
+
</template>
|
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
MetroWidget,
|
|
4
|
+
VERTICAL,
|
|
5
|
+
HORIZONTAL,
|
|
6
|
+
useFocusHub,
|
|
7
|
+
EdgeDirection,
|
|
8
|
+
} from "jsview";
|
|
3
9
|
import Item from "./Item.vue";
|
|
10
|
+
import ControlItem from "./ControlItem.vue";
|
|
4
11
|
import { onMounted, shallowRef } from "vue";
|
|
5
12
|
import { useRouter } from "vue-router";
|
|
6
|
-
import
|
|
13
|
+
import imageUrl from "./assets/imageList.json";
|
|
7
14
|
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
15
|
+
let freshToken = 0;
|
|
16
|
+
const prepareData = (data, w, h, start, end, contentPrefix = "test") => {
|
|
17
|
+
for (let i = start; i < end; ++i) {
|
|
18
|
+
data.push({
|
|
19
|
+
jsvKey: i + "_" + freshToken,
|
|
20
|
+
width: w,
|
|
21
|
+
height: h,
|
|
22
|
+
url: imageUrl[i],
|
|
23
|
+
index: i,
|
|
24
|
+
content: contentPrefix + "_" + i,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const data1 = [];
|
|
30
|
+
const data2 = [];
|
|
31
|
+
prepareData(data2, 200, 200, 0, 40);
|
|
32
|
+
const data3 = [];
|
|
33
|
+
prepareData(data3, 200, 200, 0, 60);
|
|
11
34
|
|
|
12
35
|
const router = useRouter();
|
|
13
36
|
const focusHub = useFocusHub();
|
|
@@ -21,13 +44,6 @@ const measures = (item) => {
|
|
|
21
44
|
};
|
|
22
45
|
};
|
|
23
46
|
|
|
24
|
-
const onKeyDown = (ev) => {
|
|
25
|
-
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
26
|
-
router.go(-1);
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
47
|
let curData = data1;
|
|
32
48
|
const provideData = () => {
|
|
33
49
|
return curData;
|
|
@@ -38,64 +54,164 @@ onMounted(() => {
|
|
|
38
54
|
setTimeout(() => {
|
|
39
55
|
curData = data2;
|
|
40
56
|
widgetRef.value.refreshData();
|
|
41
|
-
|
|
42
57
|
setTimeout(() => {
|
|
43
58
|
curData = data3;
|
|
44
59
|
widgetRef.value.refreshData();
|
|
45
|
-
},
|
|
46
|
-
},
|
|
60
|
+
}, 1000);
|
|
61
|
+
}, 1000);
|
|
47
62
|
});
|
|
48
63
|
|
|
49
64
|
const widgetRef = shallowRef();
|
|
65
|
+
const onEdge = (edgeInfo) => {
|
|
66
|
+
if (edgeInfo.direction == EdgeDirection.right) {
|
|
67
|
+
focusHub.setFocus("control");
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
//controller
|
|
72
|
+
const controlList = [
|
|
73
|
+
{
|
|
74
|
+
name: "追加",
|
|
75
|
+
callback: () => {
|
|
76
|
+
if (curData.length + 20 < imageUrl.length) {
|
|
77
|
+
prepareData(curData, 200, 200, curData.length, curData.length + 20);
|
|
78
|
+
widgetRef.value.refreshData();
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "全部替换",
|
|
84
|
+
callback: () => {
|
|
85
|
+
freshToken++;
|
|
86
|
+
const data = [];
|
|
87
|
+
prepareData(data, 200, 100, 0, 60);
|
|
88
|
+
curData = data;
|
|
89
|
+
widgetRef.value.refreshData();
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "刷新第5个item",
|
|
94
|
+
callback: () => {
|
|
95
|
+
if (curData.length > 5) {
|
|
96
|
+
freshToken++;
|
|
97
|
+
let oldItem = curData[5];
|
|
98
|
+
curData[5] = {
|
|
99
|
+
...oldItem,
|
|
100
|
+
jsvKey: 5 + "_" + freshToken,
|
|
101
|
+
content: Math.round(Math.random() * 100) + "",
|
|
102
|
+
};
|
|
103
|
+
widgetRef.value.refreshData();
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
// {
|
|
108
|
+
// name: "新数据旧id:不刷新",
|
|
109
|
+
// callback: () => {
|
|
110
|
+
// const data = [];
|
|
111
|
+
// prepareData(data, 200, 200, 0, curData.length);
|
|
112
|
+
// data.forEach((i, index) => {
|
|
113
|
+
// i.jsvKey = curData[index].jsvKey;
|
|
114
|
+
// });
|
|
115
|
+
// curData = data;
|
|
116
|
+
// widgetRef.value.refreshData();
|
|
117
|
+
// },
|
|
118
|
+
// },
|
|
119
|
+
{
|
|
120
|
+
name: "同尺寸新数据:刷新",
|
|
121
|
+
callback: () => {
|
|
122
|
+
freshToken++;
|
|
123
|
+
const data = [];
|
|
124
|
+
prepareData(data, 200, 200, 0, curData.length > 0 ? curData.length : 40);
|
|
125
|
+
curData = data;
|
|
126
|
+
widgetRef.value.refreshData();
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "刷新为空数据",
|
|
131
|
+
callback: () => {
|
|
132
|
+
freshToken++;
|
|
133
|
+
const data = [];
|
|
134
|
+
curData = data;
|
|
135
|
+
widgetRef.value.refreshData();
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
];
|
|
139
|
+
const controlWidgetMeasure = (data) => {
|
|
140
|
+
return {
|
|
141
|
+
width: 300,
|
|
142
|
+
height: 50,
|
|
143
|
+
marginBottom: 10,
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
const controlWidgetProvideData = () => {
|
|
147
|
+
return controlList;
|
|
148
|
+
};
|
|
149
|
+
const controlOnEdge = (edgeInfo) => {
|
|
150
|
+
if (edgeInfo.direction == EdgeDirection.left) {
|
|
151
|
+
focusHub.setFocus("myFocusWidget");
|
|
152
|
+
}
|
|
153
|
+
};
|
|
50
154
|
</script>
|
|
51
155
|
|
|
52
156
|
<template>
|
|
53
|
-
<
|
|
54
|
-
ref="focusNode"
|
|
157
|
+
<div
|
|
55
158
|
:style="{
|
|
56
159
|
width: 1920,
|
|
57
160
|
height: 1080,
|
|
58
161
|
backgroundColor: '#007788',
|
|
59
162
|
}"
|
|
60
|
-
|
|
163
|
+
></div>
|
|
164
|
+
<metro-widget
|
|
165
|
+
ref="widgetRef"
|
|
166
|
+
name="myFocusWidget"
|
|
167
|
+
:top="100"
|
|
168
|
+
:left="50"
|
|
169
|
+
:width="1000"
|
|
170
|
+
:height="550"
|
|
171
|
+
:direction="VERTICAL"
|
|
172
|
+
:provideData="provideData"
|
|
173
|
+
:measures="measures"
|
|
174
|
+
:padding="{ left: 50, right: 50, top: 50, bottom: 50 }"
|
|
175
|
+
:enableItemRenderBreak="true"
|
|
176
|
+
:onEdge="onEdge"
|
|
177
|
+
:placeHolderSetting="{
|
|
178
|
+
backgroundColor: 'rgba(78,105,127, 0.8)',
|
|
179
|
+
focusBackgroundColor: '#770088aa',
|
|
180
|
+
borderRadius: 10,
|
|
181
|
+
gap: 10,
|
|
182
|
+
}"
|
|
183
|
+
>
|
|
184
|
+
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
185
|
+
<item :data="data" :query="query" :onEdge="onEdge" :onAction="onAction" />
|
|
186
|
+
</template>
|
|
187
|
+
</metro-widget>
|
|
188
|
+
|
|
189
|
+
<metro-widget
|
|
190
|
+
name="control"
|
|
191
|
+
:left="1100"
|
|
192
|
+
:top="50"
|
|
193
|
+
:width="300"
|
|
194
|
+
:height="500"
|
|
195
|
+
:direction="HORIZONTAL"
|
|
196
|
+
:provideData="controlWidgetProvideData"
|
|
197
|
+
:measures="controlWidgetMeasure"
|
|
198
|
+
:onEdge="controlOnEdge"
|
|
199
|
+
>
|
|
200
|
+
<template #renderItem="{ data, onAction }">
|
|
201
|
+
<control-item :data="data" :onAction="onAction" />
|
|
202
|
+
</template>
|
|
203
|
+
</metro-widget>
|
|
204
|
+
|
|
205
|
+
<div
|
|
206
|
+
:style="{
|
|
207
|
+
left: 50,
|
|
208
|
+
top: 50,
|
|
209
|
+
width: 800,
|
|
210
|
+
height: 200,
|
|
211
|
+
color: '#FFFFFF',
|
|
212
|
+
fontSize: 30,
|
|
213
|
+
}"
|
|
61
214
|
>
|
|
62
|
-
|
|
63
|
-
ref="widgetRef"
|
|
64
|
-
name="myFocusWidget"
|
|
65
|
-
:top="100"
|
|
66
|
-
:left="50"
|
|
67
|
-
:width="1000"
|
|
68
|
-
:height="550"
|
|
69
|
-
:direction="VERTICAL"
|
|
70
|
-
:provideData="provideData"
|
|
71
|
-
:measures="measures"
|
|
72
|
-
:padding="{ left: 50, right: 50, top: 50, bottom: 50 }"
|
|
73
|
-
:enableItemRenderBreak="true"
|
|
74
|
-
:placeHolderSetting="{
|
|
75
|
-
backgroundColor: 'rgba(78,105,127, 0.8)',
|
|
76
|
-
focusBackgroundColor: '#770088aa',
|
|
77
|
-
borderRadius: 10,
|
|
78
|
-
gap: 10,
|
|
79
|
-
}"
|
|
80
|
-
>
|
|
81
|
-
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
82
|
-
<item
|
|
83
|
-
:data="data"
|
|
84
|
-
:query="query"
|
|
85
|
-
:onEdge="onEdge"
|
|
86
|
-
:onAction="onAction"
|
|
87
|
-
/>
|
|
88
|
-
</template>
|
|
89
|
-
</metro-widget>
|
|
90
|
-
</jsv-focus-block>
|
|
91
|
-
<div :style="{
|
|
92
|
-
left: 50,
|
|
93
|
-
top: 50,
|
|
94
|
-
width: 800,
|
|
95
|
-
height: 200,
|
|
96
|
-
color: '#FFFFFF',
|
|
97
|
-
fontSize: 30
|
|
98
|
-
}">
|
|
99
|
-
起来时会刷新两次数据, 看起来无闪烁即可
|
|
215
|
+
起来时先是无数据, 1s后有数据, 再1s后刷新, 无报错, 无闪烁即可
|
|
100
216
|
</div>
|
|
101
217
|
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-02-06 10:19:42
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { ref } from "vue";
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
data: Object,
|
|
11
|
+
onAction: Object,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
let focused = ref(false);
|
|
15
|
+
|
|
16
|
+
const onFocus = () => {
|
|
17
|
+
focused.value = true;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const onBlur = () => {
|
|
21
|
+
focused.value = false;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const onClicked = () => {
|
|
25
|
+
props.data.callback();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
props.onAction.register("onFocus", onFocus);
|
|
29
|
+
props.onAction.register("onBlur", onBlur);
|
|
30
|
+
props.onAction.register("onClick", onClicked);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div
|
|
35
|
+
:style="{
|
|
36
|
+
width: 300,
|
|
37
|
+
height: 50,
|
|
38
|
+
backgroundColor: focused ? '#444444' : '#778800',
|
|
39
|
+
fontSize: 30,
|
|
40
|
+
color: '#ffffff',
|
|
41
|
+
}"
|
|
42
|
+
>
|
|
43
|
+
{{ data.name }}
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @Description: file content
|
|
5
5
|
-->
|
|
6
6
|
<script setup>
|
|
7
|
-
import { ref } from "vue";
|
|
7
|
+
import { ref, onMounted } from "vue";
|
|
8
8
|
import { JsvPosterImage, JsvPosterDiv } from "jsview";
|
|
9
9
|
|
|
10
10
|
const props = defineProps({
|
|
@@ -31,6 +31,10 @@ const onClicked = () => {
|
|
|
31
31
|
props.onAction.register("onFocus", onFocus);
|
|
32
32
|
props.onAction.register("onBlur", onBlur);
|
|
33
33
|
props.onAction.register("onClick", onClicked);
|
|
34
|
+
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
console.log("item mounted", props.data.index);
|
|
37
|
+
});
|
|
34
38
|
</script>
|
|
35
39
|
|
|
36
40
|
<template>
|
|
@@ -52,8 +56,7 @@ props.onAction.register("onClick", onClicked);
|
|
|
52
56
|
backgroundColor: '#770088',
|
|
53
57
|
borderRadius: 10,
|
|
54
58
|
}"
|
|
55
|
-
>
|
|
56
|
-
</div>
|
|
59
|
+
></div>
|
|
57
60
|
<div v-if="query.index % 2 == 0">
|
|
58
61
|
<jsv-poster-image
|
|
59
62
|
:style="{
|
|
@@ -112,5 +115,18 @@ props.onAction.register("onClick", onClicked);
|
|
|
112
115
|
{{ "div" }}
|
|
113
116
|
</div>
|
|
114
117
|
</div>
|
|
118
|
+
|
|
119
|
+
<div
|
|
120
|
+
:style="{
|
|
121
|
+
top: 50,
|
|
122
|
+
width: data.width,
|
|
123
|
+
height: 40,
|
|
124
|
+
backgroundColor: '#444444aa',
|
|
125
|
+
fontSize: 30,
|
|
126
|
+
color: '#ffffff',
|
|
127
|
+
}"
|
|
128
|
+
>
|
|
129
|
+
{{ data.content }}
|
|
130
|
+
</div>
|
|
115
131
|
</div>
|
|
116
|
-
</template>
|
|
132
|
+
</template>
|
|
@@ -92,4 +92,10 @@ export default [
|
|
|
92
92
|
component: () =>
|
|
93
93
|
import("jsview-vue-samples/MetroWidgetDemos/SeamlessSlide/App.vue"),
|
|
94
94
|
},
|
|
95
|
+
{
|
|
96
|
+
name: "多item分段显示",
|
|
97
|
+
path: "/metroWidget/MassiveItems",
|
|
98
|
+
component: () =>
|
|
99
|
+
import("jsview-vue-samples/MetroWidgetDemos/MassiveItems/App.vue"),
|
|
100
|
+
},
|
|
95
101
|
]
|
|
@@ -98,61 +98,49 @@ const randomSelect = () => {
|
|
|
98
98
|
const sag = () => {
|
|
99
99
|
centerItemArray.forEach((item, index) => {
|
|
100
100
|
if (center.x - item.x <= Math.abs(60)) {
|
|
101
|
-
controlArray[index].run([
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
.setSpdAndAccel(16, randomSelect(), 0, 15, null, null),
|
|
105
|
-
controlArray[index]
|
|
101
|
+
controlArray[index].run((cmds) => [
|
|
102
|
+
cmds.action().setSpdAndAccel(16, randomSelect(), 0, 15, null, null),
|
|
103
|
+
cmds
|
|
106
104
|
.condition()
|
|
107
105
|
.reachPosition(undefined, 1380)
|
|
108
|
-
.then([
|
|
106
|
+
.then([cmds.action().stopMoving()]),
|
|
109
107
|
]);
|
|
110
108
|
} else if (center.x - item.x <= 200) {
|
|
111
|
-
controlArray[index].run([
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
.setSpdAndAccel(8, randomSelect(), 0, 15, null, null),
|
|
115
|
-
controlArray[index]
|
|
109
|
+
controlArray[index].run((cmds) => [
|
|
110
|
+
cmds.action().setSpdAndAccel(8, randomSelect(), 0, 15, null, null),
|
|
111
|
+
cmds
|
|
116
112
|
.condition()
|
|
117
113
|
.reachPosition(undefined, 1380)
|
|
118
|
-
.then([
|
|
114
|
+
.then([cmds.action().stopMoving()]),
|
|
119
115
|
]);
|
|
120
116
|
} else if (center.x - item.x <= 500) {
|
|
121
|
-
controlArray[index].run([
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
.setSpdAndAccel(-8, randomSelect(), 0, 15, null, null),
|
|
125
|
-
controlArray[index]
|
|
117
|
+
controlArray[index].run((cmds) => [
|
|
118
|
+
cmds.action().setSpdAndAccel(-8, randomSelect(), 0, 15, null, null),
|
|
119
|
+
cmds
|
|
126
120
|
.condition()
|
|
127
121
|
.reachPosition(undefined, 1380)
|
|
128
|
-
.then([
|
|
122
|
+
.then([cmds.action().stopMoving()]),
|
|
129
123
|
]);
|
|
130
124
|
} else if (center.x - item.x > 500) {
|
|
131
|
-
controlArray[index].run([
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
.setSpdAndAccel(-16, randomSelect(), 0, 15, null, null),
|
|
135
|
-
controlArray[index]
|
|
125
|
+
controlArray[index].run((cmds) => [
|
|
126
|
+
cmds.action().setSpdAndAccel(-16, randomSelect(), 0, 15, null, null),
|
|
127
|
+
cmds
|
|
136
128
|
.condition()
|
|
137
129
|
.reachPosition(undefined, 1380)
|
|
138
|
-
.then([
|
|
130
|
+
.then([cmds.action().stopMoving()]),
|
|
139
131
|
]);
|
|
140
132
|
} else if (center.x - item.x < -60) {
|
|
141
|
-
controlArray[index].run([
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
.setSpdAndAccel(20, randomSelect(), 0, 15, null, null),
|
|
145
|
-
controlArray[index]
|
|
133
|
+
controlArray[index].run((cmds) => [
|
|
134
|
+
cmds.action().setSpdAndAccel(20, randomSelect(), 0, 15, null, null),
|
|
135
|
+
cmds
|
|
146
136
|
.condition()
|
|
147
137
|
.reachPosition(undefined, 1380)
|
|
148
|
-
.then([
|
|
149
|
-
controlArray[index].action().stopMoving(),
|
|
150
|
-
]),
|
|
138
|
+
.then([cmds.action().stopMoving()]),
|
|
151
139
|
]);
|
|
152
140
|
}
|
|
153
141
|
//给所有运动物体创建onNexusEvent条件以便召回
|
|
154
|
-
controlArray[index].run([
|
|
155
|
-
|
|
142
|
+
controlArray[index].run((cmds) => [
|
|
143
|
+
cmds
|
|
156
144
|
.condition()
|
|
157
145
|
.onNexusEvent(interactNexus, 1001 + index)
|
|
158
146
|
.then([
|
|
@@ -171,16 +159,16 @@ const sag = () => {
|
|
|
171
159
|
|
|
172
160
|
const fireNeEvent = () => {
|
|
173
161
|
controlArray.forEach((item, index) => {
|
|
174
|
-
item.run([
|
|
175
|
-
|
|
176
|
-
|
|
162
|
+
item.run((cmds) => [
|
|
163
|
+
cmds.action().stopMoving(),
|
|
164
|
+
cmds.state().fireNexusEvent(interactNexus, 1001 + index),
|
|
177
165
|
]);
|
|
178
166
|
});
|
|
179
167
|
};
|
|
180
168
|
//往回恢复的函数
|
|
181
169
|
const recover = (index) => {
|
|
182
|
-
controlArray[index].run([
|
|
183
|
-
|
|
170
|
+
controlArray[index].run((cmds) => [
|
|
171
|
+
cmds
|
|
184
172
|
.action()
|
|
185
173
|
.moveTo(
|
|
186
174
|
0,
|
|
@@ -189,9 +177,9 @@ const recover = (index) => {
|
|
|
189
177
|
Math.abs(recallArray[index].y),
|
|
190
178
|
recallArray[index].y / 15,
|
|
191
179
|
() => {
|
|
192
|
-
controlArray[index].run([
|
|
193
|
-
|
|
194
|
-
|
|
180
|
+
controlArray[index].run((cmds) => [
|
|
181
|
+
cmds.action().teleportTo(0, 0),
|
|
182
|
+
cmds.state().clearAllConditions(),
|
|
195
183
|
]);
|
|
196
184
|
}
|
|
197
185
|
),
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<jsv-focus-block autoFocus :onKeyDown="procKeyDown">
|
|
3
|
+
<div class="bgSty">
|
|
4
|
+
<!-- 提示 -->
|
|
5
|
+
<div class="text" :style="{ left: 210, top: 20 }">
|
|
6
|
+
{{
|
|
7
|
+
"操作提示:\n触控进行左右拖拽\n点击进度条空白处游标直接跳过去\n按 返回 键退出"
|
|
8
|
+
}}
|
|
9
|
+
</div>
|
|
10
|
+
<div
|
|
11
|
+
class="logo-bg"
|
|
12
|
+
:style="{
|
|
13
|
+
left: 210,
|
|
14
|
+
top: 160,
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<!-- 三个背景色块,用来确认进度条的透明度 -->
|
|
18
|
+
<div class="bg1" />
|
|
19
|
+
<div class="bg2" />
|
|
20
|
+
<div class="bg3" />
|
|
21
|
+
<!-- 进度条 -->
|
|
22
|
+
<SizeDivBar :top="80" :left="0" />
|
|
23
|
+
<ClipBar :top="210" :left="0" />
|
|
24
|
+
<NinePatchBar :top="340" :left="0" />
|
|
25
|
+
<!-- 图1说明 -->
|
|
26
|
+
<div :style="{ left: 0, top: 26 }" class="text">
|
|
27
|
+
{{ "pin模式下拖拽(拖动点尺寸略大于进度条)" }}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</jsv-focus-block>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup>
|
|
35
|
+
import { shallowRef, onMounted } from "vue";
|
|
36
|
+
import NoBackgroundBar from "./NoBackgroundBar.vue";
|
|
37
|
+
import ClipBar from "./ClipBar.vue";
|
|
38
|
+
import NinePatchBar from "./NinePatchBar.vue";
|
|
39
|
+
import SizeDivBar from "./SizeDivBar.vue";
|
|
40
|
+
|
|
41
|
+
// //进度百分比
|
|
42
|
+
// let myProgress = shallowRef(20);
|
|
43
|
+
// //按键事件 控制进度条的width
|
|
44
|
+
const procKeyDown = (ev) => {
|
|
45
|
+
// switch (ev.keyCode) {
|
|
46
|
+
// case 37:
|
|
47
|
+
// myProgress.value -= 5;
|
|
48
|
+
// if (myProgress.value <= 0) {
|
|
49
|
+
// myProgress.value = 0;
|
|
50
|
+
// }
|
|
51
|
+
// break;
|
|
52
|
+
// case 39:
|
|
53
|
+
// myProgress.value += 5;
|
|
54
|
+
// if (myProgress.value >= 100) {
|
|
55
|
+
// myProgress.value = 100;
|
|
56
|
+
// }
|
|
57
|
+
// break;
|
|
58
|
+
// case 13:
|
|
59
|
+
// myProgress.value = 0;
|
|
60
|
+
// break;
|
|
61
|
+
// default:
|
|
62
|
+
// break;
|
|
63
|
+
// }
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
onMounted(() => {});
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<style scoped>
|
|
70
|
+
.bgSty {
|
|
71
|
+
background-color: #5490d1;
|
|
72
|
+
width: 1280;
|
|
73
|
+
height: 720;
|
|
74
|
+
}
|
|
75
|
+
.logo-bg {
|
|
76
|
+
width: 800;
|
|
77
|
+
height: 400;
|
|
78
|
+
}
|
|
79
|
+
.text {
|
|
80
|
+
width: 800;
|
|
81
|
+
height: 200;
|
|
82
|
+
font-size: 24;
|
|
83
|
+
font-weight: bold;
|
|
84
|
+
line-height: 32;
|
|
85
|
+
color: #ffffff;
|
|
86
|
+
text-align: center;
|
|
87
|
+
}
|
|
88
|
+
.bg1 {
|
|
89
|
+
left: 0;
|
|
90
|
+
top: 0;
|
|
91
|
+
height: 500;
|
|
92
|
+
width: 267;
|
|
93
|
+
background-color: #007f00;
|
|
94
|
+
}
|
|
95
|
+
.bg2 {
|
|
96
|
+
left: 267;
|
|
97
|
+
top: 0;
|
|
98
|
+
height: 500;
|
|
99
|
+
width: 267;
|
|
100
|
+
background-color: #3049b8;
|
|
101
|
+
}
|
|
102
|
+
.bg3 {
|
|
103
|
+
left: 534;
|
|
104
|
+
top: 0;
|
|
105
|
+
height: 500;
|
|
106
|
+
width: 266;
|
|
107
|
+
background-color: #d12b8c;
|
|
108
|
+
}
|
|
109
|
+
</style>
|