@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
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 进度条 -->
|
|
3
|
+
<div :style="{ top: rProps.top, left: rProps.left }">
|
|
4
|
+
<div ref="rPressDetectDiv" :style="{ width: 800, height: 84 }">
|
|
5
|
+
<JsvScrollBox
|
|
6
|
+
ref="rJsvScrollBox"
|
|
7
|
+
:linkName="cLinkName"
|
|
8
|
+
:style="{
|
|
9
|
+
width: 800,
|
|
10
|
+
height: 84,
|
|
11
|
+
}"
|
|
12
|
+
:direction="HORIZONTAL"
|
|
13
|
+
:sliderSize="{
|
|
14
|
+
width: 84,
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<!-- 用位置固定的区域来进行进度条展示(FixedBox) -->
|
|
18
|
+
<template #FixedBox="{ boxWidth, boxHeight }">
|
|
19
|
+
<!-- 正向进度的颜色(对圆角div进行剪切) -->
|
|
20
|
+
<JsvScrollFollow
|
|
21
|
+
:proxyType="ScrollBoxStyle.SizeClip"
|
|
22
|
+
:syncWith="cLinkName"
|
|
23
|
+
:varWidth="{ start: 0, end: boxWidth }"
|
|
24
|
+
:varHeight="boxHeight"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
:style="{
|
|
28
|
+
width: boxWidth,
|
|
29
|
+
height: boxHeight,
|
|
30
|
+
backgroundColor: 'rgba(128,128,0,0.7)',
|
|
31
|
+
borderRadius: Math.floor(boxHeight / 2),
|
|
32
|
+
}"
|
|
33
|
+
/>
|
|
34
|
+
</JsvScrollFollow>
|
|
35
|
+
|
|
36
|
+
<!-- 反向进度的颜色(对圆角div进行剪切) -->
|
|
37
|
+
<JsvScrollFollow
|
|
38
|
+
:proxyType="ScrollBoxStyle.SizeClip"
|
|
39
|
+
:varMode="ScrollBoxStyle.Size"
|
|
40
|
+
:syncWith="cLinkName"
|
|
41
|
+
:varLeft="boxWidth /* 将left置于进度条最右边 */"
|
|
42
|
+
:varWidth="{ start: 0, end: -boxWidth }"
|
|
43
|
+
:varHeight="boxHeight"
|
|
44
|
+
:syncType="ScrollBoxStyle.SyncReverse"
|
|
45
|
+
>
|
|
46
|
+
<div
|
|
47
|
+
:style="{
|
|
48
|
+
left: -boxWidth,
|
|
49
|
+
width: boxWidth,
|
|
50
|
+
height: boxHeight,
|
|
51
|
+
backgroundColor: 'rgba(0,128,255,0.7)',
|
|
52
|
+
borderRadius: Math.floor(boxHeight / 2),
|
|
53
|
+
}"
|
|
54
|
+
/>
|
|
55
|
+
</JsvScrollFollow>
|
|
56
|
+
|
|
57
|
+
<!-- 进度文字 -->
|
|
58
|
+
<div
|
|
59
|
+
:style="{
|
|
60
|
+
width: boxWidth,
|
|
61
|
+
height: boxHeight,
|
|
62
|
+
lineHeight: boxHeight,
|
|
63
|
+
fontSize: Math.floor(boxHeight * 0.5),
|
|
64
|
+
textAlign: 'center',
|
|
65
|
+
color: 'rgba(0,0,0,1)',
|
|
66
|
+
}"
|
|
67
|
+
>
|
|
68
|
+
{{
|
|
69
|
+
`左黄色:${rPercentDisp} 右蓝色:${
|
|
70
|
+
Math.floor((1 - rPercentDisp) * 100) / 100
|
|
71
|
+
}`
|
|
72
|
+
}}
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<!-- 进度游标球(SliderBox) -->
|
|
77
|
+
<template #SliderBox="{ boxWidth, boxHeight }">
|
|
78
|
+
<div
|
|
79
|
+
:style="{
|
|
80
|
+
top: -15,
|
|
81
|
+
left: -15,
|
|
82
|
+
width: boxWidth + 30,
|
|
83
|
+
height: boxHeight + 30,
|
|
84
|
+
backgroundColor: 'rgba(255, 0,0,0.5)',
|
|
85
|
+
borderRadius: Math.floor((boxHeight + 30) / 2),
|
|
86
|
+
}"
|
|
87
|
+
@click="fncOnClick"
|
|
88
|
+
/>
|
|
89
|
+
</template>
|
|
90
|
+
</JsvScrollBox>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script setup>
|
|
96
|
+
import { shallowRef, onMounted } from "vue";
|
|
97
|
+
import {
|
|
98
|
+
JsvScrollBox,
|
|
99
|
+
JsvScrollFollow,
|
|
100
|
+
ScrollBoxStyle,
|
|
101
|
+
HORIZONTAL,
|
|
102
|
+
} from "jsview";
|
|
103
|
+
import { numberCheckSet } from "../../jsview-vue/utils";
|
|
104
|
+
|
|
105
|
+
let rProps = defineProps({
|
|
106
|
+
top: {
|
|
107
|
+
Type: Number,
|
|
108
|
+
default: 0,
|
|
109
|
+
},
|
|
110
|
+
left: {
|
|
111
|
+
Type: Number,
|
|
112
|
+
default: 0,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const cLinkName = "ScrollBoxTest_ClipSlider";
|
|
117
|
+
|
|
118
|
+
//进度百分比
|
|
119
|
+
let myProgress = shallowRef(20);
|
|
120
|
+
|
|
121
|
+
let fncOnClick = () => {
|
|
122
|
+
console.log("ClipBar slider OnClicked");
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
let rJsvScrollBox = shallowRef(null);
|
|
126
|
+
let rPressDetectDiv = shallowRef(null);
|
|
127
|
+
let rPercentDisp = shallowRef(0);
|
|
128
|
+
|
|
129
|
+
onMounted(() => {
|
|
130
|
+
rJsvScrollBox.value.setSensor((percent, x, y) => {
|
|
131
|
+
rPercentDisp.value = Math.floor(percent * 100) / 100;
|
|
132
|
+
console.log(
|
|
133
|
+
`onProgress dragged percent=${percent} \
|
|
134
|
+
x=${Math.floor(x)} \
|
|
135
|
+
y=${Math.floor(y)}`
|
|
136
|
+
);
|
|
137
|
+
}, 15);
|
|
138
|
+
|
|
139
|
+
// 通过代码设计进度条位置, 同理按键操作下来的进度条调整也可以这么处理
|
|
140
|
+
rJsvScrollBox.value.updatePercent(0.7);
|
|
141
|
+
|
|
142
|
+
// 注册按下抬起的监听
|
|
143
|
+
rPressDetectDiv.value.jsvSetTapListener({
|
|
144
|
+
onTouchEnd: () => {
|
|
145
|
+
rPercentDisp.value =
|
|
146
|
+
Math.floor(rJsvScrollBox.value.currentPercent() * 100) / 100;
|
|
147
|
+
console.log("ClipBar release percent=" + rPercentDisp.value);
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
</script>
|
|
152
|
+
|
|
153
|
+
<style scoped></style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JsvTextureStoreApi } from "@shijiu/jsview-vue";
|
|
2
|
+
|
|
3
|
+
export function DrawCircle(
|
|
4
|
+
bitmapWidth: number,
|
|
5
|
+
bitmapHeight: number,
|
|
6
|
+
cornerX: number,
|
|
7
|
+
cornerY: number,
|
|
8
|
+
radius: number,
|
|
9
|
+
colorFormat: string): any {
|
|
10
|
+
const canvasRef = JsvTextureStoreApi.canvasTexture(
|
|
11
|
+
bitmapWidth,
|
|
12
|
+
bitmapHeight,
|
|
13
|
+
null
|
|
14
|
+
);
|
|
15
|
+
const customPath = canvasRef.circlePath(cornerX, cornerY, radius);
|
|
16
|
+
customPath?.fill(colorFormat);
|
|
17
|
+
const textureId = canvasRef.commit();
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
id: textureId,
|
|
21
|
+
doRecycle: () => {
|
|
22
|
+
JsvTextureStoreApi.deleteTexture(textureId);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 进度条 -->
|
|
3
|
+
<div id="NinePatchBar" :style="{ top: rProps.top, left: rProps.left }">
|
|
4
|
+
<div ref="rPressDetectDiv" :style="{ width: 800, height: 84 }">
|
|
5
|
+
<JsvScrollBox
|
|
6
|
+
ref="rJsvScrollBox"
|
|
7
|
+
:linkName="cLinkName"
|
|
8
|
+
:style="{
|
|
9
|
+
width: 800,
|
|
10
|
+
height: cBarHeight,
|
|
11
|
+
}"
|
|
12
|
+
:direction="HORIZONTAL"
|
|
13
|
+
:sliderSize="{
|
|
14
|
+
width: 84,
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<!-- 用位置固定的区域来进度条展示(FixedBox) -->
|
|
18
|
+
<template #FixedBox="{ boxWidth, boxHeight }">
|
|
19
|
+
<!-- 正向进度的颜色条(.9形变) -->
|
|
20
|
+
<JsvScrollFollow
|
|
21
|
+
ref="rJsvScrollFlowA"
|
|
22
|
+
:proxyType="ScrollBoxStyle.JsvNinePatch"
|
|
23
|
+
:proxyProps="{
|
|
24
|
+
imageUrl: `jsvtexturestore://${cLeftBarTexture.id}`,
|
|
25
|
+
imageWidth: cBitMap.width,
|
|
26
|
+
centerWidth: 1,
|
|
27
|
+
borderOutset: cCircleBorderGap,
|
|
28
|
+
waitForInit: false,
|
|
29
|
+
}"
|
|
30
|
+
:syncWith="cLinkName"
|
|
31
|
+
:varWidth="{ start: cMiniWidth, end: boxWidth }"
|
|
32
|
+
:varHeight="boxHeight"
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
<!-- 反向进度的颜色条(.9形变) -->
|
|
36
|
+
<JsvScrollFollow
|
|
37
|
+
:proxyType="ScrollBoxStyle.JsvNinePatch"
|
|
38
|
+
:syncWith="cLinkName"
|
|
39
|
+
:varLeft="boxWidth /* 将left置于进度条最右边 */"
|
|
40
|
+
:varWidth="{ start: -cMiniWidth, end: -boxWidth }"
|
|
41
|
+
:varHeight="boxHeight"
|
|
42
|
+
:syncType="ScrollBoxStyle.SyncReverse"
|
|
43
|
+
:proxyProps="{
|
|
44
|
+
imageUrl: `jsvtexturestore://${cRightBarTexture.id}`,
|
|
45
|
+
imageWidth: cBitMap.width,
|
|
46
|
+
centerWidth: 1,
|
|
47
|
+
borderOutset: cCircleBorderGap,
|
|
48
|
+
waitForInit: false,
|
|
49
|
+
}"
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
<!-- 进度文字 -->
|
|
53
|
+
<div
|
|
54
|
+
:style="{
|
|
55
|
+
width: boxWidth,
|
|
56
|
+
height: boxHeight,
|
|
57
|
+
lineHeight: boxHeight,
|
|
58
|
+
fontSize: Math.floor(boxHeight * 0.5),
|
|
59
|
+
textAlign: 'center',
|
|
60
|
+
color: 'rgba(0,0,0,1)',
|
|
61
|
+
}"
|
|
62
|
+
>
|
|
63
|
+
{{
|
|
64
|
+
`左黄色:${rPercentDisp} 右蓝色:${
|
|
65
|
+
Math.floor((1 - rPercentDisp) * 100) / 100
|
|
66
|
+
}`
|
|
67
|
+
}}
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<!-- 进度游标球(SliderBox) -->
|
|
72
|
+
<template #SliderBox="{ boxWidth, boxHeight }">
|
|
73
|
+
<div
|
|
74
|
+
:style="{
|
|
75
|
+
top: -15,
|
|
76
|
+
left: -15,
|
|
77
|
+
width: boxWidth + 30,
|
|
78
|
+
height: boxHeight + 30,
|
|
79
|
+
backgroundColor: 'rgba(255, 0,0,0.5)',
|
|
80
|
+
borderRadius: Math.floor((boxHeight + 30) / 2),
|
|
81
|
+
}"
|
|
82
|
+
@click="fncOnClick"
|
|
83
|
+
/>
|
|
84
|
+
</template>
|
|
85
|
+
</JsvScrollBox>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</template>
|
|
89
|
+
|
|
90
|
+
<script setup>
|
|
91
|
+
import { shallowRef, onMounted, onUnmounted } from "vue";
|
|
92
|
+
import { DrawCircle } from "./DrawCircle";
|
|
93
|
+
import {
|
|
94
|
+
JsvScrollBox,
|
|
95
|
+
JsvScrollFollow,
|
|
96
|
+
ScrollBoxStyle,
|
|
97
|
+
HORIZONTAL,
|
|
98
|
+
} from "jsview";
|
|
99
|
+
|
|
100
|
+
let rProps = defineProps({
|
|
101
|
+
top: {
|
|
102
|
+
Type: Number,
|
|
103
|
+
default: 0,
|
|
104
|
+
},
|
|
105
|
+
left: {
|
|
106
|
+
Type: Number,
|
|
107
|
+
default: 0,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const cLinkName = "ScrollBoxTest_NinePatchSlider";
|
|
112
|
+
const cBarHeight = 84;
|
|
113
|
+
const cMiniWidth = cBarHeight; // 进度条最小宽度和高度相同,形成一个.9的原点
|
|
114
|
+
|
|
115
|
+
/***** 构建NinePatch的图元 *****/
|
|
116
|
+
const cBitMap = {
|
|
117
|
+
width: cBarHeight,
|
|
118
|
+
height: cBarHeight,
|
|
119
|
+
};
|
|
120
|
+
const cCircleBorderGap = 2;
|
|
121
|
+
const cRadius = Math.floor((cBarHeight - 2 * cCircleBorderGap) / 2);
|
|
122
|
+
//相应Texture赋值
|
|
123
|
+
const cLeftBarTexture = DrawCircle(
|
|
124
|
+
cBitMap.width,
|
|
125
|
+
cBitMap.height,
|
|
126
|
+
cRadius + cCircleBorderGap,
|
|
127
|
+
cRadius + cCircleBorderGap,
|
|
128
|
+
cRadius,
|
|
129
|
+
"rgba(128,128,0,0.7)"
|
|
130
|
+
);
|
|
131
|
+
const cRightBarTexture = DrawCircle(
|
|
132
|
+
cBitMap.width,
|
|
133
|
+
cBitMap.height,
|
|
134
|
+
cRadius + cCircleBorderGap,
|
|
135
|
+
cRadius + cCircleBorderGap,
|
|
136
|
+
cRadius,
|
|
137
|
+
"rgba(0,128,255,0.7)"
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
let fncOnClick = () => {
|
|
141
|
+
console.log("NinePatchBar slider OnClicked");
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
let rJsvScrollBox = shallowRef(null);
|
|
145
|
+
let rPressDetectDiv = shallowRef(null);
|
|
146
|
+
let rPercentDisp = shallowRef(0);
|
|
147
|
+
let rJsvScrollFlowA = shallowRef(null);
|
|
148
|
+
|
|
149
|
+
onMounted(() => {
|
|
150
|
+
rJsvScrollBox.value.setSensor((percent, x, y) => {
|
|
151
|
+
rPercentDisp.value = Math.floor(percent * 100) / 100;
|
|
152
|
+
console.log(
|
|
153
|
+
`onProgress dragged percent=${percent} \
|
|
154
|
+
x=${Math.floor(x)} \
|
|
155
|
+
y=${Math.floor(y)}`
|
|
156
|
+
);
|
|
157
|
+
}, 15);
|
|
158
|
+
|
|
159
|
+
// 通过代码设计进度条位置, 同理按键操作下来的进度条调整也可以这么处理
|
|
160
|
+
rJsvScrollBox.value.updatePercent(0.5);
|
|
161
|
+
|
|
162
|
+
// 注册按下抬起的监听
|
|
163
|
+
rPressDetectDiv.value.jsvSetTapListener({
|
|
164
|
+
onTouchEnd: () => {
|
|
165
|
+
rPercentDisp.value =
|
|
166
|
+
Math.floor(rJsvScrollBox.value.currentPercent() * 100) / 100;
|
|
167
|
+
console.log("+NinePatchBar release percent=" + rPercentDisp.value);
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
rJsvScrollFlowA.value.setSensor((percent, x, y) => {
|
|
172
|
+
console.log(
|
|
173
|
+
`follow onProgress dragged percent=${percent} \
|
|
174
|
+
x=${Math.floor(x)} \
|
|
175
|
+
y=${Math.floor(y)}`
|
|
176
|
+
);
|
|
177
|
+
}, 15);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
onUnmounted(() => {
|
|
181
|
+
// 销毁记录在全局的texture
|
|
182
|
+
cLeftBarTexture?.doRecycle();
|
|
183
|
+
cRightBarTexture?.doRecycle();
|
|
184
|
+
});
|
|
185
|
+
</script>
|
|
186
|
+
|
|
187
|
+
<style scoped></style>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 进度条 -->
|
|
3
|
+
<div :style="{ top: rProps.top, left: rProps.left }">
|
|
4
|
+
<JsvScrollBox
|
|
5
|
+
ref="rJsvScrollBox"
|
|
6
|
+
:style="{
|
|
7
|
+
width: 800,
|
|
8
|
+
height: 84,
|
|
9
|
+
}"
|
|
10
|
+
:direction="HORIZONTAL"
|
|
11
|
+
:sliderSize="{
|
|
12
|
+
width: 84,
|
|
13
|
+
}"
|
|
14
|
+
>
|
|
15
|
+
<template #FixedBox="{ boxWidth, boxHeight }">
|
|
16
|
+
<div
|
|
17
|
+
:style="{
|
|
18
|
+
width: boxWidth,
|
|
19
|
+
height: boxHeight,
|
|
20
|
+
lineHeight: boxHeight,
|
|
21
|
+
backgroundColor: 'rgba(255,255,255,0.3)',
|
|
22
|
+
borderRadius: Math.floor(boxHeight / 2),
|
|
23
|
+
fontSize: Math.floor(boxHeight * 0.5),
|
|
24
|
+
textAlign: 'center',
|
|
25
|
+
color: 'rgba(0,0,0,1)',
|
|
26
|
+
}"
|
|
27
|
+
>
|
|
28
|
+
{{ `进度:${rPercentDisp}` }}
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
<template #SliderBox="{ boxWidth, boxHeight }">
|
|
32
|
+
<div
|
|
33
|
+
:style="{
|
|
34
|
+
top: -15,
|
|
35
|
+
left: -15,
|
|
36
|
+
width: boxWidth + 30,
|
|
37
|
+
height: boxHeight + 30,
|
|
38
|
+
backgroundColor: 'rgba(255, 0,0,0.8)',
|
|
39
|
+
borderRadius: Math.floor((boxHeight + 30) / 2),
|
|
40
|
+
}"
|
|
41
|
+
@click="fncOnClick"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
</JsvScrollBox>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script setup>
|
|
49
|
+
import { shallowRef, onMounted } from "vue";
|
|
50
|
+
import { JsvScrollBox, HORIZONTAL } from "jsview";
|
|
51
|
+
|
|
52
|
+
let rProps = defineProps({
|
|
53
|
+
top: {
|
|
54
|
+
Type: Number,
|
|
55
|
+
default: 0,
|
|
56
|
+
},
|
|
57
|
+
left: {
|
|
58
|
+
Type: Number,
|
|
59
|
+
default: 0,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
//进度百分比
|
|
64
|
+
let myProgress = shallowRef(20);
|
|
65
|
+
|
|
66
|
+
let fncOnClick = () => {
|
|
67
|
+
console.log("OnClicked");
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
let rJsvScrollBox = shallowRef(null);
|
|
71
|
+
let rPercentDisp = shallowRef(0);
|
|
72
|
+
|
|
73
|
+
onMounted(() => {
|
|
74
|
+
rJsvScrollBox.value.setSensor((percent, x, y) => {
|
|
75
|
+
rPercentDisp.value = Math.floor(percent * 100) / 100;
|
|
76
|
+
console.log(
|
|
77
|
+
`onProgress dragged percent=${percent} \
|
|
78
|
+
x=${Math.floor(x)} \
|
|
79
|
+
y=${Math.floor(y)}`
|
|
80
|
+
);
|
|
81
|
+
}, 15);
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style scoped>
|
|
86
|
+
.bgSty {
|
|
87
|
+
background-color: #5490d1;
|
|
88
|
+
width: 1280;
|
|
89
|
+
height: 720;
|
|
90
|
+
}
|
|
91
|
+
.logo-bg {
|
|
92
|
+
width: 800;
|
|
93
|
+
height: 400;
|
|
94
|
+
}
|
|
95
|
+
.text {
|
|
96
|
+
width: 800;
|
|
97
|
+
height: 200;
|
|
98
|
+
font-size: 24;
|
|
99
|
+
font-weight: bold;
|
|
100
|
+
line-height: 32;
|
|
101
|
+
color: #ffffff;
|
|
102
|
+
text-align: center;
|
|
103
|
+
}
|
|
104
|
+
.bg1 {
|
|
105
|
+
left: 0;
|
|
106
|
+
top: 0;
|
|
107
|
+
height: 400;
|
|
108
|
+
width: 267;
|
|
109
|
+
background-color: #007f00;
|
|
110
|
+
}
|
|
111
|
+
.bg2 {
|
|
112
|
+
left: 267;
|
|
113
|
+
top: 0;
|
|
114
|
+
height: 400;
|
|
115
|
+
width: 267;
|
|
116
|
+
background-color: #3049b8;
|
|
117
|
+
}
|
|
118
|
+
.bg3 {
|
|
119
|
+
left: 534;
|
|
120
|
+
top: 0;
|
|
121
|
+
height: 400;
|
|
122
|
+
width: 266;
|
|
123
|
+
background-color: #d12b8c;
|
|
124
|
+
}
|
|
125
|
+
</style>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 进度条 -->
|
|
3
|
+
<div :style="{ top: rProps.top, left: rProps.left }">
|
|
4
|
+
<div ref="rPressDetectDiv" :style="{ width: 800, height: 84 }">
|
|
5
|
+
<JsvScrollBox
|
|
6
|
+
ref="rJsvScrollBox"
|
|
7
|
+
:linkName="cLinkName"
|
|
8
|
+
:style="{
|
|
9
|
+
width: 800,
|
|
10
|
+
height: 84,
|
|
11
|
+
}"
|
|
12
|
+
:direction="HORIZONTAL"
|
|
13
|
+
:sliderSize="{
|
|
14
|
+
width: 84,
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<!-- 用位置固定的区域来进行进度条展示(FixedBox) -->
|
|
18
|
+
<template #FixedBox="{ boxWidth, boxHeight }">
|
|
19
|
+
<!-- 进度条背景色 -->
|
|
20
|
+
<div
|
|
21
|
+
:style="{
|
|
22
|
+
width: boxWidth,
|
|
23
|
+
height: boxHeight,
|
|
24
|
+
backgroundColor: 'rgba(255,255,255,0.3)',
|
|
25
|
+
borderRadius: Math.floor(boxHeight / 2),
|
|
26
|
+
}"
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<!-- 正向进度的颜色(对圆角div进行剪切) -->
|
|
30
|
+
<JsvScrollFollow
|
|
31
|
+
:proxyType="ScrollBoxStyle.SizeDiv"
|
|
32
|
+
:proxyProps="{
|
|
33
|
+
style: {
|
|
34
|
+
backgroundColor: 'rgba(255,255,255,0.7)',
|
|
35
|
+
borderRadius: Math.floor(boxHeight / 2),
|
|
36
|
+
},
|
|
37
|
+
}"
|
|
38
|
+
:syncWith="cLinkName"
|
|
39
|
+
:varWidth="{
|
|
40
|
+
start: boxHeight /* 最小尺寸为一个小圆形 */,
|
|
41
|
+
end: boxWidth,
|
|
42
|
+
}"
|
|
43
|
+
:varHeight="boxHeight"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<!-- 进度文字 -->
|
|
47
|
+
<div
|
|
48
|
+
:style="{
|
|
49
|
+
width: boxWidth,
|
|
50
|
+
height: boxHeight,
|
|
51
|
+
lineHeight: boxHeight,
|
|
52
|
+
fontSize: Math.floor(boxHeight * 0.5),
|
|
53
|
+
textAlign: 'center',
|
|
54
|
+
color: 'rgba(0,0,0,1)',
|
|
55
|
+
}"
|
|
56
|
+
>
|
|
57
|
+
{{ `进度:${rPercentDisp}` }}
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<!-- 进度游标球(SliderBox) -->
|
|
62
|
+
<template #SliderBox="{ boxWidth, boxHeight }">
|
|
63
|
+
<div
|
|
64
|
+
:style="{
|
|
65
|
+
top: -15,
|
|
66
|
+
left: -15,
|
|
67
|
+
width: boxWidth + 30,
|
|
68
|
+
height: boxHeight + 30,
|
|
69
|
+
backgroundColor: 'rgba(255, 0,0,0.5)',
|
|
70
|
+
borderRadius: Math.floor((boxHeight + 30) / 2),
|
|
71
|
+
}"
|
|
72
|
+
@click="fncOnClick"
|
|
73
|
+
/>
|
|
74
|
+
</template>
|
|
75
|
+
</JsvScrollBox>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<script setup>
|
|
81
|
+
import { shallowRef, onMounted } from "vue";
|
|
82
|
+
import {
|
|
83
|
+
JsvScrollBox,
|
|
84
|
+
JsvScrollFollow,
|
|
85
|
+
ScrollBoxStyle,
|
|
86
|
+
HORIZONTAL,
|
|
87
|
+
} from "jsview";
|
|
88
|
+
import { numberCheckSet } from "../../jsview-vue/utils";
|
|
89
|
+
|
|
90
|
+
let rProps = defineProps({
|
|
91
|
+
top: {
|
|
92
|
+
Type: Number,
|
|
93
|
+
default: 0,
|
|
94
|
+
},
|
|
95
|
+
left: {
|
|
96
|
+
Type: Number,
|
|
97
|
+
default: 0,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const cLinkName = "ScrollBoxTest_SizeDivSlider";
|
|
102
|
+
|
|
103
|
+
//进度百分比
|
|
104
|
+
let myProgress = shallowRef(20);
|
|
105
|
+
|
|
106
|
+
let fncOnClick = () => {
|
|
107
|
+
console.log("SizeDiv slider OnClicked");
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
let rJsvScrollBox = shallowRef(null);
|
|
111
|
+
let rPressDetectDiv = shallowRef(null);
|
|
112
|
+
let rPercentDisp = shallowRef(0);
|
|
113
|
+
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
rJsvScrollBox.value.setSensor((percent, x, y) => {
|
|
116
|
+
rPercentDisp.value = Math.floor(percent * 100) / 100;
|
|
117
|
+
console.log(
|
|
118
|
+
`onProgress dragged percent=${percent} \
|
|
119
|
+
x=${Math.floor(x)} \
|
|
120
|
+
y=${Math.floor(y)}`
|
|
121
|
+
);
|
|
122
|
+
}, 15);
|
|
123
|
+
|
|
124
|
+
// 通过代码设计进度条位置, 同理按键操作下来的进度条调整也可以这么处理
|
|
125
|
+
rJsvScrollBox.value.updatePercent(0.2);
|
|
126
|
+
|
|
127
|
+
// 注册按下抬起的监听
|
|
128
|
+
rPressDetectDiv.value.jsvSetTapListener({
|
|
129
|
+
onTouchEnd: () => {
|
|
130
|
+
rPercentDisp.value =
|
|
131
|
+
Math.floor(rJsvScrollBox.value.currentPercent() * 100) / 100;
|
|
132
|
+
console.log("+SizeDiv release percent=" + rPercentDisp.value);
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<style scoped></style>
|