@shijiu/jsview-vue-samples 2.2.128 → 2.2.373
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/App.vue +6 -1
- package/Basic/components/anim/AnimEasingCubicBezier.vue +56 -0
- package/Basic/components/anim/AnimGroup2.vue +33 -0
- package/Basic/components/panel/Panel2.vue +8 -3
- package/CoupletsTest/widget/Banger/Maroon.vue +4 -7
- package/CoupletsTest/widget/Fireworks/Fireworks.vue +52 -44
- package/CustomShader/App.vue +174 -0
- package/CustomShader/gaussianBlur.glsl +27 -0
- package/CustomShader/pageFlip.glsl +41 -0
- package/CustomShader/sdf.glsl +22 -0
- package/CustomShader/test.glsl +8 -0
- package/CustomShader/vortex.glsl +38 -0
- package/DemoHomepage/App.vue +50 -32
- package/DemoHomepage/components/Item.vue +23 -12
- package/DemoHomepage/index.d.ts +5 -2
- package/DemoHomepage/router.js +105 -72
- package/DispersedFocusControl/App.vue +67 -0
- package/DispersedFocusControl/Button.vue +76 -0
- package/DispersedFocusControl/data.js +44 -0
- package/DragBox/App.vue +148 -0
- package/DriftScopeTest/App.vue +128 -0
- package/FlexCellDemo/App.vue +47 -223
- package/FlexCellDemo/TestFrame1.vue +88 -0
- package/FlexCellDemo/TestFrame2.vue +100 -0
- package/FlexCellDemo/TestFrame3.vue +97 -0
- package/FlexCellDemo/TestFrame4.vue +60 -0
- package/FlexCellDemo/TestFrame5.vue +60 -0
- package/FlexCellDemo/images/6.jpg +0 -0
- package/FocusMoveStyle/App.vue +1 -0
- package/FocusMoveStyle/CreepFocus.vue +11 -1
- package/FocusMoveStyle/FoldableItem.vue +1 -1
- package/FreeMove/App.vue +62 -64
- package/FreeMoveLink/App.vue +2 -2
- package/FullScreenFlex/App.vue +42 -0
- package/FullScreenFlex/TestFrame2.vue +107 -0
- package/FullScreenFlex/images/1.png +0 -0
- package/HashHistory/App.vue +8 -4
- package/ImpactStop/App.vue +45 -45
- package/Input/App.vue +184 -97
- package/Input/InputPanel.vue +98 -82
- package/LatexFormula/App.vue +97 -10
- 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/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +1 -1
- package/MetroWidgetDemos/routeList.js +17 -17
- package/MindMap/App.vue +10 -1
- package/MindMap/data.js +34 -8
- package/Parkour/appConfig/jsview.config.mjs +0 -4
- package/PosterPacker/App.vue +207 -0
- package/PosterPacker/images/bg.jpg +0 -0
- package/PosterPacker/images/blue.png +0 -0
- package/PosterPacker/images/darkGreen.png +0 -0
- package/PosterPacker/images/left.png +0 -0
- package/PosterPacker/images/orange.png +0 -0
- package/PosterPacker/images/pink.png +0 -0
- package/PosterPacker/images/purple.png +0 -0
- package/PosterPacker/images/red.png +0 -0
- package/PosterPacker/images/right.png +0 -0
- package/PosterPacker/images/yellowGreen.png +0 -0
- package/PosterPacker/tools/geniePakcer/Genie.vue +686 -0
- package/PosterPacker/tools/geniePakcer/genieBottom.glsl +49 -0
- package/PosterPacker/tools/geniePakcer/genieLeft.glsl +50 -0
- package/PosterPacker/tools/geniePakcer/genieRight.glsl +57 -0
- package/PosterPacker/tools/geniePakcer/genieTop.glsl +50 -0
- package/PosterPacker/tools/particlePacker/Particle.vue +71 -0
- package/PosterPacker/tools/vortexPacker/Vortex.vue +135 -0
- package/PosterPacker/tools/vortexPacker/vortex.glsl +37 -0
- package/Preload/App.vue +1 -1
- package/SceneTransition/JsvSceneTransition.vue +30 -42
- package/ScrollBoxTest/App.vue +35 -86
- package/ScrollBoxTest/ClipBar.vue +154 -0
- package/ScrollBoxTest/DrawCircle.ts +25 -0
- package/ScrollBoxTest/NinePatchBar.vue +188 -0
- package/ScrollBoxTest/NoBackgroundBar.vue +125 -0
- package/ScrollBoxTest/SizeDivBar.vue +139 -0
- package/SprayMove/App.vue +75 -0
- package/SprayMove/SprayMove.vue +173 -0
- package/SprayView/App.vue +8 -9
- package/TestNativeSharedView/App.vue +6 -4
- package/TextShadowDemo/App.vue +3 -3
- package/TextureAnimation/App.vue +244 -148
- package/TextureAnimation/App2.vue +66 -14
- package/TextureAnimation/assets/blackWhiteTurntable.png +0 -0
- package/TextureAnimation/assets/circleHaloMask.png +0 -0
- package/TombSweepingDayTest/Raining/Rain.vue +8 -8
- package/TouchWidget/App.vue +79 -40
- package/TouchWidget/Item.vue +15 -3
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/MetroWidgetDemos/RefreshDemo/data.js +0 -16
- package/TextureAnimation/assets/mask.png +0 -0
- package/TextureAnimation/assets/php.jpg +0 -0
- package/TouchSample/App.vue +0 -136
- package/TouchSample/Item.vue +0 -102
- package/TouchSample/MetroWidgetHorizontal.vue +0 -144
- package/TouchSample/MetroWidgetVertical.vue +0 -144
- package/TouchSample/TouchContainerHorizontal.vue +0 -160
- package/TouchSample/TouchContainerVertical.vue +0 -160
- package/TouchSample/data.js +0 -81
- /package/TextureAnimation/assets/{php2.png → borderOpacity.png} +0 -0
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
|
}
|
|
@@ -0,0 +1,154 @@
|
|
|
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
|
+
onTouchStart: () => {console.log(" touch start")},
|
|
145
|
+
onTouchEnd: () => {
|
|
146
|
+
rPercentDisp.value =
|
|
147
|
+
Math.floor(rJsvScrollBox.value.currentPercent() * 100) / 100;
|
|
148
|
+
console.log("ClipBar release percent=" + rPercentDisp.value);
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<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,188 @@
|
|
|
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
|
+
onTouchStart: () => {console.log(" touch start")},
|
|
165
|
+
onTouchEnd: () => {
|
|
166
|
+
rPercentDisp.value =
|
|
167
|
+
Math.floor(rJsvScrollBox.value.currentPercent() * 100) / 100;
|
|
168
|
+
console.log("+NinePatchBar release percent=" + rPercentDisp.value);
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
rJsvScrollFlowA.value.setSensor((percent, x, y) => {
|
|
173
|
+
console.log(
|
|
174
|
+
`follow onProgress dragged percent=${percent} \
|
|
175
|
+
x=${Math.floor(x)} \
|
|
176
|
+
y=${Math.floor(y)}`
|
|
177
|
+
);
|
|
178
|
+
}, 15);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
onUnmounted(() => {
|
|
182
|
+
// 销毁记录在全局的texture
|
|
183
|
+
cLeftBarTexture?.doRecycle();
|
|
184
|
+
cRightBarTexture?.doRecycle();
|
|
185
|
+
});
|
|
186
|
+
</script>
|
|
187
|
+
|
|
188
|
+
<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>
|