@shijiu/jsview-vue-samples 2.2.128 → 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/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/router.js +10 -0
- package/DriftScopeTest/App.vue +128 -0
- package/FreeMove/App.vue +62 -64
- package/FreeMoveLink/App.vue +2 -2
- package/ImpactStop/App.vue +45 -45
- package/LongImage/App.vue +1 -2
- package/LongText/App.vue +2 -2
- package/LongText/LongTextScroll.vue +22 -22
- package/LongText/Scroll.vue +28 -9
- package/MetroWidgetDemos/RefreshDemo/App.vue +172 -56
- package/MetroWidgetDemos/RefreshDemo/ControlItem.vue +45 -0
- package/MetroWidgetDemos/RefreshDemo/Item.vue +20 -4
- package/SceneTransition/JsvSceneTransition.vue +30 -42
- package/ScrollBoxTest/App.vue +35 -86
- 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/TombSweepingDayTest/Raining/Rain.vue +8 -8
- package/package.json +1 -1
- package/MetroWidgetDemos/RefreshDemo/data.js +0 -16
package/LongText/Scroll.vue
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { VERTICAL, JsvScrollBox, SeamlessSlide, ScrollBoxStyle } from "jsview";
|
|
3
|
+
|
|
4
|
+
let rProps = defineProps({
|
|
3
5
|
scrollStyle: Object,
|
|
4
|
-
top: Number,
|
|
5
6
|
scrollBlockStyle: Object,
|
|
6
7
|
});
|
|
8
|
+
|
|
9
|
+
let { left: cScrollLeft, ...cScrollSubStyle } = rProps.scrollStyle as any;
|
|
7
10
|
</script>
|
|
8
11
|
<template>
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
<jsv-scroll-box
|
|
13
|
+
linkName="ScrollBarTextArea"
|
|
14
|
+
syncWith="ScrollBoxTextArea"
|
|
15
|
+
:style="{
|
|
16
|
+
left: cScrollLeft,
|
|
17
|
+
width: cScrollSubStyle.width,
|
|
18
|
+
height: cScrollSubStyle.height,
|
|
19
|
+
}"
|
|
20
|
+
:direction="VERTICAL"
|
|
21
|
+
:mode="ScrollBoxStyle.PinMode"
|
|
22
|
+
:sliderSize="{
|
|
23
|
+
height: (rProps.scrollBlockStyle as any).height,
|
|
24
|
+
}"
|
|
25
|
+
>
|
|
26
|
+
<template #FixedBox>
|
|
27
|
+
<div :style="{ ...cScrollSubStyle }" />
|
|
28
|
+
</template>
|
|
29
|
+
<template #SliderBox>
|
|
30
|
+
<div :style="{ ...rProps.scrollBlockStyle }" />
|
|
31
|
+
</template>
|
|
32
|
+
</jsv-scroll-box>
|
|
33
|
+
</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>
|
|
@@ -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
|
),
|
package/ScrollBoxTest/App.vue
CHANGED
|
@@ -11,57 +11,17 @@
|
|
|
11
11
|
class="logo-bg"
|
|
12
12
|
:style="{
|
|
13
13
|
left: 210,
|
|
14
|
-
top:
|
|
14
|
+
top: 160,
|
|
15
15
|
}"
|
|
16
16
|
>
|
|
17
|
-
<!--
|
|
17
|
+
<!-- 三个背景色块,用来确认进度条的透明度 -->
|
|
18
18
|
<div class="bg1" />
|
|
19
19
|
<div class="bg2" />
|
|
20
20
|
<div class="bg3" />
|
|
21
21
|
<!-- 进度条 -->
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
:style="{
|
|
26
|
-
width: 800,
|
|
27
|
-
height: 84,
|
|
28
|
-
}"
|
|
29
|
-
:direction="HORIZONTAL"
|
|
30
|
-
:sliderSize="{
|
|
31
|
-
width: 84,
|
|
32
|
-
}"
|
|
33
|
-
>
|
|
34
|
-
<template #FixedBox="{ boxWidth, boxHeight }">
|
|
35
|
-
<div
|
|
36
|
-
:style="{
|
|
37
|
-
width: boxWidth,
|
|
38
|
-
height: boxHeight,
|
|
39
|
-
lineHeight: boxHeight,
|
|
40
|
-
backgroundColor: 'rgba(255,255,255,0.3)',
|
|
41
|
-
borderRadius: Math.floor(boxHeight / 2),
|
|
42
|
-
fontSize: Math.floor(boxHeight * 0.5),
|
|
43
|
-
textAlign: 'center',
|
|
44
|
-
color: 'rgba(0,0,0,1)',
|
|
45
|
-
}"
|
|
46
|
-
>
|
|
47
|
-
{{ `进度:${rPercentDisp}` }}
|
|
48
|
-
</div>
|
|
49
|
-
</template>
|
|
50
|
-
<template #SliderBox="{ boxWidth, boxHeight }">
|
|
51
|
-
<div
|
|
52
|
-
:style="{
|
|
53
|
-
top: -15,
|
|
54
|
-
left: -15,
|
|
55
|
-
width: boxWidth + 30,
|
|
56
|
-
height: boxHeight + 30,
|
|
57
|
-
backgroundColor: 'rgba(255, 0,0,0.8)',
|
|
58
|
-
borderRadius: Math.floor((boxHeight + 30) / 2),
|
|
59
|
-
}"
|
|
60
|
-
@click="fncOnClick"
|
|
61
|
-
/>
|
|
62
|
-
</template>
|
|
63
|
-
</JsvScrollBox>
|
|
64
|
-
</div>
|
|
22
|
+
<SizeDivBar :top="80" :left="0" />
|
|
23
|
+
<ClipBar :top="210" :left="0" />
|
|
24
|
+
<NinePatchBar :top="340" :left="0" />
|
|
65
25
|
<!-- 图1说明 -->
|
|
66
26
|
<div :style="{ left: 0, top: 26 }" class="text">
|
|
67
27
|
{{ "pin模式下拖拽(拖动点尺寸略大于进度条)" }}
|
|
@@ -73,48 +33,37 @@
|
|
|
73
33
|
|
|
74
34
|
<script setup>
|
|
75
35
|
import { shallowRef, onMounted } from "vue";
|
|
76
|
-
import
|
|
36
|
+
import NoBackgroundBar from "./NoBackgroundBar.vue";
|
|
37
|
+
import ClipBar from "./ClipBar.vue";
|
|
38
|
+
import NinePatchBar from "./NinePatchBar.vue";
|
|
39
|
+
import SizeDivBar from "./SizeDivBar.vue";
|
|
77
40
|
|
|
78
|
-
//进度百分比
|
|
79
|
-
let myProgress = shallowRef(20);
|
|
80
|
-
//按键事件 控制进度条的width
|
|
41
|
+
// //进度百分比
|
|
42
|
+
// let myProgress = shallowRef(20);
|
|
43
|
+
// //按键事件 控制进度条的width
|
|
81
44
|
const procKeyDown = (ev) => {
|
|
82
|
-
switch (ev.keyCode) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
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
|
+
// }
|
|
101
64
|
};
|
|
102
65
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
let rJsvScrollBox = shallowRef(null);
|
|
106
|
-
let rPercentDisp = shallowRef(0);
|
|
107
|
-
|
|
108
|
-
onMounted(() => {
|
|
109
|
-
rJsvScrollBox.value.setSensor((percent, x, y) => {
|
|
110
|
-
rPercentDisp.value = Math.floor(percent * 100) / 100;
|
|
111
|
-
console.log(
|
|
112
|
-
`onProgress dragged percent=${percent} \
|
|
113
|
-
x=${Math.floor(x)} \
|
|
114
|
-
y=${Math.floor(y)}`
|
|
115
|
-
);
|
|
116
|
-
}, 15);
|
|
117
|
-
});
|
|
66
|
+
onMounted(() => {});
|
|
118
67
|
</script>
|
|
119
68
|
|
|
120
69
|
<style scoped>
|
|
@@ -139,21 +88,21 @@ y=${Math.floor(y)}`
|
|
|
139
88
|
.bg1 {
|
|
140
89
|
left: 0;
|
|
141
90
|
top: 0;
|
|
142
|
-
height:
|
|
91
|
+
height: 500;
|
|
143
92
|
width: 267;
|
|
144
93
|
background-color: #007f00;
|
|
145
94
|
}
|
|
146
95
|
.bg2 {
|
|
147
96
|
left: 267;
|
|
148
97
|
top: 0;
|
|
149
|
-
height:
|
|
98
|
+
height: 500;
|
|
150
99
|
width: 267;
|
|
151
100
|
background-color: #3049b8;
|
|
152
101
|
}
|
|
153
102
|
.bg3 {
|
|
154
103
|
left: 534;
|
|
155
104
|
top: 0;
|
|
156
|
-
height:
|
|
105
|
+
height: 500;
|
|
157
106
|
width: 266;
|
|
158
107
|
background-color: #d12b8c;
|
|
159
108
|
}
|