@shijiu/jsview-vue 0.9.602 → 1.9.627

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.
Files changed (61) hide show
  1. package/dom/bin/jsview-browser-debug-dom.min.js +1 -1
  2. package/dom/bin/jsview-dom.min.js +1 -1
  3. package/dom/{target_core_revision.js → target_core_revision.mjs} +4 -4
  4. package/index.d.ts +1 -0
  5. package/index.js +1 -10
  6. package/loader/jsview-main.js +1 -1
  7. package/loader/loader.js +0 -1
  8. package/package.json +3 -3
  9. package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +17225 -2182
  10. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +10 -12
  11. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-format.js +5 -1
  12. package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-types.js +6 -1
  13. package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +6972 -7050
  14. package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +221 -117
  15. package/patches/node_modules/postcss-js/objectifier.js +4 -4
  16. package/samples/Basic/App.vue +2 -2
  17. package/samples/Basic/components/FontStyle.css +1 -1
  18. package/samples/Basic/components/anim/AnimGroup.vue +4 -4
  19. package/samples/Basic/components/div/DivGroup1.vue +4 -4
  20. package/samples/Basic/components/div/DivGroup2.vue +5 -5
  21. package/samples/Basic/components/img/ImageGroup.vue +2 -2
  22. package/samples/Basic/components/panel/Panel1.vue +6 -6
  23. package/samples/Basic/components/panel/Panel2.vue +2 -2
  24. package/samples/Basic/components/text/TextGroup1.vue +4 -4
  25. package/samples/Basic/components/text/TextGroup2.vue +2 -2
  26. package/samples/DemoHomepage/App.vue +1 -1
  27. package/samples/DemoHomepage/router.js +38 -33
  28. package/samples/DemoHomepage/views/Homepage.vue +2 -5
  29. package/samples/HashHistory/router.js +6 -6
  30. package/samples/SprayView/App.vue +2 -2
  31. package/samples/TextureAnimation/App2.vue +83 -0
  32. package/samples/TextureAnimation/assets/blackWhiteGrid.png +0 -0
  33. package/samples/TextureAnimation/assets/mask.png +0 -0
  34. package/samples/VideoDemo/App.vue +2 -2
  35. package/scripts/jsview-post-install.js +5 -5
  36. package/scripts/jsview-run-android.js +12 -11
  37. package/utils/JsViewEngineWidget/JsvFocusBlock.vue +56 -52
  38. package/utils/JsViewEngineWidget/JsvFocusManager.js +1 -1
  39. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +3 -2
  40. package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
  41. package/utils/JsViewVueTools/JsvHashHistory.js +12 -12
  42. package/utils/JsViewVueTools/index.d.ts +5 -1
  43. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +203 -14
  44. package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +282 -285
  45. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +127 -43
  46. package/utils/JsViewVueWidget/JsvTextureAnim/index.js +9 -5
  47. package/utils/JsViewVueWidget/JsvVideo.vue +9 -12
  48. package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +1 -1
  49. package/utils/JsViewVueWidget/index.js +2 -2
  50. package/utils/index.d.ts +3 -0
  51. package/utils/index.js +10 -0
  52. package/dom/jsv-browser-debug-dom.js_1 +0 -8
  53. package/dom/jsv-dom.js_1 +0 -6
  54. package/dom/jsv-forge-define.js_1 +0 -6
  55. package/patches/node_modules/@babel/preset-env/lib/available-plugins.js +0 -219
  56. package/patches/node_modules/@vue/cli-plugin-typescript/index.js +0 -100
  57. package/patches/node_modules/@vue/cli-service/lib/commands/serve.js +0 -395
  58. package/patches/node_modules/@vue/cli-service/lib/config/app.js +0 -272
  59. package/patches/node_modules/@vue/cli-service/lib/config/assets.js +0 -70
  60. package/patches/node_modules/@vue/cli-service/lib/config/base.js +0 -212
  61. package/patches/node_modules/vue-loader/dist/resolveScript.js +0 -70
@@ -64,47 +64,45 @@ if (props.name && props.name.indexOf(".") >= 0) {
64
64
  '". name must not contains "."'
65
65
  );
66
66
  }
67
- let actionCallback = {};
68
- let fDivRef = ref(null);
69
67
 
