@leafer-ui/display 2.1.10 → 2.2.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 +8 -8
- package/src/Line.ts +2 -0
- package/src/Polygon.ts +1 -0
- package/src/Text.ts +2 -2
- package/src/UI.ts +9 -4
- package/types/index.d.ts +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "@leafer-ui/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "2.
|
|
26
|
-
"@leafer-ui/data": "2.
|
|
27
|
-
"@leafer-ui/display-module": "2.
|
|
28
|
-
"@leafer-ui/decorator": "2.
|
|
29
|
-
"@leafer-ui/external": "2.
|
|
25
|
+
"@leafer/core": "2.2.0",
|
|
26
|
+
"@leafer-ui/data": "2.2.0",
|
|
27
|
+
"@leafer-ui/display-module": "2.2.0",
|
|
28
|
+
"@leafer-ui/decorator": "2.2.0",
|
|
29
|
+
"@leafer-ui/external": "2.2.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "2.
|
|
33
|
-
"@leafer-ui/interface": "2.
|
|
32
|
+
"@leafer/interface": "2.2.0",
|
|
33
|
+
"@leafer-ui/interface": "2.2.0"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Line.ts
CHANGED
|
@@ -34,6 +34,8 @@ export class Line<TInputData = ILineInputData> extends UI<TInputData> implements
|
|
|
34
34
|
@pathType(false)
|
|
35
35
|
declare public closed?: boolean
|
|
36
36
|
|
|
37
|
+
public get isPointsMode(): boolean { return this.points && !this.pathInputed }
|
|
38
|
+
|
|
37
39
|
public get toPoint(): IPointData {
|
|
38
40
|
const { width, rotation } = this.__
|
|
39
41
|
const to: IPointData = getPointData()
|
package/src/Polygon.ts
CHANGED
package/src/Text.ts
CHANGED
|
@@ -114,7 +114,7 @@ export class Text<TInputData = ITextInputData> extends UI<TInputData> implements
|
|
|
114
114
|
|
|
115
115
|
stintSet(data, '__padding', padding && MathHelper.fourNumber(padding))
|
|
116
116
|
stintSet(data, '__clipText', textOverflow !== 'show' && !data.__autoSize)
|
|
117
|
-
stintSet(data, '__isCharMode', (width || height || data.__letterSpacing || (textCase !== 'none')) as boolean)
|
|
117
|
+
stintSet(data, '__isCharMode', (width || height || data.__letterSpacing || data.motionText || (textCase !== 'none')) as boolean)
|
|
118
118
|
|
|
119
119
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__)
|
|
120
120
|
}
|
|
@@ -150,7 +150,7 @@ export class Text<TInputData = ITextInputData> extends UI<TInputData> implements
|
|
|
150
150
|
|
|
151
151
|
if (italic) b.width += fontSize * 0.16 // 倾斜会导致文本的bounds增大
|
|
152
152
|
|
|
153
|
-
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds))
|
|
153
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds) && !data.motionText)
|
|
154
154
|
|
|
155
155
|
if (this.isOverflow) setList(data.__textBoxBounds = {} as IBoundsData, [b, contentBounds]), layout.renderChanged = true
|
|
156
156
|
else data.__textBoxBounds = b
|
package/src/UI.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ILeaferCanvas, IRenderOptions, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IEraserType, IWindingRule, IPathCreator, IFourNumber, IBoundsData, IFlowType, IGap, IFlowWrap, IAxis, IConstraint, IAutoBoxData, IFlowBoxType, IPointGap, IFlowAlign, IFlowAxisAlign, IFindCondition, IAutoSize, IRangeSize, IAlign, IUnitPointData, IObject, IScaleData, IUnitData, IPathCommandObject, ITransition, IFilter, IScaleFixed, IDragBoundsType, IPathCommandNode } from '@leafer/interface'
|
|
1
|
+
import { ILeaferCanvas, IRenderOptions, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IEraserType, IWindingRule, IPathCreator, IFourNumber, IBoundsData, IFlowType, IGap, IFlowWrap, IAxis, IConstraint, IAutoBoxData, IFlowBoxType, IPointGap, IFlowAlign, IFlowAxisAlign, IFindCondition, IAutoSize, IRangeSize, IAlign, IUnitPointData, IObject, IScaleData, IUnitData, IPathCommandObject, ITransition, IFilter, IMotionVertical, IScaleFixed, IDragBoundsType, IPathCommandNode } from '@leafer/interface'
|
|
2
2
|
import { Leaf, PathDrawer, surfaceType, dimType, dataType, positionType, scrollType, boundsType, pathType, scaleType, rotationType, opacityType, visibleType, sortType, maskType, dataProcessor, registerUI, useModule, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, pen, naturalBoundsType, pathInputType, MathHelper, Plugin, DataHelper, affectRenderBoundsType, isString, isNumber } from '@leafer/core'
|
|
3
3
|
|
|
4
|
-
import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IArrowStyle, IFindUIMethod, ILeafer, IEditorConfig, IEditorConfigFunction, IEditToolFunction, IKeyframe, IAnimation, IAnimate, IStates, IStateName, IAnimateType, IStateStyle, IColorString, IAnimateList, ILeafPaint, ILinker, IPathCommandDataWithRadius } from '@leafer-ui/interface'
|
|
4
|
+
import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IArrowStyle, IFindUIMethod, ILeafer, IEditorConfig, IEditorConfigFunction, IEditToolFunction, IKeyframe, IAnimation, IAnimate, IStates, IStateName, IAnimateType, IStateStyle, IColorString, IAnimateList, ILeafPaint, ILinker, IPathCommandDataWithRadius, ILineData } from '@leafer-ui/interface'
|
|
5
5
|
import { effectType, zoomLayerType } from '@leafer-ui/decorator'
|
|
6
6
|
|
|
7
7
|
import { UIData } from '@leafer-ui/data'
|
|
@@ -339,15 +339,19 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
|
|
|
339
339
|
|
|
340
340
|
// @leafer-in/motion-path rewrite
|
|
341
341
|
|
|
342
|
-
public motionPath?: boolean
|
|
342
|
+
public motionPath?: boolean
|
|
343
343
|
|
|
344
344
|
public motionPrecision?: INumber
|
|
345
345
|
|
|
346
346
|
|
|
347
347
|
public motion?: INumber | IUnitData
|
|
348
348
|
|
|
349
|
+
public motionVertical?: IMotionVertical
|
|
350
|
+
|
|
349
351
|
public motionRotation?: INumber | IBoolean
|
|
350
352
|
|
|
353
|
+
public motionText?: boolean
|
|
354
|
+
|
|
351
355
|
|
|
352
356
|
// @leafer-in/state rewrite
|
|
353
357
|
|
|
@@ -487,8 +491,9 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
|
|
|
487
491
|
}
|
|
488
492
|
|
|
489
493
|
public __drawPath(canvas: ILeaferCanvas): void {
|
|
494
|
+
const data = this.__ as ILineData
|
|
490
495
|
canvas.beginPath()
|
|
491
|
-
this.__drawPathByData(canvas,
|
|
496
|
+
data.__usePointsMode ? PathDrawer.drawPathByPoints(canvas, data.points, data.closed) : this.__drawPathByData(canvas, data.path, true)
|
|
492
497
|
}
|
|
493
498
|
|
|
494
499
|
public __drawPathByData(drawer: IPathDrawer, data: IPathCommandData, ignoreCornerRadius?: boolean): void {
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IString, INumber, IBoolean, IMaskType, IEraserType, IScaleFixed, IAlign, IUnitPointData, IFourNumber, IPathCommandData, IPathCommandNode, IPathCommandObject, IPathString, IWindingRule, IFlowType, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IDragBoundsType, IHitType, ICursorType, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IFindCondition, ILeaferCanvas, IPathDrawer, IRenderOptions, IExportFileType, IJSONOptions, IPickOptions, IPickResult, ILeaferMode, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IValue, ICanvasSizeAttr, IZoomType, IZoomOptions, IClientPointData, ILeaferImage, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
|
|
1
|
+
import { IString, INumber, IBoolean, IMaskType, IEraserType, IScaleFixed, IAlign, IUnitPointData, IFourNumber, IPathCommandData, IPathCommandNode, IPathCommandObject, IPathString, IWindingRule, IFlowType, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IDragBoundsType, IHitType, ICursorType, IFilter, ITransition, IUnitData, IMotionVertical, IObject, IPointData, IPathCreator, IFindCondition, ILeaferCanvas, IPathDrawer, IRenderOptions, IExportFileType, IJSONOptions, IPickOptions, IPickResult, ILeaferMode, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IValue, ICanvasSizeAttr, IZoomType, IZoomOptions, IClientPointData, ILeaferImage, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
|
|
2
2
|
import { Leaf, LeafList } from '@leafer/core';
|
|
3
3
|
import { IUIInputData, IUI, IUIData, ILeafer, IGroup, ILinker, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowStyle, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IAnimation, IStates, IStateName, IStateStyle, IColorString, IEditorConfig, IAnimate, IAnimateList, IFindUIMethod, ILeafPaint, IKeyframe, IAnimateType, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupInputData, IGroupData, IUIJSONData, IFindCondition as IFindCondition$1, ILeaferData, IApp, IEditorBase, IFunction, ILeaferInputData, IBoxInputData, IBox, IBoxData, IOverflow, IScrollConfig, IScroller, IFrameInputData, IFrame, IFrameData, IRectInputData, IRect, IRectData, IEllipseInputData, IEllipse, IEllipseData, IPolygonInputData, IPolygon, IPolygonData, IStarInputData, IStar, IStarData, ILineInputData, ILine, ILineData, IImageInputData, IImage, IImageData, ICanvasInputData, ICanvas, ICanvasData, ITextInputData, IText, ITextData, IBackgroundBoxStyle, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IWritingMode, ITextAlign, IVerticalAlign, ITextWrap, ITextOverflow, ITextDrawData, IPathInputData, IPath, IPathData, IPenInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPointData as IPointData$1 } from '@leafer-ui/interface';
|
|
4
4
|
|
|
@@ -101,10 +101,12 @@ declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements
|
|
|
101
101
|
animationOut?: IAnimation | IAnimation[];
|
|
102
102
|
transition?: ITransition;
|
|
103
103
|
transitionOut?: ITransition;
|
|
104
|
-
motionPath?: boolean
|
|
104
|
+
motionPath?: boolean;
|
|
105
105
|
motionPrecision?: INumber;
|
|
106
106
|
motion?: INumber | IUnitData;
|
|
107
|
+
motionVertical?: IMotionVertical;
|
|
107
108
|
motionRotation?: INumber | IBoolean;
|
|
109
|
+
motionText?: boolean;
|
|
108
110
|
states?: IStates;
|
|
109
111
|
state?: IStateName;
|
|
110
112
|
selected?: IBoolean;
|
|
@@ -352,6 +354,7 @@ declare class Polygon<TInputData = IPolygonInputData> extends UI<TInputData> imp
|
|
|
352
354
|
startAngle?: INumber;
|
|
353
355
|
points?: number[] | IPointData[];
|
|
354
356
|
curve?: boolean | number;
|
|
357
|
+
get isPointsMode(): boolean;
|
|
355
358
|
__updatePath(): void;
|
|
356
359
|
}
|
|
357
360
|
|
|
@@ -372,6 +375,7 @@ declare class Line<TInputData = ILineInputData> extends UI<TInputData> implement
|
|
|
372
375
|
points?: number[] | IPointData[];
|
|
373
376
|
curve?: boolean | number;
|
|
374
377
|
closed?: boolean;
|
|
378
|
+
get isPointsMode(): boolean;
|
|
375
379
|
get toPoint(): IPointData;
|
|
376
380
|
set toPoint(value: IPointData);
|
|
377
381
|
__updatePath(): void;
|