@shijiu/jsview-vue 0.9.684 → 0.9.783
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/dom/bin/jsview-browser-debug-dom.min.js +1 -1
- package/dom/bin/jsview-dom.min.js +1 -1
- package/dom/bin/jsview-engine-js-browser.min.js +1 -1
- package/dom/bin/jsview-forge-define.min.js +1 -1
- package/dom/jsv-engine-js-browser.js +6 -0
- package/dom/target_core_revision.js +4 -4
- package/loader/loader.js +4 -0
- package/package.json +1 -1
- package/patches/node_modules/@vue/cli-service/lib/config/base.js +1 -1
- package/samples/AnimPicture/App.vue +5 -5
- package/samples/Basic/components/div/DivLayout.vue +1 -1
- package/samples/Basic/components/img/ImageGroup.vue +2 -2
- package/samples/Basic/components/img/ImgLayout.vue +79 -15
- package/samples/Basic/components/text/TextDirection.vue +104 -0
- package/samples/Basic/components/text/TextEmoji.vue +1 -1
- package/samples/Basic/components/text/TextGroup1.vue +1 -1
- package/samples/Basic/components/text/TextGroup2.vue +11 -1
- package/samples/BasicFocusControl/components/BaseBlock.vue +2 -2
- package/samples/Collision/App.vue +11 -11
- package/samples/DemoHomepage/App.vue +67 -8
- package/samples/DemoHomepage/components/TabFrame.vue +7 -0
- package/samples/DemoHomepage/router.js +27 -26
- package/samples/DemoHomepage/views/Homepage.vue +89 -98
- package/samples/FilterDemo/App.vue +1 -1
- package/samples/FlipCard/App.vue +2 -2
- package/samples/FlipCard/FlipCard.vue +3 -3
- package/samples/FocusBlockDemos/AutoFocus/App.vue +51 -0
- package/samples/FocusBlockDemos/AutoFocus/BaseBlock.vue +82 -0
- package/samples/FocusBlockDemos/AutoFocus/DialogBlock.vue +89 -0
- package/samples/FocusBlockDemos/AutoFocus/DialogContorls.js +42 -0
- package/samples/FocusBlockDemos/AutoFocus/FocusNamesDefine.js +9 -0
- package/samples/FocusBlockDemos/AutoFocus/PlaneBlock.vue +71 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/App.vue +78 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/BaseBlock.vue +77 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/DownPlaneBlock.vue +83 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/FocusNamesDefine.js +12 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/UpPlaneBlock.vue +83 -0
- package/samples/GridDemo/App.vue +3 -3
- package/samples/GridDemo/ButtonBlock.vue +2 -2
- package/samples/GridDemo/FocusItem.vue +2 -2
- package/samples/GridDemo/Item.vue +1 -1
- package/samples/HashHistory/App.vue +10 -3
- package/samples/HashHistory/components/Item.vue +1 -1
- package/samples/ImpactStop/App.vue +15 -11
- package/samples/Input/InputPanel.vue +1 -1
- package/samples/LongImage/Button.vue +1 -1
- package/samples/LongImage/ButtonItem.vue +1 -1
- package/samples/LongImage/LongImageScroll.vue +2 -2
- package/samples/LongText/App.vue +1 -1
- package/samples/LongText/Button.vue +1 -1
- package/samples/LongText/ButtonItem.vue +1 -1
- package/samples/LongText/LongTextScroll.vue +3 -3
- package/samples/Marquee/App.vue +34 -3
- package/samples/Marquee/longText.js +2 -2
- package/samples/MetroWidgetDemos/PerformanceTest/App.vue +4 -4
- package/samples/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +1 -1
- package/samples/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +3 -3
- package/samples/MetroWidgetDemos/PingPong/App.vue +22 -11
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +5 -5
- package/samples/MetroWidgetDemos/{Item.vue → PingPong/Item.vue} +3 -21
- package/samples/MetroWidgetDemos/PingPong/TabItem.vue +1 -1
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +5 -5
- package/samples/MetroWidgetDemos/{WidgetItem.vue → PingPong/WidgetItem.vue} +8 -4
- package/samples/MetroWidgetDemos/basic/App.vue +162 -0
- package/samples/MetroWidgetDemos/basic/Item.vue +43 -0
- package/samples/MetroWidgetDemos/direction/App.vue +158 -0
- package/samples/MetroWidgetDemos/direction/Item.vue +45 -0
- package/samples/MetroWidgetDemos/focusableItemBasic/App.vue +67 -0
- package/samples/MetroWidgetDemos/{Advanced → focusableItemBasic}/ButtonItem.vue +17 -21
- package/samples/MetroWidgetDemos/focusableItemMetroWidget/App.vue +74 -0
- package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/Item.vue +13 -32
- package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/WidgetItem.vue +12 -12
- package/samples/MetroWidgetDemos/focusableItemMix/App.vue +88 -0
- package/samples/MetroWidgetDemos/focusableItemMix/ButtonItem.vue +86 -0
- package/samples/MetroWidgetDemos/focusableItemMix/Item.vue +43 -0
- package/samples/MetroWidgetDemos/index.js +6 -0
- package/samples/MetroWidgetDemos/layoutType/App.vue +180 -0
- package/samples/MetroWidgetDemos/layoutType/Item.vue +45 -0
- package/samples/MetroWidgetDemos/padding/App.vue +222 -0
- package/samples/MetroWidgetDemos/padding/Item.vue +64 -0
- package/samples/MetroWidgetDemos/routeList.js +64 -0
- package/samples/MetroWidgetDemos/slideSetting/App.vue +225 -0
- package/samples/MetroWidgetDemos/slideSetting/Item.vue +45 -0
- package/samples/NinePatchDemo/App.vue +78 -122
- package/samples/NinePatchDemo/Item.vue +29 -27
- package/samples/Preload/App.vue +1 -1
- package/samples/Preload/Item.vue +1 -1
- package/samples/QrcodeDemo/App.vue +1 -1
- package/samples/SoundPool/App.vue +3 -3
- package/samples/SpriteImage/App.vue +5 -0
- package/samples/Swiper/App.vue +148 -0
- package/samples/TextBox/App.vue +2 -1
- package/samples/TextureAnimation/App2.vue +1 -1
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +33 -47
- package/samples/TouchSample/MetroWidgetHorizontal.vue +1 -1
- package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
- package/samples/TransitPage/App.vue +1 -1
- package/samples/VideoDemo/App.vue +8 -8
- package/samples/VideoDemo/components/Button.vue +1 -1
- package/samples/VideoDemo/components/Controllor.vue +1 -1
- package/samples/VisibleSensorDemo/App.vue +3 -3
- package/scripts/jsview-run-android.js +5 -4
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +4 -4
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +79 -50
- package/utils/JsViewEngineWidget/TemplateParser.js +144 -147
- package/utils/JsViewEngineWidget/WidgetCommon.js +12 -3
- package/utils/JsViewPlugin/BrowserPluginLoader.js +4 -2
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +302 -0
- package/utils/JsViewPlugin/JsvAudio/CheckType.js +68 -0
- package/utils/JsViewPlugin/JsvAudio/Events.js +17 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +176 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBridgeProxy.js +40 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBrowser.vue +46 -0
- package/utils/JsViewPlugin/JsvAudio/PluginLoader.js +140 -0
- package/utils/JsViewPlugin/JsvAudio/index.js +26 -0
- package/utils/JsViewPlugin/JsvAudio/version.js +24 -0
- package/utils/JsViewPlugin/JsvPlayer/index.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
- package/utils/JsViewVueTools/JsvHashHistory.js +34 -8
- package/utils/JsViewVueTools/JsvImpactTracer.js +2 -2
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +46 -8
- package/utils/JsViewVueTools/JsvStyleClass.js +9 -0
- package/utils/{JsViewVueWidget/utils/text.js → JsViewVueTools/JsvTextTools.js} +24 -4
- package/utils/JsViewVueTools/TypeCheckAndSet.js +3 -3
- package/utils/JsViewVueTools/index.js +2 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +5 -7
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +20 -22
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +4 -4
- package/utils/JsViewVueWidget/JsvGrid.vue +1 -9
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +1 -1
- package/utils/JsViewVueWidget/JsvMarquee.vue +91 -20
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvNinePatch.vue +63 -53
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +10 -5
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +2 -2
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +116 -80
- package/utils/JsViewVueWidget/JsvSwiper/index.js +3 -2
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +1 -1
- package/utils/JsViewVueWidget/JsvTextBox.vue +11 -31
- package/utils/JsViewVueWidget/JsvTouchContainer.vue +2 -2
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +5 -5
- package/utils/JsViewVueWidget/index.js +8 -8
- package/samples/MetroWidgetDemos/Advanced/App.vue +0 -46
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +0 -70
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +0 -77
- package/samples/MetroWidgetDemos/Advanced/widgets/Widgets.vue +0 -116
- package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +0 -75
- package/samples/MetroWidgetDemos/Simple/App.vue +0 -45
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +0 -111
- package/samples/MetroWidgetDemos/data.js +0 -205
- package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +0 -35
- package/utils/JsViewVueWidget/utils/index.js +0 -8
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
-->
|
|
67
67
|
<script>
|
|
68
68
|
import { reactive } from "vue";
|
|
69
|
-
import { EdgeDirection } from "jsview/utils/JsViewEngineWidget";
|
|
69
|
+
import { EdgeDirection, FocusMoveType } from "jsview/utils/JsViewEngineWidget";
|
|
70
70
|
|
|
71
71
|
const TAG = "JsvGrid";
|
|
72
72
|
|
|
@@ -93,14 +93,6 @@ class LineType extends UpdateType {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
const FocusMoveType = {
|
|
97
|
-
NO_ADJUST: 0x00000000,
|
|
98
|
-
COLUMN_LOOP: 0x00000001,
|
|
99
|
-
ROW_LOOP: 0x00000001 << 1,
|
|
100
|
-
COLUMN_FIND_NEAR: 0x00000001 << 2,
|
|
101
|
-
ROW_FIND_NEAR: 0x00000001 << 3,
|
|
102
|
-
};
|
|
103
|
-
|
|
104
96
|
export { PageType, LineType, FocusMoveType };
|
|
105
97
|
|
|
106
98
|
export default {
|
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
* text {String} 文字内容
|
|
6
6
|
* style {Object} 样式
|
|
7
7
|
* slideSpeed {int} 滚动速度 px/s, 默认60
|
|
8
|
+
* slideDirection{String} 滚动方向 ste(start to end)/ets(end to start)/ltr/rtl
|
|
8
9
|
* forceSlide {boolean} 短文字是否滚动,默认false
|
|
10
|
+
* 说明
|
|
11
|
+
* JsvMarquee会识别阿拉伯字符自动设置direction
|
|
9
12
|
-->
|
|
10
13
|
|
|
11
14
|
<script setup>
|
|
12
15
|
import { Forge } from "../../dom/jsv-forge-define";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
16
|
+
import { TextTools } from "../JsViewVueTools/JsvTextTools";
|
|
17
|
+
import { shallowRef, computed, toRaw, onMounted, onBeforeUnmount } from "vue";
|
|
15
18
|
|
|
16
19
|
const defaultFontStyle = () => {
|
|
17
20
|
return {
|
|
@@ -20,7 +23,7 @@ const defaultFontStyle = () => {
|
|
|
20
23
|
textAlign: "start",
|
|
21
24
|
lineHeight: "20px",
|
|
22
25
|
whiteSpace: "nowrap",
|
|
23
|
-
direction:
|
|
26
|
+
direction: "ltr",
|
|
24
27
|
};
|
|
25
28
|
};
|
|
26
29
|
const props = defineProps({
|
|
@@ -41,7 +44,7 @@ const props = defineProps({
|
|
|
41
44
|
textAlign: "start",
|
|
42
45
|
lineHeight: "20px",
|
|
43
46
|
whiteSpace: "nowrap",
|
|
44
|
-
direction:
|
|
47
|
+
direction: "ltr,",
|
|
45
48
|
};
|
|
46
49
|
},
|
|
47
50
|
},
|
|
@@ -49,16 +52,33 @@ const props = defineProps({
|
|
|
49
52
|
type: Number,
|
|
50
53
|
default: 60,
|
|
51
54
|
},
|
|
55
|
+
slideDirection: {
|
|
56
|
+
type: String,
|
|
57
|
+
validator(value) {
|
|
58
|
+
// The value must match one of these strings
|
|
59
|
+
return ["ste", "ets", "ltr", "rtl"].includes(value);
|
|
60
|
+
},
|
|
61
|
+
default: "ste",
|
|
62
|
+
},
|
|
52
63
|
forceSlide: {
|
|
53
64
|
type: Boolean,
|
|
54
65
|
default: false,
|
|
55
66
|
},
|
|
56
67
|
});
|
|
57
|
-
const slideDiv =
|
|
58
|
-
const textDiv =
|
|
68
|
+
const slideDiv = shallowRef(null);
|
|
69
|
+
const textDiv = shallowRef(null);
|
|
59
70
|
let animState = 0;
|
|
60
71
|
let animIdleHandler = -1;
|
|
61
72
|
let asyncStartHandler = -1;
|
|
73
|
+
|
|
74
|
+
const _direction = computed(() => {
|
|
75
|
+
if (props.style?.direction == "rtl" || props.style.direction == "ltr") {
|
|
76
|
+
return props.style.direction;
|
|
77
|
+
} else {
|
|
78
|
+
return TextTools.isRtl(props.text) ? "rtl" : "ltr";
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
62
82
|
const fontStyle = computed(() => {
|
|
63
83
|
let { left, top, width, height, ...rest } = props.style;
|
|
64
84
|
let r = defaultFontStyle();
|
|
@@ -67,27 +87,76 @@ const fontStyle = computed(() => {
|
|
|
67
87
|
//滚送时必需start对齐
|
|
68
88
|
r.textAlign = "start";
|
|
69
89
|
}
|
|
90
|
+
r.direction = _direction.value;
|
|
70
91
|
return r;
|
|
71
92
|
});
|
|
93
|
+
|
|
72
94
|
//rtl文字需要先获得文字宽度
|
|
73
95
|
let textWidth =
|
|
74
|
-
fontStyle.value.direction == "rtl"
|
|
96
|
+
fontStyle.value.direction == "rtl"
|
|
97
|
+
? TextTools.getTextWidth(props.text, fontStyle.value)
|
|
98
|
+
: 0;
|
|
75
99
|
const slideDivLeft = computed(() =>
|
|
76
100
|
fontStyle.value.direction == "rtl" && props.style.width < textWidth
|
|
77
101
|
? props.style.width - textWidth
|
|
78
102
|
: 0
|
|
79
103
|
);
|
|
80
104
|
|
|
105
|
+
const getAnimInfo = (state) => {
|
|
106
|
+
const info = {
|
|
107
|
+
start: 0,
|
|
108
|
+
end: 0,
|
|
109
|
+
};
|
|
110
|
+
const isRtl = _direction.value == "rtl";
|
|
111
|
+
if (state == 0) {
|
|
112
|
+
//滚出
|
|
113
|
+
if (isRtl) {
|
|
114
|
+
if (props.slideDirection == "rtl" || props.slideDirection == "ste") {
|
|
115
|
+
info.end = textWidth;
|
|
116
|
+
} else {
|
|
117
|
+
//反向滚动
|
|
118
|
+
info.end = -props.style.width;
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
if (props.slideDirection == "ltr" || props.slideDirection == "ste") {
|
|
122
|
+
info.end = -textWidth;
|
|
123
|
+
} else {
|
|
124
|
+
//反向滚动
|
|
125
|
+
info.end = props.style.width;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
//滚入
|
|
130
|
+
if (isRtl) {
|
|
131
|
+
if (props.slideDirection == "rtl" || props.slideDirection == "ste") {
|
|
132
|
+
info.start = -props.style.width;
|
|
133
|
+
} else {
|
|
134
|
+
//反向滚动
|
|
135
|
+
info.start = textWidth;
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
if (props.slideDirection == "ltr" || props.slideDirection == "ste") {
|
|
139
|
+
info.start = props.style.width;
|
|
140
|
+
} else {
|
|
141
|
+
//反向滚动
|
|
142
|
+
info.start = -textWidth;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return info;
|
|
147
|
+
};
|
|
148
|
+
|
|
81
149
|
const slideStep = () => {
|
|
150
|
+
let animInfo = getAnimInfo(animState);
|
|
82
151
|
if (animState == 0) {
|
|
83
152
|
// 文字从原始位置,移动出屏幕(每次完整移动,停顿1秒)
|
|
84
|
-
let start = 0,
|
|
85
|
-
|
|
153
|
+
// let start = 0,
|
|
154
|
+
// end = fontStyle.value.direction == "rtl" ? textWidth : -textWidth;
|
|
86
155
|
animIdleHandler = setTimeout(() => {
|
|
87
156
|
animIdleHandler = -1;
|
|
88
157
|
const anim = new Forge.TranslateFrameAnimation(
|
|
89
|
-
start,
|
|
90
|
-
end,
|
|
158
|
+
animInfo.start,
|
|
159
|
+
animInfo.end,
|
|
91
160
|
props.slideSpeed,
|
|
92
161
|
true,
|
|
93
162
|
0,
|
|
@@ -106,17 +175,19 @@ const slideStep = () => {
|
|
|
106
175
|
)
|
|
107
176
|
);
|
|
108
177
|
anim.Enable(Forge.AnimationEnable.ReleaseAfterEndCallback);
|
|
109
|
-
toRaw(slideDiv.value.
|
|
178
|
+
toRaw(slideDiv.value).jsvGetProxyView(true).StartAnimation(anim);
|
|
110
179
|
animState = 1;
|
|
111
180
|
}, 1000);
|
|
112
181
|
} else {
|
|
113
182
|
// 文字从屏幕外部,移动回屏幕中的文字原始位置
|
|
114
|
-
let start =
|
|
115
|
-
|
|
116
|
-
|
|
183
|
+
// let start =
|
|
184
|
+
// fontStyle.value.direction == "rtl"
|
|
185
|
+
// ? -props.style.width
|
|
186
|
+
// : props.style.width,
|
|
187
|
+
// end = 0;
|
|
117
188
|
const anim = new Forge.TranslateFrameAnimation(
|
|
118
|
-
start,
|
|
119
|
-
end,
|
|
189
|
+
animInfo.start,
|
|
190
|
+
animInfo.end,
|
|
120
191
|
props.slideSpeed,
|
|
121
192
|
true,
|
|
122
193
|
props.style.width,
|
|
@@ -134,7 +205,7 @@ const slideStep = () => {
|
|
|
134
205
|
null
|
|
135
206
|
)
|
|
136
207
|
);
|
|
137
|
-
toRaw(slideDiv.value.
|
|
208
|
+
toRaw(slideDiv.value.jsvGetProxyView(true)).StartAnimation(anim);
|
|
138
209
|
animState = 0;
|
|
139
210
|
}
|
|
140
211
|
};
|
|
@@ -145,7 +216,7 @@ const stopSlide = () => {
|
|
|
145
216
|
animIdleHandler = -1;
|
|
146
217
|
}
|
|
147
218
|
animState = 0;
|
|
148
|
-
toRaw(slideDiv.value?.
|
|
219
|
+
toRaw(slideDiv.value?.jsvGetProxyView(true))?.StopAnimation();
|
|
149
220
|
};
|
|
150
221
|
|
|
151
222
|
const asyncStartAnim = () => {
|
|
@@ -211,4 +282,4 @@ onBeforeUnmount(() => {
|
|
|
211
282
|
</div>
|
|
212
283
|
</div>
|
|
213
284
|
</div>
|
|
214
|
-
</template>
|
|
285
|
+
</template>
|
|
@@ -110,7 +110,7 @@ export default {
|
|
|
110
110
|
const canvas = window.originDocument.createElement("canvas");
|
|
111
111
|
canvas.style.width = this.style.width + "px";
|
|
112
112
|
canvas.style.height = this.style.height + "px";
|
|
113
|
-
this.$refs.innerView?.
|
|
113
|
+
this.$refs.innerView?.jsvGetProxyView(true).Element.appendChild(canvas);
|
|
114
114
|
|
|
115
115
|
const clip_image = new Image();
|
|
116
116
|
const bg_image = new Image();
|
|
@@ -16,64 +16,77 @@
|
|
|
16
16
|
* waitForInit {boolean} (选填)尺寸为0时是否进行描画(例如: 首次显示不展示动画的场合,设置为true),默认值为true
|
|
17
17
|
-->
|
|
18
18
|
|
|
19
|
-
<script>
|
|
20
|
-
|
|
21
|
-
name: "JsvNinePatch",
|
|
22
|
-
props: {
|
|
23
|
-
style: {
|
|
24
|
-
type: Object,
|
|
25
|
-
default: () => {
|
|
26
|
-
return {};
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
top: { type: Number, default: 0 },
|
|
30
|
-
left: { type: Number, default: 0 },
|
|
31
|
-
waitForInit: { type: Boolean, default: true },
|
|
32
|
-
|
|
33
|
-
imageUrl: { type:String, required: true },
|
|
34
|
-
imageWidth: { type:Number, required: true },
|
|
35
|
-
imageDspWidth: { type:Number, default:0 },
|
|
36
|
-
contentWidth: { type:Number, default: -1},
|
|
37
|
-
centerWidth: { type:Number, default: -1, required: true },
|
|
38
|
-
borderOutset: { type:Number, required: true },
|
|
39
|
-
animTime: Number,
|
|
40
|
-
},
|
|
19
|
+
<script setup>
|
|
20
|
+
import { ref, watchEffect, computed } from "vue";
|
|
41
21
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
return this.style && this.style.width !== 0 && this.style.height !== 0;
|
|
48
|
-
},
|
|
49
|
-
getTransition() {
|
|
50
|
-
let transition = "";
|
|
51
|
-
if (this.animTime) {
|
|
52
|
-
transition = `left ${this.animTime}s, top ${this.animTime}s, width ${this.animTime}s, height ${this.animTime}s`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return transition;
|
|
22
|
+
const props = defineProps({
|
|
23
|
+
style: {
|
|
24
|
+
type: Object,
|
|
25
|
+
default: () => {
|
|
26
|
+
return {};
|
|
56
27
|
},
|
|
57
28
|
},
|
|
29
|
+
top: { type: Number, default: 0 },
|
|
30
|
+
left: { type: Number, default: 0 },
|
|
31
|
+
waitForInit: { type: Boolean, default: true },
|
|
58
32
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
33
|
+
imageUrl: { type: String, required: true },
|
|
34
|
+
imageWidth: { type: Number, required: true },
|
|
35
|
+
imageDspWidth: { type: Number, default: 0 },
|
|
36
|
+
contentWidth: { type: Number, default: -1 },
|
|
37
|
+
centerWidth: { type: Number, default: -1, required: true },
|
|
38
|
+
borderOutset: { type: Number, required: true },
|
|
39
|
+
animTime: { type: Number, default: 0 },
|
|
40
|
+
});
|
|
64
41
|
|
|
65
|
-
|
|
66
|
-
|
|
42
|
+
const isReady = () => {
|
|
43
|
+
if (!props.waitForInit) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return props.style && props.style.width !== 0 && props.style.height !== 0;
|
|
47
|
+
};
|
|
67
48
|
|
|
68
|
-
|
|
49
|
+
const getTransition = () => {
|
|
50
|
+
let transition = "";
|
|
51
|
+
if (props.animTime && props.animTime > 0) {
|
|
52
|
+
transition = `left ${props.animTime}s, top ${props.animTime}s, width ${props.animTime}s, height ${props.animTime}s`;
|
|
53
|
+
}
|
|
69
54
|
|
|
70
|
-
|
|
71
|
-
sliceWidth: slice_width,
|
|
72
|
-
borderDspWidth: Math.ceil(slice_width * image_dsp_width / this.imageWidth), // 跟进图片的缩放信息
|
|
73
|
-
convertedBorderOutset: Math.ceil(this.borderOutset * image_dsp_width / this.imageWidth),
|
|
74
|
-
};
|
|
75
|
-
},
|
|
55
|
+
return transition;
|
|
76
56
|
};
|
|
57
|
+
|
|
58
|
+
let centerWidth = props.contentWidth >= 0 ? props.contentWidth : 0; // 兼容处理,contentWidth变更为centerWidth
|
|
59
|
+
if (props.centerWidth >= 0) {
|
|
60
|
+
centerWidth = props.centerWidth;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const imageDspWidthInner = computed(() =>
|
|
64
|
+
props.imageDspWidth > 0 ? props.imageDspWidth : props.imageWidth
|
|
65
|
+
);
|
|
66
|
+
// slice_width 获取
|
|
67
|
+
const sliceWidth = ref(
|
|
68
|
+
Math.ceil(Math.max(0, (props.imageWidth - centerWidth) / 2))
|
|
69
|
+
);
|
|
70
|
+
const borderDspWidth = ref(
|
|
71
|
+
Math.ceil((sliceWidth.value * imageDspWidthInner.value) / props.imageWidth)
|
|
72
|
+
);
|
|
73
|
+
const convertedBorderOutset = ref(
|
|
74
|
+
Math.ceil((props.borderOutset * imageDspWidthInner.value) / props.imageWidth)
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
watchEffect(() => {
|
|
78
|
+
if (
|
|
79
|
+
(props.style?.width && props.style.width <= imageDspWidthInner.value) ||
|
|
80
|
+
(props.style?.height && props.style.height <= imageDspWidthInner.value)
|
|
81
|
+
) {
|
|
82
|
+
console.warn(
|
|
83
|
+
"JsvNinePatch: style size must be larger than imageDspWidth. style is",
|
|
84
|
+
props.style,
|
|
85
|
+
"imageDspWidth is",
|
|
86
|
+
imageDspWidthInner.value
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
77
90
|
</script>
|
|
78
91
|
|
|
79
92
|
<template>
|
|
@@ -88,6 +101,3 @@ export default {
|
|
|
88
101
|
}"
|
|
89
102
|
/>
|
|
90
103
|
</template>
|
|
91
|
-
|
|
92
|
-
<style scoped>
|
|
93
|
-
</style>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2021-10-12 18:20:43
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime:
|
|
5
|
+
* @LastEditTime: 2022-11-25 18:26:40
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* prop说明:
|
|
13
13
|
* pointRes {string} (必需)粒子图案 可选值: 绝对路径url|url(相对路径url)|#FFFFFF|rbga(255,0,0,1.0)
|
|
14
14
|
* sprayStyle {object} (必需)粒子效果配置
|
|
15
|
+
* ignoreClip {boolean} 无视clipView描画
|
|
15
16
|
*
|
|
16
17
|
* prop中的sprayStyle说明:
|
|
17
18
|
* type {int} (必需)喷射类型 0: 一次喷射 1: 持续喷射
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
<script>
|
|
35
36
|
import { Forge, ForgeExtension } from "../../../dom/jsv-forge-define";
|
|
36
37
|
|
|
37
|
-
let buildForgeView = (pointRes, sprayStyle, sizeRef) => {
|
|
38
|
+
let buildForgeView = (pointRes, sprayStyle, sizeRef, ignoreClip) => {
|
|
38
39
|
if (!pointRes) {
|
|
39
40
|
return -1;
|
|
40
41
|
}
|
|
@@ -56,7 +57,7 @@ let buildForgeView = (pointRes, sprayStyle, sizeRef) => {
|
|
|
56
57
|
texture_manager.GetImage2(image_url, false, null, "RGB_8888", null)
|
|
57
58
|
);
|
|
58
59
|
}
|
|
59
|
-
const spray_view = new Forge.SprayView(texture_setting);
|
|
60
|
+
const spray_view = new Forge.SprayView(texture_setting, ignoreClip);
|
|
60
61
|
const add_num_per_frame = sprayStyle.addNumSpeed
|
|
61
62
|
? sprayStyle.addNumSpeed
|
|
62
63
|
: 0.001;
|
|
@@ -105,6 +106,10 @@ export default {
|
|
|
105
106
|
type: Object,
|
|
106
107
|
required: true,
|
|
107
108
|
},
|
|
109
|
+
ignoreClip: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: false,
|
|
112
|
+
}
|
|
108
113
|
},
|
|
109
114
|
data() {
|
|
110
115
|
return {
|
|
@@ -124,11 +129,11 @@ export default {
|
|
|
124
129
|
},
|
|
125
130
|
},
|
|
126
131
|
created() {
|
|
127
|
-
this.viewId = buildForgeView(this.pointRes, this.sprayStyle, this.size);
|
|
132
|
+
this.viewId = buildForgeView(this.pointRes, this.sprayStyle, this.size, this.ignoreClip);
|
|
128
133
|
},
|
|
129
134
|
updated() {
|
|
130
135
|
this.unloadView();
|
|
131
|
-
this.viewId = buildForgeView(this.pointRes, this.sprayStyle, this.size);
|
|
136
|
+
this.viewId = buildForgeView(this.pointRes, this.sprayStyle, this.size, this.ignoreClip);
|
|
132
137
|
},
|
|
133
138
|
beforeUnmount() {
|
|
134
139
|
this.unloadView();
|
|
@@ -433,8 +433,8 @@ export default {
|
|
|
433
433
|
<template>
|
|
434
434
|
<div id="canvas">
|
|
435
435
|
<div id="clip" :style="{...transform_style.clipStyle}">
|
|
436
|
-
<div id="trans" :style="{...transform_style.transStyle}"
|
|
437
|
-
<div id="image" :style="{...transform_style.imageStyle, animation: blinkAnim}"
|
|
436
|
+
<div id="trans" :style="{...transform_style.transStyle}" @animationend="onAnimEndDelegate">
|
|
437
|
+
<div id="image" :style="{...transform_style.imageStyle, animation: blinkAnim}" @animationend="onBlinkAnimEnd"></div>
|
|
438
438
|
</div>
|
|
439
439
|
</div>
|
|
440
440
|
</div>
|