@leafer/decorator 1.9.6 → 1.9.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/decorator",
3
- "version": "1.9.6",
3
+ "version": "1.9.7",
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.9.6",
26
- "@leafer/data": "1.9.6",
27
- "@leafer/debug": "1.9.6"
25
+ "@leafer/platform": "1.9.7",
26
+ "@leafer/data": "1.9.7",
27
+ "@leafer/debug": "1.9.7"
28
28
  },
29
29
  "devDependencies": {
30
- "@leafer/interface": "1.9.6"
30
+ "@leafer/interface": "1.9.7"
31
31
  }
32
32
  }
package/src/data.ts CHANGED
@@ -150,6 +150,18 @@ export function surfaceType(defaultValue?: IValue) {
150
150
  }))
151
151
  }
152
152
 
153
+ export function dimType(defaultValue?: IValue) {
154
+ return decorateLeafAttr(defaultValue, (key: string) => attr({
155
+ set(value: IValue) {
156
+ if (this.__setAttr(key, value)) {
157
+ const data = this.__
158
+ DataHelper.stintSet(data, '__useDim', (data.dim || data.bright || data.dimskip) as boolean)
159
+ this.__layout.surfaceChange()
160
+ }
161
+ }
162
+ }))
163
+ }
164
+
153
165
  export function opacityType(defaultValue?: IValue) {
154
166
  return decorateLeafAttr(defaultValue, (key: string) => attr({
155
167
  set(value: IValue) {
@@ -194,7 +206,7 @@ export function sortType(defaultValue?: IValue) {
194
206
  return decorateLeafAttr(defaultValue, (key: string) => attr({
195
207
  set(value: IValue) {
196
208
  if (this.__setAttr(key, value)) {
197
- this.__layout.surfaceChanged || this.__layout.surfaceChange()
209
+ this.__layout.surfaceChange()
198
210
  this.waitParent(() => { this.parent.__layout.childrenSortChange() })
199
211
  }
200
212
  }
@@ -225,7 +237,7 @@ export function hitType(defaultValue?: IValue) {
225
237
  set(value: IValue) {
226
238
  if (this.__setAttr(key, value)) {
227
239
  this.__layout.hitCanvasChanged = true
228
- if (Debug.showBounds === 'hit') this.__layout.surfaceChanged || this.__layout.surfaceChange()
240
+ if (Debug.showBounds === 'hit') this.__layout.surfaceChange()
229
241
  if (this.leafer) this.leafer.updateCursor()
230
242
  }
231
243
  }
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { defineLeafAttr, decorateLeafAttr, attr, dataType, positionType, scrollType, autoLayoutType, boundsType, doBoundsType, naturalBoundsType, affectStrokeBoundsType, doStrokeType, strokeType, affectRenderBoundsType, scaleType, rotationType, surfaceType, opacityType, visibleType, sortType, maskType, eraserType, hitType, pathType, pathInputType, cursorType, dataProcessor, layoutProcessor, defineDataProcessor } from './data'
1
+ export { defineLeafAttr, decorateLeafAttr, attr, dataType, positionType, scrollType, autoLayoutType, boundsType, doBoundsType, naturalBoundsType, affectStrokeBoundsType, doStrokeType, strokeType, affectRenderBoundsType, scaleType, rotationType, surfaceType, dimType, opacityType, visibleType, sortType, maskType, eraserType, hitType, pathType, pathInputType, cursorType, dataProcessor, layoutProcessor, defineDataProcessor } from './data'
2
2
  export { useModule, rewrite, rewriteAble } from './rewrite'
3
3
  export { defineKey, getDescriptor, createDescriptor } from './object'
4
4
  export { registerUI, registerUIEvent } from './class'
package/types/index.d.ts CHANGED
@@ -19,6 +19,7 @@ declare function doStrokeType(leaf: ILeaf): void;
19
19
  declare const strokeType: typeof affectStrokeBoundsType;
20
20
  declare function affectRenderBoundsType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
21
21
  declare function surfaceType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
22
+ declare function dimType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
22
23
  declare function opacityType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
23
24
  declare function visibleType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
24
25
  declare function sortType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
@@ -44,4 +45,4 @@ declare function createDescriptor(key: string, defaultValue?: IValue): {
44
45
  declare function registerUI(): (target: IObject) => void;
45
46
  declare function registerUIEvent(): (target: IObject) => void;
46
47
 
47
- export { affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, eraserType, getDescriptor, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, useModule, visibleType };
48
+ export { affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, eraserType, getDescriptor, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, useModule, visibleType };