@shijiu/jsview-vue-samples 2.3.151-test.0 → 3.0.0-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/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/CssPreprocessor/Scss/PanelData.js +1 -1
- package/CssPreprocessor/Scss/components/scss-group4/ScssMaps.vue +4 -3
- package/CssPreprocessor/Scss/components/scss-group5/ScssImporting.vue +2 -2
- package/DemoForOperator/Bounce/FreeMoveBuilder.js +1 -1
- package/DemoForOperator/Firework1/App.vue +12 -1
- package/DemoForOperator/Firework1/Fireworks.vue +18 -0
- package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +1 -0
- package/DemoForOperator/Focus/Alpha/Item.vue +1 -0
- package/DemoForOperator/Focus/Light/Item.vue +1 -0
- package/DemoForOperator/Focus/Normal/Item.vue +1 -0
- package/DemoForOperator/FrameShadow/FrameShadow.vue +1 -1
- 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/Jigsaw/JigsawFull.vue +12 -7
- package/DemoForOperator/Jigsaw/JigsawSingle.vue +13 -7
- package/DemoForOperator/LongChatBox/App.vue +13 -13
- package/DemoForOperator/LongChatBox/Bubble.vue +78 -66
- package/DemoForOperator/LongChatBox/LongChat.vue +68 -36
- package/DemoForOperator/LongChatBox/testData.js +7 -44
- package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +1 -1
- package/DemoForOperator/routeList.js +8 -2
- package/DemoHomepage/App.vue +74 -1
- package/DemoHomepage/components/BodyFrame.vue +1 -0
- package/DemoHomepage/components/TabFrame.vue +1 -1
- package/DemoHomepage/router.js +723 -160
- package/DemoHomepage/views/Homepage.vue +60 -2
- package/DemoHomepage/watchTest.vue +50 -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/FreeMoveChildAttract/App.vue +18 -8
- package/FreeMoveLink/App.vue +49 -20
- 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 +100 -47
- package/LongImage/Scroll.vue +28 -9
- package/LongText/LongTextScroll.vue +1 -0
- package/Markdown/App.vue +36 -0
- package/Markdown/Bubble.vue +109 -0
- package/Markdown/LongChat.vue +206 -0
- package/Markdown/Markdown/Markdown.vue +156 -0
- package/Markdown/Markdown/index.ts +1 -0
- package/Markdown/Markdown/marked/LICENSE.md +45 -0
- package/Markdown/Markdown/marked/index.ts +2 -0
- package/Markdown/Markdown/marked/marked.d.ts +756 -0
- package/Markdown/Markdown/marked/marked.js +71 -0
- package/Markdown/Markdown/parser.ts +1365 -0
- package/Markdown/data.js +581 -0
- package/MetroWidgetDemos/AI_skills_update.md +2 -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/RenderAccelerate/Item.vue +67 -0
- 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/{TripleWidget → SpatialNav}/Item.vue +1 -8
- package/MetroWidgetDemos/{TripleWidget/WidgetItem.vue → SpatialNav/SimpleFloor.vue} +14 -45
- 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 +22 -7
- package/MetroWidgetDemos/ninePatchFocusPage/Item.vue +7 -5
- package/MetroWidgetDemos/ninePatchFocusPage/focusConstants.js +2 -0
- package/MetroWidgetDemos/routeList.js +203 -12
- 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/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/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/TransitPage/App.vue +2 -0
- package/assets/logo.png +0 -0
- package/package.json +5 -5
- package/DemoForOperator/Genie/geniePakcer/Genie.vue +0 -741
- package/DemoForOperator/LongChatBox/TextManager.ts +0 -147
- package/DemoForOperator/LongChatBox/VirtualList.vue +0 -298
- package/DemoForOperator/LongChatBox/utile.js +0 -331
- 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 -87
- package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +0 -99
- 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/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
|
@@ -1,74 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="{
|
|
4
|
+
top: -markdownTop,
|
|
5
|
+
width: visibleRect.width,
|
|
6
|
+
height: markdownHeight,
|
|
7
|
+
backgroundColor: backgroundColor,
|
|
8
|
+
}"
|
|
9
|
+
></div>
|
|
10
|
+
<Markdown
|
|
11
|
+
ref="markdownRef"
|
|
12
|
+
:layout="{ width: visibleRect.width, height: visibleRect.height }"
|
|
13
|
+
:content="''"
|
|
14
|
+
:enableLatex="false"
|
|
15
|
+
@sizechange="onSizeChange"
|
|
16
|
+
/>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
1
19
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { JsvTextBox } from "@shijiu/jsview-vue";
|
|
20
|
+
import { ref, shallowRef, onBeforeUnmount, onMounted } from "vue";
|
|
21
|
+
import { Markdown } from "../../Markdown/Markdown";
|
|
5
22
|
|
|
6
|
-
|
|
23
|
+
const text = ref("")
|
|
7
24
|
|
|
8
25
|
const emit = defineEmits(["sizechange"]);
|
|
9
26
|
const props = defineProps({
|
|
10
|
-
|
|
27
|
+
messages: Array,
|
|
11
28
|
onDone: Function,
|
|
12
29
|
left: Number,
|
|
13
30
|
visibleRect: Object,
|
|
31
|
+
backgroundColor: String,
|
|
14
32
|
});
|
|
15
33
|
|
|
16
|
-
|
|
34
|
+
//fake data generator
|
|
35
|
+
const generateList = props.messages;
|
|
17
36
|
|
|
18
|
-
function
|
|
19
|
-
|
|
37
|
+
function* testMessageGenerator() {
|
|
38
|
+
for (const chunk of generateList) {
|
|
39
|
+
yield chunk;
|
|
40
|
+
}
|
|
20
41
|
}
|
|
42
|
+
const messageGen = testMessageGenerator();
|
|
21
43
|
|
|
22
|
-
|
|
44
|
+
const addText = () => {
|
|
45
|
+
const result = messageGen.next();
|
|
46
|
+
if (result.done) {
|
|
47
|
+
console.log("所有文本已写入完成");
|
|
48
|
+
markdownRef.value.writeDone();
|
|
49
|
+
props.onDone?.();
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
23
52
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
53
|
+
text.value += result.value;
|
|
54
|
+
|
|
55
|
+
const chunk =
|
|
56
|
+
typeof result.value === "string"
|
|
57
|
+
? result.value
|
|
58
|
+
: String(result.value ?? "");
|
|
59
|
+
markdownRef.value.write(chunk);
|
|
60
|
+
return true;
|
|
61
|
+
};
|
|
27
62
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const textRef = ref("");
|
|
35
|
-
let intervalHandel = -1;
|
|
36
|
-
function start() {
|
|
37
|
-
let currentIndex = 0;
|
|
38
|
-
intervalHandel = setInterval(() => {
|
|
39
|
-
if (currentIndex < props.data.length) {
|
|
40
|
-
textManager.addText(props.data[currentIndex], textRef);
|
|
41
|
-
currentIndex++;
|
|
42
|
-
} else {
|
|
43
|
-
clearInterval(intervalHandel);
|
|
44
|
-
textManager.stopUpdateLineManually();
|
|
45
|
-
props.onDone?.();
|
|
63
|
+
let timeoutHandle = -1;
|
|
64
|
+
const startTestMessage = () => {
|
|
65
|
+
const tick = () => {
|
|
66
|
+
if (!addText()) {
|
|
67
|
+
timeoutHandle = -1;
|
|
68
|
+
return;
|
|
46
69
|
}
|
|
47
|
-
|
|
48
|
-
|
|
70
|
+
timeoutHandle = setTimeout(() => {
|
|
71
|
+
tick();
|
|
72
|
+
}, 80);
|
|
73
|
+
};
|
|
74
|
+
tick();
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const stopTestMessage = () => {
|
|
78
|
+
clearTimeout(timeoutHandle);
|
|
79
|
+
timeoutHandle = -1;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const markdownRef = shallowRef();
|
|
83
|
+
const markdownHeight = ref(0);
|
|
84
|
+
const markdownTop = ref(0);
|
|
85
|
+
let autoSlide = true;
|
|
86
|
+
const onSizeChange = (width, height) => {
|
|
87
|
+
emit("sizechange", height);
|
|
88
|
+
markdownHeight.value = height;
|
|
89
|
+
};
|
|
49
90
|
|
|
50
91
|
onBeforeUnmount(() => {
|
|
51
|
-
|
|
92
|
+
stopTestMessage();
|
|
52
93
|
});
|
|
53
94
|
|
|
54
95
|
onMounted(() => {
|
|
55
|
-
|
|
96
|
+
startTestMessage();
|
|
56
97
|
});
|
|
57
98
|
|
|
58
99
|
function show() {
|
|
59
|
-
|
|
100
|
+
markdownRef.value?.show();
|
|
60
101
|
}
|
|
61
102
|
|
|
62
103
|
function hide() {
|
|
63
|
-
|
|
104
|
+
markdownRef.value?.hide();
|
|
64
105
|
}
|
|
65
106
|
|
|
66
107
|
function setVisibleRectStart(distance) {
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function onSizeChange(height) {
|
|
71
|
-
emit("sizechange", height);
|
|
108
|
+
markdownRef.value?.setVisibleStart(distance);
|
|
72
109
|
}
|
|
73
110
|
|
|
74
111
|
defineExpose({
|
|
@@ -77,28 +114,3 @@ defineExpose({
|
|
|
77
114
|
setVisibleRectStart,
|
|
78
115
|
});
|
|
79
116
|
</script>
|
|
80
|
-
|
|
81
|
-
<template>
|
|
82
|
-
<virtual-list
|
|
83
|
-
:layout="{
|
|
84
|
-
width: visibleRect.width,
|
|
85
|
-
height: visibleRect.height,
|
|
86
|
-
left: left,
|
|
87
|
-
}"
|
|
88
|
-
ref="listRef"
|
|
89
|
-
@sizechange="onSizeChange"
|
|
90
|
-
>
|
|
91
|
-
<template #="{ data }">
|
|
92
|
-
<jsv-text-box
|
|
93
|
-
:enableLatex="true"
|
|
94
|
-
syncDraw="sync"
|
|
95
|
-
:style="{
|
|
96
|
-
width: visibleRect.width,
|
|
97
|
-
...data.style,
|
|
98
|
-
}"
|
|
99
|
-
>
|
|
100
|
-
{{ data.lineNumber + ":" + String(data.text) }}
|
|
101
|
-
</jsv-text-box>
|
|
102
|
-
</template>
|
|
103
|
-
</virtual-list>
|
|
104
|
-
</template>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, reactive } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
data1,
|
|
5
|
+
data2,
|
|
6
|
+
data3,
|
|
7
|
+
} from "./testData.js";
|
|
4
8
|
import Bubble from "./Bubble.vue";
|
|
5
9
|
|
|
6
10
|
//可视范围的位置
|
|
@@ -10,17 +14,30 @@ let visibleStart = ref(0);
|
|
|
10
14
|
let messageList = [];
|
|
11
15
|
let renderList = reactive([]);
|
|
12
16
|
let totalHeight = 0;
|
|
17
|
+
let generating = false;
|
|
13
18
|
|
|
14
|
-
function createMessageItem(
|
|
19
|
+
function createMessageItem(
|
|
20
|
+
key,
|
|
21
|
+
data,
|
|
22
|
+
left,
|
|
23
|
+
top,
|
|
24
|
+
width,
|
|
25
|
+
height,
|
|
26
|
+
backgroundColor
|
|
27
|
+
) {
|
|
15
28
|
let item = {
|
|
16
29
|
key,
|
|
17
30
|
data,
|
|
18
31
|
left: ref(left),
|
|
19
32
|
top: ref(top),
|
|
20
|
-
width: ref(width),
|
|
21
|
-
height: ref(height),
|
|
33
|
+
width: ref(width ?? 0),
|
|
34
|
+
height: ref(height ?? 0),
|
|
22
35
|
ref: null,
|
|
23
|
-
|
|
36
|
+
backgroundColor: backgroundColor,
|
|
37
|
+
onDone() {
|
|
38
|
+
generating = false;
|
|
39
|
+
console.log("onDone");
|
|
40
|
+
},
|
|
24
41
|
onSizeChange(height) {
|
|
25
42
|
this.height.value = height;
|
|
26
43
|
arrangeLayout();
|
|
@@ -53,19 +70,22 @@ function arrangeLayout() {
|
|
|
53
70
|
totalHeight += item.height.value;
|
|
54
71
|
}
|
|
55
72
|
}
|
|
73
|
+
const viewWidth = 400;
|
|
74
|
+
const viewHeight = 600;
|
|
56
75
|
|
|
57
76
|
function updateRenderList() {
|
|
58
77
|
renderList.length = 0;
|
|
59
78
|
if (autoSlideMode) {
|
|
60
79
|
//自动保持一行模式, 根据总高度和可视范围的高度, 计算出可视范围的开始位置
|
|
61
|
-
visibleStart.value =
|
|
80
|
+
visibleStart.value =
|
|
81
|
+
totalHeight > viewHeight ? totalHeight - viewHeight : 0;
|
|
62
82
|
}
|
|
63
83
|
for (let i = 0; i < messageList.length; i++) {
|
|
64
84
|
const item = messageList[i];
|
|
65
85
|
renderList.push(item);
|
|
66
86
|
if (
|
|
67
87
|
item.top.value + item.height.value >= visibleStart.value &&
|
|
68
|
-
item.top.value <= visibleStart.value +
|
|
88
|
+
item.top.value <= visibleStart.value + viewHeight
|
|
69
89
|
) {
|
|
70
90
|
//可见的泡泡, 显示
|
|
71
91
|
item.show();
|
|
@@ -78,35 +98,26 @@ function updateRenderList() {
|
|
|
78
98
|
}
|
|
79
99
|
}
|
|
80
100
|
|
|
81
|
-
|
|
82
|
-
function addData() {
|
|
83
|
-
|
|
101
|
+
const messages = [data1, data2, data3];
|
|
102
|
+
function addData(message) {
|
|
103
|
+
console.log("myt add data")
|
|
84
104
|
const lastItem = messageList[messageList.length - 1];
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
} else {
|
|
95
|
-
item = createMessageItem(
|
|
96
|
-
count,
|
|
97
|
-
data1,
|
|
98
|
-
0,
|
|
99
|
-
lastItem ? lastItem.top.value + lastItem.height.value : 0,
|
|
100
|
-
800,
|
|
101
|
-
100
|
|
102
|
-
);
|
|
103
|
-
}
|
|
105
|
+
const item = createMessageItem(
|
|
106
|
+
messageList.length,
|
|
107
|
+
message,
|
|
108
|
+
messageList.length % 2 == 0 ? 0 : 400,
|
|
109
|
+
lastItem ? lastItem.top.value + lastItem.height.value : 0,
|
|
110
|
+
800,
|
|
111
|
+
100,
|
|
112
|
+
messageList.length % 2 ? "#339933" : "#993333"
|
|
113
|
+
);
|
|
104
114
|
messageList.push(item);
|
|
105
115
|
updateRenderList();
|
|
116
|
+
generating = true;
|
|
106
117
|
}
|
|
107
118
|
|
|
108
119
|
function normalizeSlidePos(pos) {
|
|
109
|
-
return Math.
|
|
120
|
+
return Math.max(Math.min(pos, totalHeight - viewHeight), 0);
|
|
110
121
|
}
|
|
111
122
|
|
|
112
123
|
let autoSlideMode = true;
|
|
@@ -119,15 +130,27 @@ const onKeyDown = (ev) => {
|
|
|
119
130
|
return true;
|
|
120
131
|
case 40:
|
|
121
132
|
visibleStart.value = normalizeSlidePos(visibleStart.value + 100);
|
|
122
|
-
if (visibleStart.value != totalHeight -
|
|
133
|
+
if (visibleStart.value != totalHeight - viewHeight) {
|
|
123
134
|
autoSlideMode = false;
|
|
124
135
|
} else {
|
|
125
136
|
autoSlideMode = true;
|
|
126
137
|
}
|
|
127
138
|
updateRenderList();
|
|
128
139
|
return true;
|
|
129
|
-
case
|
|
130
|
-
|
|
140
|
+
case 49:
|
|
141
|
+
if (!generating) {
|
|
142
|
+
addData(messages[0]);
|
|
143
|
+
}
|
|
144
|
+
return true;
|
|
145
|
+
case 50:
|
|
146
|
+
if (!generating) {
|
|
147
|
+
addData(messages[1]);
|
|
148
|
+
}
|
|
149
|
+
return true;
|
|
150
|
+
case 51:
|
|
151
|
+
if (!generating) {
|
|
152
|
+
addData(messages[2]);
|
|
153
|
+
}
|
|
131
154
|
return true;
|
|
132
155
|
}
|
|
133
156
|
return false;
|
|
@@ -157,12 +180,13 @@ const onKeyDown = (ev) => {
|
|
|
157
180
|
}"
|
|
158
181
|
>
|
|
159
182
|
<bubble
|
|
160
|
-
:
|
|
183
|
+
:messages="item.data"
|
|
161
184
|
:onDone="item.onDone"
|
|
162
185
|
:left="0"
|
|
186
|
+
:backgroundColor="item.backgroundColor"
|
|
163
187
|
:visibleRect="{
|
|
164
|
-
width:
|
|
165
|
-
height:
|
|
188
|
+
width: viewWidth,
|
|
189
|
+
height: viewHeight,
|
|
166
190
|
}"
|
|
167
191
|
@sizechange="item.onSizeChange"
|
|
168
192
|
:ref="item.onRef"
|
|
@@ -170,4 +194,12 @@ const onKeyDown = (ev) => {
|
|
|
170
194
|
</div>
|
|
171
195
|
</template>
|
|
172
196
|
</div>
|
|
197
|
+
<div :style="{
|
|
198
|
+
top: 10,
|
|
199
|
+
left: 900,
|
|
200
|
+
width: 250,
|
|
201
|
+
height: 300,
|
|
202
|
+
color: '#fff',
|
|
203
|
+
fontSize: 20,
|
|
204
|
+
}">{{ "1键: 长文本\n2键: 中文本\n3键: 短文本" }}</div>
|
|
173
205
|
</template>
|