@shijiu/jsview-vue-samples 1.9.747
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AnimPicture/App.vue +207 -0
- package/AnimPicture/assets/animated_webp.webp +0 -0
- package/AnimPicture/assets/ball_3.webp +0 -0
- package/AnimPicture/assets/girl_run.gif +0 -0
- package/AnimPicture/assets/quan.webp +0 -0
- package/Basic/App.vue +134 -0
- package/Basic/assets/border.png +0 -0
- package/Basic/assets/border2.png +0 -0
- package/Basic/assets/icon.png +0 -0
- package/Basic/assets/test.jpg +0 -0
- package/Basic/components/ContentBlock.vue +38 -0
- package/Basic/components/FontStyle.css +16 -0
- package/Basic/components/anim/AnimGroup.vue +66 -0
- package/Basic/components/anim/AnimKeyframeBasic.vue +119 -0
- package/Basic/components/anim/AnimKeyframeComposite.vue +52 -0
- package/Basic/components/anim/AnimTransition.vue +157 -0
- package/Basic/components/div/DivBackground.vue +44 -0
- package/Basic/components/div/DivClip.vue +159 -0
- package/Basic/components/div/DivCssScoped.vue +20 -0
- package/Basic/components/div/DivCssVar.vue +53 -0
- package/Basic/components/div/DivGroup1.vue +47 -0
- package/Basic/components/div/DivGroup2.vue +65 -0
- package/Basic/components/div/DivLayout.vue +70 -0
- package/Basic/components/div/DivRadius.vue +65 -0
- package/Basic/components/div/DivTransform.vue +32 -0
- package/Basic/components/img/ImageGroup.vue +31 -0
- package/Basic/components/img/ImgLayout.vue +41 -0
- package/Basic/components/panel/Panel1.vue +55 -0
- package/Basic/components/panel/Panel2.vue +31 -0
- package/Basic/components/panel/TitleBar.vue +29 -0
- package/Basic/components/text/TextAlign.vue +66 -0
- package/Basic/components/text/TextEmoji.vue +26 -0
- package/Basic/components/text/TextFontStyle.vue +89 -0
- package/Basic/components/text/TextGroup1.vue +49 -0
- package/Basic/components/text/TextGroup2.vue +28 -0
- package/Basic/components/text/TextOverflow.vue +110 -0
- package/BasicFocusControl/App.vue +104 -0
- package/BasicFocusControl/components/BaseBlock.vue +50 -0
- package/BasicFocusControl/components/MainArea.vue +83 -0
- package/BasicFocusControl/components/MainAreaLeftBlock.vue +17 -0
- package/BasicFocusControl/components/MainAreaRightBlock.vue +27 -0
- package/BasicFocusControl/components/SideBar.vue +58 -0
- package/BasicFocusControl/components/SideBarBlock.vue +27 -0
- package/Collision/App.vue +452 -0
- package/ColorSpace/App.vue +126 -0
- package/ColorSpace/bmpDemo.bmp +0 -0
- package/ColorSpace/jpegDemo.jpeg +0 -0
- package/ColorSpace/pngDemo.png +0 -0
- package/ColorSpace/pngNoAlphaDemo.png +0 -0
- package/DemoHomepage/App.vue +27 -0
- package/DemoHomepage/components/BodyFrame.vue +95 -0
- package/DemoHomepage/components/Dialog.vue +94 -0
- package/DemoHomepage/components/Item.vue +77 -0
- package/DemoHomepage/components/TabFrame.vue +85 -0
- package/DemoHomepage/router.js +196 -0
- package/DemoHomepage/views/Homepage.vue +195 -0
- package/FilterDemo/AnimatePic.vue +58 -0
- package/FilterDemo/App.vue +159 -0
- package/FilterDemo/VideoLayer.vue +62 -0
- package/FilterDemo/jpegDemo.jpeg +0 -0
- package/FilterDemo/webpDemo.webp +0 -0
- package/FlipCard/App.vue +71 -0
- package/FlipCard/FlipCard.vue +118 -0
- package/FlipCard/assets/blue_egg.png +0 -0
- package/FlipCard/assets/red_egg.png +0 -0
- package/FlipCard/data.js +13 -0
- package/GridDemo/App.vue +215 -0
- package/GridDemo/ButtonBlock.vue +112 -0
- package/GridDemo/FocusItem.vue +37 -0
- package/GridDemo/Item.vue +93 -0
- package/HashHistory/App.vue +115 -0
- package/HashHistory/components/HorizontalButtonList.vue +91 -0
- package/HashHistory/components/Item.vue +60 -0
- package/HashHistory/router.js +41 -0
- package/HashHistory/views/MainPage.vue +57 -0
- package/HashHistory/views/SubPage.vue +66 -0
- package/ImpactStop/App.vue +435 -0
- package/Input/App.vue +164 -0
- package/Input/FullKeyboard.vue +87 -0
- package/Input/InputPanel.vue +131 -0
- package/Input/KeyboardItem.vue +58 -0
- package/LongImage/App.vue +80 -0
- package/LongImage/Button.vue +58 -0
- package/LongImage/ButtonItem.vue +44 -0
- package/LongImage/LongImageScroll.vue +92 -0
- package/LongImage/Scroll.vue +14 -0
- package/LongImage/assets/1280x7200.jpg +0 -0
- package/LongText/App.vue +96 -0
- package/LongText/Button.vue +51 -0
- package/LongText/ButtonItem.vue +44 -0
- package/LongText/LongTextScroll.vue +192 -0
- package/LongText/Scroll.vue +14 -0
- package/Marquee/App.vue +247 -0
- package/Marquee/longText.js +14 -0
- package/MaskClip/App.vue +122 -0
- package/MaskClip/images/mask-025/config.json +29 -0
- package/MaskClip/images/mask-025/res/1.png +0 -0
- package/MaskClip/images/mask-025/res/2.png +0 -0
- package/MaskClip/images/mask-025/res/3.png +0 -0
- package/MaskClip/images/mask-025/res/4.png +0 -0
- package/MaskClip/images/mask-025/res/icon.png +0 -0
- package/MaskClip/images/mask-025/res/stroke.png +0 -0
- package/MaskClip/images/php.jpg +0 -0
- package/MetroWidgetDemos/Advanced/App.vue +46 -0
- package/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
- package/MetroWidgetDemos/Advanced/Buttons.vue +70 -0
- package/MetroWidgetDemos/Advanced/Mixed.vue +77 -0
- package/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
- package/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
- package/MetroWidgetDemos/Advanced/widgets/Widgets.vue +116 -0
- package/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/MetroWidgetDemos/Item.vue +85 -0
- package/MetroWidgetDemos/PerformanceTest/App.vue +210 -0
- package/MetroWidgetDemos/PerformanceTest/Item.vue +90 -0
- package/MetroWidgetDemos/PerformanceTest/assets/bg.jpg +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_content.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_left.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_mid.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/coupon_right.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/focus_border.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/holder_logo.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/jrbm.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_left.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_mid.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/line_right.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/loading.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/logo.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/mcjx.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/tao.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/assets/tmall.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/border.png +0 -0
- package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +386 -0
- package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +129 -0
- package/MetroWidgetDemos/PerformanceTest/data.js +45 -0
- package/MetroWidgetDemos/PingPong/App.vue +135 -0
- package/MetroWidgetDemos/PingPong/AppPage.vue +73 -0
- package/MetroWidgetDemos/PingPong/AppTab.vue +62 -0
- package/MetroWidgetDemos/PingPong/TabItem.vue +84 -0
- package/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
- package/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +75 -0
- package/MetroWidgetDemos/Simple/App.vue +45 -0
- package/MetroWidgetDemos/Simple/RelativeTemplate.vue +111 -0
- package/MetroWidgetDemos/WidgetItem.vue +89 -0
- package/MetroWidgetDemos/data.js +205 -0
- package/NinePatchDemo/App.vue +145 -0
- package/NinePatchDemo/Item.vue +69 -0
- package/NinePatchDemo/assets/border.png +0 -0
- package/Preload/App.vue +135 -0
- package/Preload/Item.vue +32 -0
- package/Preload/data.js +23 -0
- package/Preload/images/awesomeface.png +0 -0
- package/Preload/images/cat.jpg +0 -0
- package/Preload/images/rank.png +0 -0
- package/Preload/images/rank_focus.png +0 -0
- package/Preload/images/rule.png +0 -0
- package/Preload/images/rule_focus.png +0 -0
- package/Preload/images/start.png +0 -0
- package/Preload/images/start_focus.png +0 -0
- package/QrcodeDemo/App.vue +68 -0
- package/ScaleDownNeon/App.vue +107 -0
- package/SoundPool/App.vue +134 -0
- package/SoundPool/bgmusic.mp3 +0 -0
- package/SoundPool/coin.mp3 +0 -0
- package/SoundPool/jump.mp3 +0 -0
- package/SoundPool/lose.mp3 +0 -0
- package/SoundPool/run.mp3 +0 -0
- package/SprayView/App.vue +272 -0
- package/SprayView/assets/snow.png +0 -0
- package/SpriteImage/App.vue +173 -0
- package/SpriteImage/images/cat_run.png +0 -0
- package/SpriteImage/images/egg_break.json +116 -0
- package/SpriteImage/images/egg_break.png +0 -0
- package/SpriteImage/images/sprite.png +0 -0
- package/TextBox/App.vue +91 -0
- package/TextBox/RenderCenter.vue +133 -0
- package/TextBox/RenderLeft.vue +138 -0
- package/TextBox/RenderOneLine.vue +101 -0
- package/TextBox/RenderRight.vue +131 -0
- package/TextShadowDemo/App.vue +91 -0
- package/TextureAnimation/App.vue +336 -0
- package/TextureAnimation/App2.vue +111 -0
- package/TextureAnimation/assets/blackWhiteGrid.png +0 -0
- package/TextureAnimation/assets/light.png +0 -0
- package/TextureAnimation/assets/light2.png +0 -0
- package/TextureAnimation/assets/mask.png +0 -0
- package/TextureAnimation/assets/php.jpg +0 -0
- package/TextureAnimation/assets/php2.png +0 -0
- package/TextureAnimation/assets/swipLight.png +0 -0
- package/TextureSize/App.vue +132 -0
- package/TextureSize/bmpDemo.bmp +0 -0
- package/TextureSize/jpegDemo.jpeg +0 -0
- package/TextureSize/jpgDemo.jpg +0 -0
- package/TextureSize/pngDemo.png +0 -0
- package/TextureSize/pngNoAlphaDemo.png +0 -0
- package/ThrowMoveDemo/AccelerateDemo.vue +116 -0
- package/ThrowMoveDemo/App.vue +114 -0
- package/ThrowMoveDemo/LRParabolicDemo.vue +115 -0
- package/ThrowMoveDemo/TargetDemo.vue +116 -0
- package/ThrowMoveDemo/UDParabolicDemo.vue +121 -0
- package/TouchSample/App.vue +136 -0
- package/TouchSample/Item.vue +103 -0
- package/TouchSample/MetroWidgetHorizontal.vue +144 -0
- package/TouchSample/MetroWidgetVertical.vue +144 -0
- package/TouchSample/TouchContainerHorizontal.vue +160 -0
- package/TouchSample/TouchContainerVertical.vue +160 -0
- package/TouchSample/data.js +81 -0
- package/TransitPage/App.vue +29 -0
- package/VideoDemo/App.vue +121 -0
- package/VideoDemo/components/Button.vue +58 -0
- package/VideoDemo/components/Controllor.vue +197 -0
- package/VideoDemo/components/VideoFrame.vue +140 -0
- package/VisibleSensorDemo/App.vue +234 -0
- package/package.json +17 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* 【界面概述】
|
|
3
|
+
* 展示精灵图的用法,包含动图和切图
|
|
4
|
+
*
|
|
5
|
+
* 【控件介绍】
|
|
6
|
+
* JsvSpriteImg:精灵图控件
|
|
7
|
+
* spriteInfo {object} (必需)精灵图配置信息{frames:[], meta:{}}
|
|
8
|
+
* viewSize {object} (必需){w:0, h:0}
|
|
9
|
+
* imageUrl {string} (必需)图片地址
|
|
10
|
+
* duration {float} (动图必需)动图的时间
|
|
11
|
+
* onAnimEnd {fucntion} 动图结束回调
|
|
12
|
+
* loop {string} 动图的循环次数 infinite/数字,默认为infinite
|
|
13
|
+
* spriteName {string} 动图的名称,默认为null
|
|
14
|
+
* autostart{boolean} 是否自动播放动图
|
|
15
|
+
* controller {SpriteController} 控制动图的对象
|
|
16
|
+
* stop(end_frame) 停止动画 end_frame: "start", "end"
|
|
17
|
+
* start() 开始动画
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
* 【技巧说明】
|
|
21
|
+
* Q: 动图和切图如何实现?
|
|
22
|
+
* A: spriteInfo中的frame有多个时为动图,只有一个时为切图
|
|
23
|
+
*
|
|
24
|
+
* Q: spriteInfo中属性的含义?
|
|
25
|
+
* A: meta.size为整张切图的大小;frames中为每一帧的位置和大小信息,目前仅支持统一大小的帧
|
|
26
|
+
-->
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import { SpriteController, JsvSpriteAnim } from "jsview";
|
|
30
|
+
import spriteImage from "./images/egg_break.png";
|
|
31
|
+
import config_json from "./images/egg_break.json";
|
|
32
|
+
export default {
|
|
33
|
+
components: {
|
|
34
|
+
JsvSpriteAnim,
|
|
35
|
+
},
|
|
36
|
+
setup() {
|
|
37
|
+
return {
|
|
38
|
+
spriteImage: spriteImage,
|
|
39
|
+
config_json: config_json,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
data() {
|
|
43
|
+
console.log(
|
|
44
|
+
"test spriteImage =",
|
|
45
|
+
spriteImage,
|
|
46
|
+
"/n config_json=",
|
|
47
|
+
config_json
|
|
48
|
+
);
|
|
49
|
+
const sprite_info = this._formatInfo();
|
|
50
|
+
console.log("test sprite_into =", sprite_info);
|
|
51
|
+
const view_size = {
|
|
52
|
+
w: sprite_info.maxW,
|
|
53
|
+
h: sprite_info.maxH,
|
|
54
|
+
};
|
|
55
|
+
console.log("test view_size =", view_size);
|
|
56
|
+
return {
|
|
57
|
+
sprite_info,
|
|
58
|
+
view_size,
|
|
59
|
+
spriteController: new SpriteController(),
|
|
60
|
+
show: true,
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
methods: {
|
|
64
|
+
spriteAnimEnd() {
|
|
65
|
+
this.show = false;
|
|
66
|
+
},
|
|
67
|
+
onKeyDown(ev) {
|
|
68
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
69
|
+
this.$router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
},
|
|
74
|
+
_formatInfo() {
|
|
75
|
+
const info = {
|
|
76
|
+
frames: [],
|
|
77
|
+
meta: {
|
|
78
|
+
size: this.config_json.meta.size,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
let frames_ref = info.frames;
|
|
83
|
+
let max_width = 0;
|
|
84
|
+
let max_height = 0;
|
|
85
|
+
|
|
86
|
+
for (let i = 0; i < this.config_json.frames.length; i++) {
|
|
87
|
+
const target = this.config_json.frames[i].spriteSourceSize;
|
|
88
|
+
frames_ref.push({
|
|
89
|
+
target,
|
|
90
|
+
source: this.config_json.frames[i].frame,
|
|
91
|
+
});
|
|
92
|
+
const sprite_with = target.x + target.w;
|
|
93
|
+
const sprite_height = target.y + target.h;
|
|
94
|
+
if (sprite_with > max_width) {
|
|
95
|
+
max_width = sprite_with;
|
|
96
|
+
}
|
|
97
|
+
if (sprite_height > max_height) {
|
|
98
|
+
max_height = sprite_height;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return { info, maxW: max_width, maxH: max_height };
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<template>
|
|
108
|
+
<jsv-focus-block
|
|
109
|
+
autoFocus
|
|
110
|
+
:onAction="{
|
|
111
|
+
onKeyDown: onKeyDown,
|
|
112
|
+
}"
|
|
113
|
+
>
|
|
114
|
+
<div
|
|
115
|
+
:style="{
|
|
116
|
+
textAlign: 'center',
|
|
117
|
+
fontSize: '30px',
|
|
118
|
+
lineHeight: '50px',
|
|
119
|
+
color: '#ffffff',
|
|
120
|
+
left: 200,
|
|
121
|
+
top: 100,
|
|
122
|
+
width: 434,
|
|
123
|
+
height: 50,
|
|
124
|
+
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
125
|
+
}"
|
|
126
|
+
>
|
|
127
|
+
精灵图效果
|
|
128
|
+
</div>
|
|
129
|
+
<!--
|
|
130
|
+
通过show进行 清理精灵图,用于验证精灵图清理后,StyleSheet中cssRules的keyFrame清理工作能正常完成
|
|
131
|
+
-->
|
|
132
|
+
<div
|
|
133
|
+
v-if="this.show"
|
|
134
|
+
:style="{ left: 200, top: 150, transform: 'scale3d(2.5, 2.5, 1)' }"
|
|
135
|
+
>
|
|
136
|
+
<JsvSpriteAnim
|
|
137
|
+
:spriteInfo="sprite_info.info"
|
|
138
|
+
:loop="10"
|
|
139
|
+
:viewSize="view_size"
|
|
140
|
+
:duration="0.8"
|
|
141
|
+
:controller="this.spriteController"
|
|
142
|
+
:autostart="true"
|
|
143
|
+
:onAnimEnd="spriteAnimEnd"
|
|
144
|
+
:imageUrl="spriteImage"
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
<div
|
|
149
|
+
:style="{
|
|
150
|
+
textAlign: 'center',
|
|
151
|
+
fontSize: '30px',
|
|
152
|
+
lineHeight: '50px',
|
|
153
|
+
color: '#ffffff',
|
|
154
|
+
left: 700,
|
|
155
|
+
top: 100,
|
|
156
|
+
width: 434,
|
|
157
|
+
height: 50,
|
|
158
|
+
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
159
|
+
}"
|
|
160
|
+
>
|
|
161
|
+
原始图片
|
|
162
|
+
</div>
|
|
163
|
+
<div
|
|
164
|
+
:style="{
|
|
165
|
+
left: 700,
|
|
166
|
+
top: 150,
|
|
167
|
+
width: 434,
|
|
168
|
+
height: 372,
|
|
169
|
+
backgroundImage: `url(${spriteImage})`,
|
|
170
|
+
}"
|
|
171
|
+
/>
|
|
172
|
+
</jsv-focus-block>
|
|
173
|
+
</template>
|
|
Binary file
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{"frames": [
|
|
2
|
+
|
|
3
|
+
{
|
|
4
|
+
"filename": "image_00.png",
|
|
5
|
+
"frame": {"x":104,"y":2,"w":50,"h":64},
|
|
6
|
+
"rotated": false,
|
|
7
|
+
"trimmed": false,
|
|
8
|
+
"spriteSourceSize": {"x":53,"y":43,"w":50,"h":64},
|
|
9
|
+
"sourceSize": {"w":50,"h":64}
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"filename": "image_01.png",
|
|
13
|
+
"frame": {"x":2,"y":2,"w":48,"h":64},
|
|
14
|
+
"rotated": false,
|
|
15
|
+
"trimmed": false,
|
|
16
|
+
"spriteSourceSize": {"x":55,"y":43,"w":48,"h":64},
|
|
17
|
+
"sourceSize": {"w":48,"h":64}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"filename": "image_02.png",
|
|
21
|
+
"frame": {"x":52,"y":2,"w":50,"h":64},
|
|
22
|
+
"rotated": false,
|
|
23
|
+
"trimmed": false,
|
|
24
|
+
"spriteSourceSize": {"x":55,"y":43,"w":50,"h":64},
|
|
25
|
+
"sourceSize": {"w":50,"h":64}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"filename": "image_03.png",
|
|
29
|
+
"frame": {"x":274,"y":2,"w":64,"h":74},
|
|
30
|
+
"rotated": false,
|
|
31
|
+
"trimmed": false,
|
|
32
|
+
"spriteSourceSize": {"x":54,"y":33,"w":64,"h":74},
|
|
33
|
+
"sourceSize": {"w":64,"h":74}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"filename": "image_04.png",
|
|
37
|
+
"frame": {"x":156,"y":2,"w":56,"h":72},
|
|
38
|
+
"rotated": false,
|
|
39
|
+
"trimmed": false,
|
|
40
|
+
"spriteSourceSize": {"x":47,"y":44,"w":56,"h":72},
|
|
41
|
+
"sourceSize": {"w":56,"h":72}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"filename": "image_05.png",
|
|
45
|
+
"frame": {"x":214,"y":2,"w":58,"h":84},
|
|
46
|
+
"rotated": false,
|
|
47
|
+
"trimmed": false,
|
|
48
|
+
"spriteSourceSize": {"x":46,"y":44,"w":58,"h":84},
|
|
49
|
+
"sourceSize": {"w":58,"h":84}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"filename": "image_06.png",
|
|
53
|
+
"frame": {"x":2,"y":88,"w":92,"h":106},
|
|
54
|
+
"rotated": false,
|
|
55
|
+
"trimmed": false,
|
|
56
|
+
"spriteSourceSize": {"x":32,"y":32,"w":92,"h":106},
|
|
57
|
+
"sourceSize": {"w":92,"h":106}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"filename": "image_07.png",
|
|
61
|
+
"frame": {"x":2,"y":228,"w":142,"h":140},
|
|
62
|
+
"rotated": false,
|
|
63
|
+
"trimmed": false,
|
|
64
|
+
"spriteSourceSize": {"x":8,"y":20,"w":142,"h":140},
|
|
65
|
+
"sourceSize": {"w":142,"h":140}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"filename": "image_08.png",
|
|
69
|
+
"frame": {"x":146,"y":228,"w":142,"h":140},
|
|
70
|
+
"rotated": false,
|
|
71
|
+
"trimmed": false,
|
|
72
|
+
"spriteSourceSize": {"x":8,"y":20,"w":142,"h":140},
|
|
73
|
+
"sourceSize": {"w":142,"h":140}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"filename": "image_09.png",
|
|
77
|
+
"frame": {"x":290,"y":228,"w":142,"h":140},
|
|
78
|
+
"rotated": false,
|
|
79
|
+
"trimmed": false,
|
|
80
|
+
"spriteSourceSize": {"x":8,"y":20,"w":142,"h":140},
|
|
81
|
+
"sourceSize": {"w":142,"h":140}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"filename": "image_10.png",
|
|
85
|
+
"frame": {"x":190,"y":88,"w":136,"h":138},
|
|
86
|
+
"rotated": false,
|
|
87
|
+
"trimmed": false,
|
|
88
|
+
"spriteSourceSize": {"x":11,"y":21,"w":136,"h":138},
|
|
89
|
+
"sourceSize": {"w":136,"h":138}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"filename": "image_11.png",
|
|
93
|
+
"frame": {"x":96,"y":88,"w":92,"h":88},
|
|
94
|
+
"rotated": false,
|
|
95
|
+
"trimmed": false,
|
|
96
|
+
"spriteSourceSize": {"x":33,"y":26,"w":92,"h":88},
|
|
97
|
+
"sourceSize": {"w":92,"h":88}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"filename": "image_12.png",
|
|
101
|
+
"frame": {"x":340,"y":2,"w":88,"h":84},
|
|
102
|
+
"rotated": false,
|
|
103
|
+
"trimmed": false,
|
|
104
|
+
"spriteSourceSize": {"x":35,"y":26,"w":88,"h":84},
|
|
105
|
+
"sourceSize": {"w":88,"h":84}
|
|
106
|
+
}],
|
|
107
|
+
"meta": {
|
|
108
|
+
"app": "http://www.texturepacker.com",
|
|
109
|
+
"version": "1.0",
|
|
110
|
+
"image": "egg_1.png",
|
|
111
|
+
"format": "RGBA8888",
|
|
112
|
+
"size": {"w":434,"h":372},
|
|
113
|
+
"scale": "1",
|
|
114
|
+
"smartupdate": "$TexturePacker:SmartUpdate:3ca02d63806cac6ee77822c5f378c4f3$"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
Binary file
|
|
Binary file
|
package/TextBox/App.vue
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* 【界面概述】
|
|
3
|
+
* 展示文字垂直对齐方式显示控件的用法
|
|
4
|
+
*
|
|
5
|
+
* 【控件介绍】
|
|
6
|
+
*
|
|
7
|
+
* JsvTextBox:Vue高阶组件,文字的垂直对齐方式显示控件
|
|
8
|
+
* props说明:
|
|
9
|
+
* verticalAlign {string} 垂直对齐方式 (必需) top、middle、bottom
|
|
10
|
+
* style {object} 样式(必需)
|
|
11
|
+
*
|
|
12
|
+
* 【技巧说明】
|
|
13
|
+
* Q: 如何实现文字居中对齐方式显示?
|
|
14
|
+
* A: verticalAlign属性设置为middle
|
|
15
|
+
*
|
|
16
|
+
* Q: 如何触发控件重绘?
|
|
17
|
+
* A: 1. 变更文字内容,将触发控件重绘,但不会重新解析styles
|
|
18
|
+
-->
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import RenderLeft from "./RenderLeft.vue";
|
|
22
|
+
import RenderRight from "./RenderRight.vue";
|
|
23
|
+
import RenderCenter from "./RenderCenter.vue";
|
|
24
|
+
import RenderOneLine from "./RenderOneLine.vue";
|
|
25
|
+
import { ref, shallowRef } from "vue";
|
|
26
|
+
import { useRouter } from "vue-router";
|
|
27
|
+
|
|
28
|
+
const router = useRouter();
|
|
29
|
+
let offsetX = ref(0);
|
|
30
|
+
let offsetY = ref(0);
|
|
31
|
+
const onLineText = "abcdefghigk";
|
|
32
|
+
const text = `静夜思 --唐李白
|
|
33
|
+
床前明月光,疑是地上霜;
|
|
34
|
+
举头望明月,低头思故乡。`;
|
|
35
|
+
const text_latex = `静夜思 --唐李白
|
|
36
|
+
床前\\textcolor{#FF0000}{明月光},疑是地上霜;
|
|
37
|
+
举头\\textcolor{#0000FF}{望明月},低头思故乡。`;
|
|
38
|
+
|
|
39
|
+
const moveCount = ref(0);
|
|
40
|
+
|
|
41
|
+
const onKeyDown = (ev) => {
|
|
42
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
43
|
+
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
switch (ev.keyCode) {
|
|
47
|
+
case 37:
|
|
48
|
+
offsetX.value += 30;
|
|
49
|
+
moveCount.value++;
|
|
50
|
+
break;
|
|
51
|
+
case 39:
|
|
52
|
+
offsetX.value -= 30;
|
|
53
|
+
moveCount.value++;
|
|
54
|
+
break;
|
|
55
|
+
case 38:
|
|
56
|
+
offsetY.value += 30;
|
|
57
|
+
moveCount.value++;
|
|
58
|
+
break;
|
|
59
|
+
case 40:
|
|
60
|
+
offsetY.value -= 30;
|
|
61
|
+
moveCount.value++;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
};
|
|
66
|
+
const onFocus = () => {
|
|
67
|
+
console.log("TextBox getFocus");
|
|
68
|
+
};
|
|
69
|
+
const onBlur = () => {
|
|
70
|
+
console.log("TextBox loseFocus");
|
|
71
|
+
};
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<jsv-focus-block
|
|
76
|
+
autoFocus
|
|
77
|
+
:onAction="{
|
|
78
|
+
onKeyDown: onKeyDown,
|
|
79
|
+
onFocus: onFocus,
|
|
80
|
+
onBlur: onBlur,
|
|
81
|
+
}"
|
|
82
|
+
>
|
|
83
|
+
<div :style="{width:1280, height:720, backgroundColor:'#000000'}"/>
|
|
84
|
+
<div :style="{ top: offsetY, left: offsetX }">
|
|
85
|
+
<RenderLeft :text="text" :moveCount="moveCount" />
|
|
86
|
+
<RenderRight :text="text" />
|
|
87
|
+
<RenderCenter :text="text" :text_latex="text_latex" />
|
|
88
|
+
<RenderOneLine :text="onLineText" />
|
|
89
|
+
</div>
|
|
90
|
+
</jsv-focus-block>
|
|
91
|
+
</template>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { JsvTextBox } from "jsview";
|
|
3
|
+
export default {
|
|
4
|
+
props: {
|
|
5
|
+
text: String,
|
|
6
|
+
text_latex: String,
|
|
7
|
+
},
|
|
8
|
+
components: { JsvTextBox },
|
|
9
|
+
};
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div :style="{ top: 400 }">
|
|
14
|
+
<div
|
|
15
|
+
:style="{
|
|
16
|
+
left: 0,
|
|
17
|
+
top: -50,
|
|
18
|
+
width: 400,
|
|
19
|
+
height: 50,
|
|
20
|
+
fontSize: '20px',
|
|
21
|
+
textAlign: 'left',
|
|
22
|
+
lineHeight: '50px',
|
|
23
|
+
backgroundColor: '#00ff00',
|
|
24
|
+
}"
|
|
25
|
+
>
|
|
26
|
+
整体垂直向上对齐、文字水平居中显示
|
|
27
|
+
</div>
|
|
28
|
+
<JsvTextBox
|
|
29
|
+
:verticalAlign="'top'"
|
|
30
|
+
:style="{
|
|
31
|
+
left: 0,
|
|
32
|
+
top: 0,
|
|
33
|
+
width: 400,
|
|
34
|
+
height: 300,
|
|
35
|
+
backgroundColor: 'rgba(255,255,0,0.5)',
|
|
36
|
+
fontSize: '30px',
|
|
37
|
+
textAlign: 'center',
|
|
38
|
+
lineHeight: '40px',
|
|
39
|
+
}"
|
|
40
|
+
>
|
|
41
|
+
{{ `[TC]${text}` }}
|
|
42
|
+
</JsvTextBox>
|
|
43
|
+
<div
|
|
44
|
+
:style="{
|
|
45
|
+
left: 410,
|
|
46
|
+
top: -50,
|
|
47
|
+
width: 400,
|
|
48
|
+
height: 50,
|
|
49
|
+
fontSize: '20px',
|
|
50
|
+
textAlign: 'left',
|
|
51
|
+
lineHeight: '50px',
|
|
52
|
+
backgroundColor: '#00ff00',
|
|
53
|
+
}"
|
|
54
|
+
>
|
|
55
|
+
整体垂直居中对齐、文字水平居中显示
|
|
56
|
+
</div>
|
|
57
|
+
<JsvTextBox
|
|
58
|
+
:verticalAlign="'middle'"
|
|
59
|
+
:style="{
|
|
60
|
+
left: 410,
|
|
61
|
+
top: 0,
|
|
62
|
+
width: 400,
|
|
63
|
+
height: 300,
|
|
64
|
+
backgroundColor: 'rgba(255,255,0,0.5)',
|
|
65
|
+
fontSize: '30px',
|
|
66
|
+
textAlign: 'center',
|
|
67
|
+
lineHeight: '40px',
|
|
68
|
+
}"
|
|
69
|
+
:enableLatex="true"
|
|
70
|
+
>
|
|
71
|
+
{{ `[MC]${text_latex}` }}
|
|
72
|
+
</JsvTextBox>
|
|
73
|
+
<div
|
|
74
|
+
:style="{
|
|
75
|
+
left: 820,
|
|
76
|
+
top: -50,
|
|
77
|
+
width: 400,
|
|
78
|
+
height: 50,
|
|
79
|
+
fontSize: '20px',
|
|
80
|
+
textAlign: 'left',
|
|
81
|
+
lineHeight: '50px',
|
|
82
|
+
backgroundColor: '#00ff00',
|
|
83
|
+
}"
|
|
84
|
+
>
|
|
85
|
+
整体垂直向下对齐、文字水平居中显示
|
|
86
|
+
</div>
|
|
87
|
+
<JsvTextBox
|
|
88
|
+
:verticalAlign="'bottom'"
|
|
89
|
+
:style="{
|
|
90
|
+
left: 820,
|
|
91
|
+
top: 0,
|
|
92
|
+
width: 400,
|
|
93
|
+
height: 300,
|
|
94
|
+
backgroundColor: 'rgba(255,255,0,0.5)',
|
|
95
|
+
fontSize: '30px',
|
|
96
|
+
textAlign: 'center',
|
|
97
|
+
lineHeight: '40px',
|
|
98
|
+
}"
|
|
99
|
+
>
|
|
100
|
+
{{ `[BC]${text}` }}
|
|
101
|
+
</JsvTextBox>
|
|
102
|
+
|
|
103
|
+
<div
|
|
104
|
+
:style="{
|
|
105
|
+
left: 1240,
|
|
106
|
+
top: -50,
|
|
107
|
+
width: 500,
|
|
108
|
+
height: 50,
|
|
109
|
+
fontSize: '20px',
|
|
110
|
+
textAlign: 'left',
|
|
111
|
+
lineHeight: '50px',
|
|
112
|
+
backgroundColor: '#00ff00',
|
|
113
|
+
}"
|
|
114
|
+
>
|
|
115
|
+
整体垂直居中对齐、文字水平居中显示、行高80px
|
|
116
|
+
</div>
|
|
117
|
+
<JsvTextBox
|
|
118
|
+
:verticalAlign="'middle'"
|
|
119
|
+
:style="{
|
|
120
|
+
left: 1240,
|
|
121
|
+
top: 0,
|
|
122
|
+
width: 500,
|
|
123
|
+
height: 300,
|
|
124
|
+
backgroundColor: 'rgba(255,255,0,0.5)',
|
|
125
|
+
fontSize: '30px',
|
|
126
|
+
textAlign: 'center',
|
|
127
|
+
lineHeight: '80px',
|
|
128
|
+
}"
|
|
129
|
+
>
|
|
130
|
+
{{ `[MC]${text}` }}
|
|
131
|
+
</JsvTextBox>
|
|
132
|
+
</div>
|
|
133
|
+
</template>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { JsvTextBox } from "jsview";
|
|
3
|
+
export default {
|
|
4
|
+
props: {
|
|
5
|
+
text: String,
|
|
6
|
+
moveCount: Number,
|
|
7
|
+
},
|
|
8
|
+
components: { JsvTextBox },
|
|
9
|
+
};
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div :style="{ top: 50 }">
|
|
14
|
+
<div
|
|
15
|
+
:style="{
|
|
16
|
+
left: 0,
|
|
17
|
+
top: -50,
|
|
18
|
+
width: 400,
|
|
19
|
+
height: 50,
|
|
20
|
+
fontSize: '20px',
|
|
21
|
+
textAlign: 'left',
|
|
22
|
+
lineHeight: '50px',
|
|
23
|
+
backgroundColor: '#00ff00',
|
|
24
|
+
}"
|
|
25
|
+
>
|
|
26
|
+
整体向上对齐、文字居左显示
|
|
27
|
+
</div>
|
|
28
|
+
<JsvTextBox
|
|
29
|
+
:verticalAlign="'top'"
|
|
30
|
+
:style="{
|
|
31
|
+
left: 0,
|
|
32
|
+
top: 0,
|
|
33
|
+
width: 400,
|
|
34
|
+
height: 300,
|
|
35
|
+
backgroundColor: 'rgba(255,255,0,0.5)',
|
|
36
|
+
fontSize: '30px',
|
|
37
|
+
textAlign: 'left',
|
|
38
|
+
lineHeight: '40px',
|
|
39
|
+
}"
|
|
40
|
+
>
|
|
41
|
+
{{ `测试文字变化能引起刷新: [${moveCount}]\n[TL]${text}` }}
|
|
42
|
+
</JsvTextBox>
|
|
43
|
+
<div
|
|
44
|
+
:style="{
|
|
45
|
+
left: 410,
|
|
46
|
+
top: -50,
|
|
47
|
+
width: 400,
|
|
48
|
+
height: 50,
|
|
49
|
+
fontSize: '20px',
|
|
50
|
+
textAlign: 'left',
|
|
51
|
+
lineHeight: '50px',
|
|
52
|
+
backgroundColor: '#00ff00',
|
|
53
|
+
}"
|
|
54
|
+
>
|
|
55
|
+
整体垂直居中对齐、文字水平居左显示
|
|
56
|
+
</div>
|
|
57
|
+
<JsvTextBox
|
|
58
|
+
:verticalAlign="'middle'"
|
|
59
|
+
:style="{
|
|
60
|
+
left: 410,
|
|
61
|
+
top: 0,
|
|
62
|
+
width: 400,
|
|
63
|
+
height: 300,
|
|
64
|
+
backgroundColor: 'rgba(255,255,0,0.5)',
|
|
65
|
+
fontSize: '30px',
|
|
66
|
+
textAlign: 'left',
|
|
67
|
+
lineHeight: '40px',
|
|
68
|
+
}"
|
|
69
|
+
>
|
|
70
|
+
{{ `[ML]${text}` }}
|
|
71
|
+
</JsvTextBox>
|
|
72
|
+
<div
|
|
73
|
+
:style="{
|
|
74
|
+
left: 820,
|
|
75
|
+
top: -50,
|
|
76
|
+
width: 400,
|
|
77
|
+
height: 50,
|
|
78
|
+
fontSize: '20px',
|
|
79
|
+
textAlign: 'left',
|
|
80
|
+
lineHeight: '50px',
|
|
81
|
+
backgroundColor: '#00ff00',
|
|
82
|
+
}"
|
|
83
|
+
>
|
|
84
|
+
整体垂直向下对齐、文字水平居左显示
|
|
85
|
+
</div>
|
|
86
|
+
<JsvTextBox
|
|
87
|
+
:verticalAlign="'bottom'"
|
|
88
|
+
:style="{
|
|
89
|
+
left: 820,
|
|
90
|
+
top: 0,
|
|
91
|
+
width: 400,
|
|
92
|
+
height: 300,
|
|
93
|
+
backgroundColor: 'rgba(255,255,0,0.5)',
|
|
94
|
+
fontSize: '30px',
|
|
95
|
+
textAlign: 'left',
|
|
96
|
+
lineHeight: '40px',
|
|
97
|
+
}"
|
|
98
|
+
>
|
|
99
|
+
{{ `[BL]${text}` }}
|
|
100
|
+
</JsvTextBox>
|
|
101
|
+
<div
|
|
102
|
+
:style="{
|
|
103
|
+
left: 1240,
|
|
104
|
+
top: -50,
|
|
105
|
+
width: 500,
|
|
106
|
+
height: 50,
|
|
107
|
+
fontSize: '20px',
|
|
108
|
+
textAlign: 'left',
|
|
109
|
+
lineHeight: '50px',
|
|
110
|
+
backgroundColor: '#00ff00',
|
|
111
|
+
}"
|
|
112
|
+
>
|
|
113
|
+
整体垂直向上对齐、文字水平居左显示、行高80px
|
|
114
|
+
</div>
|
|
115
|
+
<JsvTextBox
|
|
116
|
+
:verticalAlign="'top'"
|
|
117
|
+
:style="{
|
|
118
|
+
left: 1240,
|
|
119
|
+
top: 0,
|
|
120
|
+
width: 500,
|
|
121
|
+
height: 300,
|
|
122
|
+
backgroundColor: 'rgba(255,255,0,0.5)',
|
|
123
|
+
fontSize: '30px',
|
|
124
|
+
textAlign: 'left',
|
|
125
|
+
lineHeight: '80px',
|
|
126
|
+
}"
|
|
127
|
+
className="test"
|
|
128
|
+
>
|
|
129
|
+
{{ `[TL]${text}` }}
|
|
130
|
+
</JsvTextBox>
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
<style scoped>
|
|
135
|
+
.test {
|
|
136
|
+
color: #007788
|
|
137
|
+
}
|
|
138
|
+
</style>
|