@shijiu/jsview-vue-samples 2.2.373 → 2.3.0
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 +1 -1
- package/Basic/components/text/TextDirection.vue +7 -2
- package/BasicFocusControl/components/BaseBlock.vue +65 -18
- package/BreakRender/assets/imageList.json +235 -235
- package/ColorSpace/App.vue +4 -4
- package/CoupletsTest/App.vue +1 -1
- package/CoupletsTest/widget/Banger/Banger.vue +3 -3
- package/CoupletsTest/widget/Banger/MaroonLoader.vue +5 -5
- package/CoupletsTest/widget/Couplets/Couplets.vue +4 -4
- package/CoupletsTest/widget/Fireworks/Fireworks.vue +13 -13
- package/CssPreprocessor/Stylus/components/stylus-group1/StylusOperations.vue +0 -1
- package/CssPreprocessor/utils/ContentBlock.vue +3 -3
- package/CssPreprocessor/utils/{FontStyle.css → FontConfig.css} +3 -3
- package/CssPreprocessor/utils/TitleBar.vue +2 -2
- package/CustomShader/App.vue +6 -6
- package/CustomShader/gaussianBlur.glsl +1 -1
- package/DashPath/App.vue +79 -0
- package/DashPath/AppForOperator.vue +35 -0
- package/DashPath/DashPath.vue +118 -0
- package/DemoForOperator/AnimPic/AnimPic.vue +47 -0
- package/DemoForOperator/AnimPic/App.vue +28 -0
- package/DemoForOperator/Banger/App.vue +26 -0
- package/DemoForOperator/Banger/Banger/Banger.vue +252 -0
- package/DemoForOperator/Banger/Banger/Maroon.vue +123 -0
- package/DemoForOperator/Banger/Banger/MaroonLoader.vue +78 -0
- package/DemoForOperator/Banger/Banger/SpriteDeal.js +30 -0
- package/DemoForOperator/Bounce/App.vue +43 -0
- package/DemoForOperator/Bounce/Bounce.vue +49 -0
- package/DemoForOperator/Bounce/FreeMoveBuilder.js +139 -0
- package/DemoForOperator/ChunLian/App.vue +47 -0
- package/DemoForOperator/ChunLian/Couplets.vue +248 -0
- package/DemoForOperator/EpisodeList/App.vue +80 -0
- package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +113 -0
- package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +176 -0
- package/DemoForOperator/EpisodeList/GroupItem.vue +65 -0
- package/DemoForOperator/EpisodeList/ListItem.vue +48 -0
- package/DemoForOperator/Firework1/App.vue +25 -0
- package/DemoForOperator/Firework1/Fireworks.vue +358 -0
- package/DemoForOperator/Firework1/SpriteDeal.js +30 -0
- package/DemoForOperator/FlipPage/App.vue +75 -0
- package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +150 -0
- package/DemoForOperator/FlipPage/FlipPage/flipIn.glsl +41 -0
- package/DemoForOperator/FlipPage/FlipPage/flipOut.glsl +41 -0
- package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +70 -0
- package/DemoForOperator/Focus/Alpha/AlphaPage.vue +40 -0
- package/DemoForOperator/Focus/Alpha/Item.vue +64 -0
- package/DemoForOperator/Focus/App.vue +124 -0
- package/DemoForOperator/Focus/CommonPageSetting.js +30 -0
- package/DemoForOperator/Focus/Item.vue +46 -0
- package/DemoForOperator/Focus/Light/Item.vue +67 -0
- package/DemoForOperator/Focus/Light/LightFocusBox.vue +46 -0
- package/DemoForOperator/Focus/Light/LightPage.vue +43 -0
- package/DemoForOperator/Focus/Light/utils/FrameCanvasStore.ts +68 -0
- package/DemoForOperator/Focus/Light/utils/RotateFrame.vue +146 -0
- package/DemoForOperator/Focus/Light/utils/circleHaloMask.png +0 -0
- package/DemoForOperator/Focus/Normal/Item.vue +64 -0
- package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +53 -0
- package/DemoForOperator/Focus/Normal/NormalPage.vue +41 -0
- package/DemoForOperator/Focus/SwipeLight/Item.vue +73 -0
- package/DemoForOperator/Focus/SwipeLight/SwipeLightBox.vue +62 -0
- package/DemoForOperator/Focus/SwipeLight/SwipeLightPage.vue +44 -0
- package/DemoForOperator/FullscreenIn/App.vue +105 -0
- package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +41 -0
- package/DemoForOperator/FullscreenIn/Item.vue +50 -0
- package/DemoForOperator/Genie/App.vue +78 -0
- package/DemoForOperator/Genie/geniePakcer/Genie.vue +699 -0
- package/DemoForOperator/Genie/geniePakcer/genieBottom.glsl +49 -0
- package/DemoForOperator/Genie/geniePakcer/genieLeft.glsl +50 -0
- package/DemoForOperator/Genie/geniePakcer/genieRight.glsl +57 -0
- package/DemoForOperator/Genie/geniePakcer/genieTop.glsl +50 -0
- package/DemoForOperator/GrayFilter/App.vue +51 -0
- package/DemoForOperator/GrayFilter/GrayFilter.vue +38 -0
- package/DemoForOperator/Jigsaw/App.vue +45 -0
- package/DemoForOperator/Jigsaw/JigsawFull.vue +100 -0
- package/DemoForOperator/Jigsaw/JigsawSingle.vue +86 -0
- package/DemoForOperator/Particle/App.vue +69 -0
- package/DemoForOperator/Particle/Drop/DropParticle.vue +176 -0
- package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +99 -0
- package/DemoForOperator/PosterAnim/App.vue +125 -0
- package/DemoForOperator/PosterAnim/Bounce/BouncePage.vue +54 -0
- package/DemoForOperator/PosterAnim/Bounce/Item.vue +85 -0
- package/DemoForOperator/PosterAnim/Breath/BreathPage.vue +47 -0
- package/DemoForOperator/PosterAnim/Breath/Item.vue +58 -0
- package/DemoForOperator/PosterAnim/CommonPageSetting.js +30 -0
- package/DemoForOperator/PosterAnim/Item.vue +46 -0
- package/DemoForOperator/PosterAnim/PosterAnim.js +58 -0
- package/DemoForOperator/PosterAnim/Scale/Item.vue +72 -0
- package/DemoForOperator/PosterAnim/Scale/ScalePage.vue +48 -0
- package/DemoForOperator/PosterAnim/Shake/Item.vue +85 -0
- package/DemoForOperator/PosterAnim/Shake/ShakePage.vue +53 -0
- package/DemoForOperator/PosterOverflow/App.vue +116 -0
- package/DemoForOperator/PosterOverflow/Item.vue +67 -0
- package/DemoForOperator/PosterOverflow/PosterOverflow.vue +23 -0
- package/DemoForOperator/Ripple/App.vue +54 -0
- package/DemoForOperator/Ripple/Ripple.vue +50 -0
- package/DemoForOperator/ScalePoster/App.vue +4 -0
- package/DemoForOperator/ScalePoster/ScalePoster.vue +0 -0
- package/DemoForOperator/Sprite/App.vue +33 -0
- package/DemoForOperator/Sprite/Sprite.vue +90 -0
- package/DemoForOperator/Stretch/App.vue +103 -0
- package/DemoForOperator/Stretch/Stretch/Item.vue +192 -0
- package/DemoForOperator/Stretch/Stretch/Stretch.vue +168 -0
- package/DemoForOperator/TabContent/App.vue +89 -0
- package/DemoForOperator/TabContent/ContentPage.vue +66 -0
- package/DemoForOperator/TabContent/Item.vue +85 -0
- package/DemoForOperator/TabContent/PageItem.vue +40 -0
- package/DemoForOperator/TabContent/TabContent/CreepFocus.vue +160 -0
- package/DemoForOperator/TabContent/TabContent/Item.vue +63 -0
- package/DemoForOperator/TabContent/TabContent/TabContent.vue +146 -0
- package/DemoForOperator/TabContent/TabContent/TabItem.vue +368 -0
- package/DemoForOperator/TabContent/TabContent/TabWidget.vue +243 -0
- package/DemoForOperator/TabContent/TabContent/Util.js +3 -0
- package/DemoForOperator/TabContent/TabContent/ViewSwiper.vue +110 -0
- package/DemoForOperator/TabContent/testData.js +241 -0
- package/DemoForOperator/Vortex/App.vue +78 -0
- package/DemoForOperator/Vortex/Vortex/Vortex.vue +154 -0
- package/DemoForOperator/Vortex/Vortex/vortexIn.glsl +38 -0
- package/DemoForOperator/Vortex/Vortex/vortexOut.glsl +38 -0
- package/DemoForOperator/index.js +6 -0
- package/DemoForOperator/routeList.js +142 -0
- package/DemoHomepage/App.vue +50 -30
- package/DemoHomepage/components/Dialog.vue +1 -0
- package/DemoHomepage/components/TabFrame.vue +7 -0
- package/DemoHomepage/router.js +104 -81
- package/DemoHomepage/views/Homepage.vue +7 -6
- package/DivMetroPerformance/components/ContentItem.vue +0 -1
- package/DivMetroPerformance/data.js +3 -3
- package/DriftScopeTest/App.vue +1 -1
- package/FilterDemo/AnimatePic.vue +1 -1
- package/FilterDemo/VideoLayer.vue +2 -2
- package/FlexCellDemo/TestFrame1.vue +0 -4
- package/FullScreenFlex/TestFrame2.vue +1 -1
- package/GiftRain/App.vue +12 -15
- package/HashParams/App.vue +0 -1
- package/JsvPreDownloader/App.vue +4 -6
- package/Marquee/App.vue +2 -2
- package/MediaDemo/components/frames/AudioFrame.vue +1 -1
- package/MediaDemo/components/frames/VideoFrame.vue +1 -1
- package/MetroWidgetDemos/MassiveItems/ContentItem.vue +1 -2
- package/MetroWidgetDemos/MassiveItems/data.js +1 -1
- package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +0 -1
- package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +18 -17
- package/MetroWidgetDemos/PerformanceTest/data.js +3 -3
- package/MetroWidgetDemos/RefreshDemo/assets/imageList.json +235 -235
- package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.json +235 -235
- package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +3 -1
- package/MetroWidgetDemos/routeList.js +17 -17
- package/Poster3d/App.vue +69 -0
- package/Poster3d/Poster3d.vue +92 -0
- package/PosterPacker/App.vue +5 -5
- package/PosterPacker/tools/geniePakcer/Genie.vue +2 -2
- package/PosterPacker/tools/vortexPacker/Vortex.vue +15 -15
- package/QrcodeDemo/App.vue +1 -1
- package/Ripple/App.vue +1 -1
- package/ScaleDownNeon/App.vue +13 -10
- package/SceneTransition/App.vue +7 -6
- package/SceneTransition/maskConfig/config2.js +12 -12
- package/SceneTransition/maskConfig/config3.js +14 -14
- package/SprayView/App.vue +96 -51
- package/SpringFestival/App.vue +73 -0
- package/SpringFestival/SpringFestivalScene/ChunLian.vue +211 -0
- package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +139 -0
- package/SpringFestival/SpringFestivalScene/LanternAnim.js +60 -0
- package/SpringFestival/SpringFestivalScene/Rain.vue +137 -0
- package/SpringFestival/SpringFestivalScene/Scene.vue +218 -0
- package/SpringFestival/SpringFestivalScene/imageConfig.js +87 -0
- package/SpringFestival/SpringFestivalScene/index.js +1 -0
- package/Swiper/App.vue +28 -29
- package/Swiper/Item.vue +19 -0
- package/SwiperTest/App.vue +9 -9
- package/TestNativeSharedView/AckEventDefine.ts +82 -0
- package/TestNativeSharedView/App.vue +4 -6
- package/TestNativeSharedView/JsvDemoTester.js +131 -0
- package/TextureAnimation/App3.vue +100 -0
- package/TextureAnimation/utils/FrameCanvasStore.ts +68 -0
- package/TextureAnimation/utils/RotateFrame.vue +146 -0
- package/TextureAnimation/utils/circleHaloMask.png +0 -0
- package/TextureSize/App.vue +5 -6
- package/TombSweepingDayTest/Raining/RainScene.vue +4 -4
- package/ViewOpacity/App.vue +6 -7
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { MetroWidget, HORIZONTAL, useFocusHub } from "jsview";
|
|
3
|
+
import { ref, onMounted } from "vue";
|
|
4
|
+
import PageItem from "./PageItem.vue";
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
pageData: Object,
|
|
8
|
+
name: String,
|
|
9
|
+
onEdge: Function,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
console.log("content page on edge", props.pageData);
|
|
13
|
+
|
|
14
|
+
const provideData = () => {
|
|
15
|
+
return props.pageData.list;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const measures = (data) => {
|
|
19
|
+
return {
|
|
20
|
+
width: data.width,
|
|
21
|
+
height: data.height,
|
|
22
|
+
marginRight: 20,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const widgetLayout = {
|
|
27
|
+
left: 0,
|
|
28
|
+
top: 80,
|
|
29
|
+
width: 1280,
|
|
30
|
+
height: 400,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
onMounted(() => {});
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<div
|
|
38
|
+
:style="{
|
|
39
|
+
fontSize: 40,
|
|
40
|
+
width: 1280,
|
|
41
|
+
height: 80,
|
|
42
|
+
color: '#FFFFFF',
|
|
43
|
+
}"
|
|
44
|
+
>
|
|
45
|
+
{{ pageData.title }}
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<metro-widget
|
|
49
|
+
:name="name"
|
|
50
|
+
:left="widgetLayout.left"
|
|
51
|
+
:top="widgetLayout.top"
|
|
52
|
+
:width="widgetLayout.width"
|
|
53
|
+
:height="widgetLayout.height"
|
|
54
|
+
:provideData="provideData"
|
|
55
|
+
:direction="HORIZONTAL"
|
|
56
|
+
:measures="measures"
|
|
57
|
+
:onEdge="onEdge"
|
|
58
|
+
:padding="{ left: 40, right: 40, top: 50, bottom: 50 }"
|
|
59
|
+
>
|
|
60
|
+
<template #renderItem="{ data, onAction }">
|
|
61
|
+
<page-item :data="data" :onAction="onAction" />
|
|
62
|
+
</template>
|
|
63
|
+
</metro-widget>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<style scoped></style>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, inject, shallowRef, onMounted, computed } from "vue";
|
|
3
|
+
const modeIsKey = inject("modeIsKey");
|
|
4
|
+
const tabFocus = inject("tabFocus");
|
|
5
|
+
const globalInfo = inject("globalInfo");
|
|
6
|
+
const colorList = ["#FFD700", "#FF1493", "#1E90FF"];
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
data: Object,
|
|
9
|
+
query: Object,
|
|
10
|
+
onAction: Object,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const focused = ref(false);
|
|
14
|
+
const divRef = shallowRef();
|
|
15
|
+
|
|
16
|
+
const onFocus = () => {
|
|
17
|
+
focused.value = true;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const onBlur = () => {
|
|
21
|
+
focused.value = false;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const onClicked = () => {
|
|
25
|
+
console.log("item clicked", props.data);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const onGaze = () => {};
|
|
29
|
+
|
|
30
|
+
const onIgnore = () => {};
|
|
31
|
+
|
|
32
|
+
const isSlect = computed(() => {
|
|
33
|
+
if (modeIsKey()) {
|
|
34
|
+
return (
|
|
35
|
+
!tabFocus.value &&
|
|
36
|
+
!focused.value &&
|
|
37
|
+
globalInfo.updateTabId == props.data.indexId
|
|
38
|
+
);
|
|
39
|
+
} else {
|
|
40
|
+
return globalInfo.updateTabId == props.data.indexId;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
props.onAction.register("onFocus", onFocus);
|
|
45
|
+
props.onAction.register("onBlur", onBlur);
|
|
46
|
+
props.onAction.register("onClick", onClicked);
|
|
47
|
+
props.onAction.register("onGaze", onGaze);
|
|
48
|
+
props.onAction.register("onIgnore", onIgnore);
|
|
49
|
+
|
|
50
|
+
// indexId为4时,是有子tab的电影tab
|
|
51
|
+
const fontSize = computed(() => {
|
|
52
|
+
return props.data.isSubTab && props.data.indexId != 4 ? 26 : 30;
|
|
53
|
+
});
|
|
54
|
+
const fontWeight = computed(() => {
|
|
55
|
+
return props.data.isSubTab && props.data.indexId != 4 ? "bold" : null;
|
|
56
|
+
});
|
|
57
|
+
const textColor = computed(() => {
|
|
58
|
+
return props.data.isSubTab && props.data.indexId != 4
|
|
59
|
+
? colorList[props.data.indexId % 3]
|
|
60
|
+
: "#ffffff";
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
onMounted(() => {});
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<template>
|
|
67
|
+
<div
|
|
68
|
+
:style="{
|
|
69
|
+
fontSize: fontSize,
|
|
70
|
+
width: data.width,
|
|
71
|
+
height: data.height,
|
|
72
|
+
color: textColor,
|
|
73
|
+
backgroundColor: isSlect ? 'rgba(211,115,78,0.4)' : 'rgba(0,0,0,0)',
|
|
74
|
+
borderRadius: 15,
|
|
75
|
+
textAlign: 'center',
|
|
76
|
+
lineHeight: data.height,
|
|
77
|
+
transform: focused ? 'scale3d(1.1,1.1,1)' : 'scale3d(1,1,1)',
|
|
78
|
+
fontWeight: fontWeight,
|
|
79
|
+
}"
|
|
80
|
+
>
|
|
81
|
+
{{ data.content }}
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<style scoped></style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
data: Object,
|
|
6
|
+
onAction: Object,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const focused = ref(false);
|
|
10
|
+
|
|
11
|
+
// 注册回调
|
|
12
|
+
const onFocus = () => {
|
|
13
|
+
focused.value = true;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const onBlur = () => {
|
|
17
|
+
focused.value = false;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const onClick = () => {
|
|
21
|
+
console.log("page item clicked:", props.data);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
props.onAction.register("onFocus", onFocus);
|
|
25
|
+
props.onAction.register("onBlur", onBlur);
|
|
26
|
+
props.onAction.register("onClick", onClick);
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div
|
|
31
|
+
:style="{
|
|
32
|
+
width: data.width,
|
|
33
|
+
height: data.height,
|
|
34
|
+
backgroundImage: `url(${data.img})`,
|
|
35
|
+
borderRadius: 15,
|
|
36
|
+
transform: focused ? 'scale3d(1.1, 1.1, 1)' : 'scale3d(1, 1, 1)',
|
|
37
|
+
transition: 'transform 0.2s',
|
|
38
|
+
}"
|
|
39
|
+
/>
|
|
40
|
+
</template>
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { JsvNinePatch, getKeyFramesGroup, JsvTextureStoreApi } from "jsview";
|
|
3
|
+
import { reactive, onBeforeUnmount, ref } from "vue";
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
color: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: "#e26c44" // 默认橙色,完全不透明
|
|
9
|
+
},
|
|
10
|
+
borderWidth: {
|
|
11
|
+
type: Number,
|
|
12
|
+
default: 3 // 边框宽度
|
|
13
|
+
},
|
|
14
|
+
initWidth: {
|
|
15
|
+
type: Number,
|
|
16
|
+
default: 0,
|
|
17
|
+
},
|
|
18
|
+
initHeight: {
|
|
19
|
+
type: Number,
|
|
20
|
+
default: 0,
|
|
21
|
+
},
|
|
22
|
+
initLeft: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: 0,
|
|
25
|
+
},
|
|
26
|
+
initTop: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: 0,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// 创建圆形纹理
|
|
33
|
+
const sourceId = ref('');
|
|
34
|
+
const circleSize = 35; // 保持原有imageWidth的大小
|
|
35
|
+
const canvasRef = JsvTextureStoreApi.canvasTexture(
|
|
36
|
+
circleSize,
|
|
37
|
+
circleSize
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// 创建圆形路径
|
|
41
|
+
const radius = Math.floor(circleSize / 2);
|
|
42
|
+
const customPath = canvasRef.circlePath(
|
|
43
|
+
radius,
|
|
44
|
+
radius,
|
|
45
|
+
radius - props.borderWidth/2
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// 设置透明背景
|
|
49
|
+
canvasRef.drawColor("rgba(0,0,0,0)");
|
|
50
|
+
|
|
51
|
+
// 绘制圆形边框
|
|
52
|
+
customPath?.fill(props.color);
|
|
53
|
+
|
|
54
|
+
// 提交并获取纹理ID
|
|
55
|
+
sourceId.value = canvasRef.commit();
|
|
56
|
+
|
|
57
|
+
const styleShell = getKeyFramesGroup();
|
|
58
|
+
|
|
59
|
+
const animationCache = {};
|
|
60
|
+
const addAnimation = (fromRect, toRect, name) => {
|
|
61
|
+
if (animationCache.hasOwnProperty(name)) {
|
|
62
|
+
styleShell?.removeRule(name);
|
|
63
|
+
delete animationCache[name];
|
|
64
|
+
}
|
|
65
|
+
if (!(name in animationCache)) {
|
|
66
|
+
const animStr = `@keyframes ${name} {
|
|
67
|
+
0% {
|
|
68
|
+
left: ${fromRect.left};
|
|
69
|
+
top: ${fromRect.top};
|
|
70
|
+
width: ${fromRect.width};
|
|
71
|
+
height: ${fromRect.height};
|
|
72
|
+
}
|
|
73
|
+
50% {
|
|
74
|
+
left: ${Math.min(fromRect.left, toRect.left)};
|
|
75
|
+
top: ${Math.min(fromRect.top, toRect.top)};
|
|
76
|
+
width: ${
|
|
77
|
+
Math.max(fromRect.left + fromRect.width, toRect.left + toRect.width) -
|
|
78
|
+
Math.min(fromRect.left, toRect.left)
|
|
79
|
+
};
|
|
80
|
+
height: ${
|
|
81
|
+
Math.max(fromRect.top + fromRect.height, toRect.top + toRect.height) -
|
|
82
|
+
Math.min(fromRect.top, toRect.top)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
100% {
|
|
86
|
+
left: ${toRect.left};
|
|
87
|
+
top: ${toRect.top};
|
|
88
|
+
width: ${toRect.width};
|
|
89
|
+
height: ${toRect.height};
|
|
90
|
+
}
|
|
91
|
+
}`;
|
|
92
|
+
animationCache[name] = animStr;
|
|
93
|
+
styleShell.insertRule(animStr);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const removeAnimation = (name) => {
|
|
97
|
+
styleShell?.removeRule(name);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const focusSize = reactive({
|
|
101
|
+
width: props.initWidth,
|
|
102
|
+
height: props.initHeight,
|
|
103
|
+
left: props.initLeft,
|
|
104
|
+
top: props.initTop,
|
|
105
|
+
animation: null,
|
|
106
|
+
onTransitionEnd: null,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
let animateChange = 0; // A B版动画切换,解决animation属性不变化引起不刷新问题
|
|
110
|
+
let preRect = null;
|
|
111
|
+
let curRect = null;
|
|
112
|
+
let first = true;
|
|
113
|
+
|
|
114
|
+
const changeRect = (rect, doAnim = true) => {
|
|
115
|
+
preRect = curRect;
|
|
116
|
+
curRect = rect;
|
|
117
|
+
if (first) {
|
|
118
|
+
first = false;
|
|
119
|
+
} else if (doAnim) {
|
|
120
|
+
const animName = "test_focusMove_" + animateChange;
|
|
121
|
+
animateChange = animateChange == 0 ? 1 : 0; // A B 版切换
|
|
122
|
+
addAnimation(preRect, curRect, animName);
|
|
123
|
+
focusSize.animation = `${animName} 0.3s linear`;
|
|
124
|
+
}
|
|
125
|
+
focusSize.left = curRect.left;
|
|
126
|
+
focusSize.top = curRect.top;
|
|
127
|
+
focusSize.width = curRect.width;
|
|
128
|
+
focusSize.height = curRect.height;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
onBeforeUnmount(() => {
|
|
132
|
+
for (let name in animationCache) {
|
|
133
|
+
removeAnimation(name);
|
|
134
|
+
}
|
|
135
|
+
JsvTextureStoreApi.deleteTexture(sourceId.value);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
defineExpose({
|
|
139
|
+
changeRect,
|
|
140
|
+
});
|
|
141
|
+
</script>
|
|
142
|
+
|
|
143
|
+
<template>
|
|
144
|
+
<jsv-nine-patch
|
|
145
|
+
:style="{
|
|
146
|
+
width: focusSize.width,
|
|
147
|
+
height: focusSize.height,
|
|
148
|
+
top: focusSize.top,
|
|
149
|
+
left: focusSize.left,
|
|
150
|
+
}"
|
|
151
|
+
:animation="focusSize.animation"
|
|
152
|
+
:imageUrl="`jsvtexturestore://${sourceId}`"
|
|
153
|
+
:imageWidth="circleSize"
|
|
154
|
+
:centerWidth="2"
|
|
155
|
+
:imageDspWidth="circleSize"
|
|
156
|
+
:borderOutset="borderWidth"
|
|
157
|
+
:animTime="0.2"
|
|
158
|
+
:waitForInit="true"
|
|
159
|
+
></jsv-nine-patch>
|
|
160
|
+
</template>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { onMounted } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
data: Object,
|
|
5
|
+
query: Object,
|
|
6
|
+
onEdge: Function,
|
|
7
|
+
onAction: Object,
|
|
8
|
+
onItemFocus: Function,
|
|
9
|
+
focusRectController: {
|
|
10
|
+
type: Object,
|
|
11
|
+
},
|
|
12
|
+
onItemClick: Function,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const customCallbacks = {};
|
|
16
|
+
const selfOnAction = {
|
|
17
|
+
register: (name, func) => {
|
|
18
|
+
customCallbacks[name] = func;
|
|
19
|
+
},
|
|
20
|
+
unregister: (name) => {
|
|
21
|
+
delete customCallbacks[name];
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const onFocus = (params) => {
|
|
26
|
+
const rect = props.query.templatePosition(props.query.index);
|
|
27
|
+
props.focusRectController?.onFocusChange(rect);
|
|
28
|
+
props.onItemFocus?.(props.data, rect);
|
|
29
|
+
customCallbacks.onFocus?.(params);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const onBlur = () => {
|
|
33
|
+
customCallbacks.onBlur?.();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const onClicked = () => {
|
|
37
|
+
console.log("item clicked", props.data);
|
|
38
|
+
props.onItemClick?.(props.data);
|
|
39
|
+
customCallbacks.onClick?.();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const onGaze = () => {
|
|
43
|
+
customCallbacks.onGaze?.();
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const onIgnore = () => {
|
|
47
|
+
customCallbacks.onIgnore?.();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
props.onAction.register("onFocus", onFocus);
|
|
51
|
+
props.onAction.register("onBlur", onBlur);
|
|
52
|
+
props.onAction.register("onClick", onClicked);
|
|
53
|
+
props.onAction.register("onGaze", onGaze);
|
|
54
|
+
props.onAction.register("onIgnore", onIgnore);
|
|
55
|
+
|
|
56
|
+
onMounted(() => {});
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<slot name="tabItem" :data="data" :query="query" :onAction="selfOnAction"></slot>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<style scoped></style>
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<jsv-focus-block
|
|
3
|
+
:name="name"
|
|
4
|
+
:onAction="{
|
|
5
|
+
onFocus,
|
|
6
|
+
onDispatchKeyUp,
|
|
7
|
+
}"
|
|
8
|
+
>
|
|
9
|
+
<tab-widget
|
|
10
|
+
:data="data"
|
|
11
|
+
:name="tabName"
|
|
12
|
+
:onEdge="tabOnEdge"
|
|
13
|
+
:layout="tabLayout"
|
|
14
|
+
:padding="tabPadding"
|
|
15
|
+
:itemGap="tagItemGap"
|
|
16
|
+
:initFocusId="initFocusId"
|
|
17
|
+
:tabTextFontSize="tabTextFontSize"
|
|
18
|
+
:creepFocusColor="creepFocusColor"
|
|
19
|
+
>
|
|
20
|
+
<template #tabItem="{ data, onAction, query }">
|
|
21
|
+
<slot
|
|
22
|
+
name="tabItem"
|
|
23
|
+
:data="data"
|
|
24
|
+
:query="query"
|
|
25
|
+
:onAction="onAction"
|
|
26
|
+
></slot>
|
|
27
|
+
</template>
|
|
28
|
+
</tab-widget>
|
|
29
|
+
<view-swiper
|
|
30
|
+
:name="contentName"
|
|
31
|
+
:dataLoader="contentDataLoader"
|
|
32
|
+
:onEdge="contentOnEdge"
|
|
33
|
+
:layout="contentLayout"
|
|
34
|
+
:onFocus="contentOnFocus"
|
|
35
|
+
:onBlur="contentOnBlur"
|
|
36
|
+
>
|
|
37
|
+
<template #default="{ data, onEdge }">
|
|
38
|
+
<slot name="content" :data="data" :onEdge="onEdge"></slot>
|
|
39
|
+
</template>
|
|
40
|
+
</view-swiper>
|
|
41
|
+
</jsv-focus-block>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup>
|
|
45
|
+
import TabWidget from "./TabWidget.vue";
|
|
46
|
+
import ViewSwiper from "./ViewSwiper.vue";
|
|
47
|
+
import { ref, reactive, provide } from "vue";
|
|
48
|
+
import { useFocusHub, EdgeDirection } from "jsview";
|
|
49
|
+
|
|
50
|
+
const props = defineProps({
|
|
51
|
+
name: {
|
|
52
|
+
type: String,
|
|
53
|
+
required: true,
|
|
54
|
+
},
|
|
55
|
+
data: {
|
|
56
|
+
type: Array,
|
|
57
|
+
required: true,
|
|
58
|
+
},
|
|
59
|
+
tabLayout: {
|
|
60
|
+
type: Object,
|
|
61
|
+
required: true,
|
|
62
|
+
},
|
|
63
|
+
tabPadding: {
|
|
64
|
+
type: Object,
|
|
65
|
+
required: true,
|
|
66
|
+
},
|
|
67
|
+
tagItemGap: {
|
|
68
|
+
type: Number,
|
|
69
|
+
required: true,
|
|
70
|
+
},
|
|
71
|
+
contentLayout: {
|
|
72
|
+
type: Object,
|
|
73
|
+
required: true,
|
|
74
|
+
},
|
|
75
|
+
contentDataLoader: {
|
|
76
|
+
type: Function,
|
|
77
|
+
required: true,
|
|
78
|
+
},
|
|
79
|
+
initFocusId: {
|
|
80
|
+
type: Number,
|
|
81
|
+
default: 0,
|
|
82
|
+
},
|
|
83
|
+
tabTextFontSize: {
|
|
84
|
+
type: Number,
|
|
85
|
+
default: 30,
|
|
86
|
+
},
|
|
87
|
+
contentOnFocus: {
|
|
88
|
+
type: Function,
|
|
89
|
+
default: () => {},
|
|
90
|
+
},
|
|
91
|
+
contentOnBlur: {
|
|
92
|
+
type: Function,
|
|
93
|
+
default: () => {},
|
|
94
|
+
},
|
|
95
|
+
creepFocusColor: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: "#e26c44",
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
const focusHub = useFocusHub();
|
|
101
|
+
const tabName = `${props.name}-tab`;
|
|
102
|
+
const contentName = `${props.name}-content`;
|
|
103
|
+
let focusName = tabName;
|
|
104
|
+
|
|
105
|
+
const animState = ref(0);
|
|
106
|
+
const globalInfo = reactive({
|
|
107
|
+
tabId: -1,
|
|
108
|
+
updateTabId: -1,
|
|
109
|
+
});
|
|
110
|
+
const getTouchFlag = () => {
|
|
111
|
+
return 0;
|
|
112
|
+
};
|
|
113
|
+
const tabFocus = ref(false);
|
|
114
|
+
const modeIsKey = () => {
|
|
115
|
+
return true;
|
|
116
|
+
};
|
|
117
|
+
function onFocus() {
|
|
118
|
+
console.log("ccht onFocus", focusName);
|
|
119
|
+
focusHub.setFocus(focusName);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function tabOnEdge(edgeInfo) {
|
|
123
|
+
console.log("testtest tab on edge");
|
|
124
|
+
if (edgeInfo.direction == EdgeDirection.bottom) {
|
|
125
|
+
focusHub.setFocus(contentName);
|
|
126
|
+
focusName = contentName;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function contentOnEdge(edgeInfo) {
|
|
131
|
+
if (edgeInfo.direction == EdgeDirection.top) {
|
|
132
|
+
focusHub.setFocus(tabName);
|
|
133
|
+
focusName = tabName;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const onDispatchKeyUp = () => {
|
|
138
|
+
globalInfo.updateTabId = globalInfo.tabId;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
provide("animState", animState);
|
|
142
|
+
provide("globalInfo", globalInfo);
|
|
143
|
+
provide("tabFocus", tabFocus);
|
|
144
|
+
provide("modeIsKey", modeIsKey);
|
|
145
|
+
provide("getTouchFlag", getTouchFlag);
|
|
146
|
+
</script>
|