@leafer-ui/data 1.6.7 → 1.8.0
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 +5 -5
- package/src/BoxData.ts +4 -4
- package/src/UIData.ts +23 -18
- package/types/index.d.ts +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/data",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "@leafer-ui/data",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.
|
|
26
|
-
"@leafer-ui/external": "1.
|
|
25
|
+
"@leafer/core": "1.8.0",
|
|
26
|
+
"@leafer-ui/external": "1.8.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leafer/interface": "1.
|
|
30
|
-
"@leafer-ui/interface": "1.
|
|
29
|
+
"@leafer/interface": "1.8.0",
|
|
30
|
+
"@leafer-ui/interface": "1.8.0"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/BoxData.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBoxData } from '@leafer-ui/interface'
|
|
1
|
+
import { IBox, IBoxData } from '@leafer-ui/interface'
|
|
2
2
|
|
|
3
3
|
import { GroupData } from "./GroupData"
|
|
4
4
|
|
|
@@ -7,9 +7,9 @@ export class BoxData extends GroupData implements IBoxData {
|
|
|
7
7
|
|
|
8
8
|
public get __boxStroke(): boolean { return !(this as IBoxData).__pathInputed }
|
|
9
9
|
|
|
10
|
-
//
|
|
11
|
-
public get __drawAfterFill(): boolean { const t = this as IBoxData; return
|
|
10
|
+
// 当成整体处理
|
|
11
|
+
public get __drawAfterFill(): boolean { const t = this as IBoxData; return t.__single || t.__clipAfterFill }
|
|
12
12
|
|
|
13
|
-
public get __clipAfterFill(): boolean { return
|
|
13
|
+
public get __clipAfterFill(): boolean { const t = this as IBoxData; return t.overflow === 'hide' && t.__leaf.children.length && ((t.__leaf as IBox).isOverflow || super.__clipAfterFill) as unknown as boolean }
|
|
14
14
|
|
|
15
15
|
}
|
package/src/UIData.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { INumber, IValue, IBoolean, IPathCommandData, IPathString, IPointData, IPathCommandObject, IObject, IFilter } from '@leafer/interface'
|
|
2
2
|
import { PathConvert, DataHelper, LeafData, Debug } from '@leafer/core'
|
|
3
3
|
|
|
4
|
-
import { IUI, IUIData, ILeafPaint } from '@leafer-ui/interface'
|
|
4
|
+
import { IUI, IUIData, ILeafPaint, IStrokeComputedStyle } from '@leafer-ui/interface'
|
|
5
5
|
import { Paint, PaintImage, ColorConvert } from '@leafer-ui/external'
|
|
6
6
|
|
|
7
7
|
|
|
@@ -20,23 +20,13 @@ export class UIData extends LeafData implements IUIData {
|
|
|
20
20
|
public __isFills?: boolean
|
|
21
21
|
public __isStrokes?: boolean
|
|
22
22
|
|
|
23
|
-
public get __strokeWidth(): number {
|
|
24
|
-
const { strokeWidth, strokeWidthFixed } = this as IUIData
|
|
25
|
-
if (strokeWidthFixed) {
|
|
26
|
-
const ui = this.__leaf
|
|
27
|
-
let { scaleX } = ui.__nowWorld || ui.__world
|
|
28
|
-
if (scaleX < 0) scaleX = -scaleX
|
|
29
|
-
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth
|
|
30
|
-
} else return strokeWidth
|
|
31
|
-
}
|
|
23
|
+
public get __strokeWidth(): number { return this.__getRealStrokeWidth() }
|
|
32
24
|
|
|
33
|
-
public get
|
|
34
|
-
|
|
35
|
-
public
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return t.fill && this.__hasStroke
|
|
39
|
-
}
|
|
25
|
+
public get __maxStrokeWidth(): number { const t = this as IUIData; return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth }
|
|
26
|
+
|
|
27
|
+
public __hasMultiStrokeStyle?: number // 是否存在多个不同的描述样式(同时存储多个描边样式中的最大宽度用于运算)
|
|
28
|
+
|
|
29
|
+
public get __hasMultiPaint(): boolean { const t = this as IUIData; return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect } // fix: opacity
|
|
40
30
|
|
|
41
31
|
public __isAlphaPixelFill?: boolean // png / svg / webp
|
|
42
32
|
public __isAlphaPixelStroke?: boolean
|
|
@@ -44,7 +34,7 @@ export class UIData extends LeafData implements IUIData {
|
|
|
44
34
|
public __isTransparentFill?: boolean // 半透明的
|
|
45
35
|
public __isTransparentStroke?: boolean
|
|
46
36
|
|
|
47
|
-
public get __clipAfterFill(): boolean { const t = this as IUIData; return (t.cornerRadius || t.innerShadow || t.__pathInputed) as unknown as boolean } // 用于 __drawAfterFill()
|
|
37
|
+
public get __clipAfterFill(): boolean { const t = this as IUIData; return (t.cornerRadius || t.innerShadow || t.__pathInputed) as unknown as boolean } // 用于 (Box | Canvas | Robot) __drawAfterFill() 时裁剪内容
|
|
48
38
|
public get __hasSurface(): boolean { const t = this as IUIData; return (t.fill || t.stroke) as unknown as boolean }
|
|
49
39
|
|
|
50
40
|
public __needComputePaint: boolean
|
|
@@ -148,6 +138,20 @@ export class UIData extends LeafData implements IUIData {
|
|
|
148
138
|
this.__needComputePaint = undefined
|
|
149
139
|
}
|
|
150
140
|
|
|
141
|
+
|
|
142
|
+
public __getRealStrokeWidth(childStyle?: IStrokeComputedStyle): number {
|
|
143
|
+
let { strokeWidth, strokeWidthFixed } = this as IUIData
|
|
144
|
+
if (childStyle) {
|
|
145
|
+
if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth
|
|
146
|
+
if (childStyle.strokeWidthFixed !== undefined) strokeWidthFixed = childStyle.strokeWidthFixed
|
|
147
|
+
}
|
|
148
|
+
if (strokeWidthFixed) {
|
|
149
|
+
const scale = this.__leaf.getClampRenderScale()
|
|
150
|
+
return scale > 1 ? strokeWidth / scale : strokeWidth
|
|
151
|
+
} else return strokeWidth
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
151
155
|
public __setPaint(attrName: 'fill' | 'stroke', value: IValue): void {
|
|
152
156
|
this.__setInput(attrName, value)
|
|
153
157
|
const layout = this.__leaf.__layout
|
|
@@ -168,6 +172,7 @@ export class UIData extends LeafData implements IUIData {
|
|
|
168
172
|
this._fill = this.__isFills = undefined
|
|
169
173
|
} else {
|
|
170
174
|
stintSet(this, '__isAlphaPixelStroke', undefined)
|
|
175
|
+
stintSet(this, '__hasMultiStrokeStyle', undefined)
|
|
171
176
|
this._stroke = this.__isStrokes = undefined
|
|
172
177
|
}
|
|
173
178
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { INumber, IPointData, IBoolean, IValue, IPathCommandData, IPathCommandObject, IPathString } from '@leafer/interface';
|
|
2
2
|
import { LeafData } from '@leafer/core';
|
|
3
|
-
import { IUIData, IUI, IGroupData, IBoxData, ILeaferData, IObject, IJSONOptions, IFrameData, ILineData, IRectData, IEllipseData, IPolygonData, IStarData, IPathData, IPenData, ITextData, IBackgroundBoxStyle, IFontWeight, IImageData, IImage, ICanvasData } from '@leafer-ui/interface';
|
|
3
|
+
import { IUIData, IUI, IStrokeComputedStyle, IGroupData, IBoxData, ILeaferData, IObject, IJSONOptions, IFrameData, ILineData, IRectData, IEllipseData, IPolygonData, IStarData, IPathData, IPenData, ITextData, IBackgroundBoxStyle, IFontWeight, IImageData, IImage, ICanvasData } from '@leafer-ui/interface';
|
|
4
4
|
|
|
5
5
|
declare class UIData extends LeafData implements IUIData {
|
|
6
6
|
__leaf: IUI;
|
|
@@ -9,8 +9,8 @@ declare class UIData extends LeafData implements IUIData {
|
|
|
9
9
|
__isFills?: boolean;
|
|
10
10
|
__isStrokes?: boolean;
|
|
11
11
|
get __strokeWidth(): number;
|
|
12
|
-
get
|
|
13
|
-
|
|
12
|
+
get __maxStrokeWidth(): number;
|
|
13
|
+
__hasMultiStrokeStyle?: number;
|
|
14
14
|
get __hasMultiPaint(): boolean;
|
|
15
15
|
__isAlphaPixelFill?: boolean;
|
|
16
16
|
__isAlphaPixelStroke?: boolean;
|
|
@@ -41,6 +41,7 @@ declare class UIData extends LeafData implements IUIData {
|
|
|
41
41
|
protected setInnerShadow(value: IValue): void;
|
|
42
42
|
protected setFilter(value: IValue): void;
|
|
43
43
|
__computePaint(): void;
|
|
44
|
+
__getRealStrokeWidth(childStyle?: IStrokeComputedStyle): number;
|
|
44
45
|
__setPaint(attrName: 'fill' | 'stroke', value: IValue): void;
|
|
45
46
|
__removePaint(attrName: 'fill' | 'stroke', removeInput?: boolean): void;
|
|
46
47
|
}
|