@tarojs/plugin-platform-harmony-ets 4.0.0-beta.71 → 4.0.0-beta.73

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.
@@ -17,11 +17,6 @@ export default struct TaroMovableView {
17
17
  if (this.node) {
18
18
  this.node._instance = this
19
19
 
20
- setTimeout(() => {
21
- const x = this.node.getAttribute('x') ? Number(this.node.getAttribute('x')) : 0
22
- const y = this.node.getAttribute('y') ? Number(this.node.getAttribute('y')) : 0
23
- this.node.checkPositionBoundary({ x, y }, this.node.scaleValue)
24
- }, 0)
25
20
  }
26
21
  }
27
22
 
@@ -49,8 +44,9 @@ export default struct TaroMovableView {
49
44
  .onAreaChange((oldValue: Area, newValue: Area) => {
50
45
  this.node.selfSize = { w: Number(newValue.width), h: Number(newValue.height) }
51
46
  })
47
+ .visibility(this.node.visibility)
52
48
  .gesture(
53
- GestureGroup(GestureMode.Exclusive,
49
+ GestureGroup(GestureMode.Parallel,
54
50
  PanGesture({ fingers: 1 }).onActionStart((e: GestureEvent) => {
55
51
 
56
52
  this.node.startMove()
@@ -9,11 +9,6 @@ export class DynamicCenter {
9
9
 
10
10
  uninstall (node: TaroElement) {
11
11
  if (!node._isCompileMode || !node._instance) return
12
-
13
- if (node._attrs?._dynamicID) {
14
- node._instance[node._attrs._dynamicID] = null
15
- }
16
- node._instance = null
17
12
  }
18
13
 
19
14
  bindComponentToNodeWithDFS (node: TaroElement, component: TaroAny) {
@@ -30,6 +30,8 @@ export class TaroMovableViewElement extends TaroElement<MovableViewProps & { ani
30
30
  _area?: Tsize
31
31
  // 自己元素的大小
32
32
  _selfSize?: Tsize
33
+ _areaInited: false
34
+ _selfSizeInited: false
33
35
 
34
36
  // 元素的位置
35
37
  _position: Tpoint = {
@@ -54,6 +56,9 @@ export class TaroMovableViewElement extends TaroElement<MovableViewProps & { ani
54
56
  }
55
57
 
56
58
  set area(val: Tsize) {
59
+ if (this._area === undefined) {
60
+ this._areaInited = true
61
+ }
57
62
  this._area = val
58
63
  }
59
64
 
@@ -87,6 +92,10 @@ export class TaroMovableViewElement extends TaroElement<MovableViewProps & { ani
87
92
  }
88
93
  }
89
94
 
95
+ get visibility () {
96
+ return this._areaInited && this._selfSizeInited ? Visibility.Visible : Visibility.Hidden
97
+ }
98
+
90
99
  get scaleValue() {
91
100
  return this._scaleValue
92
101
  }
@@ -96,8 +105,12 @@ export class TaroMovableViewElement extends TaroElement<MovableViewProps & { ani
96
105
  }
97
106
 
98
107
  doMove(val: Tpoint) {
99
- if (!this.area || !this.selfSize) return
100
- if (this.getAttribute('disabled')) return
108
+ if (!this.area || !this.selfSize) {
109
+ return
110
+ }
111
+ if (this.getAttribute('disabled')) {
112
+ return
113
+ }
101
114
  const direction = this.getAttribute('direction')
102
115
 
103
116
  // 容器的宽高终点
@@ -146,14 +159,40 @@ export class TaroMovableViewElement extends TaroElement<MovableViewProps & { ani
146
159
  this._position = val
147
160
  }
148
161
 
162
+ set area(val: Tsize) {
163
+
164
+ this._area = val
165
+ if (!this._areaInited) {
166
+ this._areaInited = true
167
+ this.initPositionFromAttribute()
168
+ }
169
+ }
170
+
171
+ get area(): Tsize | undefined {
172
+ return this._area
173
+ }
174
+
149
175
  set selfSize(val: Tsize) {
150
176
  this._selfSize = val
177
+ if (!this._selfSizeInited) {
178
+ this._selfSizeInited = true
179
+ this.initPositionFromAttribute()
180
+ }
151
181
  }
152
182
 
153
183
  get selfSize(): Tsize | undefined {
154
184
  return this._selfSize
155
185
  }
156
186
 
187
+ initPositionFromAttribute () {
188
+ if (!this.area || !this.selfSize) {
189
+ return
190
+ }
191
+ const x = this.getAttribute('x') ? Number(this.getAttribute('x')) : 0
192
+ const y = this.getAttribute('y') ? Number(this.getAttribute('y')) : 0
193
+ this.checkPositionBoundary({ x, y }, this.scaleValue)
194
+ }
195
+
157
196
  checkPositionBoundary(position: Tpoint, scale: number) {
158
197
  if (!this.area || !this.selfSize) {
159
198
  return { x: 0, y: 0 }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/plugin-platform-harmony-ets",
3
- "version": "4.0.0-beta.71",
3
+ "version": "4.0.0-beta.73",
4
4
  "description": "OpenHarmony & 鸿蒙系统插件",
5
5
  "author": "O2Team",
6
6
  "homepage": "https://gitee.com/openharmony-sig/taro",
@@ -25,13 +25,13 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "webpack-sources": "^3.2.3",
28
- "@tarojs/components": "4.0.0-beta.71",
29
- "@tarojs/helper": "4.0.0-beta.71",
30
- "@tarojs/runner-utils": "4.0.0-beta.71",
31
- "@tarojs/runtime": "4.0.0-beta.71",
32
- "@tarojs/service": "4.0.0-beta.71",
33
- "@tarojs/shared": "4.0.0-beta.71",
34
- "@tarojs/taro": "4.0.0-beta.71"
28
+ "@tarojs/components": "4.0.0-beta.73",
29
+ "@tarojs/runtime": "4.0.0-beta.73",
30
+ "@tarojs/runner-utils": "4.0.0-beta.73",
31
+ "@tarojs/helper": "4.0.0-beta.73",
32
+ "@tarojs/shared": "4.0.0-beta.73",
33
+ "@tarojs/service": "4.0.0-beta.73",
34
+ "@tarojs/taro": "4.0.0-beta.73"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rollup/plugin-commonjs": "^25.0.7",
@@ -44,7 +44,7 @@
44
44
  "solid-js": "^1.8.16",
45
45
  "tslib": "^2.4.0",
46
46
  "typescript": "^4.8.2",
47
- "rollup-plugin-copy": "4.0.0-beta.71"
47
+ "rollup-plugin-copy": "4.0.0-beta.73"
48
48
  },
49
49
  "scripts": {
50
50
  "prebuild": "rimraf ./dist",