70
68
  //methods
71
- const getName = () => {
72
- return toRaw(fDivRef.value)?.FocusNodeRef.getName();
69
+ function getName() {
70
+ return toRaw(_fDivRef.value)?.FocusNodeRef.getName();
73
71
  };
74
72
 
75
- const getNamespace = () => {
76
- let focusNode = toRaw(fDivRef.value)?.FocusNodeRef;
73
+ function getNamespace() {
74
+ let focusNode = toRaw(_fDivRef.value)?.FocusNodeRef;
77
75
  if (focusNode?.AsHub) {
78
76
  // hub的getHub返回的是自己
79
- focusNode = toRaw(fDivRef.value)?.FocusNodeRef.GetParentPage();
77
+ focusNode = toRaw(_fDivRef.value)?.FocusNodeRef.GetParentPage();
80
78
  }
81
79
  const namespace = focusNode.getName();
82
80
  return namespace !== ".__AppRoot__" ? namespace : "";
83
81
  };
84
82
 
85
- const findBlockByName = (name) => {
86
- const focusNode = toRaw(fDivRef.value)?.FocusNodeRef.getNodeByName(name);
83
+ function findBlockByName(name) {
84
+ const focusNode = toRaw(_fDivRef.value)?.FocusNodeRef.getNodeByName(name);
87
85
  return focusNode?.jsvVueComponent;
88
86
  };
89
87
 
90
- const requestFocus = (passToChild) => {
91
- toRaw(fDivRef.value)?.FocusNodeRef.requestFocus(passToChild);
88
+ function requestFocus(passToChild) {
89
+ toRaw(_fDivRef.value)?.FocusNodeRef.requestFocus(passToChild);
92
90
  };
93
91
 
94
- const returnFocusToParent = () => {
95
- toRaw(fDivRef.value)?.FocusNodeRef.ReturnFocusToParent();
92
+ function returnFocusToParent() {
93
+ toRaw(_fDivRef.value)?.FocusNodeRef.ReturnFocusToParent();
96
94
  };
97
95
 
98
- const bubbleCustomerEvent = (ev) => {
99
- toRaw(fDivRef.value)?.FocusNodeRef.bubbleCustomerEvent(ev);
96
+ function bubbleCustomerEvent(ev) {
97
+ toRaw(_fDivRef.value)?.FocusNodeRef.bubbleCustomerEvent(ev);
100
98
  };
101
99
 
102
- const debugPrintFocusChain = () => {
103
- toRaw(fDivRef.value)?.FocusNodeRef.printFocusNodeList();
100
+ function debugPrintFocusChain() {
101
+ toRaw(_fDivRef.value)?.FocusNodeRef.printFocusNodeList();
104
102
  };
105
103
 
106
- const debugPrintLastFocus = () => {
107
- toRaw(fDivRef.value)?.FocusNodeRef.printGlobalLastFocus();
104
+ function debugPrintLastFocus() {
105
+ toRaw(_fDivRef.value)?.FocusNodeRef.printGlobalLastFocus();
108
106
  };
109
107
 
110
108
  const exportObject = {
@@ -117,47 +115,48 @@ const exportObject = {
117
115
  debugPrintFocusChain,
118
116
  debugPrintLastFocus,
119
117
  };
120
- const _mountToFocusSystem = () => {
121
- const focusNode = toRaw(fDivRef.value)?.FocusNodeRef;
118
+
119
+ function _mountToFocusSystem() {
120
+ const focusNode = toRaw(_fDivRef.value)?.FocusNodeRef;
122
121
 
123
122
  // 保存self,find用, 通过exportObject代表自己的instance
124
123
  focusNode.jsvVueComponent = exportObject;
125
124
 
126
125
  // 注册回调函数
127
- actionCallback.onDispatchKeyDown =
126
+ _actionCallback.onDispatchKeyDown =
128
127
  props.onDispatchKeyDown || props.onAction?.onDispatchKeyDown;
129
- if (actionCallback.onDispatchKeyDown) {
128
+ if (_actionCallback.onDispatchKeyDown) {
130
129
  focusNode.setDispatchKeyDown(_onDispatchKeyDown);
131
130
  }
132
- actionCallback.onDispatchKeyUp =
131
+ _actionCallback.onDispatchKeyUp =
133
132
  props.onDispatchKeyUp || props.onAction?.onDispatchKeyUp;
134
- if (actionCallback.onDispatchKeyUp) {
133
+ if (_actionCallback.onDispatchKeyUp) {
135
134
  focusNode.setDispatchKeyUp(_onDispatchKeyUp);
136
135
  }
137
- actionCallback.onKeyDown = props.onKeyDown || props.onAction?.onKeyDown;
138
- if (actionCallback.onKeyDown) {
136
+ _actionCallback.onKeyDown = props.onKeyDown || props.onAction?.onKeyDown;
137
+ if (_actionCallback.onKeyDown) {
139
138
  focusNode.setOnKeyDown(_onKeyDown);
140
139
  }
141
- actionCallback.onKeyUp = props.onKeyUp || props.onAction?.onKeyUp;
142
- if (actionCallback.onKeyUp) {
140
+ _actionCallback.onKeyUp = props.onKeyUp || props.onAction?.onKeyUp;
141
+ if (_actionCallback.onKeyUp) {
143
142
  focusNode.setOnKeyUp(_onKeyUp);
144
143
  }
145
- actionCallback.onFocus = props.onFocus || props.onAction?.onFocus;
146
- if (actionCallback.onFocus) {
144
+ _actionCallback.onFocus = props.onFocus || props.onAction?.onFocus;
145
+ if (_actionCallback.onFocus) {
147
146
  focusNode.setOnFocus(_onFocus);
148
147
  }
149
- actionCallback.onBlur = props.onBlur || props.onAction?.onBlur;
150
- if (actionCallback.onBlur) {
148
+ _actionCallback.onBlur = props.onBlur || props.onAction?.onBlur;
149
+ if (_actionCallback.onBlur) {
151
150
  focusNode.setOnBlur(_onBlur);
152
151
  }
153
152
 
154
- actionCallback.onCustomerEvent =
153
+ _actionCallback.onCustomerEvent =
155
154
  props.onCustomerEvent || props.onAction?.onCustomerEvent;
156
- if (actionCallback.onCustomerEvent) {
155
+ if (_actionCallback.onCustomerEvent) {
157
156
  focusNode.setOnCustomerEvent(_onCustomerEvent);
158
157
  }
159
158
  // 建立父子关系链
160
- let self = toRaw(fDivRef.value);
159
+ let self = toRaw(_fDivRef.value);
161
160
  let parent = self.parentElement;
162
161
  while (parent) {
163
162
  if (self.FocusNodeRef.GetParentPage()) {
@@ -174,32 +173,35 @@ const _mountToFocusSystem = () => {
174
173
  }
175
174
  };
176
175
 
177
- const _onDispatchKeyDown = (ev) => {
176
+ function _onDispatchKeyDown(ev) {
178
177
  ev.ownerNode = exportObject;
179
- return actionCallback?.onDispatchKeyDown(ev) || false;
178
+ return _actionCallback?.onDispatchKeyDown(ev) || false;
180
179
  };
181
- const _onDispatchKeyUp = (ev) => {
180
+ function _onDispatchKeyUp(ev) {
182
181
  ev.ownerNode = exportObject;
183
- return actionCallback?.onDispatchKeyUp(ev) || false;
182
+ return _actionCallback?.onDispatchKeyUp(ev) || false;
184
183
  };
185
- const _onKeyDown = (ev) => {
184
+ function _onKeyDown(ev) {
186
185
  ev.ownerNode = exportObject;
187
- return actionCallback?.onKeyDown(ev) || false;
186
+ return _actionCallback?.onKeyDown(ev) || false;
188
187
  };
189
- const _onKeyUp = (ev) => {
188
+ function _onKeyUp(ev) {
190
189
  ev.ownerNode = exportObject;
191
- return actionCallback?.onKeyUp(ev) || false;
190
+ return _actionCallback?.onKeyUp(ev) || false;
192
191
  };
193
- const _onFocus = () => {
194
- actionCallback?.onFocus(exportObject);
192
+ function _onFocus() {
193
+ _actionCallback?.onFocus(exportObject);
195
194
  };
196
- const _onBlur = () => {
197
- actionCallback?.onBlur(exportObject);
195
+ function _onBlur() {
196
+ _actionCallback?.onBlur(exportObject);
198
197
  };
199
- const _onCustomerEvent = (ev) => {
200
- return actionCallback?.onCustomerEvent(ev) || false;
198
+ function _onCustomerEvent(ev) {
199
+ return _actionCallback?.onCustomerEvent(ev) || false;
201
200
  };
202
201
 
202
+ let _actionCallback = {};
203
+ let _fDivRef = ref(null);
204
+
203
205
  onMounted(() => {
204
206
  _mountToFocusSystem();
205
207
 
@@ -209,7 +211,7 @@ onMounted(() => {
209
211
  });
210
212
 
211
213
  onBeforeUnmount(() => {
212
- const focusNode = toRaw(fDivRef.value)?.FocusNodeRef;
214
+ const focusNode = toRaw(_fDivRef.value)?.FocusNodeRef;
213
215
  focusNode?.onUnMount();
214
216
  if (focusNode?.jsvVueComponent) {
215
217
  focusNode.jsvVueComponent = undefined;
@@ -220,7 +222,9 @@ defineExpose(exportObject);
220
222
  </script>
221
223
 
222
224
  <template>
223
- <fdiv ref="fDivRef" :fname="name" :new-namespace="namespace">
225
+ <div>
226
+ <fdiv ref="_fDivRef" :fname="name" :new-namespace="namespace">
224
227
  <slot></slot>
225
228
  </fdiv>
229
+ </div>
226
230
  </template>
@@ -13,7 +13,7 @@ export class JsvFocusManager {
13
13
  constructor() {}
14
14
 
15
15
  install(app, ...options) {
16
- console.log("JsvFocusManager install");
16
+ // console.log("JsvFocusManager install");
17
17
  if (typeof options[0] !== "string") {
18
18
  throw new Error(
19
19
  "JsvFocusManager Error: 2nd argument is required. Such as: app.use(FocusManager, '#app')"
@@ -49,7 +49,7 @@ export default {
49
49
  /**
50
50
  * 属性,Boolean类型,是否保留最后一帧,true保留,false不保留。
51
51
  */
52
- keepLastFrame: {type: Boolean, default: false},
52
+ keepLastFrame: {type: Boolean, default: true},
53
53
  /**
54
54
  * 属性,String类型,视频显示比例,origin原始比例显示,full全屏显示,x:y按照指定比例显示。
55
55
  */
@@ -255,7 +255,7 @@ export default {
255
255
  this.video.loop = this.loop;
256
256
  }
257
257
 
258
- if(this.keepLastFrame){
258
+ if(!this.keepLastFrame){
259
259
  this.video.keepLastFrame = this.keepLastFrame;
260
260
  }
261
261
 
@@ -279,6 +279,7 @@ export default {
279
279
  unmounted(){
280
280
  if(this.video != null){
281
281
  this.video.releasePlayer();
282
+
282
283
  this.onRef?.(null)
283
284
  }
284
285
  },
@@ -2,16 +2,16 @@ let PluginInfo={
2
2
  // downloadUrl:"http://192.168.0.63:8080/plugin/JsvPlayer-164.zip", //插件下载地址
3
3
  packageName:"com.qcode.jsvplayer",
4
4
  name:"播放器插件",
5
- version:"1.6.5", //插件需要的版本号
6
- versionCodeMin:165,
7
- versionCodeMax:165,
5
+ version:"1.6.6", //插件需要的版本号
6
+ versionCodeMin:166,
7
+ versionCodeMax:166,
8
8
  bridgeName:"jsvPlayerBridge", //插件bridge注册到jsview的名称
9
9
  className:"com.qcode.jsvplayer.JsvPlayer", //插件初始化类名称
10
10
  initMethod:"createInstance", //插件初始化方法
11
11
  listener:"top.JsvPlayerPluginLoadResult", //插件加载结果回调
12
12
  listener2: "top.JsvPlayerPluginStatus",
13
13
  // debug:true,
14
- md5:"1d06b3a8acba255efb4826a15a7fb480"
14
+ md5:"b08edbe68f22ba93855a2016d9372858"
15
15
  };
16
16
 
17
17
  // 不要用export default,update-env脚本不能解析
@@ -5,10 +5,10 @@ class JsvHashHistory {
5
5
  if(window.jsvIsBrowserDebug) {
6
6
  this.#history = createWebHashHistory(base)
7
7
  } else {
8
- this.#history = this.#createMockHashHistory(base);
8
+ this.#history = this._createMockHashHistory(base);
9
9
  }
10
10
  }
11
-
11
+
12
12
  get location() {
13
13
  return this.#history.location;
14
14
  }
@@ -31,24 +31,24 @@ class JsvHashHistory {
31
31
 
32
32
  replace(to, data) {
33
33
  this.#history.replace(to, data);
34
- this.#updateLocation(this.#history.location);
34
+ this._updateLocation(this.#history.location);
35
35
  }
36
36
 
37
37
  push(to, data) {
38
38
  this.#history.push(to, data);
39
- this.#updateLocation(this.#history.location);
39
+ this._updateLocation(this.#history.location);
40
40
  }
41
41
 
42
42
  go(delta, triggerListeners) {
43
43
  this.#history.go(delta, triggerListeners);
44
- this.#updateLocation(this.#history.location);
44
+ this._updateLocation(this.#history.location);
45
45
  }
46
46
 
47
47
  destroy() {
48
48
  this.#history.destroy();
49
49
  }
50
50
 
51
- #createMockHashHistory(base) {
51
+ _createMockHashHistory(base) {
52
52
  // 抄 createWebHashHistory 作业
53
53
  base = location.host ? base || location.pathname + location.search : '';
54
54
  if (!base.includes('#'))
@@ -60,7 +60,7 @@ class JsvHashHistory {
60
60
  this.baseURL = window.location.origin + base;
61
61
 
62
62
  const history = createMemoryHistory(base)
63
- const initHash = this.#getInitHash();
63
+ const initHash = this._getInitHash();
64
64
  if(initHash) {
65
65
  // 已设置hash,替换到hash页面
66
66
  history.replace({
@@ -69,13 +69,13 @@ class JsvHashHistory {
69
69
  });
70
70
  } else {
71
71
  // 未设置hash定位,追加hash根的显示
72
- this.#updateLocation(null);
72
+ this._updateLocation(null);
73
73
  }
74
74
 
75
75
  return history;
76
76
  }
77
77
 
78
- #getInitHash() {
78
+ _getInitHash() {
79
79
  let initHash;
80
80
 
81
81
  // 抓取history hash在启动过程中的变更, 用于warmUp/warmLoad不一致的情况。
@@ -94,7 +94,7 @@ class JsvHashHistory {
94
94
  return initHash;
95
95
  }
96
96
 
97
- #updateLocation(location) {
97
+ _updateLocation(location) {
98
98
  if(!window.jsvIsBrowserDebug) {
99
99
  const url = new window.JsView.Dom.UrlRef(
100
100
  location ? this.baseURL + location : this.baseURL,
@@ -107,8 +107,8 @@ class JsvHashHistory {
107
107
  #history;
108
108
  }
109
109
 
110
- function createJsvHashHistory(base) {
110
+ function jsvCreateHashHistory(base) {
111
111
  return new JsvHashHistory(base)
112
112
  }
113
113
 
114
- export { createJsvHashHistory }
114
+ export { jsvCreateHashHistory }
@@ -1,3 +1,7 @@
1
+ // 添加jsvCreateHashHistory的声明
2
+ export declare function jsvCreateHashHistory(): RouterHistory;
3
+
4
+
1
5
  declare module '@shijiu/jsview-vue/utils/JsViewVueTools/JsvRuntimeBridge' {
2
6
  export const jJsvRuntimeBridge: {
3
7
  notifyPageLoaded();
@@ -10,4 +14,4 @@ declare module 'jsview/utils/JsViewVueTools/JsvRuntimeBridge' {
10
14
  }
11
15
  }
12
16
 
13
- declare module '*.js'
17
+ declare module '*.js'
@@ -2,19 +2,81 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-02-08 09:29:17
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-03-08 14:08:39
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.width = this.width + "px";
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.width = this.width + "px";
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 = this.width + "px";
87
- imgDiv.style.height = this.height + "px";
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>