@shijiu/jsview-vue 0.9.602 → 0.9.684
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 -0
- package/dom/target_core_revision.js +4 -4
- package/package.json +1 -1
- package/samples/Basic/components/text/TextOverflow.vue +10 -5
- package/samples/Collision/App.vue +452 -0
- package/samples/DemoHomepage/components/BodyFrame.vue +2 -0
- package/samples/DemoHomepage/router.js +25 -0
- package/samples/DemoHomepage/views/Homepage.vue +3 -10
- package/samples/ImpactStop/App.vue +435 -0
- package/samples/Input/App.vue +8 -17
- package/samples/Input/InputPanel.vue +18 -11
- package/samples/Marquee/App.vue +176 -40
- package/samples/Marquee/longText.js +14 -0
- package/samples/MetroWidgetDemos/Advanced/App.vue +5 -6
- package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +1 -1
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +5 -5
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +4 -4
- package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
- package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
- package/samples/MetroWidgetDemos/Advanced/{Widgets.vue → widgets/Widgets.vue} +56 -11
- package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/samples/MetroWidgetDemos/Item.vue +20 -2
- package/samples/MetroWidgetDemos/PingPong/App.vue +3 -3
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +17 -2
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +3 -10
- package/samples/MetroWidgetDemos/PingPong/{Item.vue → TabItem.vue} +2 -10
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +2 -2
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +2 -2
- package/samples/MetroWidgetDemos/Simple/App.vue +2 -2
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +4 -4
- package/samples/MetroWidgetDemos/data.js +2 -1
- package/samples/Preload/App.vue +16 -11
- package/samples/ScaleDownNeon/App.vue +107 -0
- package/samples/TextBox/App.vue +7 -81
- package/samples/TextBox/RenderCenter.vue +40 -16
- package/samples/TextBox/RenderLeft.vue +48 -19
- package/samples/TextBox/RenderOneLine.vue +30 -49
- package/samples/TextBox/RenderRight.vue +40 -16
- package/samples/TextShadowDemo/App.vue +11 -17
- package/samples/TextureAnimation/App2.vue +111 -0
- package/samples/TextureAnimation/assets/blackWhiteGrid.png +0 -0
- package/samples/TextureAnimation/assets/light.png +0 -0
- package/samples/TextureAnimation/assets/light2.png +0 -0
- package/samples/TextureAnimation/assets/mask.png +0 -0
- package/samples/TextureSize/App.vue +3 -3
- package/samples/VisibleSensorDemo/App.vue +92 -25
- package/utils/JsViewEngineWidget/MetroWidget/Const.js +11 -0
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +188 -80
- package/utils/JsViewEngineWidget/TemplateParser.js +89 -32
- package/utils/JsViewEngineWidget/WidgetCommon.js +3 -4
- package/utils/JsViewEngineWidget/index.js +3 -2
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +95 -12
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +25 -3
- package/utils/JsViewPlugin/JsvPlayer/index.js +22 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
- package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
- package/utils/JsViewVueTools/index.js +2 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +203 -14
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +2 -2
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +4 -2
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +13 -12
- package/utils/JsViewVueWidget/JsvMarquee.vue +178 -205
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +35 -27
- package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -2
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +37 -41
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +282 -285
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +18 -2
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +22 -2
- package/utils/JsViewVueWidget/JsvTextBox.vue +35 -72
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +123 -46
- package/utils/JsViewVueWidget/JsvTextureAnim/index.js +9 -5
- package/utils/JsViewVueWidget/JsvTouchContainer.vue +3 -4
- package/utils/JsViewVueWidget/JsvVideo.vue +9 -12
- package/utils/JsViewVueWidget/index.js +2 -2
- package/utils/JsViewVueWidget/utils/index.js +8 -0
- package/utils/JsViewVueWidget/utils/text.js +19 -0
- package/utils/JsViewEngineWidget/MetroPage.js +0 -2128
- package/utils/JsViewEngineWidget/SimpleWidget/ContentView.vue +0 -51
- package/utils/JsViewEngineWidget/SimpleWidget/Dispatcher.js +0 -19
- package/utils/JsViewEngineWidget/SimpleWidget/DivWrapper.vue +0 -53
- package/utils/JsViewEngineWidget/SimpleWidget/ItemView.vue +0 -142
- package/utils/JsViewEngineWidget/SimpleWidget/RootView.vue +0 -140
- package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +0 -1629
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-08-30 10:54:42
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-08-30 10:54:44
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Created by donglin.lu@qcast.cn on 4/30/2020.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* 【模块 export 内容】
|
|
14
|
+
* createImpactTracer: 函数,创建碰撞跟踪对象
|
|
15
|
+
* createImpactCallback: 函数,创建碰撞发生后的回调函数
|
|
16
|
+
* createImpactAutoFroze: 函数,注册碰撞发生后,控制动画立刻停止的管理对象
|
|
17
|
+
* updateImpactAutoFroze: 函数,更新 createImpactAutoFroze 创建的碰撞即停管理对象中管理的运动元素列表
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { Forge } from "../../dom/jsv-forge-define";
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* createImpactCallback 参数说明:
|
|
24
|
+
* on_contact (function[]) 接受碰撞事件的回调
|
|
25
|
+
* on_dis_contact (function[]) 接受物体分离事件的回调
|
|
26
|
+
* 返回值:
|
|
27
|
+
* Object 句柄,用于传输给 createImpactTracer
|
|
28
|
+
*/
|
|
29
|
+
function createImpactCallback(on_contact, on_dis_contact) {
|
|
30
|
+
return new Forge.sImpactSensorManager.Callback(on_contact, on_dis_contact);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* createImpactTracer 参数说明:
|
|
35
|
+
* ele1 (Element) html element句柄,1号碰撞体
|
|
36
|
+
* ele2 (Element) html element句柄,2号碰撞体
|
|
37
|
+
* callback (Object) 由 createImpactCallback 创建的回调构造体句柄
|
|
38
|
+
* auto_froze (Object) 由 createImpactAutoFroze 创建的碰撞即停构造体句柄
|
|
39
|
+
* 返回值:
|
|
40
|
+
* Object 句柄,提供 Recycle() 函数用于停止碰撞检测,需要再componentWillUnmount进行调用(清理)
|
|
41
|
+
*/
|
|
42
|
+
function createImpactTracer(ele1, ele2, callback, auto_froze) {
|
|
43
|
+
return Forge.sImpactSensorManager.StartTrace(ele1.jsvMainView, ele2.jsvMainView, callback, auto_froze);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 创建用于设置碰撞即停管理对象的参数
|
|
47
|
+
// 结果用于函数 createImpactAutoFroze 和 updateImpactAutoFroze
|
|
48
|
+
function _ConvertToViewsList(elements_array) {
|
|
49
|
+
const views_array = [];
|
|
50
|
+
if (elements_array) {
|
|
51
|
+
for (const ele of elements_array) {
|
|
52
|
+
views_array.push(ele.jsvMainView);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return views_array;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
* createImpactAutoFroze 参数说明:
|
|
60
|
+
* element_auto_froze_pre_impact (Array<Element>) 关联运动元素的列表,这些元素碰撞前一帧停止运动
|
|
61
|
+
* element_auto_froze_on_impact (Array<Element>) 关联运动元素的列表,这些元素碰撞当前帧停止运动
|
|
62
|
+
* 返回值:
|
|
63
|
+
* Object 句柄,用于传输给 createImpactTracer,也用于 updateImpactAutoFroze 调整关联元素
|
|
64
|
+
*
|
|
65
|
+
* 【注意点】
|
|
66
|
+
* 多个碰撞对可以共享同一个碰撞管理对象,并且建议共享同一个对象以提升效率
|
|
67
|
+
* 该管理对象中的view的列表可以通过 updateImpactAutoFrozeHandler进行更新,
|
|
68
|
+
* 更新后立刻在对所有的共享此管理对象的碰撞对中生效
|
|
69
|
+
*/
|
|
70
|
+
function createImpactAutoFroze(element_auto_froze_pre_impact, element_auto_froze_on_impact) {
|
|
71
|
+
if (!element_auto_froze_pre_impact && !element_auto_froze_on_impact) {
|
|
72
|
+
// Nothing to set
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const pre_impact_list = _ConvertToViewsList(element_auto_froze_pre_impact);
|
|
77
|
+
const on_impact_list = _ConvertToViewsList(element_auto_froze_on_impact);
|
|
78
|
+
|
|
79
|
+
return new Forge.sImpactSensorManager.AutoFroze(
|
|
80
|
+
(pre_impact_list.length > 0 ? pre_impact_list : null),
|
|
81
|
+
(on_impact_list.length > 0 ? on_impact_list : null));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
* updateImpactAutoFroze 参数说明:
|
|
86
|
+
* handler (Object) 由 createImpactAutoFroze 创建的句柄
|
|
87
|
+
* element_auto_froze_pre_impact (Array<Element>) 关联运动元素的列表,这些元素碰撞前一帧停止运动
|
|
88
|
+
* element_auto_froze_on_impact (Array<Element>) 关联运动元素的列表,这些元素碰撞当前帧停止运动
|
|
89
|
+
* 返回值:
|
|
90
|
+
* 无
|
|
91
|
+
*/
|
|
92
|
+
function updateImpactAutoFroze(handler, element_auto_froze_pre_impact, element_auto_froze_on_impact) {
|
|
93
|
+
if (handler instanceof Forge.sImpactSensorManager.AutoFroze) {
|
|
94
|
+
console.error("Error: handler type error");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const pre_impact_list = _ConvertToViewsList(element_auto_froze_pre_impact);
|
|
99
|
+
const on_impact_list = _ConvertToViewsList(element_auto_froze_on_impact);
|
|
100
|
+
|
|
101
|
+
// 更新碰撞即停列表
|
|
102
|
+
handler.UpdatePreImpactList((pre_impact_list.length > 0 ? pre_impact_list : null));
|
|
103
|
+
|
|
104
|
+
// 更新接触接触即停列表
|
|
105
|
+
handler.UpdateOnImpactList((on_impact_list.length ? on_impact_list : null));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
createImpactCallback,
|
|
110
|
+
createImpactTracer,
|
|
111
|
+
createImpactAutoFroze,
|
|
112
|
+
updateImpactAutoFroze,
|
|
113
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-07-05 14:09:55
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-08-30 10:58:14
|
|
6
6
|
* @Description: file content
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -16,4 +16,5 @@ export * from "./JsvRefTaker.js";
|
|
|
16
16
|
export * from "./JsvStyleClass.js";
|
|
17
17
|
export * from "./DebugContentShellJBridge.js";
|
|
18
18
|
export * from "./DebugTool.js";
|
|
19
|
+
export * from "./JsvImpactTracer.js";
|
|
19
20
|
export { default as DefaultKeyCodeMap } from "./DefaultKeyMap.js";
|
|
@@ -10,6 +10,8 @@ export default {
|
|
|
10
10
|
setup() {
|
|
11
11
|
return {
|
|
12
12
|
preloadResultMap: {},
|
|
13
|
+
downloadResultMap: {},
|
|
14
|
+
downloadUrlList: [],
|
|
13
15
|
unmountStatus: {unmount:false}
|
|
14
16
|
};
|
|
15
17
|
},
|
|
@@ -70,16 +72,19 @@ export default {
|
|
|
70
72
|
},
|
|
71
73
|
getDownloadList() {
|
|
72
74
|
this.downloadStateList = new Array(this.downloadList.length).fill(false);
|
|
75
|
+
this.downloadUrlList = new Array(this.downloadStateList.length);
|
|
73
76
|
let downloadListData = this.downloadList;
|
|
74
77
|
for (let i = 0; i < downloadListData.length; i++) {
|
|
75
78
|
if (!downloadListData[i].url) {
|
|
76
79
|
this.downloadStateList[i] = true;
|
|
80
|
+
this.downloadUrlList[i] = "invalid";
|
|
77
81
|
// downloadListData.splice(i, 1);
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
this._DownloadViewList = downloadListData.map((item, index) => {
|
|
81
85
|
if (!item.url) {
|
|
82
86
|
this.downloadStateList[index] = true;
|
|
87
|
+
this.downloadUrlList[index] = "invalid";
|
|
83
88
|
return null;
|
|
84
89
|
}
|
|
85
90
|
const image = new Image();
|
|
@@ -91,6 +96,11 @@ export default {
|
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
this.downloadStateList[index] = true;
|
|
99
|
+
this.downloadUrlList[index] = item.url;
|
|
100
|
+
this.downloadResultMap[item.url] = {
|
|
101
|
+
width: image.width,
|
|
102
|
+
height: image.height
|
|
103
|
+
}
|
|
94
104
|
console.log(`pre download succeed ${item.url}`);
|
|
95
105
|
if (this.onDownloadDone) {
|
|
96
106
|
let downloadNum = 0;
|
|
@@ -98,7 +108,7 @@ export default {
|
|
|
98
108
|
downloadNum += item ? 1 : 0;
|
|
99
109
|
});
|
|
100
110
|
if (downloadNum == this.downloadStateList.length) {
|
|
101
|
-
this.onDownloadDone?.();
|
|
111
|
+
this.onDownloadDone?.(this.downloadUrlList, this.downloadResultMap);
|
|
102
112
|
}
|
|
103
113
|
}
|
|
104
114
|
};
|
|
@@ -2,19 +2,81 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-02-08 09:29:17
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-08-22 16:00:50
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
9
|
+
import { ref } from "vue";
|
|
9
10
|
import { getKeyFramesGroup } from "jsview/utils/JsViewVueTools/JsvDynamicKeyFrames";
|
|
10
11
|
|
|
12
|
+
const DECORATE_BORDER_RADIUS = "BroderRaidus";
|
|
13
|
+
const DECORATE_NINEPATCH_ALPHA_MIX = "NinePatchAlphaMix";
|
|
14
|
+
|
|
15
|
+
const TexAlignAnchor = {
|
|
16
|
+
LEFT_TOP: 1,
|
|
17
|
+
CENTER_TOP: 2,
|
|
18
|
+
RIGHT_TOP: 3,
|
|
19
|
+
LEFT_MIDDLE: 4,
|
|
20
|
+
CENTER: 5,
|
|
21
|
+
RIGHT_MIDDLE: 6,
|
|
22
|
+
LEFT_BOTTOM: 7,
|
|
23
|
+
CENTER_BOTTOM: 8,
|
|
24
|
+
RIGHT_BOTTOM: 9,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const getOffset = (type, viewW, viewH, texLeft, texTop) => {
|
|
28
|
+
let extraLeft, extraTop;
|
|
29
|
+
switch (type) {
|
|
30
|
+
case TexAlignAnchor.LEFT_TOP:
|
|
31
|
+
extraLeft = 0;
|
|
32
|
+
extraTop = 0;
|
|
33
|
+
break;
|
|
34
|
+
case TexAlignAnchor.CENTER_TOP:
|
|
35
|
+
extraLeft = viewW / 2;
|
|
36
|
+
extraTop = 0;
|
|
37
|
+
break;
|
|
38
|
+
case TexAlignAnchor.RIGHT_TOP:
|
|
39
|
+
extraLeft = viewW;
|
|
40
|
+
extraTop = 0;
|
|
41
|
+
break;
|
|
42
|
+
case TexAlignAnchor.LEFT_MIDDLE:
|
|
43
|
+
extraLeft = 0;
|
|
44
|
+
extraTop = viewH / 2;
|
|
45
|
+
break;
|
|
46
|
+
case TexAlignAnchor.RIGHT_MIDDLE:
|
|
47
|
+
extraLeft = viewW;
|
|
48
|
+
extraTop = viewH / 2;
|
|
49
|
+
break;
|
|
50
|
+
case TexAlignAnchor.LEFT_BOTTOM:
|
|
51
|
+
extraLeft = 0;
|
|
52
|
+
extraTop = viewH;
|
|
53
|
+
break;
|
|
54
|
+
case TexAlignAnchor.CENTER_BOTTOM:
|
|
55
|
+
extraLeft = viewW / 2;
|
|
56
|
+
extraTop = viewH;
|
|
57
|
+
break;
|
|
58
|
+
case TexAlignAnchor.RIGHT_BOTTOM:
|
|
59
|
+
extraLeft = viewW;
|
|
60
|
+
extraTop = viewH;
|
|
61
|
+
break;
|
|
62
|
+
case TexAlignAnchor.CENTER:
|
|
63
|
+
default:
|
|
64
|
+
extraLeft = viewW / 2;
|
|
65
|
+
extraTop = viewH / 2;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
return [texLeft + extraLeft, texTop + extraTop];
|
|
69
|
+
};
|
|
11
70
|
let TOKEN = 0;
|
|
12
71
|
export default {
|
|
13
72
|
props: {
|
|
14
73
|
src: String,
|
|
74
|
+
top: Number,
|
|
75
|
+
left: Number,
|
|
15
76
|
width: Number,
|
|
16
77
|
height: Number,
|
|
17
78
|
borderRadius: String,
|
|
79
|
+
decorate: Object,
|
|
18
80
|
animation: String,
|
|
19
81
|
duration: Number,
|
|
20
82
|
transform: String,
|
|
@@ -36,13 +98,17 @@ export default {
|
|
|
36
98
|
type: Boolean,
|
|
37
99
|
default: false,
|
|
38
100
|
},
|
|
101
|
+
texCoord: {
|
|
102
|
+
type: Object,
|
|
103
|
+
},
|
|
39
104
|
},
|
|
40
|
-
setup() {
|
|
105
|
+
setup(props) {
|
|
41
106
|
let styleShell = getKeyFramesGroup();
|
|
42
107
|
return {
|
|
43
108
|
styleShell,
|
|
44
109
|
animName: "browser-texture-anim-" + TOKEN++,
|
|
45
110
|
animDiv: null,
|
|
111
|
+
watcherHandlerList: [],
|
|
46
112
|
};
|
|
47
113
|
},
|
|
48
114
|
computed: {
|
|
@@ -51,6 +117,104 @@ export default {
|
|
|
51
117
|
this.delay / 1000
|
|
52
118
|
}s ${this.repeat === -1 ? "infinite" : this.repeat}`;
|
|
53
119
|
},
|
|
120
|
+
textureLayout() {
|
|
121
|
+
if (!isNaN(this.texCoord?.width) && !isNaN(this.texCoord?.height)) {
|
|
122
|
+
const texLeft = !isNaN(this.texCoord.left)
|
|
123
|
+
? this.texCoord.left
|
|
124
|
+
: -this.texCoord.width / 2;
|
|
125
|
+
const texTop = !isNaN(this.texCoord.top)
|
|
126
|
+
? this.texCoord.top
|
|
127
|
+
: -this.texCoord.height / 2;
|
|
128
|
+
const type = !isNaN(this.texCoord.alignAnchor)
|
|
129
|
+
? this.texCoord.alignAnchor
|
|
130
|
+
: 5;
|
|
131
|
+
const offset = getOffset(
|
|
132
|
+
type,
|
|
133
|
+
this.width,
|
|
134
|
+
this.height,
|
|
135
|
+
texLeft,
|
|
136
|
+
texTop
|
|
137
|
+
);
|
|
138
|
+
const transition = this.decorate?.animTime
|
|
139
|
+
? `left ${this.decorate.animTime}s, top ${this.decorate.animTime}s`
|
|
140
|
+
: "";
|
|
141
|
+
return {
|
|
142
|
+
position: "absolute",
|
|
143
|
+
left: offset[0] + "px",
|
|
144
|
+
top: offset[1] + "px",
|
|
145
|
+
transition,
|
|
146
|
+
width: this.texCoord.width + "px",
|
|
147
|
+
height: this.texCoord.height + "px",
|
|
148
|
+
};
|
|
149
|
+
} else {
|
|
150
|
+
return {
|
|
151
|
+
position: "absolute",
|
|
152
|
+
left: 0 + "px",
|
|
153
|
+
top: 0 + "px",
|
|
154
|
+
width: this.width + "px",
|
|
155
|
+
height: this.height + "px",
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
maskStyle() {
|
|
160
|
+
if (this.borderRadius) {
|
|
161
|
+
return {
|
|
162
|
+
left: this.left + "px",
|
|
163
|
+
top: this.top + "px",
|
|
164
|
+
borderRadius: this.borderRadius,
|
|
165
|
+
width: this.width + "px",
|
|
166
|
+
height: this.height + "px",
|
|
167
|
+
overflow: 'hidden',
|
|
168
|
+
};
|
|
169
|
+
} else if (this.decorate) {
|
|
170
|
+
if (this.decorate.type == DECORATE_NINEPATCH_ALPHA_MIX) {
|
|
171
|
+
const imageDspWidth =
|
|
172
|
+
this.decorate.imageDspWidth > 0
|
|
173
|
+
? this.decorate.imageDspWidth
|
|
174
|
+
: this.decorate.imageWidth;
|
|
175
|
+
const slideWidth =
|
|
176
|
+
(this.decorate.imageWidth - this.decorate.centerWidth) / 2;
|
|
177
|
+
const outset = Math.ceil(
|
|
178
|
+
(this.decorate.borderOutset * imageDspWidth) /
|
|
179
|
+
this.decorate.imageWidth
|
|
180
|
+
);
|
|
181
|
+
console.log("get mask style");
|
|
182
|
+
const transitionTime = this.decorate.animTime;
|
|
183
|
+
return {
|
|
184
|
+
left: this.left + "px",
|
|
185
|
+
top: this.top + "px",
|
|
186
|
+
width: this.width + "px",
|
|
187
|
+
height: this.height + "px",
|
|
188
|
+
transition: `left ${transitionTime}s, top ${transitionTime}s, width ${transitionTime}s, height ${transitionTime}s`,
|
|
189
|
+
webkitMaskBoxImageSource: this.decorate.url,
|
|
190
|
+
webkitMaskBoxImageSlice: slideWidth,
|
|
191
|
+
webkitMaskBoxImageWidth:
|
|
192
|
+
Math.ceil(
|
|
193
|
+
(slideWidth * imageDspWidth) / this.decorate.imageWidth
|
|
194
|
+
) + "px",
|
|
195
|
+
webkitMaskBoxImageOutset: outset + "px",
|
|
196
|
+
position: "absolute",
|
|
197
|
+
};
|
|
198
|
+
} else if (this.decorate.type == DECORATE_BORDER_RADIUS) {
|
|
199
|
+
return {
|
|
200
|
+
left: this.left + "px",
|
|
201
|
+
top: this.top + "px",
|
|
202
|
+
borderRadius: `${this.decorate.topLeft}px ${this.decorate.topRight}px ${this.decorate.bottomRight}px ${this.decorate.bottomLeft}`,
|
|
203
|
+
width: this.width + "px",
|
|
204
|
+
height: this.height + "px",
|
|
205
|
+
overflow: 'hidden',
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
return {
|
|
210
|
+
left: this.left + "px",
|
|
211
|
+
top: this.top + "px",
|
|
212
|
+
width: this.width + "px",
|
|
213
|
+
height: this.height + "px",
|
|
214
|
+
overflow: 'hidden',
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
},
|
|
54
218
|
},
|
|
55
219
|
methods: {
|
|
56
220
|
start() {
|
|
@@ -65,28 +229,22 @@ export default {
|
|
|
65
229
|
"@keyframes " + this.animName + " " + this.animation
|
|
66
230
|
);
|
|
67
231
|
}
|
|
68
|
-
|
|
232
|
+
//绕过 jsview 对document 的 hook
|
|
69
233
|
const clipDiv = window.originDocument.createElement("div");
|
|
70
|
-
clipDiv.style
|
|
71
|
-
clipDiv.style.height = this.height + "px";
|
|
72
|
-
clipDiv.style.position = "absolute";
|
|
73
|
-
clipDiv.style.borderRadius = this.borderRadius;
|
|
74
|
-
clipDiv.style.overflow = "hidden";
|
|
234
|
+
Object.assign(clipDiv.style, this.maskStyle);
|
|
75
235
|
|
|
236
|
+
const textureLayout = this.textureLayout;
|
|
76
237
|
this.animDiv = window.originDocument.createElement("div");
|
|
77
|
-
this.animDiv.style
|
|
78
|
-
this.animDiv.style.height = this.height + "px";
|
|
79
|
-
this.animDiv.style.position = "absolute";
|
|
238
|
+
Object.assign(this.animDiv.style, textureLayout);
|
|
80
239
|
this.animDiv.onanimationend = () => {
|
|
81
240
|
this.animDiv.style.animation = null;
|
|
82
241
|
this.onAnimationEnd?.();
|
|
83
242
|
};
|
|
84
243
|
|
|
85
244
|
const imgDiv = window.originDocument.createElement("div");
|
|
86
|
-
imgDiv.style.width =
|
|
87
|
-
imgDiv.style.height =
|
|
245
|
+
imgDiv.style.width = textureLayout.width;
|
|
246
|
+
imgDiv.style.height = textureLayout.height;
|
|
88
247
|
imgDiv.style.backgroundImage = `url(${this.src})`;
|
|
89
|
-
// imgDiv.style.backgroundColor = "#FF0000"
|
|
90
248
|
imgDiv.style.transform = this.transform;
|
|
91
249
|
imgDiv.style.transformOrigin = this.transformOrigin;
|
|
92
250
|
|
|
@@ -94,6 +252,33 @@ export default {
|
|
|
94
252
|
clipDiv.appendChild(this.animDiv);
|
|
95
253
|
this.$refs.root.jsvMaskView.Element.appendChild(clipDiv);
|
|
96
254
|
|
|
255
|
+
this.watcherHandlerList.push(
|
|
256
|
+
this.$watch("left", (newValue) => {
|
|
257
|
+
clipDiv.style.left = newValue + "px";
|
|
258
|
+
})
|
|
259
|
+
);
|
|
260
|
+
this.watcherHandlerList.push(
|
|
261
|
+
this.$watch("top", (newValue) => {
|
|
262
|
+
clipDiv.style.top = newValue + "px";
|
|
263
|
+
})
|
|
264
|
+
);
|
|
265
|
+
this.watcherHandlerList.push(
|
|
266
|
+
this.$watch("width", (newValue) => {
|
|
267
|
+
clipDiv.style.width = newValue + "px";
|
|
268
|
+
})
|
|
269
|
+
);
|
|
270
|
+
this.watcherHandlerList.push(
|
|
271
|
+
this.$watch("height", (newValue) => {
|
|
272
|
+
clipDiv.style.height = newValue + "px";
|
|
273
|
+
})
|
|
274
|
+
);
|
|
275
|
+
this.watcherHandlerList.push(
|
|
276
|
+
this.$watch("textureLayout", (newValue) => {
|
|
277
|
+
Object.assign(this.animDiv.style, newValue);
|
|
278
|
+
imgDiv.style.width = newValue.width;
|
|
279
|
+
imgDiv.style.height = newValue.height;
|
|
280
|
+
})
|
|
281
|
+
);
|
|
97
282
|
if (this.autoStart) {
|
|
98
283
|
setTimeout(() => {
|
|
99
284
|
this.start();
|
|
@@ -102,6 +287,10 @@ export default {
|
|
|
102
287
|
},
|
|
103
288
|
beforeUnmount() {
|
|
104
289
|
this.styleShell.removeRule(this.animName);
|
|
290
|
+
for (let handler of this.watcherHandlerList) {
|
|
291
|
+
handler?.();
|
|
292
|
+
}
|
|
293
|
+
this.watcherHandlerList = [];
|
|
105
294
|
},
|
|
106
295
|
};
|
|
107
296
|
</script>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2021-10-20 17:21:21
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime:
|
|
5
|
+
* @LastEditTime: 2022-08-31 11:14:13
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
|
|
@@ -48,7 +48,7 @@ export default {
|
|
|
48
48
|
if (this.refDefine) {
|
|
49
49
|
const type = typeof this.refDefine;
|
|
50
50
|
if (type === "object") {
|
|
51
|
-
|
|
51
|
+
this.refDefine.current = this.$refs.element;
|
|
52
52
|
} else if (type === "function") {
|
|
53
53
|
this.refDefine(this.$refs.element);
|
|
54
54
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-01-20 10:37:01
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-09-02 13:28:59
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
@@ -39,7 +39,9 @@ export default {
|
|
|
39
39
|
this.visible = show;
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
|
-
mounted() {
|
|
42
|
+
mounted() {
|
|
43
|
+
this.startBlink();
|
|
44
|
+
},
|
|
43
45
|
beforeUnmount() {
|
|
44
46
|
this._cleanInterval();
|
|
45
47
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-01-20 10:35:56
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-02
|
|
5
|
+
* @LastEditTime: 2022-09-02 13:44:56
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
@@ -228,9 +228,9 @@ export default {
|
|
|
228
228
|
!ifDigital(add_text) &&
|
|
229
229
|
this.type === InputType.NUMBER
|
|
230
230
|
) {
|
|
231
|
-
console.log(
|
|
232
|
-
|
|
233
|
-
);
|
|
231
|
+
// console.log(
|
|
232
|
+
// `onTextChanged add text failed, add_text:${add_text}, when input type is number!`
|
|
233
|
+
// );
|
|
234
234
|
if (this.editControlView) {
|
|
235
235
|
this.editControlView.updateCursorOffset(
|
|
236
236
|
this.fullString,
|
|
@@ -255,7 +255,7 @@ export default {
|
|
|
255
255
|
|
|
256
256
|
// 1:shown 0:hidden
|
|
257
257
|
_onStatusChanged(status) {
|
|
258
|
-
console.log("OnStatusChanged status", status);
|
|
258
|
+
// console.log("OnStatusChanged status", status);
|
|
259
259
|
},
|
|
260
260
|
|
|
261
261
|
_getStringWithFont(str) {
|
|
@@ -327,7 +327,7 @@ export default {
|
|
|
327
327
|
|
|
328
328
|
add(string) {
|
|
329
329
|
if (this.type === InputType.NUMBER && !ifDigital(string)) {
|
|
330
|
-
console.log(`The input data:${string} is not number`);
|
|
330
|
+
// console.log(`The input data:${string} is not number`);
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
333
|
const pre_full_str = this.fullString;
|
|
@@ -573,8 +573,9 @@ export default {
|
|
|
573
573
|
},
|
|
574
574
|
|
|
575
575
|
onFocus() {
|
|
576
|
-
console.log("Input Focus");
|
|
576
|
+
// console.log("Input Focus");
|
|
577
577
|
this.isFocus = true;
|
|
578
|
+
this.$refs.cursor?.startBlink();
|
|
578
579
|
if (this.editControlView && !this.readonly) {
|
|
579
580
|
this.editControlView.showIme(
|
|
580
581
|
this.type,
|
|
@@ -586,7 +587,7 @@ export default {
|
|
|
586
587
|
|
|
587
588
|
onBlur() {
|
|
588
589
|
this.isFocus = false;
|
|
589
|
-
console.log("Input Blur");
|
|
590
|
+
// console.log("Input Blur");
|
|
590
591
|
if (this.editControlView && !this.readonly) {
|
|
591
592
|
this.editControlView.hideIme();
|
|
592
593
|
}
|
|
@@ -604,9 +605,7 @@ export default {
|
|
|
604
605
|
}
|
|
605
606
|
this.clearCursorPauseTimer();
|
|
606
607
|
this.cursorPauseTimeoutToken = setTimeout(() => {
|
|
607
|
-
|
|
608
|
-
this.$refs.cursor?.startBlink();
|
|
609
|
-
}
|
|
608
|
+
this.$refs.cursor?.startBlink();
|
|
610
609
|
}, 500);
|
|
611
610
|
},
|
|
612
611
|
onKeyDown(keyEvent) {
|
|
@@ -731,7 +730,9 @@ export default {
|
|
|
731
730
|
this.textWidth = cur_position > this.width ? cur_position : this.width;
|
|
732
731
|
this.textLeft = this._calculateSlide("", this.value, this.value.length);
|
|
733
732
|
},
|
|
734
|
-
mounted() {
|
|
733
|
+
mounted() {
|
|
734
|
+
this.$refs.cursor?.startBlink();
|
|
735
|
+
},
|
|
735
736
|
beforeUnmount() {
|
|
736
737
|
if (this.editControlViewId != -1) {
|
|
737
738
|
const view_store = ForgeExtension.RootActivity
|