@leafer/decorator 1.1.0 → 1.1.2

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 (2) hide show
  1. package/package.json +5 -5
  2. package/src/data.ts +11 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/decorator",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "@leafer/decorator",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,11 +22,11 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/platform": "1.1.0",
26
- "@leafer/data": "1.1.0",
27
- "@leafer/debug": "1.1.0"
25
+ "@leafer/platform": "1.1.2",
26
+ "@leafer/data": "1.1.2",
27
+ "@leafer/debug": "1.1.2"
28
28
  },
29
29
  "devDependencies": {
30
- "@leafer/interface": "1.1.0"
30
+ "@leafer/interface": "1.1.2"
31
31
  }
32
32
  }
package/src/data.ts CHANGED
@@ -140,6 +140,7 @@ export function opacityType(defaultValue?: IValue) {
140
140
  return decorateLeafAttr(defaultValue, (key: string) => attr({
141
141
  set(value: IValue) {
142
142
  this.__setAttr(key, value) && (this.__layout.opacityChanged || this.__layout.opacityChange())
143
+ if (this.mask) checkMask(this)
143
144
  }
144
145
  }))
145
146
  }
@@ -154,10 +155,20 @@ export function visibleType(defaultValue?: IValue) {
154
155
  if (this.animation) this.__runAnimation('in') // show
155
156
  }
156
157
  doVisible(this, key, value, oldValue)
158
+ if (this.mask) checkMask(this)
157
159
  }
158
160
  }))
159
161
  }
160
162
 
163
+ function checkMask(leaf: ILeaf): void { // mask 的透明度和可见性变更,会影响parent
164
+ const { parent } = leaf
165
+ if (parent) {
166
+ const { __hasMask } = parent
167
+ parent.__updateMask()
168
+ if (__hasMask !== parent.__hasMask) parent.forceUpdate()
169
+ }
170
+ }
171
+
161
172
  function doVisible(leaf: ILeaf, key: string, value: IValue, oldValue: IValue): void {
162
173
  if (leaf.__setAttr(key, value)) {
163
174
  leaf.__layout.opacityChanged || leaf.__layout.opacityChange()