@leafer-ui/display 1.9.12 → 1.10.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/Text.ts +6 -4
- package/src/UI.ts +3 -3
- package/types/index.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.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": "1.
|
|
26
|
-
"@leafer-ui/data": "1.
|
|
27
|
-
"@leafer-ui/display-module": "1.
|
|
28
|
-
"@leafer-ui/decorator": "1.
|
|
29
|
-
"@leafer-ui/external": "1.
|
|
25
|
+
"@leafer/core": "1.10.0",
|
|
26
|
+
"@leafer-ui/data": "1.10.0",
|
|
27
|
+
"@leafer-ui/display-module": "1.10.0",
|
|
28
|
+
"@leafer-ui/decorator": "1.10.0",
|
|
29
|
+
"@leafer-ui/external": "1.10.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.
|
|
33
|
-
"@leafer-ui/interface": "1.
|
|
32
|
+
"@leafer/interface": "1.10.0",
|
|
33
|
+
"@leafer-ui/interface": "1.10.0"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Text.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { TextConvert, UnitConvert } from '@leafer-ui/external'
|
|
|
9
9
|
import { UI } from './UI'
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
const { copyAndSpread, includes, spread, setList } = BoundsHelper
|
|
12
|
+
const { copyAndSpread, includes, spread, setList } = BoundsHelper, { stintSet } = DataHelper
|
|
13
13
|
|
|
14
14
|
@registerUI()
|
|
15
15
|
export class Text<TConstructorData = ITextInputData> extends UI<TConstructorData> implements IText {
|
|
@@ -105,14 +105,16 @@ export class Text<TConstructorData = ITextInputData> extends UI<TConstructorData
|
|
|
105
105
|
|
|
106
106
|
public __updateTextDrawData(): void {
|
|
107
107
|
const data = this.__
|
|
108
|
-
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data
|
|
108
|
+
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding, width, height } = data
|
|
109
109
|
|
|
110
110
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize)
|
|
111
111
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize)
|
|
112
|
-
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined
|
|
113
112
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2 // 基线位置
|
|
114
113
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize || 12}px ${fontFamily || 'caption'}`
|
|
115
|
-
|
|
114
|
+
|
|
115
|
+
stintSet(data, '__padding', padding && MathHelper.fourNumber(padding))
|
|
116
|
+
stintSet(data, '__clipText', textOverflow !== 'show' && !data.__autoSize)
|
|
117
|
+
stintSet(data, '__isCharMode', (width || height || data.__letterSpacing || (textCase !== 'none')) as boolean)
|
|
116
118
|
|
|
117
119
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__)
|
|
118
120
|
}
|
package/src/UI.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaferCanvas, 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, ILeaferImage, IScaleFixed, IDragBoundsType } 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, ILeaferImage, IScaleFixed, IDragBoundsType } from '@leafer/interface'
|
|
2
2
|
import { Leaf, PathDrawer, surfaceType, dimType, dataType, positionType, scrollType, boundsType, pathType, scaleType, rotationType, opacityType, visibleType, sortType, maskType, dataProcessor, registerUI, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, pen, naturalBoundsType, pathInputType, MathHelper, Plugin, DataHelper, affectRenderBoundsType, isString, isNumber } from '@leafer/core'
|
|
3
3
|
|
|
4
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 } from '@leafer-ui/interface'
|
|
@@ -488,8 +488,8 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
|
|
|
488
488
|
} else drawer.rect(x, y, width, height)
|
|
489
489
|
}
|
|
490
490
|
|
|
491
|
-
public drawImagePlaceholder(canvas: ILeaferCanvas,
|
|
492
|
-
Paint.fill(this.__.placeholderColor, this, canvas) // 图片占位符
|
|
491
|
+
public drawImagePlaceholder(_image: ILeaferImage, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void {
|
|
492
|
+
Paint.fill(this.__.placeholderColor, this, canvas, renderOptions) // 图片占位符
|
|
493
493
|
}
|
|
494
494
|
|
|
495
495
|
// @leafer-in/animate rewrite
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IFourNumber, IPathCommandData, IPathCommandObject, IPathString, IWindingRule, IFlowType, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IDragBoundsType, IHitType, ICursorType, IScaleFixed, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IFindCondition, ILeaferCanvas, IPathDrawer, ILeaferImage, 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,
|
|
1
|
+
import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IFourNumber, IPathCommandData, IPathCommandObject, IPathString, IWindingRule, IFlowType, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IDragBoundsType, IHitType, ICursorType, IScaleFixed, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IFindCondition, ILeaferCanvas, IPathDrawer, ILeaferImage, 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, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
|
|
2
2
|
import { Leaf, LeafList } from '@leafer/core';
|
|
3
3
|
import { IUIInputData, IUI, IUIData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowStyle, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IAnimation, IStates, IStateName, IStateStyle, IColorString, IEditorConfig, IAnimate, IAnimateList, IFindUIMethod, 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
|
|
|
@@ -142,7 +142,7 @@ declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements
|
|
|
142
142
|
__drawPath(canvas: ILeaferCanvas): void;
|
|
143
143
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
|
|
144
144
|
__drawPathByBox(drawer: IPathDrawer): void;
|
|
145
|
-
drawImagePlaceholder(canvas: ILeaferCanvas,
|
|
145
|
+
drawImagePlaceholder(_image: ILeaferImage, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
|
|
146
146
|
animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate;
|
|
147
147
|
killAnimate(_type?: IAnimateType, _nextStyle?: IUIInputData): void;
|
|
148
148
|
export(_filename: IExportFileType | string, _options?: IExportOptions | number | boolean): Promise<IExportResult>;
|