@shijiu/jsview-vue-samples 1.9.747
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/AnimPicture/App.vue +207 -0
- package/AnimPicture/assets/animated_webp.webp +0 -0
- package/AnimPicture/assets/ball_3.webp +0 -0
- package/AnimPicture/assets/girl_run.gif +0 -0
- package/AnimPicture/assets/quan.webp +0 -0
- package/Basic/App.vue +134 -0
- package/Basic/assets/border.png +0 -0
- package/Basic/assets/border2.png +0 -0
- package/Basic/assets/icon.png +0 -0
- package/Basic/assets/test.jpg +0 -0
- package/Basic/components/ContentBlock.vue +38 -0
- package/Basic/components/FontStyle.css +16 -0
- package/Basic/components/anim/AnimGroup.vue +66 -0
- package/Basic/components/anim/AnimKeyframeBasic.vue +119 -0
- package/Basic/components/anim/AnimKeyframeComposite.vue +52 -0
- package/Basic/components/anim/AnimTransition.vue +157 -0
- package/Basic/components/div/DivBackground.vue +44 -0
- package/Basic/components/div/DivClip.vue +159 -0
- package/Basic/components/div/DivCssScoped.vue +20 -0
- package/Basic/components/div/DivCssVar.vue +53 -0
- package/Basic/components/div/DivGroup1.vue +47 -0
- package/Basic/components/div/DivGroup2.vue +65 -0
- package/Basic/components/div/DivLayout.vue +70 -0
- package/Basic/components/div/DivRadius.vue +65 -0
- package/Basic/components/div/DivTransform.vue +32 -0
- package/Basic/components/img/ImageGroup.vue +31 -0
- package/Basic/components/img/ImgLayout.vue +41 -0
- package/Basic/components/panel/Panel1.vue +55 -0
- package/Basic/components/panel/Panel2.vue +31 -0
- package/Basic/components/panel/TitleBar.vue +29 -0
- package/Basic/components/text/TextAlign.vue +66 -0
- package/Basic/components/text/TextEmoji.vue +26 -0
- package/Basic/components/text/TextFontStyle.vue +89 -0
- package/Basic/components/text/TextGroup1.vue +49 -0
- package/Basic/components/text/TextGroup2.vue +28 -0
- package/Basic/components/text/TextOverflow.vue +110 -0
- package/BasicFocusControl/App.vue +104 -0
- package/BasicFocusControl/components/BaseBlock.vue +50 -0
- package/BasicFocusControl/components/MainArea.vue +83 -0
- package/BasicFocusControl/components/MainAreaLeftBlock.vue +17 -0
- package/BasicFocusControl/components/MainAreaRightBlock.vue +27 -0
- package/BasicFocusControl/components/SideBar.vue +58 -0
- package/BasicFocusControl/components/SideBarBlock.vue +27 -0
- package/Collision/App.vue +452 -0
- package/ColorSpace/App.vue +126 -0
- package/ColorSpace/bmpDemo.bmp +0 -0
- package/ColorSpace/jpegDemo.jpeg +0 -0
- package/ColorSpace/pngDemo.png +0 -0
- package/ColorSpace/pngNoAlphaDemo.png +0 -0
- package/DemoHomepage/App.vue +27 -0
- package/DemoHomepage/components/BodyFrame.vue +95 -0
- package/DemoHomepage/components/Dialog.vue +94 -0
- package/DemoHomepage/components/Item.vue +77 -0
- package/DemoHomepage/components/TabFrame.vue +85 -0
- package/DemoHomepage/router.js +196 -0
- package/DemoHomepage/views/Homepage.vue +195 -0
- package/FilterDemo/AnimatePic.vue +58 -0
- package/FilterDemo/App.vue +159 -0
- package/FilterDemo/VideoLayer.vue +62 -0
- package/FilterDemo/jpegDemo.jpeg +0 -0
- package/FilterDemo/webpDemo.webp +0 -0
- package/FlipCard/App.vue +71 -0
- package/FlipCard/FlipCard.vue +118 -0
- package/FlipCard/assets/blue_egg.png +0 -0
- package/FlipCard/assets/red_egg.png +0 -0
- package/FlipCard/data.js +13 -0
- package/GridDemo/App.vue +215 -0
- package/GridDemo/ButtonBlock.vue +112 -0
- package/GridDemo/FocusItem.vue +37 -0
- package/GridDemo/Item.vue +93 -0
- package/HashHistory/App.vue +115 -0
- package/HashHistory/components/HorizontalButtonList.vue +91 -0
- package/HashHistory/components/Item.vue +60 -0
- package/HashHistory/router.js +41 -0
- package/HashHistory/views/MainPage.vue +57 -0
- package/HashHistory/views/SubPage.vue +66 -0
- package/ImpactStop/App.vue +435 -0
- package/Input/App.vue +164 -0
- package/Input/FullKeyboard.vue +87 -0
- package/Input/InputPanel.vue +131 -0
- package/Input/KeyboardItem.vue +58 -0
- package/LongImage/App.vue +80 -0
- package/LongImage/Button.vue +58 -0
- package/LongImage/ButtonItem.vue +44 -0
- package/LongImage/LongImageScroll.vue +92 -0
- package/LongImage/Scroll.vue +14 -0
- package/LongImage/assets/1280x7200.jpg +0 -0
- package/LongText/App.vue +96 -0
- package/LongText/Button.vue +51 -0
- package/LongText/ButtonItem.vue +44 -0
- package/LongText/LongTextScroll.vue +192 -0
- package/LongText/Scroll.vue +14 -0
- package/Marquee/App.vue +247 -0
- package/Marquee/longText.js +14 -0
- package/MaskClip/App.vue +122 -0
- package/MaskClip/images/mask-025/config.json +29 -0
- package/MaskClip/images/mask-025/res/1.png +0 -0
- package/MaskClip/images/mask-025/res/2.png +0 -0
- package/MaskClip/images/mask-025/res/3.png +0 -0
- package/MaskClip/images/mask-025/res/4.png +0 -0
- package/MaskClip/images/mask-025/res/icon.png +0 -0
- package/MaskClip/images/mask-025/res/stroke.png +0 -0
- package/MaskClip/images/php.jpg +0 -0
- package/MetroWidgetDemos/Advanced/App.vue +46 -0
- package/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
- package/MetroWidgetDemos/Advanced/Buttons.vue +70 -0
- package/MetroWidgetDemos/Advanced/Mixed.vue +77 -0
- package/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
- package/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
- package/MetroWidgetDemos/Advanced/widgets/Widgets.vue +116 -0
- package/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/MetroWidgetDemos/Item.vue +85 -0
- package/MetroWidgetDemos/PerformanceTest/App.vue +210 -0
- package/MetroWidgetDemos/PerformanceTest/Item.vue +90 -0
- package/MetroWidgetDemos/PerformanceTest/assets/bg.jpg +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_content.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_left.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_mid.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_right.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/focus_border.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/holder_logo.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/jrbm.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_left.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_mid.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_right.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/loading.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/logo.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/mcjx.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/tao.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/tmall.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/border.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +386 -0
- package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +129 -0
- package/MetroWidgetDemos/PerformanceTest/data.js +45 -0
- package/MetroWidgetDemos/PingPong/App.vue +135 -0
- package/MetroWidgetDemos/PingPong/AppPage.vue +73 -0
- package/MetroWidgetDemos/PingPong/AppTab.vue +62 -0
- package/MetroWidgetDemos/PingPong/TabItem.vue +84 -0
- package/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
- package/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +75 -0
- package/MetroWidgetDemos/Simple/App.vue +45 -0
- package/MetroWidgetDemos/Simple/RelativeTemplate.vue +111 -0
- package/MetroWidgetDemos/WidgetItem.vue +89 -0
- package/MetroWidgetDemos/data.js +205 -0
- package/NinePatchDemo/App.vue +145 -0
- package/NinePatchDemo/Item.vue +69 -0
- package/NinePatchDemo/assets/border.png +0 -0
- package/Preload/App.vue +135 -0
- package/Preload/Item.vue +32 -0
- package/Preload/data.js +23 -0
- package/Preload/images/awesomeface.png +0 -0
- package/Preload/images/cat.jpg +0 -0
- package/Preload/images/rank.png +0 -0
- package/Preload/images/rank_focus.png +0 -0
- package/Preload/images/rule.png +0 -0
- package/Preload/images/rule_focus.png +0 -0
- package/Preload/images/start.png +0 -0
- package/Preload/images/start_focus.png +0 -0
- package/QrcodeDemo/App.vue +68 -0
- package/ScaleDownNeon/App.vue +107 -0
- package/SoundPool/App.vue +134 -0
- package/SoundPool/bgmusic.mp3 +0 -0
- package/SoundPool/coin.mp3 +0 -0
- package/SoundPool/jump.mp3 +0 -0
- package/SoundPool/lose.mp3 +0 -0
- package/SoundPool/run.mp3 +0 -0
- package/SprayView/App.vue +272 -0
- package/SprayView/assets/snow.png +0 -0
- package/SpriteImage/App.vue +173 -0
- package/SpriteImage/images/cat_run.png +0 -0
- package/SpriteImage/images/egg_break.json +116 -0
- package/SpriteImage/images/egg_break.png +0 -0
- package/SpriteImage/images/sprite.png +0 -0
- package/TextBox/App.vue +91 -0
- package/TextBox/RenderCenter.vue +133 -0
- package/TextBox/RenderLeft.vue +138 -0
- package/TextBox/RenderOneLine.vue +101 -0
- package/TextBox/RenderRight.vue +131 -0
- package/TextShadowDemo/App.vue +91 -0
- package/TextureAnimation/App.vue +336 -0
- package/TextureAnimation/App2.vue +111 -0
- package/TextureAnimation/assets/blackWhiteGrid.png +0 -0
- package/TextureAnimation/assets/light.png +0 -0
- package/TextureAnimation/assets/light2.png +0 -0
- package/TextureAnimation/assets/mask.png +0 -0
- package/TextureAnimation/assets/php.jpg +0 -0
- package/TextureAnimation/assets/php2.png +0 -0
- package/TextureAnimation/assets/swipLight.png +0 -0
- package/TextureSize/App.vue +132 -0
- package/TextureSize/bmpDemo.bmp +0 -0
- package/TextureSize/jpegDemo.jpeg +0 -0
- package/TextureSize/jpgDemo.jpg +0 -0
- package/TextureSize/pngDemo.png +0 -0
- package/TextureSize/pngNoAlphaDemo.png +0 -0
- package/ThrowMoveDemo/AccelerateDemo.vue +116 -0
- package/ThrowMoveDemo/App.vue +114 -0
- package/ThrowMoveDemo/LRParabolicDemo.vue +115 -0
- package/ThrowMoveDemo/TargetDemo.vue +116 -0
- package/ThrowMoveDemo/UDParabolicDemo.vue +121 -0
- package/TouchSample/App.vue +136 -0
- package/TouchSample/Item.vue +103 -0
- package/TouchSample/MetroWidgetHorizontal.vue +144 -0
- package/TouchSample/MetroWidgetVertical.vue +144 -0
- package/TouchSample/TouchContainerHorizontal.vue +160 -0
- package/TouchSample/TouchContainerVertical.vue +160 -0
- package/TouchSample/data.js +81 -0
- package/TransitPage/App.vue +29 -0
- package/VideoDemo/App.vue +121 -0
- package/VideoDemo/components/Button.vue +58 -0
- package/VideoDemo/components/Controllor.vue +197 -0
- package/VideoDemo/components/VideoFrame.vue +140 -0
- package/VisibleSensorDemo/App.vue +234 -0
- package/package.json +17 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, shallowRef } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
style: Object,
|
|
5
|
+
autoFocus: Boolean,
|
|
6
|
+
name: String,
|
|
7
|
+
onClick: Function,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const hasFocused = ref(false);
|
|
11
|
+
|
|
12
|
+
const onFocus = () => {
|
|
13
|
+
hasFocused.value = true;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const onBlur = () => {
|
|
17
|
+
hasFocused.value = false;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const onKeyDown = (ev) => {
|
|
21
|
+
if (ev.keyCode === 13) {
|
|
22
|
+
// Enter
|
|
23
|
+
props.onClick?.();
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<jsv-focus-block
|
|
32
|
+
:name="name"
|
|
33
|
+
:autoFocus="autoFocus ? '' : undefined"
|
|
34
|
+
:onAction="{
|
|
35
|
+
onFocus: onFocus,
|
|
36
|
+
onBlur: onBlur,
|
|
37
|
+
onKeyDown: onKeyDown,
|
|
38
|
+
}"
|
|
39
|
+
>
|
|
40
|
+
<div
|
|
41
|
+
class="item"
|
|
42
|
+
:style="{
|
|
43
|
+
...style,
|
|
44
|
+
backgroundColor: hasFocused ? '#FFFF00' : '#A8A8A8',
|
|
45
|
+
}"
|
|
46
|
+
>
|
|
47
|
+
<slot></slot>
|
|
48
|
+
</div>
|
|
49
|
+
</jsv-focus-block>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
.item {
|
|
54
|
+
text-align: center;
|
|
55
|
+
font-size: 24;
|
|
56
|
+
line-height: 40;
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { inject } from "vue";
|
|
3
|
+
import { useRouter } from "vue-router";
|
|
4
|
+
import Button from "./Button.vue";
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
style: {
|
|
8
|
+
type: Object,
|
|
9
|
+
default() {
|
|
10
|
+
return { width: 1400, height: 50 };
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
const router = useRouter();
|
|
15
|
+
|
|
16
|
+
const useTexture = inject("useTexture");
|
|
17
|
+
const objectFit = inject("objectFit");
|
|
18
|
+
const videoRect = inject("videoRect");
|
|
19
|
+
const playVideo = inject("playVideo");
|
|
20
|
+
const seekVideo = inject("seekVideo");
|
|
21
|
+
const enableAnimation = inject("enableAnimation");
|
|
22
|
+
const videoTime = inject("videoTime");
|
|
23
|
+
const objectFitTitle = inject("objectFitTitle");
|
|
24
|
+
let objectFitIndex = 0;
|
|
25
|
+
let focusedItemIndex = 0;
|
|
26
|
+
|
|
27
|
+
const setObjectFit = (index) => {
|
|
28
|
+
if (typeof index === "number") {
|
|
29
|
+
objectFitIndex = index;
|
|
30
|
+
} else {
|
|
31
|
+
objectFitIndex = ++objectFitIndex % objectFitData.length;
|
|
32
|
+
}
|
|
33
|
+
const data = objectFitData[objectFitIndex];
|
|
34
|
+
objectFit.value = data.objectFit;
|
|
35
|
+
objectFitTitle.value = data.name;
|
|
36
|
+
videoRect.value = {
|
|
37
|
+
left: (1280 - data.width) / 2,
|
|
38
|
+
top: 50,
|
|
39
|
+
width: data.width,
|
|
40
|
+
height: 500,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const buttonList = [
|
|
45
|
+
{
|
|
46
|
+
name: "ToVideoMode",
|
|
47
|
+
onClick: () => {
|
|
48
|
+
playVideo.value = null; // 停止并初始化播放
|
|
49
|
+
enableAnimation.value = false;
|
|
50
|
+
videoTime.currentTime = 0;
|
|
51
|
+
videoTime.duration = 0;
|
|
52
|
+
useTexture.value = !useTexture.value;
|
|
53
|
+
},
|
|
54
|
+
isModeButton: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "Play",
|
|
58
|
+
onClick: () => {
|
|
59
|
+
playVideo.value = !playVideo.value;
|
|
60
|
+
},
|
|
61
|
+
isPlayButton: true,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "Forward",
|
|
65
|
+
onClick: () => {
|
|
66
|
+
seekVideo.value = seekVideo.value !== 5 ? 5 : 5.1 /* 为了触发ref更新 */;
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "Rewind",
|
|
71
|
+
onClick: () => {
|
|
72
|
+
seekVideo.value =
|
|
73
|
+
seekVideo.value !== -5 ? -5 : -5.1 /* 为了触发ref更新 */;
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "ObjectFit",
|
|
78
|
+
onClick: setObjectFit,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "StartAnimation",
|
|
82
|
+
onClick: () => {
|
|
83
|
+
enableAnimation.value = !enableAnimation.value;
|
|
84
|
+
},
|
|
85
|
+
isAnimationButton: true,
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
const objectFitData = [
|
|
89
|
+
{ name: "contain-horizontal", objectFit: "contain", width: 1200 },
|
|
90
|
+
{ name: "contain-vertical", objectFit: "contain", width: 400 },
|
|
91
|
+
{ name: "fill", objectFit: "fill", width: 1200 },
|
|
92
|
+
{ name: "none-horizontal", objectFit: "none", width: 1200 },
|
|
93
|
+
{ name: "none-vertical", objectFit: "none", width: 400 },
|
|
94
|
+
{ name: "cover-horizontal", objectFit: "cover", width: 1200 },
|
|
95
|
+
{ name: "cover-vertical", objectFit: "cover", width: 400 },
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
const getButtonData = () => {
|
|
99
|
+
let length = buttonList.length;
|
|
100
|
+
if (!useTexture.value) {
|
|
101
|
+
// 只有texture方式可以做animation
|
|
102
|
+
length -= 1;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let data = [];
|
|
106
|
+
for (let idx = 0; idx < length; idx++) {
|
|
107
|
+
const button = buttonList[idx];
|
|
108
|
+
data.push({
|
|
109
|
+
...button,
|
|
110
|
+
size: {
|
|
111
|
+
width: 180,
|
|
112
|
+
height: 40,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return data;
|
|
117
|
+
};
|
|
118
|
+
const getButtonDataLength = () => {
|
|
119
|
+
let length = buttonList.length;
|
|
120
|
+
if (!useTexture.value) {
|
|
121
|
+
// 只有texture方式可以做animation
|
|
122
|
+
length -= 1;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return length;
|
|
126
|
+
};
|
|
127
|
+
const onKeyDown = (ev) => {
|
|
128
|
+
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
129
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
130
|
+
router?.go(-1); // 有router时,回退
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
let changeFocusTo = -1;
|
|
135
|
+
const buttonCount = getButtonDataLength();
|
|
136
|
+
switch (ev.keyCode) {
|
|
137
|
+
case 37: // Left
|
|
138
|
+
changeFocusTo = (focusedItemIndex - 1 + buttonCount) % buttonCount;
|
|
139
|
+
break;
|
|
140
|
+
case 39: // Right
|
|
141
|
+
changeFocusTo = (focusedItemIndex + 1) % buttonCount;
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
if (changeFocusTo >= 0) {
|
|
147
|
+
ev.ownerNode
|
|
148
|
+
.findBlockByName("controllor.video-" + (changeFocusTo + 10).toString())
|
|
149
|
+
.requestFocus();
|
|
150
|
+
focusedItemIndex = changeFocusTo;
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return false;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const getShowName = (item) => {
|
|
158
|
+
if (item.isModeButton) {
|
|
159
|
+
return useTexture.value ? "ToVideoMode" : "ToOffscreenMode";
|
|
160
|
+
} else if (item.isPlayButton) {
|
|
161
|
+
return playVideo.value ? "Pause" : "Play";
|
|
162
|
+
} else if (item.isAnimationButton) {
|
|
163
|
+
return enableAnimation.value ? "StopAnimation" : "StartAnimation";
|
|
164
|
+
}
|
|
165
|
+
return item.name;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
useTexture.value = false;
|
|
169
|
+
setObjectFit(0);
|
|
170
|
+
playVideo.value = !window.jsvIsBrowserDebug; // jsview自动播放该视频 TODO h5需做相应调整;
|
|
171
|
+
enableAnimation.value = false;
|
|
172
|
+
</script>
|
|
173
|
+
|
|
174
|
+
<template>
|
|
175
|
+
<div :style="style" :key="useTexture" :set="(leftOffset = 0)">
|
|
176
|
+
<jsv-focus-block namespace="controllor" :onKeyDown="onKeyDown">
|
|
177
|
+
<Button
|
|
178
|
+
v-for="(item, index) in getButtonData()"
|
|
179
|
+
:key="index"
|
|
180
|
+
:set="(leftOffset += item.size.width + 10)"
|
|
181
|
+
:style="{
|
|
182
|
+
left: leftOffset - item.size.width,
|
|
183
|
+
width: item.size.width,
|
|
184
|
+
height: item.size.height,
|
|
185
|
+
}"
|
|
186
|
+
:autoFocus="index === 0"
|
|
187
|
+
:name="'video-' + (index + 10).toString()"
|
|
188
|
+
:onClick="item.onClick"
|
|
189
|
+
>
|
|
190
|
+
{{ getShowName(item) }}
|
|
191
|
+
</Button>
|
|
192
|
+
</jsv-focus-block>
|
|
193
|
+
</div>
|
|
194
|
+
</template>
|
|
195
|
+
|
|
196
|
+
<style scoped>
|
|
197
|
+
</style>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { inject, watch, onMounted } from "vue";
|
|
3
|
+
import { JsvVideo } from "jsview";
|
|
4
|
+
|
|
5
|
+
const useTexture = inject("useTexture");
|
|
6
|
+
const objectFit = inject("objectFit");
|
|
7
|
+
const videoRect = inject("videoRect");
|
|
8
|
+
const playVideo = inject("playVideo");
|
|
9
|
+
const seekVideo = inject("seekVideo");
|
|
10
|
+
const enableAnimation = inject("enableAnimation");
|
|
11
|
+
const videoTime = inject("videoTime");
|
|
12
|
+
const playStatus = inject("playStatus");
|
|
13
|
+
const videoUrl =
|
|
14
|
+
"http://qcast-image.oss-cn-qingdao.aliyuncs.com/homepage/20190726/4cc4e6a8fd7d9d9c707ed4c4da27ca9d.mp4";
|
|
15
|
+
const canAutoPlay = !window.jsvIsBrowserDebug; // jsview自动播放该视频 TODO h5需做相应调整
|
|
16
|
+
const rect = {
|
|
17
|
+
top: 50,
|
|
18
|
+
left: 40,
|
|
19
|
+
width: 1200,
|
|
20
|
+
height: 500,
|
|
21
|
+
};
|
|
22
|
+
let video = null;
|
|
23
|
+
|
|
24
|
+
const onVideoRef = (ele) => {
|
|
25
|
+
video = ele;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const setPlayState = (play) => {
|
|
29
|
+
if (play) {
|
|
30
|
+
video?.play();
|
|
31
|
+
} else {
|
|
32
|
+
video?.pause();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const seekVideoStep = (time) => {
|
|
37
|
+
if (video) {
|
|
38
|
+
let playEnd = false;
|
|
39
|
+
let seekTime = video.currentTime + Math.ceil(time);
|
|
40
|
+
if (seekTime < 0) {
|
|
41
|
+
seekTime = 0;
|
|
42
|
+
} else if (seekTime > videoTime.duration) {
|
|
43
|
+
seekTime = videoTime.duration;
|
|
44
|
+
if (video.currentTime != videoTime.duration) {
|
|
45
|
+
// 触发一次播放,收到ended事件
|
|
46
|
+
playEnd = true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
video.currentTime = seekTime;
|
|
50
|
+
if (playEnd) {
|
|
51
|
+
this.setPlayState(true);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const onPlayStateChange = (event) => {
|
|
57
|
+
console.log("VideoFrame.onPlayStateChangeEvent()", event);
|
|
58
|
+
playVideo.value = event.type === "play" ? true : false;
|
|
59
|
+
if (!(playStatus.value == "ended" && event.type == "pause")) {
|
|
60
|
+
// 忽略播放结束后的pause事件
|
|
61
|
+
playStatus.value = event.type;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const onTimeUpdate = (event) => {
|
|
66
|
+
console.log("VideoFrame.onTimeUpdateEvent()", event);
|
|
67
|
+
videoTime.currentTime = video.currentTime;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const onDurationChange = (event) => {
|
|
71
|
+
console.log("VideoFrame.onDurationChangeEvent()", event);
|
|
72
|
+
videoTime.duration = video.duration;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const onEvent = (event) => {
|
|
76
|
+
console.log("VideoFrame.onEvent()", event);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
watch(playVideo, setPlayState);
|
|
80
|
+
watch(seekVideo, seekVideoStep);
|
|
81
|
+
|
|
82
|
+
onMounted(() => {
|
|
83
|
+
if (canAutoPlay) {
|
|
84
|
+
playVideo.value = true;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<template>
|
|
90
|
+
<div>
|
|
91
|
+
<div
|
|
92
|
+
:style="{
|
|
93
|
+
...videoRect,
|
|
94
|
+
backgroundColor: 'rgb(200,100,100)',
|
|
95
|
+
}"
|
|
96
|
+
></div>
|
|
97
|
+
<JsvVideo
|
|
98
|
+
:onRef="onVideoRef"
|
|
99
|
+
:useTexture="useTexture"
|
|
100
|
+
:src="videoUrl"
|
|
101
|
+
:autoplay="canAutoPlay ? 'autoplay' : undefined"
|
|
102
|
+
:style="{
|
|
103
|
+
...videoRect,
|
|
104
|
+
objectFit: objectFit,
|
|
105
|
+
animation:
|
|
106
|
+
useTexture && enableAnimation ? 'offscreenAnim 3s infinite' : null,
|
|
107
|
+
borderRadius: '80px 80px 160px 240px',
|
|
108
|
+
}"
|
|
109
|
+
:onCanPlay="onEvent"
|
|
110
|
+
:onCanPlayThrough="onEvent"
|
|
111
|
+
:onDurationChange="onDurationChange"
|
|
112
|
+
:onEnded="onPlayStateChange"
|
|
113
|
+
:onError="onPlayStateChange"
|
|
114
|
+
:onLoad="onEvent"
|
|
115
|
+
:onLoadedMetadata="onEvent"
|
|
116
|
+
:onLoadStart="onEvent"
|
|
117
|
+
:onPause="onPlayStateChange"
|
|
118
|
+
:onPlay="onPlayStateChange"
|
|
119
|
+
:onPlaying="onEvent"
|
|
120
|
+
:onProgress="onEvent"
|
|
121
|
+
:onSeeking="onEvent"
|
|
122
|
+
:onSeeked="onTimeUpdate"
|
|
123
|
+
:onStalled="onEvent"
|
|
124
|
+
:onTimeUpdate="onTimeUpdate"
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<style scoped>
|
|
130
|
+
@keyframes offscreenAnim {
|
|
131
|
+
from {
|
|
132
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 1, -360deg);
|
|
133
|
+
transform-origin: center center;
|
|
134
|
+
}
|
|
135
|
+
to {
|
|
136
|
+
transform: scale3d(0.4, 0.4, 0) rotate3d(0, 0, 1, 0);
|
|
137
|
+
transform-origin: center center;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { watch, reactive, onMounted, ref, shallowRef } from "vue";
|
|
3
|
+
import { useRouter } from "vue-router";
|
|
4
|
+
import { jJsvRuntimeBridge, JsvVisibleSensor } from "jsview";
|
|
5
|
+
|
|
6
|
+
const BOX_WIDTH = 150;
|
|
7
|
+
const BOX_HEIGHT = 150;
|
|
8
|
+
const BOX_COLOR = "rgba(0,255,255,0.6)";
|
|
9
|
+
const VISIBLE_RANGE = 0.25;
|
|
10
|
+
|
|
11
|
+
const router = useRouter();
|
|
12
|
+
|
|
13
|
+
const containerRef = shallowRef(null);
|
|
14
|
+
let case_config = shallowRef(null);
|
|
15
|
+
let status_text = reactive({
|
|
16
|
+
oldH: "false",
|
|
17
|
+
newH: "false",
|
|
18
|
+
oldV: "false",
|
|
19
|
+
newV: "false",
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
let test_case_type = ref(0);
|
|
23
|
+
|
|
24
|
+
window.LudlTestCase = test_case_type;
|
|
25
|
+
|
|
26
|
+
case_config.value = getTestCase(test_case_type.value);
|
|
27
|
+
|
|
28
|
+
watch(test_case_type, () => {
|
|
29
|
+
case_config.value = getTestCase(test_case_type.value);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
onMounted(() => {
|
|
33
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// const onAnimDone = () => {
|
|
37
|
+
// test_case_type.value = (test_case_type.value + 1) % 2;
|
|
38
|
+
// };
|
|
39
|
+
|
|
40
|
+
// 内部接口
|
|
41
|
+
const onBeVisible = (old_h, new_h, old_v, new_v) => {
|
|
42
|
+
status_text.oldH = old_h ? "true" : "false";
|
|
43
|
+
status_text.newH = new_h ? "true" : "false";
|
|
44
|
+
status_text.oldV = old_v ? "true" : "false";
|
|
45
|
+
status_text.newV = new_v ? "true" : "false";
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const onKeyDown = (ev) => {
|
|
49
|
+
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
50
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
51
|
+
router?.go(-1); // 有router时,回退
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (ev.keyCode == 13) {
|
|
55
|
+
test_case_type.value = (test_case_type.value + 1) % 2;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
function getTestCase(test_index) {
|
|
61
|
+
let test_config = {
|
|
62
|
+
animation: null,
|
|
63
|
+
text: null,
|
|
64
|
+
horizon: 1.0,
|
|
65
|
+
vertical: 1.0,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
switch (test_index) {
|
|
69
|
+
case 0: {
|
|
70
|
+
// 上到下
|
|
71
|
+
test_config.animation = "visibleSensor_upDown 8s infinite linear";
|
|
72
|
+
test_config.text = "从上到下";
|
|
73
|
+
test_config.horizon = 1.0;
|
|
74
|
+
test_config.vertical = VISIBLE_RANGE;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case 1: {
|
|
78
|
+
// 左到右
|
|
79
|
+
test_config.animation = "visibleSensor_leftRight 8s infinite linear";
|
|
80
|
+
test_config.text = "从左到右";
|
|
81
|
+
test_config.horizon = VISIBLE_RANGE;
|
|
82
|
+
test_config.vertical = 1.0;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return test_config;
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<template>
|
|
92
|
+
<jsv-focus-block autoFocus :onKeyDown="onKeyDown">
|
|
93
|
+
<div :style="{ width: 1280, height: 720, backgroundColor: '#00F000' }">
|
|
94
|
+
<div
|
|
95
|
+
:style="{
|
|
96
|
+
left: 10,
|
|
97
|
+
top: 10,
|
|
98
|
+
height: 120,
|
|
99
|
+
width: 900,
|
|
100
|
+
fontColor: '#000000',
|
|
101
|
+
fontSize: 15,
|
|
102
|
+
lineHeight: 20,
|
|
103
|
+
}"
|
|
104
|
+
>
|
|
105
|
+
{{
|
|
106
|
+
`按OK键切换方向
|
|
107
|
+
new horizon: ${status_text.newH}
|
|
108
|
+
new vertical: ${status_text.newV}
|
|
109
|
+
-------
|
|
110
|
+
old horizon: ${status_text.oldH}
|
|
111
|
+
old vertical: ${status_text.oldV}`
|
|
112
|
+
}}
|
|
113
|
+
</div>
|
|
114
|
+
<div
|
|
115
|
+
ref="containerRef"
|
|
116
|
+
:style="{
|
|
117
|
+
left: 240,
|
|
118
|
+
top: 180,
|
|
119
|
+
width: 300,
|
|
120
|
+
height: 300,
|
|
121
|
+
backgroundColor: '#00F0F0',
|
|
122
|
+
}"
|
|
123
|
+
>
|
|
124
|
+
<div
|
|
125
|
+
:style="{
|
|
126
|
+
left: 50,
|
|
127
|
+
top: 50,
|
|
128
|
+
width: 200,
|
|
129
|
+
height: 200,
|
|
130
|
+
backgroundColor: '#00AAAA',
|
|
131
|
+
zIndex: test_case_type == 0 ? -22 : 0,
|
|
132
|
+
}"
|
|
133
|
+
/>
|
|
134
|
+
|
|
135
|
+
<div
|
|
136
|
+
:style="{
|
|
137
|
+
left: 80,
|
|
138
|
+
top: 30,
|
|
139
|
+
width: 140,
|
|
140
|
+
height: 240,
|
|
141
|
+
backgroundColor: '#0000AA',
|
|
142
|
+
zIndex: test_case_type == 0 ? -33 : 0,
|
|
143
|
+
}"
|
|
144
|
+
/>
|
|
145
|
+
|
|
146
|
+
<div
|
|
147
|
+
:style="{
|
|
148
|
+
left: 0,
|
|
149
|
+
top: 0,
|
|
150
|
+
animation: case_config.animation,
|
|
151
|
+
}"
|
|
152
|
+
>
|
|
153
|
+
<JsvVisibleSensor
|
|
154
|
+
:horizonShown="case_config.horizon"
|
|
155
|
+
:verticalShown="case_config.vertical"
|
|
156
|
+
:width="BOX_WIDTH"
|
|
157
|
+
:height="BOX_HEIGHT"
|
|
158
|
+
:enable="true"
|
|
159
|
+
:container="containerRef"
|
|
160
|
+
:callback="onBeVisible"
|
|
161
|
+
>
|
|
162
|
+
<div v-if="test_case_type == 0">
|
|
163
|
+
<div
|
|
164
|
+
:style="{
|
|
165
|
+
width: BOX_WIDTH,
|
|
166
|
+
height: BOX_HEIGHT * VISIBLE_RANGE,
|
|
167
|
+
backgroundColor: '#FF0000',
|
|
168
|
+
}"
|
|
169
|
+
/>
|
|
170
|
+
<div
|
|
171
|
+
:style="{
|
|
172
|
+
top: BOX_HEIGHT * (1 - VISIBLE_RANGE),
|
|
173
|
+
width: BOX_WIDTH,
|
|
174
|
+
height: BOX_HEIGHT * VISIBLE_RANGE,
|
|
175
|
+
backgroundColor: '#FF0000',
|
|
176
|
+
}"
|
|
177
|
+
/>
|
|
178
|
+
</div>
|
|
179
|
+
<div v-else>
|
|
180
|
+
<div
|
|
181
|
+
:style="{
|
|
182
|
+
width: BOX_WIDTH * VISIBLE_RANGE,
|
|
183
|
+
height: BOX_HEIGHT,
|
|
184
|
+
backgroundColor: '#FF0000',
|
|
185
|
+
}"
|
|
186
|
+
/>
|
|
187
|
+
<div
|
|
188
|
+
:style="{
|
|
189
|
+
left: BOX_WIDTH * (1 - VISIBLE_RANGE),
|
|
190
|
+
width: BOX_WIDTH * VISIBLE_RANGE,
|
|
191
|
+
height: BOX_HEIGHT,
|
|
192
|
+
backgroundColor: '#FF0000',
|
|
193
|
+
}"
|
|
194
|
+
/>
|
|
195
|
+
</div>
|
|
196
|
+
<div
|
|
197
|
+
:style="{
|
|
198
|
+
width: BOX_WIDTH,
|
|
199
|
+
height: BOX_HEIGHT,
|
|
200
|
+
backgroundColor: BOX_COLOR,
|
|
201
|
+
fontSize: 20,
|
|
202
|
+
lineHeight: 30,
|
|
203
|
+
}"
|
|
204
|
+
>
|
|
205
|
+
{{
|
|
206
|
+
`${case_config.text}\nH:${status_text.newH}\nV:${status_text.newV}`
|
|
207
|
+
}}
|
|
208
|
+
</div>
|
|
209
|
+
</JsvVisibleSensor>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
</jsv-focus-block>
|
|
214
|
+
</template>
|
|
215
|
+
|
|
216
|
+
<style scoped>
|
|
217
|
+
@keyframes visibleSensor_upDown {
|
|
218
|
+
from {
|
|
219
|
+
transform: translate3d(75px, -180px, 0);
|
|
220
|
+
}
|
|
221
|
+
to {
|
|
222
|
+
transform: translate3d(75px, 330px, 0);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@keyframes visibleSensor_leftRight {
|
|
227
|
+
from {
|
|
228
|
+
transform: translate3d(-180px, 75px, 0);
|
|
229
|
+
}
|
|
230
|
+
to {
|
|
231
|
+
transform: translate3d(330px, 75px, 0);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
</style>
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shijiu/jsview-vue-samples",
|
|
3
|
+
"version": "1.9.747",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"repository": "system/jsview-framework",
|
|
6
|
+
"author": "mengxk",
|
|
7
|
+
"homepage": "http://gitlab.qcast.cn/system/jsview-framework",
|
|
8
|
+
"bugs": "http://gitlab.qcast.cn/system/jsview-framework/issues",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"jsview",
|
|
11
|
+
"jsview-vue",
|
|
12
|
+
"jsview-vue-samples"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=16.0.0"
|
|
16
|
+
}
|
|
17
|
+
}
|