@shijiu/jsview-vue-samples 2.3.0 → 2.3.728-alpha.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/ABImageAlt/App.vue +114 -0
- package/ABImageAlt/Item.vue +133 -0
- package/{MetroWidgetDemos/SkeletonDiagram/assets/imageList.json → ABImageAlt/assets/imageList.js} +9 -1
- package/ABImageAlt/data.js +17 -0
- package/AI_Check_Rules.txt +5 -0
- package/AnimPicture/App.vue +20 -10
- package/ApicSwitch/App.vue +90 -0
- package/ApicSwitch/TabItem.vue +65 -0
- package/ApicSwitch/WebpShow.vue +24 -0
- package/ApicSwitch/data.js +50 -0
- package/Basic/AI_skills_update.md +1 -0
- package/Basic/components/div/ColorFormatTest.vue +93 -0
- package/Basic/components/div/DivRadius.vue +97 -15
- package/Basic/components/div/DivTag3Group.vue +30 -0
- package/Basic/components/img/ImageType.vue +65 -0
- package/Basic/components/panel/Panel2.vue +13 -1
- package/Basic/components/text/TextAlign.vue +7 -1
- package/BlobLoadTest/App.vue +201 -0
- package/BreakLinesApi/App.vue +82 -0
- package/CanvasDrawChart/App.vue +11 -0
- package/CanvasDrawChart/Graph1.vue +104 -0
- package/CanvasDrawChart/Graph2.vue +115 -0
- package/DashPath/App.vue +17 -16
- package/DashPath/AppForOperator.vue +2 -4
- package/DemoForOperator/AnimPic/AnimPic.vue +24 -2
- package/DemoForOperator/Banger/Banger/Banger.vue +73 -9
- package/DemoForOperator/Blur/Blur.vue +146 -0
- package/DemoForOperator/Blur/BlurInOut/BlurInOut.vue +184 -0
- package/DemoForOperator/Blur/BlurInOut/StaticBgSlide.vue +162 -0
- package/DemoForOperator/Blur/BlurPopup/BlurPopup.vue +249 -0
- package/DemoForOperator/BookFlip/App.vue +115 -0
- package/DemoForOperator/BookFlip/BookPage.vue +82 -0
- package/DemoForOperator/Bounce/Bounce.vue +33 -1
- package/DemoForOperator/Bounce/FreeMoveBuilder.js +1 -1
- package/DemoForOperator/ChunLian/Couplets.vue +44 -1
- package/DemoForOperator/ClickSpriteAnim/App.vue +130 -0
- package/DemoForOperator/ClickSpriteAnim/Item.vue +74 -0
- package/DemoForOperator/DominantColor/App.vue +187 -0
- package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +0 -3
- package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +76 -2
- package/DemoForOperator/Firework1/App.vue +13 -2
- package/DemoForOperator/Firework1/Fireworks.vue +68 -11
- package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +30 -1
- package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +27 -2
- package/DemoForOperator/Focus/Alpha/Item.vue +1 -0
- package/DemoForOperator/Focus/Light/Item.vue +1 -0
- package/DemoForOperator/Focus/Light/LightFocusBox.vue +42 -1
- package/DemoForOperator/Focus/Normal/Item.vue +1 -0
- package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +12 -0
- package/DemoForOperator/FrameShadow/App.vue +193 -0
- package/DemoForOperator/FrameShadow/FrameShadow.vue +61 -0
- package/DemoForOperator/FullscreenIn/App.vue +1 -1
- package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +18 -3
- package/DemoForOperator/Genie/App.vue +20 -6
- package/DemoForOperator/Genie/App2.vue +61 -0
- package/DemoForOperator/Genie/geniePakcer/GenieImage.vue +298 -0
- package/DemoForOperator/Genie/geniePakcer/GenieSlot.vue +292 -0
- package/DemoForOperator/Genie/geniePakcer/GenieTools.ts +463 -0
- package/DemoForOperator/GrayFilter/GrayFilter.vue +21 -0
- package/DemoForOperator/Jigsaw/JigsawFull.vue +58 -11
- package/DemoForOperator/Jigsaw/JigsawSingle.vue +47 -9
- package/DemoForOperator/LongChatBox/App.vue +36 -0
- package/DemoForOperator/LongChatBox/Bubble.vue +116 -0
- package/DemoForOperator/LongChatBox/LongChat.vue +204 -0
- package/DemoForOperator/LongChatBox/testData.js +14 -0
- package/DemoForOperator/Particle/Drop/DropParticle.vue +33 -1
- package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +23 -2
- package/DemoForOperator/PosterAnim/PosterAnim.js +21 -0
- package/DemoForOperator/PosterOverflow/PosterOverflow.vue +16 -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/Ripple.vue +16 -1
- 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/Sprite.vue +62 -5
- package/DemoForOperator/Stretch/Stretch/Stretch.vue +52 -2
- package/DemoForOperator/Swiper/App.vue +101 -0
- package/DemoForOperator/Swiper/Item.vue +56 -0
- package/DemoForOperator/Swiper/ParallaxSlide.vue +164 -0
- package/DemoForOperator/TabContent/TabContent/TabContent.vue +39 -1
- 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/Vortex/Vortex.vue +26 -0
- package/DemoForOperator/routeList.js +125 -2
- package/DemoHomepage/App.vue +74 -1
- package/DemoHomepage/components/BodyFrame.vue +5 -0
- package/DemoHomepage/components/Item.vue +11 -0
- package/DemoHomepage/components/TabFrame.vue +1 -1
- package/DemoHomepage/router.js +798 -140
- package/DemoHomepage/views/Homepage.vue +60 -2
- package/DemoHomepage/watchTest.vue +50 -0
- package/DomRenderer/App.vue +133 -0
- package/FilterDemo/AnimatePic.vue +63 -17
- package/FilterDemo/App.vue +3 -3
- package/FlexCellDemo/AI_skills_update.md +4 -0
- package/FlexCellDemo/TestFrame1.vue +12 -2
- package/FlexCellDemo/TestFrame2.vue +10 -1
- package/FlexCellDemo/TestFrame3.vue +114 -59
- package/FpsLimit/App.vue +102 -0
- package/FreeMove/App.vue +24 -279
- package/FreeMove/TestScene1.vue +260 -0
- package/FreeMove/TestScene3.vue +431 -0
- package/FreeMoveChildAttract/App.vue +18 -8
- package/FreeMoveLink/App.vue +51 -22
- package/GiftRain/components/SpriteTranslate.vue +68 -48
- package/HashHistory/App.vue +2 -2
- package/HashHistory/router.js +1 -1
- package/Hover/App.vue +144 -0
- package/HttpRequestSSE/SSEReader.js +200 -0
- package/ImpactStop/App.vue +2 -2
- package/Input/FullKeyboard.vue +3 -3
- package/Input/InputPanel.vue +63 -3
- package/JsvLine/App.vue +53 -38
- package/LatexDemo/App.vue +3 -1
- package/LatexFormula/App.vue +196 -0
- package/LongImage/App.vue +1 -1
- package/LongImage/LongImageScroll.vue +111 -46
- package/LongImage/Scroll.vue +28 -9
- package/LongText/LongTextScroll.vue +14 -1
- package/Markdown/App.vue +36 -0
- package/Markdown/Bubble.vue +109 -0
- package/Markdown/LongChat.vue +216 -0
- package/Markdown/data.js +633 -0
- package/MetroWidgetDemos/AI_skills_update.md +2 -0
- package/MetroWidgetDemos/EpgFlowListType/App.vue +206 -0
- package/MetroWidgetDemos/EpgFlowListType/components/ContentCard.vue +105 -0
- package/MetroWidgetDemos/EpgFlowListType/components/FloorSection.vue +131 -0
- package/MetroWidgetDemos/EpgFlowListType/components/LeftTabItem.vue +41 -0
- package/MetroWidgetDemos/EpgFlowListType/data.js +78 -0
- package/MetroWidgetDemos/ListExpand/ChildItem.vue +130 -0
- package/MetroWidgetDemos/ListExpand/ExpandItem.vue +375 -0
- package/MetroWidgetDemos/ListExpand/ExpandItem1.vue +403 -0
- package/MetroWidgetDemos/ListExpand/assets/arrow-down.png +0 -0
- package/MetroWidgetDemos/ListExpand/assets/up-arrow.png +0 -0
- package/MetroWidgetDemos/ListExpand/components/WidgetListHandler.vue +150 -0
- package/MetroWidgetDemos/ListExpand/index.vue +88 -0
- package/MetroWidgetDemos/ListExpand/list.js +2421 -0
- package/MetroWidgetDemos/RefreshDemo/App.vue +14 -1
- package/MetroWidgetDemos/RenderAccelerate/App.vue +142 -0
- package/MetroWidgetDemos/RenderAccelerate/AppPage.vue +78 -0
- package/MetroWidgetDemos/RenderAccelerate/AppTab.vue +62 -0
- package/MetroWidgetDemos/RenderAccelerate/ContentItem.vue +409 -0
- package/MetroWidgetDemos/{TripleWidget → RenderAccelerate}/Item.vue +6 -3
- package/MetroWidgetDemos/RenderAccelerate/TabItem.vue +100 -0
- package/MetroWidgetDemos/RenderAccelerate/ViewSwiper.vue +215 -0
- package/MetroWidgetDemos/RenderAccelerate/WidgetItem.vue +107 -0
- package/MetroWidgetDemos/SkeletonDiagram/App.vue +35 -8
- package/MetroWidgetDemos/SkeletonDiagram/Item.vue +11 -2
- package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.js +245 -0
- package/MetroWidgetDemos/SkeletonDiagram/data.js +3 -3
- package/MetroWidgetDemos/SpatialNav/App.vue +177 -0
- package/MetroWidgetDemos/SpatialNav/Buttons.vue +83 -0
- package/MetroWidgetDemos/SpatialNav/CustomFocus.vue +57 -0
- package/MetroWidgetDemos/SpatialNav/Item.vue +71 -0
- package/MetroWidgetDemos/SpatialNav/SimpleFloor.vue +86 -0
- package/MetroWidgetDemos/SpatialNav/StepMw.vue +113 -0
- package/MetroWidgetDemos/SpatialNav/TabContent/TabContent.vue +185 -0
- package/MetroWidgetDemos/SpatialNav/TripleSection/TripleSection.vue +69 -0
- package/MetroWidgetDemos/SpatialNav/TripleSection/WidgetItem.vue +100 -0
- package/MetroWidgetDemos/SpatialNav/TvSection/List.vue +75 -0
- package/MetroWidgetDemos/SpatialNav/TvSection/TvSection.vue +91 -0
- package/MetroWidgetDemos/basic2/App.vue +407 -0
- package/MetroWidgetDemos/basic2/Item.vue +68 -0
- package/MetroWidgetDemos/direction/App.vue +22 -0
- package/MetroWidgetDemos/gazeFocusDiff/App.vue +126 -0
- package/MetroWidgetDemos/gazeFocusDiff/Item.vue +87 -0
- package/MetroWidgetDemos/minimalUsage/App.vue +66 -0
- package/MetroWidgetDemos/minimalUsage/Item.vue +54 -0
- package/MetroWidgetDemos/ninePatchFocusPage/App.vue +23 -7
- package/MetroWidgetDemos/ninePatchFocusPage/Item.vue +7 -5
- package/MetroWidgetDemos/ninePatchFocusPage/focusConstants.js +2 -0
- package/MetroWidgetDemos/routeList.js +229 -8
- package/MetroWidgetDemos/slideSetting/App.vue +288 -99
- package/MetroWidgetDemos/zIndex/App.vue +117 -0
- package/MetroWidgetDemos/zIndex/Item.vue +61 -0
- package/NinePatchTester/App.vue +24 -31
- package/PosterPacker/App.vue +2 -2
- package/PreDecode/App.vue +140 -0
- package/ReactiveTest/App.vue +115 -0
- package/ReactiveTest/Item.vue +92 -0
- package/ReactiveTest/assets/imageList.js +245 -0
- package/ReactiveTest/component/TestSmartDiv.vue +50 -0
- package/ReactiveTest/component/TestSmartDivSrcList.vue +74 -0
- package/ReactiveTest/component/TestSmartImage.vue +46 -0
- package/ReactiveTest/component/TestSmartImageSrcList.vue +90 -0
- package/ReactiveTest/component/TestSmartImageStyle.vue +41 -0
- package/ReactiveTest/data.js +49 -0
- package/ScreenToBlob/App.vue +250 -0
- package/ScrollBoxTest/App.vue +52 -28
- package/ScrollBoxTest/ClipBar.vue +64 -2
- package/ScrollBoxTest/NinePatchBar.vue +64 -2
- package/ScrollBoxTest/SizeDivBar.vue +64 -2
- package/SecTorTest/App.vue +9 -3
- package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +3 -3
- package/SyncDecode/App.vue +137 -0
- package/TextSizeLimit/App.vue +211 -0
- package/TextureAnimation/App3.vue +11 -1
- package/TouchWidget/App.vue +90 -5
- package/TouchWidget/WidgetItem.vue +1 -0
- package/TransitPage/App.vue +2 -0
- package/ViewOpacity/App.vue +19 -0
- package/assets/logo.png +0 -0
- package/package.json +1 -1
- package/DashPath/DashPath.vue +0 -118
- package/DemoForOperator/Genie/geniePakcer/Genie.vue +0 -699
- package/DemoForOperator/ScalePoster/App.vue +0 -4
- package/DemoForOperator/ScalePoster/ScalePoster.vue +0 -0
- package/DivMetroPerformance/App.vue +0 -157
- package/DivMetroPerformance/Item.vue +0 -58
- package/DivMetroPerformance/assets/bg.jpg +0 -0
- package/DivMetroPerformance/assets/coupon_content.png +0 -0
- package/DivMetroPerformance/assets/coupon_left.png +0 -0
- package/DivMetroPerformance/assets/coupon_mid.png +0 -0
- package/DivMetroPerformance/assets/coupon_right.png +0 -0
- package/DivMetroPerformance/assets/focus_border.png +0 -0
- package/DivMetroPerformance/assets/holder_logo.png +0 -0
- package/DivMetroPerformance/assets/jrbm.png +0 -0
- package/DivMetroPerformance/assets/line_left.png +0 -0
- package/DivMetroPerformance/assets/line_mid.png +0 -0
- package/DivMetroPerformance/assets/line_right.png +0 -0
- package/DivMetroPerformance/assets/loading.png +0 -0
- package/DivMetroPerformance/assets/logo.png +0 -0
- package/DivMetroPerformance/assets/mcjx.png +0 -0
- package/DivMetroPerformance/assets/tao.png +0 -0
- package/DivMetroPerformance/assets/tmall.png +0 -0
- package/DivMetroPerformance/border.png +0 -0
- package/DivMetroPerformance/components/ContentItem.vue +0 -384
- package/DivMetroPerformance/components/MyTab.vue +0 -129
- package/DivMetroPerformance/data.js +0 -124
- package/DivMetroPerformance/utils/GridItem.vue +0 -28
- package/DivMetroPerformance/utils/GridPlate.vue +0 -85
- package/MediaDemo/App.vue +0 -127
- package/MediaDemo/assets/audio-poster.png +0 -0
- package/MediaDemo/components/Button.vue +0 -69
- package/MediaDemo/components/Controllor.vue +0 -286
- package/MediaDemo/components/StatusBar.vue +0 -100
- package/MediaDemo/components/frames/AudioFrame.vue +0 -39
- package/MediaDemo/components/frames/AudioPoster.vue +0 -48
- package/MediaDemo/components/frames/MediaFrame.vue +0 -153
- package/MediaDemo/components/frames/VideoFrame.vue +0 -39
- package/MetroWidgetDemos/TripleWidget/App.vue +0 -81
- package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +0 -93
- package/MetroWidgetDemos/TripleWidget/WidgetItem.vue +0 -111
- package/Parkour/App.vue +0 -13
- package/Parkour/Common/Context.js +0 -21
- package/Parkour/Common/MatchmanInfo.js +0 -62
- package/Parkour/Common/Random.js +0 -61
- package/Parkour/Common/Sound.js +0 -50
- package/Parkour/appConfig/HOW_TO_CONFIG.md +0 -20
- package/Parkour/appConfig/app.config.mjs +0 -5
- package/Parkour/appConfig/app_sign_private_key_sample.crt +0 -28
- package/Parkour/appConfig/app_sign_public_key_sample.pem +0 -9
- package/Parkour/appConfig/jsview.config.mjs +0 -39
- package/Parkour/assets/Bgimages/bg1.png +0 -0
- package/Parkour/assets/Bgimages/bg2.png +0 -0
- package/Parkour/assets/Bgimages/bg3.png +0 -0
- package/Parkour/assets/Bgimages/bg4.png +0 -0
- package/Parkour/assets/Bgimages/bg5.png +0 -0
- package/Parkour/assets/audio/jump.mp3 +0 -0
- package/Parkour/assets/audio/lose.mp3 +0 -0
- package/Parkour/assets/role_skin1/fail.json +0 -44
- package/Parkour/assets/role_skin1/fail.png +0 -0
- package/Parkour/assets/role_skin1/jump_down.json +0 -20
- package/Parkour/assets/role_skin1/jump_down.png +0 -0
- package/Parkour/assets/role_skin1/jump_up.json +0 -44
- package/Parkour/assets/role_skin1/jump_up.png +0 -0
- package/Parkour/assets/role_skin1/roll.json +0 -44
- package/Parkour/assets/role_skin1/roll.png +0 -0
- package/Parkour/assets/role_skin1/run.json +0 -52
- package/Parkour/assets/role_skin1/run.png +0 -0
- package/Parkour/components/Backdrop.vue +0 -61
- package/Parkour/components/GameSence.vue +0 -602
- package/Parkour/components/Matchman.vue +0 -85
- package/TextureAnimation/utils/FrameCanvasStore.ts +0 -68
- package/TextureAnimation/utils/RotateFrame.vue +0 -146
- package/TextureAnimation/utils/circleHaloMask.png +0 -0
- package/ThrowMoveDemo/AccelerateDemo.vue +0 -85
- package/ThrowMoveDemo/App.vue +0 -104
- package/ThrowMoveDemo/LRParabolicDemo.vue +0 -101
- package/ThrowMoveDemo/TargetDemo.vue +0 -87
- package/ThrowMoveDemo/UDParabolicDemo.vue +0 -92
- /package/{AnimPicture/assets → assets}/animated_webp.webp +0 -0
- /package/{AnimPicture/assets → assets}/ball_3.webp +0 -0
- /package/{AnimPicture/assets → assets}/girl_run.gif +0 -0
- /package/{AnimPicture/assets → assets}/quan.webp +0 -0
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
:style="{
|
|
7
7
|
top: 200,
|
|
8
8
|
left: 400,
|
|
9
|
-
width:
|
|
10
|
-
height:
|
|
9
|
+
width: BOX_WIDTH,
|
|
10
|
+
height: BOX_HEIGHT,
|
|
11
11
|
backgroundColor: '#00F00F',
|
|
12
12
|
}"
|
|
13
13
|
>
|
|
14
14
|
<jsv-free-move-div
|
|
15
15
|
ref="mActRef2"
|
|
16
16
|
:style="{
|
|
17
|
-
width:
|
|
18
|
-
height:
|
|
17
|
+
width: MINI_BOX_WIDTH,
|
|
18
|
+
height: MINI_BOX_HEIGHT,
|
|
19
19
|
backgroundColor: '#FF0000',
|
|
20
20
|
}"
|
|
21
21
|
/>
|
|
@@ -29,6 +29,12 @@ import { JsvFreeMoveDiv, ForgeConst } from "jsview";
|
|
|
29
29
|
import { shallowRef, onMounted, watch } from "vue";
|
|
30
30
|
import { useRouter } from "vue-router";
|
|
31
31
|
|
|
32
|
+
const MINI_BOX_WIDTH = 50;
|
|
33
|
+
const MINI_BOX_HEIGHT = 50;
|
|
34
|
+
|
|
35
|
+
const BOX_WIDTH = 500;
|
|
36
|
+
const BOX_HEIGHT = 350;
|
|
37
|
+
|
|
32
38
|
const router = useRouter();
|
|
33
39
|
const procKeyDown = (ev) => {
|
|
34
40
|
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
@@ -60,12 +66,16 @@ onMounted(() => {
|
|
|
60
66
|
ForgeConst.DragFlags.TOUCH_RECV_LAST_END
|
|
61
67
|
);
|
|
62
68
|
|
|
63
|
-
mActControl1.run([
|
|
69
|
+
mActControl1.run((cmds)=>[cmds.state().setTouchAttractChild(mActControl2)]);
|
|
64
70
|
|
|
65
71
|
console.log(`OnMoved starting onMovement`);
|
|
66
|
-
mActControl2.run([
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
mActControl2.run((cmds)=>[
|
|
73
|
+
cmds.condition({ multiTimes: true })
|
|
74
|
+
.boxPosition(0, 0, BOX_WIDTH - MINI_BOX_WIDTH, BOX_HEIGHT - MINI_BOX_HEIGHT)
|
|
75
|
+
.then([
|
|
76
|
+
cmds.action().stopMoving(true),
|
|
77
|
+
]),
|
|
78
|
+
cmds.condition({ multiTimes: true }) // 通过第二个参数设置回调为多次触发
|
|
69
79
|
.onMovement(12) // 设置x或y移动超过12时才触发回调,以此减少回调的频次,规避js的性能影响
|
|
70
80
|
.then([
|
|
71
81
|
(pointInfo) => {
|
package/FreeMoveLink/App.vue
CHANGED
|
@@ -5,51 +5,80 @@ import { FreeMoveFunc, ForgeConst } from "jsview";
|
|
|
5
5
|
const div1 = ref();
|
|
6
6
|
const div2 = ref();
|
|
7
7
|
|
|
8
|
+
const AREA1_RECT = { left: 50, top: 100, width: 400, height: 400 };
|
|
9
|
+
const ACTOR_SIZE = { width: 60, height: 60 };
|
|
10
|
+
const AREA2_RECT = { left: 500, top: 100, width: 200, height: 200 };
|
|
11
|
+
|
|
8
12
|
const control1 = new FreeMoveFunc.ActControlDebug();
|
|
9
13
|
const control2 = new FreeMoveFunc.ActControlDebug();
|
|
10
14
|
|
|
11
15
|
onMounted(() => {
|
|
12
|
-
const
|
|
16
|
+
const linkNexusNode = FreeMoveFunc.newNexus();
|
|
13
17
|
|
|
14
18
|
let div1View = div1.value.jsvGetProxyView();
|
|
15
19
|
control1.bindForgeView(div1View, true);
|
|
16
20
|
div1View.DragEnables?.(ForgeConst.DragFlags.TOUCH_RECV_MOVE_BIT); // 只激活drag
|
|
17
21
|
|
|
18
|
-
control1.run([
|
|
19
|
-
|
|
22
|
+
control1.run((cmds)=> [
|
|
23
|
+
cmds.condition({ multiTimes: true })
|
|
24
|
+
.boxPosition(0, 0, AREA1_RECT.width - ACTOR_SIZE.width, AREA1_RECT.height - ACTOR_SIZE.height)
|
|
25
|
+
.then([cmds.action().stopMoving(true)]),
|
|
26
|
+
cmds.state().startMovementSync(linkNexusNode,
|
|
27
|
+
0, AREA1_RECT.width - ACTOR_SIZE.width,
|
|
28
|
+
0, AREA1_RECT.height - ACTOR_SIZE.height,
|
|
29
|
+
0b11),
|
|
20
30
|
]);
|
|
21
31
|
|
|
22
32
|
let div2View = div2.value.jsvGetProxyView();
|
|
23
33
|
control2.bindForgeView(div2View, true);
|
|
24
34
|
div2View.DragEnables?.(ForgeConst.DragFlags.TOUCH_RECV_MOVE_BIT); // 只激活drag
|
|
25
|
-
control2.run([
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.movementSync(
|
|
29
|
-
.then([
|
|
35
|
+
control2.run((cmds)=> [
|
|
36
|
+
// div2不设置boxPosition, 按照div1同步过来的坐标, 不应该会超过其尺寸为1/4的背景区域
|
|
37
|
+
cmds.condition({multiTimes: true})
|
|
38
|
+
.movementSync(linkNexusNode)
|
|
39
|
+
.then([cmds.action().ackMovementSync(
|
|
40
|
+
0, AREA2_RECT.width - ACTOR_SIZE.width,
|
|
41
|
+
0, AREA2_RECT.height - ACTOR_SIZE.height,
|
|
42
|
+
0b11, 1)]),
|
|
30
43
|
]);
|
|
31
44
|
});
|
|
32
45
|
</script>
|
|
33
46
|
|
|
34
47
|
<template>
|
|
35
48
|
<div
|
|
36
|
-
ref="div1"
|
|
37
49
|
:style="{
|
|
38
|
-
left:
|
|
39
|
-
top:
|
|
40
|
-
width:
|
|
41
|
-
height:
|
|
42
|
-
backgroundColor: '#
|
|
50
|
+
left: AREA1_RECT.left,
|
|
51
|
+
top: AREA1_RECT.top,
|
|
52
|
+
width: AREA1_RECT.width,
|
|
53
|
+
height: AREA1_RECT.height,
|
|
54
|
+
backgroundColor: '#552222FF',
|
|
43
55
|
}"
|
|
44
|
-
|
|
56
|
+
>
|
|
57
|
+
<div
|
|
58
|
+
ref="div1"
|
|
59
|
+
:style="{
|
|
60
|
+
width: ACTOR_SIZE.width,
|
|
61
|
+
height: ACTOR_SIZE.height,
|
|
62
|
+
backgroundColor: '#FF0000',
|
|
63
|
+
}"
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
45
66
|
<div
|
|
46
|
-
ref="div2"
|
|
47
67
|
:style="{
|
|
48
|
-
left:
|
|
49
|
-
top:
|
|
50
|
-
width:
|
|
51
|
-
height:
|
|
52
|
-
backgroundColor: '#
|
|
68
|
+
left: AREA2_RECT.left,
|
|
69
|
+
top: AREA2_RECT.top,
|
|
70
|
+
width: AREA2_RECT.width,
|
|
71
|
+
height: AREA2_RECT.height,
|
|
72
|
+
backgroundColor: '#220055FF',
|
|
53
73
|
}"
|
|
54
|
-
|
|
74
|
+
>
|
|
75
|
+
<div
|
|
76
|
+
ref="div2"
|
|
77
|
+
:style="{
|
|
78
|
+
width: ACTOR_SIZE.width,
|
|
79
|
+
height: ACTOR_SIZE.height,
|
|
80
|
+
backgroundColor: '#00FF00',
|
|
81
|
+
}"
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
55
84
|
</template>
|
|
@@ -1,72 +1,92 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<JsvActorMove
|
|
3
|
+
:key="`translate${item.key}`"
|
|
4
|
+
ref="translateF"
|
|
5
|
+
:style="{
|
|
6
|
+
left: item.left,
|
|
7
|
+
top: item.top,
|
|
8
|
+
width: item.width,
|
|
9
|
+
height: item.height,
|
|
10
|
+
}"
|
|
11
|
+
:control="_Control"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
:key="`bg${item.key}`"
|
|
15
|
+
ref="translate"
|
|
16
|
+
:style="{
|
|
17
|
+
backgroundImage: `url(${item.src})`,
|
|
18
|
+
left: 0,
|
|
19
|
+
top: 0,
|
|
20
|
+
width: item.width,
|
|
21
|
+
height: item.height,
|
|
22
|
+
}"
|
|
23
|
+
/>
|
|
24
|
+
</JsvActorMove>
|
|
7
25
|
</template>
|
|
8
26
|
|
|
9
27
|
<script setup>
|
|
10
|
-
import { shallowRef, defineProps, onMounted, onBeforeMount } from
|
|
11
|
-
import {
|
|
28
|
+
import { shallowRef, defineProps, onMounted, onBeforeMount } from "vue";
|
|
29
|
+
import {
|
|
30
|
+
JsvActorMove,
|
|
31
|
+
JsvActorMoveControl,
|
|
32
|
+
createImpactTracer,
|
|
33
|
+
createImpactCallback,
|
|
34
|
+
createImpactAutoFroze,
|
|
35
|
+
} from "jsview";
|
|
12
36
|
//定义子ref
|
|
13
|
-
let translate = shallowRef(null)
|
|
37
|
+
let translate = shallowRef(null);
|
|
14
38
|
//定义父ref
|
|
15
|
-
let translateF=shallowRef(null)
|
|
39
|
+
let translateF = shallowRef(null);
|
|
16
40
|
//定义props
|
|
17
41
|
const props = defineProps({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
42
|
+
onDestory: Function,
|
|
43
|
+
item: Object,
|
|
44
|
+
onImpactTracer: Function,
|
|
45
|
+
MoneyBag: Object,
|
|
46
|
+
});
|
|
23
47
|
const control = new JsvActorMoveControl();
|
|
24
48
|
const _Control = control;
|
|
25
49
|
const item = props.item;
|
|
26
50
|
//销毁方法
|
|
27
51
|
const _onDestroy = () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
52
|
+
if (props.onDestory) {
|
|
53
|
+
props.onDestory(props.item.key);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
32
56
|
|
|
33
57
|
let sensor = null;
|
|
34
58
|
|
|
35
59
|
const _InitItemEle = (item, ele) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
sensor = giftrain_sensor;
|
|
51
|
-
}
|
|
60
|
+
if (ele && !item.ele) {
|
|
61
|
+
item.ele = ele;
|
|
62
|
+
if (props.MoneyBag) {
|
|
63
|
+
const giftrain_sensor = createImpactTracer(
|
|
64
|
+
props.MoneyBag,
|
|
65
|
+
ele,
|
|
66
|
+
createImpactCallback(() => {
|
|
67
|
+
props.onImpactTracer(item);
|
|
68
|
+
_onDestroy();
|
|
69
|
+
}) //碰撞即停
|
|
70
|
+
);
|
|
71
|
+
sensor = giftrain_sensor;
|
|
52
72
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
73
|
+
}
|
|
74
|
+
};
|
|
55
75
|
|
|
56
76
|
//挂载时初始化
|
|
57
77
|
onMounted(() => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
78
|
+
_InitItemEle(item, translate.value);
|
|
79
|
+
_Control.moveToY(720 * 1.5 + 30, (720 * 1.5) / item.duration, () => {
|
|
80
|
+
_onDestroy();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
63
83
|
//卸载之前释放碰撞监听者
|
|
64
|
-
onBeforeMount(()=>{
|
|
65
|
-
|
|
66
|
-
sensor.Recycle()
|
|
67
|
-
sensor=null
|
|
68
|
-
|
|
69
|
-
})
|
|
84
|
+
onBeforeMount(() => {
|
|
85
|
+
if (sensor != null) {
|
|
86
|
+
sensor.Recycle();
|
|
87
|
+
sensor = null;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
70
90
|
</script>
|
|
71
91
|
|
|
72
|
-
<style lang="scss" scoped></style>
|
|
92
|
+
<style lang="scss" scoped></style>
|
package/HashHistory/App.vue
CHANGED
package/HashHistory/router.js
CHANGED
package/Hover/App.vue
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="{
|
|
4
|
+
width: 1280,
|
|
5
|
+
height: 720,
|
|
6
|
+
backgroundColor: '#007788',
|
|
7
|
+
}"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
:style="{
|
|
11
|
+
left: 150,
|
|
12
|
+
top: 20,
|
|
13
|
+
width: 1000,
|
|
14
|
+
height: 30,
|
|
15
|
+
fontSize: 20,
|
|
16
|
+
backgroundColor: '#00000077',
|
|
17
|
+
color: '#ffffff',
|
|
18
|
+
textAlign: 'center',
|
|
19
|
+
}"
|
|
20
|
+
>
|
|
21
|
+
{{
|
|
22
|
+
`hover规则: 非父子关系的,只能有一个div是hover状态; 父子关系的,可以在父是hover状态时子也是hover`
|
|
23
|
+
}}
|
|
24
|
+
</div>
|
|
25
|
+
<div
|
|
26
|
+
:style="{
|
|
27
|
+
left: 150,
|
|
28
|
+
top: 150,
|
|
29
|
+
width: 300,
|
|
30
|
+
height: 300,
|
|
31
|
+
backgroundColor: '#990000',
|
|
32
|
+
transform: redHovered ? 'scale3d(1.2, 1.2, 1)' : 'scale3d(1, 1, 1)',
|
|
33
|
+
transition: 'transform 0.3s ease-in-out',
|
|
34
|
+
fontSize: 15,
|
|
35
|
+
}"
|
|
36
|
+
@mouseenter="redEnter"
|
|
37
|
+
@mouseleave="redOut"
|
|
38
|
+
>
|
|
39
|
+
父div
|
|
40
|
+
<div
|
|
41
|
+
:style="{
|
|
42
|
+
width: 100,
|
|
43
|
+
height: 100,
|
|
44
|
+
left: 100,
|
|
45
|
+
top: 100,
|
|
46
|
+
backgroundColor: '#009900',
|
|
47
|
+
transform: greenHovered ? 'scale3d(1.3, 1.3, 1)' : 'scale3d(1, 1, 1)',
|
|
48
|
+
transition: 'transform 0.3s ease-in-out',
|
|
49
|
+
fontSize: 15,
|
|
50
|
+
}"
|
|
51
|
+
@mouseenter="greenEnter"
|
|
52
|
+
@mouseleave="greenOut"
|
|
53
|
+
>
|
|
54
|
+
子div
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<div
|
|
59
|
+
:style="{
|
|
60
|
+
left: 300,
|
|
61
|
+
top: 100,
|
|
62
|
+
width: 200,
|
|
63
|
+
height: 200,
|
|
64
|
+
backgroundColor: '#000099',
|
|
65
|
+
transform: blueHovered ? 'scale3d(1.2, 1.2, 1)' : 'scale3d(1, 1, 1)',
|
|
66
|
+
transition: 'transform 0.3s ease-in-out',
|
|
67
|
+
}"
|
|
68
|
+
@mouseenter="blueEnter"
|
|
69
|
+
@mouseleave="blueOut"
|
|
70
|
+
></div>
|
|
71
|
+
<div
|
|
72
|
+
:style="{
|
|
73
|
+
left: 430,
|
|
74
|
+
top: 250,
|
|
75
|
+
width: 100,
|
|
76
|
+
height: 100,
|
|
77
|
+
}"
|
|
78
|
+
@mouseenter="emptyEnter"
|
|
79
|
+
@mouseleave="emptyOut"
|
|
80
|
+
>
|
|
81
|
+
<div
|
|
82
|
+
:style="{
|
|
83
|
+
width: 100,
|
|
84
|
+
height: 100,
|
|
85
|
+
backgroundColor: '#009900',
|
|
86
|
+
transform: emptyHovered ? 'scale3d(1.3, 1.3, 1)' : 'scale3d(1, 1, 1)',
|
|
87
|
+
transition: 'transform 0.3s ease-in-out',
|
|
88
|
+
fontSize: 15,
|
|
89
|
+
}"
|
|
90
|
+
>
|
|
91
|
+
空texture测试
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</template>
|
|
96
|
+
|
|
97
|
+
<script setup>
|
|
98
|
+
import { ref } from "vue";
|
|
99
|
+
|
|
100
|
+
const greenHovered = ref(false);
|
|
101
|
+
const blueHovered = ref(false);
|
|
102
|
+
const redHovered = ref(false);
|
|
103
|
+
const emptyHovered = ref(false);
|
|
104
|
+
|
|
105
|
+
const blueEnter = () => {
|
|
106
|
+
console.log("blue enter");
|
|
107
|
+
blueHovered.value = true;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const blueOut = () => {
|
|
111
|
+
console.log("blue leave");
|
|
112
|
+
blueHovered.value = false;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const redEnter = () => {
|
|
116
|
+
console.log("red enter");
|
|
117
|
+
redHovered.value = true;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const redOut = () => {
|
|
121
|
+
console.log("red leave");
|
|
122
|
+
redHovered.value = false;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const greenEnter = () => {
|
|
126
|
+
greenHovered.value = true;
|
|
127
|
+
console.log("green enter");
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const greenOut = () => {
|
|
131
|
+
greenHovered.value = false;
|
|
132
|
+
console.log("green leave");
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const emptyEnter = () => {
|
|
136
|
+
emptyHovered.value = true;
|
|
137
|
+
console.log("empty enter");
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const emptyOut = () => {
|
|
141
|
+
emptyHovered.value = false;
|
|
142
|
+
console.log("empty leave");
|
|
143
|
+
};
|
|
144
|
+
</script>
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
class SSEReader {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.url = null;
|
|
4
|
+
this.headers = null;
|
|
5
|
+
this.onNewData = null;
|
|
6
|
+
this.onError = null;
|
|
7
|
+
this.onDone = null;
|
|
8
|
+
this._proccessedLength = 0;
|
|
9
|
+
this._xhr = null; // 保存 XMLHttpRequest 实例,用于取消请求
|
|
10
|
+
this._isAborted = false; // 标记请求是否被主动取消
|
|
11
|
+
/** onprogress 可能收到截断的 SSE 行,与下一段拼接后再解析 */
|
|
12
|
+
this._sseLineCarry = '';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
send(post_or_get, body_json_object) {
|
|
16
|
+
// 如果已有正在进行的请求,先取消它
|
|
17
|
+
if (this._xhr) {
|
|
18
|
+
this.abort();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
this._proccessedLength = 0;
|
|
22
|
+
this._sseLineCarry = '';
|
|
23
|
+
this._isAborted = false; // 重置取消标记
|
|
24
|
+
this._startTime = Date.now();
|
|
25
|
+
let open_url = this.url;
|
|
26
|
+
let xhr = new XMLHttpRequest();
|
|
27
|
+
this._xhr = xhr; // 保存 xhr 实例
|
|
28
|
+
let _this = this;
|
|
29
|
+
xhr.open(post_or_get, open_url);
|
|
30
|
+
xhr.setRequestHeader('Content-Type', 'application/json;charset=utf-8');
|
|
31
|
+
xhr.setRequestHeader('Accept', 'text/event-stream');
|
|
32
|
+
|
|
33
|
+
// 激活JsView的分段式获取功能
|
|
34
|
+
xhr.setRequestHeader('Jsv-Enable-Stream', '1');
|
|
35
|
+
|
|
36
|
+
// 激活JsView的onProgress时传输内容只有增量而非整量功能,避免内存峰值
|
|
37
|
+
xhr.setRequestHeader('Jsv-Increment-Progress', '1');
|
|
38
|
+
|
|
39
|
+
// 用目标对象的header进行覆盖
|
|
40
|
+
console.log('this.headers', JSON.stringify(this.headers));
|
|
41
|
+
if (this.headers) {
|
|
42
|
+
for (let key in this.headers) {
|
|
43
|
+
const value = this.headers[key];
|
|
44
|
+
console.log('key', key, 'value', value);
|
|
45
|
+
xhr.setRequestHeader(key, value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
xhr.onerror = (e) => {
|
|
50
|
+
// 如果请求已被主动取消,不触发错误回调
|
|
51
|
+
if (_this._isAborted || _this._xhr === null) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const duration = _this._startTime ? Date.now() - _this._startTime : 0;
|
|
55
|
+
const urlName = _this._extractPathFromUrl(open_url);
|
|
56
|
+
console.log(`[接口耗时] ${urlName} ${duration}ms (失败)`);
|
|
57
|
+
_this.onError?.(xhr.status, xhr.statusText, e);
|
|
58
|
+
_this._xhr = null;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
xhr.onreadystatechange = function () {
|
|
62
|
+
if (xhr.readyState !== 4) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
// 如果请求已被主动取消,不触发回调
|
|
66
|
+
if (_this._isAborted || _this._xhr === null) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const duration = _this._startTime ? Date.now() - _this._startTime : 0;
|
|
70
|
+
const urlName = _this._extractPathFromUrl(open_url);
|
|
71
|
+
if (xhr.status === 200) {
|
|
72
|
+
console.log(`[接口耗时] ${urlName} ${duration}ms`);
|
|
73
|
+
_this._flushSseCarry();
|
|
74
|
+
_this.onDone?.();
|
|
75
|
+
} else {
|
|
76
|
+
// status 为 0 通常是请求被取消,不触发错误回调
|
|
77
|
+
if (xhr.status === 0) {
|
|
78
|
+
console.log('[SSEReader] 请求被取消,不触发错误回调');
|
|
79
|
+
_this._xhr = null;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
console.log(`[接口耗时] ${urlName} ${duration}ms (失败)`);
|
|
83
|
+
_this.onError?.(xhr.status, xhr.statusText, null);
|
|
84
|
+
}
|
|
85
|
+
// 请求完成后清除 xhr 引用
|
|
86
|
+
_this._xhr = null;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
xhr.onprogress = function (ev) {
|
|
90
|
+
// 如果请求已被主动取消,不处理数据
|
|
91
|
+
if (_this._isAborted || _this._xhr === null) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
let inc_data;
|
|
95
|
+
if (window.JsvCoreApi?.Platform != 'pc-wasm') {
|
|
96
|
+
inc_data = ev.target.responseText;
|
|
97
|
+
console.log('[SSEReader] xhr.onprogress', ev.target.responseText);
|
|
98
|
+
_this._parseSSEWithCarry(inc_data);
|
|
99
|
+
} else {
|
|
100
|
+
inc_data = ev.target.responseText.substring(_this._proccessedLength);
|
|
101
|
+
_this._proccessedLength = ev.target.responseText.length;
|
|
102
|
+
_this._parseSSEWithCarry(inc_data);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
if (body_json_object) {
|
|
107
|
+
xhr.send(JSON.stringify(body_json_object));
|
|
108
|
+
} else {
|
|
109
|
+
xhr.send();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
_extractPathFromUrl(url) {
|
|
114
|
+
if (!url || typeof url !== 'string') return '未知';
|
|
115
|
+
try {
|
|
116
|
+
const parts = url.split('/');
|
|
117
|
+
return parts.length >= 4 ? parts.slice(3).join('/').split('?')[0] : url;
|
|
118
|
+
} catch {
|
|
119
|
+
return '未知';
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 将上一段未以换行结束的片段与本次数据拼接,仅对完整行派发 data:
|
|
125
|
+
*/
|
|
126
|
+
_parseSSEWithCarry(chunk) {
|
|
127
|
+
if (this._isAborted || this._xhr === null) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const text = this._sseLineCarry + chunk;
|
|
131
|
+
const lines = text.split('\n');
|
|
132
|
+
let carry = '';
|
|
133
|
+
if (text.length > 0 && !text.endsWith('\n')) {
|
|
134
|
+
carry = lines.pop() ?? '';
|
|
135
|
+
}
|
|
136
|
+
this._sseLineCarry = carry;
|
|
137
|
+
for (let line of lines) {
|
|
138
|
+
if (line.startsWith('data:')) {
|
|
139
|
+
this.onNewData?.(line.substring(5));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
_flushSseCarry() {
|
|
145
|
+
const c = this._sseLineCarry;
|
|
146
|
+
if (!c) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (c.startsWith('data:')) {
|
|
150
|
+
this.onNewData?.(c.substring(5));
|
|
151
|
+
}
|
|
152
|
+
this._sseLineCarry = '';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 取消当前请求
|
|
157
|
+
*/
|
|
158
|
+
abort() {
|
|
159
|
+
if (this._xhr) {
|
|
160
|
+
this._isAborted = true; // 标记为主动取消
|
|
161
|
+
try {
|
|
162
|
+
this._xhr.abort();
|
|
163
|
+
console.log('[SSEReader] 请求已取消');
|
|
164
|
+
} catch (error) {
|
|
165
|
+
console.warn('[SSEReader] 取消请求失败:', error);
|
|
166
|
+
}
|
|
167
|
+
this._xhr = null;
|
|
168
|
+
}
|
|
169
|
+
this._sseLineCarry = '';
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* 使用方法:
|
|
175
|
+
*
|
|
176
|
+
const reader = new SSEReader();
|
|
177
|
+
reader.url = 'https://dify.ragehealth.cn/lcs-optimize-akb-test/ai_wenzheng';
|
|
178
|
+
reader.headers = {
|
|
179
|
+
'Cache-Control': 'no-cache', // 可选
|
|
180
|
+
};
|
|
181
|
+
reader.onNewData = (data) => {
|
|
182
|
+
console.log(data);
|
|
183
|
+
};
|
|
184
|
+
reader.onError = (status, statusText, error) => {
|
|
185
|
+
console.error(status, statusText, error);
|
|
186
|
+
};
|
|
187
|
+
reader.onDone = () => {
|
|
188
|
+
console.log('done');
|
|
189
|
+
};
|
|
190
|
+
reader.send('POST', {
|
|
191
|
+
'a': '123',
|
|
192
|
+
'b': '456',
|
|
193
|
+
'c': 1,
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// 取消请求
|
|
197
|
+
reader.abort();
|
|
198
|
+
|
|
199
|
+
*/
|
|
200
|
+
export default SSEReader;
|
package/ImpactStop/App.vue
CHANGED
|
@@ -242,7 +242,7 @@ const procKeyDown = (ev) => {
|
|
|
242
242
|
actorControl.run((cmds) => [
|
|
243
243
|
cmds
|
|
244
244
|
.action(0, 0, interactNexus)
|
|
245
|
-
.setSpdAndAccel(7.
|
|
245
|
+
.setSpdAndAccel(7.88, -23, undefined, 1, null, () => {}),
|
|
246
246
|
cmds
|
|
247
247
|
.condition()
|
|
248
248
|
.onNexusEvent(interactNexus, actEvents.SpeedRevertY)
|
|
@@ -256,7 +256,7 @@ const procKeyDown = (ev) => {
|
|
|
256
256
|
actorControl.run((cmds) => [
|
|
257
257
|
cmds
|
|
258
258
|
.action(0, 0, interactNexus)
|
|
259
|
-
.setSpdAndAccel(-7.
|
|
259
|
+
.setSpdAndAccel(-7.88, -23, undefined, 1, null, () => {}),
|
|
260
260
|
cmds
|
|
261
261
|
.condition()
|
|
262
262
|
.onNexusEvent(interactNexus, actEvents.SpeedRevertY)
|