@shijiu/jsview-vue-samples 2.2.426-test.0 → 2.3.151-test.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 -1
- package/BasicFocusControl/components/BaseBlock.vue +65 -18
- package/BreakRender/assets/imageList.json +235 -235
- package/ColorSpace/App.vue +2 -2
- 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/CustomShader/App.vue +4 -4
- package/CustomShader/gaussianBlur.glsl +1 -1
- package/DashPath/App.vue +80 -0
- package/DashPath/AppForOperator.vue +33 -0
- package/DemoForOperator/AnimPic/AnimPic.vue +69 -0
- package/DemoForOperator/AnimPic/App.vue +28 -0
- package/DemoForOperator/Banger/App.vue +26 -0
- package/DemoForOperator/Banger/Banger/Banger.vue +316 -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/Blur/Blur.vue +146 -0
- package/DemoForOperator/Blur/BlurInOut/BlurInOut.vue +158 -0
- package/DemoForOperator/Blur/BlurInOut/StaticBgSlide.vue +162 -0
- package/DemoForOperator/Blur/BlurPopup/BlurPopup.vue +113 -0
- package/DemoForOperator/BookFlip/App.vue +115 -0
- package/DemoForOperator/BookFlip/BookFlip/FlipPage.vue +179 -0
- package/DemoForOperator/BookFlip/BookFlip/FlippingBook.vue +310 -0
- package/DemoForOperator/BookFlip/BookFlip/flip.glsl +135 -0
- package/DemoForOperator/BookFlip/BookPage.vue +82 -0
- package/DemoForOperator/Bounce/App.vue +43 -0
- package/DemoForOperator/Bounce/Bounce.vue +81 -0
- package/DemoForOperator/Bounce/FreeMoveBuilder.js +139 -0
- package/DemoForOperator/ChunLian/App.vue +47 -0
- package/DemoForOperator/ChunLian/Couplets.vue +291 -0
- package/DemoForOperator/ClickSpriteAnim/App.vue +130 -0
- package/DemoForOperator/ClickSpriteAnim/Item.vue +74 -0
- package/DemoForOperator/DominantColor/App.vue +187 -0
- package/DemoForOperator/EpisodeList/App.vue +80 -0
- package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +110 -0
- package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +250 -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 +397 -0
- package/DemoForOperator/Firework1/SpriteDeal.js +30 -0
- package/DemoForOperator/FlipPage/App.vue +75 -0
- package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +178 -0
- package/DemoForOperator/FlipPage/FlipPage/flipIn.glsl +41 -0
- package/DemoForOperator/FlipPage/FlipPage/flipOut.glsl +41 -0
- package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +95 -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 +87 -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 +65 -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/FrameShadow/App.vue +193 -0
- package/DemoForOperator/FrameShadow/FrameShadow.vue +61 -0
- package/DemoForOperator/FullscreenIn/App.vue +105 -0
- package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +56 -0
- package/DemoForOperator/FullscreenIn/Item.vue +50 -0
- package/DemoForOperator/Genie/App.vue +78 -0
- package/DemoForOperator/Genie/geniePakcer/Genie.vue +741 -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 +59 -0
- package/DemoForOperator/Jigsaw/App.vue +45 -0
- package/DemoForOperator/Jigsaw/JigsawFull.vue +142 -0
- package/DemoForOperator/Jigsaw/JigsawSingle.vue +118 -0
- package/DemoForOperator/LongChatBox/App.vue +36 -0
- package/DemoForOperator/LongChatBox/Bubble.vue +104 -0
- package/DemoForOperator/LongChatBox/LongChat.vue +173 -0
- package/DemoForOperator/LongChatBox/TextManager.ts +147 -0
- package/DemoForOperator/LongChatBox/VirtualList.vue +298 -0
- package/DemoForOperator/LongChatBox/testData.js +51 -0
- package/DemoForOperator/LongChatBox/utile.js +331 -0
- package/DemoForOperator/Particle/App.vue +69 -0
- package/DemoForOperator/Particle/Drop/DropParticle.vue +208 -0
- package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +120 -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 +79 -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 +39 -0
- package/DemoForOperator/Resize/App.vue +157 -0
- package/DemoForOperator/Resize/Resize/Item.vue +234 -0
- package/DemoForOperator/Resize/Resize/Resize.vue +96 -0
- package/DemoForOperator/Ripple/App.vue +54 -0
- package/DemoForOperator/Ripple/Ripple.vue +65 -0
- package/DemoForOperator/ScreenShootScale/App.vue +96 -0
- package/DemoForOperator/ScreenShootScale/Back.vue +86 -0
- package/DemoForOperator/ScreenShootScale/Front.vue +133 -0
- package/DemoForOperator/ScreenShootScale/Item.vue +62 -0
- package/DemoForOperator/ScreenShootScale/ScreenShootScale.vue +109 -0
- package/DemoForOperator/SmoothSwiper/App.vue +50 -0
- package/DemoForOperator/Sound/Bounce/App.vue +56 -0
- package/DemoForOperator/Sound/Bounce/Bounce.vue +87 -0
- package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +146 -0
- package/DemoForOperator/Sound/Bounce/bgmusic.mp3 +0 -0
- package/DemoForOperator/Sound/Bounce/coin.mp3 +0 -0
- package/DemoForOperator/Sound/FocusMove/App.vue +134 -0
- package/DemoForOperator/Sound/FocusMove/Item.vue +43 -0
- package/DemoForOperator/Sound/FocusMove/move.mp3 +0 -0
- package/DemoForOperator/Sound/Rain/App.vue +11 -0
- package/DemoForOperator/Sound/Rain/Raining/Rain.vue +69 -0
- package/DemoForOperator/Sound/Rain/Raining/RainScene.vue +118 -0
- package/DemoForOperator/Sound/Sound/Sound.vue +24 -0
- package/DemoForOperator/Sound/Sound/index.js +4 -0
- package/DemoForOperator/Sound/Sound/useSound.js +112 -0
- package/DemoForOperator/Sprite/App.vue +33 -0
- package/DemoForOperator/Sprite/Sprite.vue +147 -0
- package/DemoForOperator/Stretch/App.vue +103 -0
- package/DemoForOperator/Stretch/Stretch/Item.vue +192 -0
- package/DemoForOperator/Stretch/Stretch/Stretch.vue +218 -0
- package/DemoForOperator/Swiper/App.vue +101 -0
- package/DemoForOperator/Swiper/Item.vue +56 -0
- package/DemoForOperator/Swiper/ParallaxSlide.vue +164 -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 +184 -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/TabContentVertical/App.vue +104 -0
- package/DemoForOperator/TabContentVertical/ContentPage.vue +67 -0
- package/DemoForOperator/TabContentVertical/Item.vue +94 -0
- package/DemoForOperator/TabContentVertical/PageItem.vue +40 -0
- package/DemoForOperator/TabContentVertical/TabContent/CreepFocus.vue +160 -0
- package/DemoForOperator/TabContentVertical/TabContent/Item.vue +63 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabContent.vue +184 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabItem.vue +368 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabWidget.vue +259 -0
- package/DemoForOperator/TabContentVertical/TabContent/Util.js +3 -0
- package/DemoForOperator/TabContentVertical/TabContent/ViewSwiper.vue +110 -0
- package/DemoForOperator/TabContentVertical/assets/children_science.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/documentary.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/free.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/game.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/home_selected.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/movie_ticket.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/my_account.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/opera.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/sports.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/tv_drama.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/variety_show.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/vip.png +0 -0
- package/DemoForOperator/TabContentVertical/testData.js +76 -0
- package/DemoForOperator/Vortex/App.vue +78 -0
- package/DemoForOperator/Vortex/Vortex/Vortex.vue +180 -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 +259 -0
- package/DemoHomepage/App.vue +50 -30
- package/DemoHomepage/components/Dialog.vue +1 -0
- package/DemoHomepage/components/Item.vue +11 -0
- package/DemoHomepage/components/TabFrame.vue +7 -0
- package/DemoHomepage/router.js +178 -81
- package/DemoHomepage/views/Homepage.vue +7 -2
- 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/FullScreenFlex/TestFrame2.vue +1 -1
- package/GiftRain/App.vue +12 -12
- package/GiftRain/components/SpriteTranslate.vue +68 -48
- package/HashHistory/App.vue +2 -2
- package/HashHistory/router.js +1 -1
- package/JsvPreDownloader/App.vue +4 -4
- package/MediaDemo/components/frames/AudioFrame.vue +1 -1
- package/MediaDemo/components/frames/VideoFrame.vue +1 -1
- package/MetroWidgetDemos/MassiveItems/ContentItem.vue +1 -1
- package/MetroWidgetDemos/MassiveItems/data.js +1 -1
- 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/TripleWidget/App.vue +7 -1
- package/MetroWidgetDemos/TripleWidget/Item.vue +16 -2
- package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +7 -1
- package/MetroWidgetDemos/TripleWidget/WidgetItem.vue +8 -2
- package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +3 -1
- package/MetroWidgetDemos/routeList.js +34 -17
- package/Poster3d/App.vue +69 -0
- package/Poster3d/Poster3d.vue +92 -0
- package/PosterPacker/App.vue +5 -5
- package/PosterPacker/tools/vortexPacker/Vortex.vue +1 -1
- package/QrcodeDemo/App.vue +1 -1
- package/Ripple/App.vue +1 -1
- package/ScaleDownNeon/App.vue +4 -4
- package/SceneTransition/App.vue +2 -2
- 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/App.vue +16 -6
- 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/TombSweepingDayTest/Raining/RainScene.vue +4 -4
- package/ViewOpacity/App.vue +21 -2
- package/package.json +1 -1
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:17
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script>
|
|
7
|
+
let animToken = 0;
|
|
8
|
+
</script>
|
|
9
|
+
<script setup>
|
|
10
|
+
import { ref, onBeforeUnmount, computed } from "vue";
|
|
11
|
+
import { getKeyFramesGroup } from "jsview";
|
|
12
|
+
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
data: Object,
|
|
15
|
+
onAction: Object,
|
|
16
|
+
query: Object,
|
|
17
|
+
animSetting: Object,
|
|
18
|
+
itemOnClick: Function,
|
|
19
|
+
itemOnGaze: Function,
|
|
20
|
+
itemOnIgnore: Function,
|
|
21
|
+
itemOnFocus: Function,
|
|
22
|
+
itemOnBlur: Function,
|
|
23
|
+
widgetLayout: Object,
|
|
24
|
+
widgetPadding: Object,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const focused = ref(false);
|
|
28
|
+
|
|
29
|
+
const blurSize = props.data.blurSize;
|
|
30
|
+
const focusSize = props.data.focusSize;
|
|
31
|
+
const expandSize = props.data.expandSize;
|
|
32
|
+
const duration = props.animSetting.duration;
|
|
33
|
+
const easing = props.animSetting.easing;
|
|
34
|
+
const width = ref(blurSize.w);
|
|
35
|
+
const height = ref(blurSize.h);
|
|
36
|
+
const top = computed(() => (blurSize.h - height.value) / 2);
|
|
37
|
+
|
|
38
|
+
let timeoutHandler = -1;
|
|
39
|
+
|
|
40
|
+
const animInfo = {
|
|
41
|
+
duration: duration,
|
|
42
|
+
easing: easing,
|
|
43
|
+
onEnd: () => {},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const isLarge = ref(false);
|
|
47
|
+
const showLarge = ref(false);
|
|
48
|
+
|
|
49
|
+
const transitionStr = `left ${duration / 1000}s ${easing}, top ${
|
|
50
|
+
duration / 1000
|
|
51
|
+
}s ${easing}, width ${duration / 1000}s ${easing}, height ${
|
|
52
|
+
duration / 1000
|
|
53
|
+
}s ${easing}`;
|
|
54
|
+
const animation = ref(null);
|
|
55
|
+
const scaleupAnim = `resize_item_scale_up_keep_center_${animToken++}`;
|
|
56
|
+
const scaledownAnim = `resize_item_scale_down_keep_center_${animToken++}`;
|
|
57
|
+
|
|
58
|
+
const xOffset = (focusSize.w - expandSize.w) / 2;
|
|
59
|
+
const yOffset = (focusSize.h - expandSize.h) / 2;
|
|
60
|
+
const scaleupBody = `@keyframes ${scaleupAnim} { from {transform: translate3d(${xOffset}, ${yOffset}, 0);} to {transform: translate3d(0, 0, 0);} }`;
|
|
61
|
+
const scaledownBody = `@keyframes ${scaledownAnim} { from {transform: translate3d(0, 0, 0);} to {transform: translate3d(${xOffset}, ${yOffset}, 0);}}`;
|
|
62
|
+
|
|
63
|
+
const styleSheets = getKeyFramesGroup();
|
|
64
|
+
styleSheets.insertRule(scaleupBody);
|
|
65
|
+
styleSheets.insertRule(scaledownBody);
|
|
66
|
+
function onAnimEnd() {
|
|
67
|
+
animation.value = null;
|
|
68
|
+
}
|
|
69
|
+
function onTransitionDone() {
|
|
70
|
+
if (!isLarge.value) {
|
|
71
|
+
showLarge.value = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const edgeTransition = `left ${duration / 1000}s ${easing}, top ${
|
|
76
|
+
duration / 1000
|
|
77
|
+
}s ${easing}`;
|
|
78
|
+
const rightSlotLeft = computed(() => {
|
|
79
|
+
return width.value - blurSize.w;
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
function getAnchor(targetWidth) {
|
|
83
|
+
const curPosition = props.query.position(props.query.index);
|
|
84
|
+
//position是相对于布局区域的,所以加上padding
|
|
85
|
+
let curRect = [curPosition.left + props.widgetPadding.left, curPosition.left + props.widgetPadding.left + curPosition.width];
|
|
86
|
+
//留个20不贴边
|
|
87
|
+
let targetRect = [props.widgetLayout.width - targetWidth - 20, props.widgetLayout.width];
|
|
88
|
+
console.log("ccht get anchor", curRect, targetRect);
|
|
89
|
+
if (targetRect[0] > curRect[0]) {
|
|
90
|
+
//右边有足够空间
|
|
91
|
+
return 0;
|
|
92
|
+
} else {
|
|
93
|
+
//[a,b] 映射到 [c,d] 的不动点公式 x = (ad-bc)/(a+d-b-c)
|
|
94
|
+
let fixPoint = (curRect[0] * targetRect[1] - curRect[1] * targetRect[0]) / (curRect[0] + targetRect[1] - curRect[1] - targetRect[0]);
|
|
95
|
+
console.log("ccht get anchor 2", fixPoint);
|
|
96
|
+
return (fixPoint - curRect[0]) / curPosition.width;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const onFocus = () => {
|
|
101
|
+
focused.value = true;
|
|
102
|
+
if (width.value == blurSize.w) {
|
|
103
|
+
//立即放大
|
|
104
|
+
width.value = focusSize.w;
|
|
105
|
+
height.value = focusSize.h;
|
|
106
|
+
props.query.updateItemSize(
|
|
107
|
+
props.query.index,
|
|
108
|
+
{
|
|
109
|
+
width: width.value,
|
|
110
|
+
height: blurSize.h, //布局的高度不需要改变, 只需要改宽
|
|
111
|
+
},
|
|
112
|
+
animInfo
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
if (props.data.resizable && !isLarge.value) {
|
|
116
|
+
//延迟展开
|
|
117
|
+
timeoutHandler = setTimeout(() => {
|
|
118
|
+
isLarge.value = true;
|
|
119
|
+
showLarge.value = true;
|
|
120
|
+
animation.value = `${scaleupAnim} ${duration / 1000}s ${easing}`;
|
|
121
|
+
let anchor = getAnchor(expandSize.w);
|
|
122
|
+
width.value = expandSize.w;
|
|
123
|
+
height.value = expandSize.h;
|
|
124
|
+
props.query.updateItemSize(
|
|
125
|
+
props.query.index,
|
|
126
|
+
{
|
|
127
|
+
width: width.value,
|
|
128
|
+
height: blurSize.h, //布局的高度不需要改变, 只需要改宽
|
|
129
|
+
},
|
|
130
|
+
{ ...animInfo, anchor: anchor }
|
|
131
|
+
);
|
|
132
|
+
}, props.data.resizeDelay ?? 1500);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
props.itemOnFocus?.();
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const onBlur = () => {
|
|
139
|
+
focused.value = false;
|
|
140
|
+
if (width.value != blurSize.w) {
|
|
141
|
+
if (isLarge.vue) {
|
|
142
|
+
animation.value = `${scaledownAnim} ${duration / 1000}s linear`;
|
|
143
|
+
}
|
|
144
|
+
isLarge.value = false;
|
|
145
|
+
let anchor = getAnchor(blurSize.w);
|
|
146
|
+
width.value = blurSize.w;
|
|
147
|
+
height.value = blurSize.h;
|
|
148
|
+
props.query.updateItemSize(
|
|
149
|
+
props.query.index,
|
|
150
|
+
{
|
|
151
|
+
width: width.value,
|
|
152
|
+
height: blurSize.h, //布局的高度不需要改变, 只需要改宽
|
|
153
|
+
},
|
|
154
|
+
{ ...animInfo, anchor: anchor }
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
clearTimeout(timeoutHandler);
|
|
159
|
+
timeoutHandler = -1;
|
|
160
|
+
props.itemOnBlur?.();
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const onClick = () => {
|
|
164
|
+
props.itemOnClick?.();
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const onGaze = () => {
|
|
168
|
+
props.itemOnGaze?.();
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const onIgnore = () => {
|
|
172
|
+
props.itemOnIgnore?.();
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
props.onAction.register("onFocus", onFocus);
|
|
176
|
+
props.onAction.register("onBlur", onBlur);
|
|
177
|
+
props.onAction.register("onClick", onClick);
|
|
178
|
+
props.onAction.register("onGaze", onGaze);
|
|
179
|
+
props.onAction.register("onIgnore", onIgnore);
|
|
180
|
+
|
|
181
|
+
onBeforeUnmount(() => {
|
|
182
|
+
clearTimeout(timeoutHandler);
|
|
183
|
+
timeoutHandler = -1;
|
|
184
|
+
styleSheets.removeRule(scaleupAnim);
|
|
185
|
+
styleSheets.removeRule(scaledownAnim);
|
|
186
|
+
});
|
|
187
|
+
</script>
|
|
188
|
+
|
|
189
|
+
<template>
|
|
190
|
+
<div
|
|
191
|
+
:style="{
|
|
192
|
+
top: top,
|
|
193
|
+
width: width,
|
|
194
|
+
height: height,
|
|
195
|
+
transition: transitionStr,
|
|
196
|
+
overflow: 'hidden',
|
|
197
|
+
}"
|
|
198
|
+
@transitionend="onTransitionDone"
|
|
199
|
+
>
|
|
200
|
+
<div
|
|
201
|
+
:style="{
|
|
202
|
+
width: width,
|
|
203
|
+
height: height,
|
|
204
|
+
animation: animation,
|
|
205
|
+
}"
|
|
206
|
+
@animationend="onAnimEnd"
|
|
207
|
+
>
|
|
208
|
+
<div v-if="showLarge">
|
|
209
|
+
<slot name="large"></slot>
|
|
210
|
+
</div>
|
|
211
|
+
<div v-else>
|
|
212
|
+
<slot name="small" :focused="focused"></slot>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
<div
|
|
217
|
+
:style="{
|
|
218
|
+
top: top,
|
|
219
|
+
transition: edgeTransition,
|
|
220
|
+
}"
|
|
221
|
+
>
|
|
222
|
+
<slot name="left"></slot>
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
<div
|
|
226
|
+
:style="{
|
|
227
|
+
left: rightSlotLeft,
|
|
228
|
+
top: top,
|
|
229
|
+
transition: edgeTransition,
|
|
230
|
+
}"
|
|
231
|
+
>
|
|
232
|
+
<slot name="right"></slot>
|
|
233
|
+
</div>
|
|
234
|
+
</template>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:08
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import {
|
|
8
|
+
ListWidget,
|
|
9
|
+
HORIZONTAL,
|
|
10
|
+
FixPositionSlide,
|
|
11
|
+
} from "jsview";
|
|
12
|
+
import Item from "./Item.vue";
|
|
13
|
+
import { onMounted } from "vue";
|
|
14
|
+
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
name: String,
|
|
17
|
+
provideData: Function,
|
|
18
|
+
measures: Function,
|
|
19
|
+
initFocusId: Number,
|
|
20
|
+
layout: Object,
|
|
21
|
+
onEdge: Function,
|
|
22
|
+
anim: Object,
|
|
23
|
+
padding: Object,
|
|
24
|
+
itemOnClick: Function,
|
|
25
|
+
itemOnGaze: Function,
|
|
26
|
+
itemOnIgnore: Function,
|
|
27
|
+
itemOnFocus: Function,
|
|
28
|
+
itemOnBlur: Function,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const animSetting = {
|
|
32
|
+
duration: props.anim.duration ?? 200,
|
|
33
|
+
easing: props.anim.easing ?? "jsv-ease(0.2, 0.6, 2)",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const fixPositionSlide = new FixPositionSlide({
|
|
37
|
+
fixPercent: 0,
|
|
38
|
+
align: "start",
|
|
39
|
+
...animSetting,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const onEdge = (edgeInfo) => {
|
|
43
|
+
props.onEdge(edgeInfo);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
onMounted(() => {});
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<list-widget
|
|
51
|
+
:name="name"
|
|
52
|
+
:left="layout.left"
|
|
53
|
+
:top="layout.top"
|
|
54
|
+
:width="layout.width"
|
|
55
|
+
:height="layout.height"
|
|
56
|
+
:provideData="provideData"
|
|
57
|
+
:direction="HORIZONTAL"
|
|
58
|
+
:slideSetting="fixPositionSlide"
|
|
59
|
+
:measures="measures"
|
|
60
|
+
:padding="padding"
|
|
61
|
+
:onEdge="onEdge"
|
|
62
|
+
>
|
|
63
|
+
<template #renderItem="{ data, onAction, query }">
|
|
64
|
+
<item
|
|
65
|
+
:data="data"
|
|
66
|
+
:onAction="onAction"
|
|
67
|
+
:query="query"
|
|
68
|
+
:animSetting="animSetting"
|
|
69
|
+
:itemOnClick="itemOnClick"
|
|
70
|
+
:itemOnGaze="itemOnGaze"
|
|
71
|
+
:itemOnIgnore="itemOnIgnore"
|
|
72
|
+
:itemOnFocus="itemOnFocus"
|
|
73
|
+
:itemOnBlur="itemOnBlur"
|
|
74
|
+
:widgetLayout="layout"
|
|
75
|
+
:widgetPadding="padding"
|
|
76
|
+
>
|
|
77
|
+
<template #small="{ focused }">
|
|
78
|
+
<slot name="itemSmall" :data="data" :focused="focused"></slot>
|
|
79
|
+
</template>
|
|
80
|
+
<template #large>
|
|
81
|
+
<slot name="itemLarge" :data="data"></slot>
|
|
82
|
+
</template>
|
|
83
|
+
<template #right="{ width }">
|
|
84
|
+
<slot
|
|
85
|
+
name="itemRightEdge"
|
|
86
|
+
:itemSmallWidth="width"
|
|
87
|
+
:data="data"
|
|
88
|
+
></slot>
|
|
89
|
+
</template>
|
|
90
|
+
<template #left>
|
|
91
|
+
<slot name="itemLeftEdge" :data="data"></slot>
|
|
92
|
+
</template>
|
|
93
|
+
</item>
|
|
94
|
+
</template>
|
|
95
|
+
</list-widget>
|
|
96
|
+
</template>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<jsv-focus-block autoFocus :onAction="{ onKeyDown }">
|
|
3
|
+
<Ripple
|
|
4
|
+
ref="rippleRef"
|
|
5
|
+
:layout="{
|
|
6
|
+
left: 320,
|
|
7
|
+
top: 200,
|
|
8
|
+
width: 640,
|
|
9
|
+
height: 360,
|
|
10
|
+
}"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
:style="{ width: 640, height: 360, backgroundImage: `url(${bg})` }"
|
|
14
|
+
></div>
|
|
15
|
+
</Ripple>
|
|
16
|
+
<div
|
|
17
|
+
:style="{
|
|
18
|
+
width: 640,
|
|
19
|
+
height: 50,
|
|
20
|
+
left: 320,
|
|
21
|
+
top: 100,
|
|
22
|
+
fontSize: 30,
|
|
23
|
+
backgroundColor: '#ffffff77',
|
|
24
|
+
textAlign: 'center',
|
|
25
|
+
}"
|
|
26
|
+
>
|
|
27
|
+
按OK键生成波纹
|
|
28
|
+
</div>
|
|
29
|
+
</jsv-focus-block>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup>
|
|
33
|
+
import Ripple from "./Ripple.vue";
|
|
34
|
+
import { shallowRef } from "vue";
|
|
35
|
+
const bg =
|
|
36
|
+
"https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/TombSweepingDayTest/Raining/RainScene/qingming_bg.jpg";
|
|
37
|
+
|
|
38
|
+
const rippleRef = shallowRef();
|
|
39
|
+
const onKeyDown = (ev) => {
|
|
40
|
+
if (ev.keyCode == 13) {
|
|
41
|
+
const left = Math.round(Math.random() * 500 + 70);
|
|
42
|
+
const top = Math.round(Math.random() * 300 + 30);
|
|
43
|
+
rippleRef.value?.addRipple(
|
|
44
|
+
{
|
|
45
|
+
left,
|
|
46
|
+
top,
|
|
47
|
+
},
|
|
48
|
+
4000
|
|
49
|
+
);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
};
|
|
54
|
+
</script>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :style="{ left: layout.left, top: layout.top }">
|
|
3
|
+
<JsvRipple
|
|
4
|
+
:width="layout.width"
|
|
5
|
+
:height="layout.height"
|
|
6
|
+
ref="rippleViewRef"
|
|
7
|
+
>
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</JsvRipple>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup>
|
|
14
|
+
import { JsvRipple, JsvRippleShape } from "jsview";
|
|
15
|
+
import { shallowRef } from "vue";
|
|
16
|
+
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
/**
|
|
19
|
+
* 布局配置对象
|
|
20
|
+
* @prop {Object} layout
|
|
21
|
+
* @property {string} layout.left 左侧位置(带单位)
|
|
22
|
+
* @property {string} layout.top 顶部位置(带单位)
|
|
23
|
+
* @property {string|number} layout.width 宽度(带单位或数字)
|
|
24
|
+
* @property {string|number} layout.height 高度(带单位或数字)
|
|
25
|
+
*/
|
|
26
|
+
layout: {
|
|
27
|
+
type: Object,
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const rippleViewRef = shallowRef();
|
|
33
|
+
|
|
34
|
+
defineExpose({
|
|
35
|
+
/**
|
|
36
|
+
* 添加涟漪效果
|
|
37
|
+
* @param {Object} position 涟漪起始位置
|
|
38
|
+
* @param {number} position.left 起始位置左坐标
|
|
39
|
+
* @param {number} position.top 起始位置顶坐标
|
|
40
|
+
* @param {number} [duration=3] 涟漪持续时间(单位:秒)
|
|
41
|
+
*/
|
|
42
|
+
addRipple(position, duration = 3) {
|
|
43
|
+
//duration = ln(amplitude) / timeDecay => timeDecay = ln(amplitude) / duration
|
|
44
|
+
const amplitude = 50;
|
|
45
|
+
|
|
46
|
+
const timeDecay = Math.log(amplitude) / (duration);
|
|
47
|
+
|
|
48
|
+
rippleViewRef.value.addSource(
|
|
49
|
+
position.left,
|
|
50
|
+
position.top,
|
|
51
|
+
amplitude,
|
|
52
|
+
{
|
|
53
|
+
type: JsvRippleShape.CIRCLE,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
timeDecay: timeDecay,
|
|
57
|
+
distanceDecay: 8,
|
|
58
|
+
speed: 60,
|
|
59
|
+
frequency: 2,
|
|
60
|
+
waveNum: 2,
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
</script>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Back />
|
|
3
|
+
<Front v-if="frontShow" @hidden="onFrontHidden" />
|
|
4
|
+
<ScreenShootScale
|
|
5
|
+
v-if="showScale"
|
|
6
|
+
:from="from"
|
|
7
|
+
:to="to"
|
|
8
|
+
:duration="duration"
|
|
9
|
+
:easing="easing"
|
|
10
|
+
:fromSource="fromSource"
|
|
11
|
+
:toSource="toSource"
|
|
12
|
+
@animationend="onAnimEnd"
|
|
13
|
+
/>
|
|
14
|
+
</template>
|
|
15
|
+
<script setup>
|
|
16
|
+
import Front from "./Front.vue";
|
|
17
|
+
import Back from "./Back.vue";
|
|
18
|
+
import ScreenShootScale from "./ScreenShootScale.vue";
|
|
19
|
+
import { useFocusHub, JsvTextureStoreApi } from "jsview";
|
|
20
|
+
import { onMounted, ref, provide } from "vue";
|
|
21
|
+
|
|
22
|
+
const showScale = ref(false);
|
|
23
|
+
function capture(divRef) {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
JsvTextureStoreApi.capture2Texture(
|
|
26
|
+
divRef.value,
|
|
27
|
+
(textureName, autoRecycle, w, h) => {
|
|
28
|
+
if (textureName) {
|
|
29
|
+
resolve({
|
|
30
|
+
url: `jsvtexturestore://${textureName}`,
|
|
31
|
+
release: () => {
|
|
32
|
+
console.log("release", textureName);
|
|
33
|
+
JsvTextureStoreApi.deleteTexture(textureName);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
reject();
|
|
38
|
+
}
|
|
39
|
+
if (autoRecycle) {
|
|
40
|
+
// 已经是设置了texture的自动回收,所以不再需要主动调用 JsvTextureStoreApi.deleteTexture 来释放内存
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
false // 自动回收, 不填也行,默认为true
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
let from, to, duration, easing, fromSource, toSource, releaseFunc;
|
|
48
|
+
function start(
|
|
49
|
+
_from,
|
|
50
|
+
_to,
|
|
51
|
+
_duration,
|
|
52
|
+
_easing,
|
|
53
|
+
_fromSource,
|
|
54
|
+
_toSource,
|
|
55
|
+
_releaseFunc
|
|
56
|
+
) {
|
|
57
|
+
showScale.value = true;
|
|
58
|
+
from = _from;
|
|
59
|
+
to = _to;
|
|
60
|
+
duration = _duration;
|
|
61
|
+
easing = _easing;
|
|
62
|
+
fromSource = _fromSource;
|
|
63
|
+
toSource = _toSource;
|
|
64
|
+
releaseFunc = _releaseFunc;
|
|
65
|
+
}
|
|
66
|
+
function onAnimEnd() {
|
|
67
|
+
showScale.value = false;
|
|
68
|
+
releaseFunc?.();
|
|
69
|
+
}
|
|
70
|
+
provide("capture", capture);
|
|
71
|
+
provide("start", start);
|
|
72
|
+
|
|
73
|
+
let targetPosition = {};
|
|
74
|
+
provide("setTarget", (l, t, w, h) => {
|
|
75
|
+
targetPosition.left = l;
|
|
76
|
+
targetPosition.top = t;
|
|
77
|
+
targetPosition.width = w;
|
|
78
|
+
targetPosition.height = h;
|
|
79
|
+
});
|
|
80
|
+
provide("getTarget", () => {
|
|
81
|
+
return Object.assign({}, targetPosition);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const focusHub = useFocusHub();
|
|
85
|
+
const frontShow = ref(true);
|
|
86
|
+
|
|
87
|
+
const onFrontHidden = () => {
|
|
88
|
+
console.log("onHidden");
|
|
89
|
+
focusHub.setFocus("backmw");
|
|
90
|
+
frontShow.value = false;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
onMounted(() => {
|
|
94
|
+
focusHub.setFocus("frontmw");
|
|
95
|
+
});
|
|
96
|
+
</script>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:08
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { MetroWidget, HORIZONTAL } from "jsview";
|
|
8
|
+
import Item from "./Item.vue";
|
|
9
|
+
import { onMounted } from "vue";
|
|
10
|
+
|
|
11
|
+
const randomColor = () => {
|
|
12
|
+
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
13
|
+
return (
|
|
14
|
+
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const provideData = () => {
|
|
19
|
+
const data = [];
|
|
20
|
+
for (let i = 0; i < 10; ++i) {
|
|
21
|
+
data.push({
|
|
22
|
+
width: 200,
|
|
23
|
+
height: 100,
|
|
24
|
+
marginRight: 10,
|
|
25
|
+
marginBottom: 10,
|
|
26
|
+
color: randomColor(),
|
|
27
|
+
content: i,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
data[0].imgUrl =
|
|
31
|
+
"https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/Genie/App/element_228542_icon_20230610184253.jpg";
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const measures = (data) => {
|
|
36
|
+
return {
|
|
37
|
+
width: data.width,
|
|
38
|
+
height: data.height,
|
|
39
|
+
marginRight: data.marginRight,
|
|
40
|
+
marginBottom: data.marginBottom,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// callbacks
|
|
45
|
+
const onEdge = (edgeInfo) => {};
|
|
46
|
+
|
|
47
|
+
const onFocus = () => {};
|
|
48
|
+
|
|
49
|
+
const onBlur = () => {};
|
|
50
|
+
|
|
51
|
+
const widgetLayout = {
|
|
52
|
+
left: 50,
|
|
53
|
+
top: 450,
|
|
54
|
+
width: 1000,
|
|
55
|
+
height: 120,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
onMounted(() => {});
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<div
|
|
63
|
+
:style="{
|
|
64
|
+
width: 1280,
|
|
65
|
+
height: 720,
|
|
66
|
+
backgroundColor: '#007788',
|
|
67
|
+
}"
|
|
68
|
+
/>
|
|
69
|
+
<metro-widget
|
|
70
|
+
name="backmw"
|
|
71
|
+
:left="widgetLayout.left"
|
|
72
|
+
:top="widgetLayout.top"
|
|
73
|
+
:width="widgetLayout.width"
|
|
74
|
+
:height="widgetLayout.height"
|
|
75
|
+
:provideData="provideData"
|
|
76
|
+
:direction="HORIZONTAL"
|
|
77
|
+
:measures="measures"
|
|
78
|
+
:onEdge="onEdge"
|
|
79
|
+
:onFocus="onFocus"
|
|
80
|
+
:onBlur="onBlur"
|
|
81
|
+
>
|
|
82
|
+
<template #renderItem="{ data, onAction }">
|
|
83
|
+
<item :data="data" :onAction="onAction" />
|
|
84
|
+
</template>
|
|
85
|
+
</metro-widget>
|
|
86
|
+
</template>
|