@leafer-ui/display 2.1.0 → 2.1.1
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 +7 -3
- package/src/UI.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
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.1.
|
|
26
|
-
"@leafer-ui/data": "2.1.
|
|
27
|
-
"@leafer-ui/display-module": "2.1.
|
|
28
|
-
"@leafer-ui/decorator": "2.1.
|
|
29
|
-
"@leafer-ui/external": "2.1.
|
|
25
|
+
"@leafer/core": "2.1.1",
|
|
26
|
+
"@leafer-ui/data": "2.1.1",
|
|
27
|
+
"@leafer-ui/display-module": "2.1.1",
|
|
28
|
+
"@leafer-ui/decorator": "2.1.1",
|
|
29
|
+
"@leafer-ui/external": "2.1.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "2.1.
|
|
33
|
-
"@leafer-ui/interface": "2.1.
|
|
32
|
+
"@leafer/interface": "2.1.1",
|
|
33
|
+
"@leafer-ui/interface": "2.1.1"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Text.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILeaferCanvas, IBoolean, INumber, IString, IBoundsData, IUnitData, IRenderOptions, IFourNumber } from '@leafer/interface'
|
|
2
|
-
import { BoundsHelper, boundsType, surfaceType, dataProcessor, registerUI, affectStrokeBoundsType, dataType, hitType, MathHelper, DataHelper } from '@leafer/core'
|
|
2
|
+
import { BoundsHelper, boundsType, surfaceType, dataProcessor, registerUI, affectStrokeBoundsType, dataType, hitType, MathHelper, DataHelper, FourNumberHelper } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IFill, IText, IFontWeight, ITextCase, ITextDecoration, ITextData, ITextInputData, ITextAlign, IVerticalAlign, ITextDrawData, ITextOverflow, IStrokeAlign, IHitType, ITextWrap, IWritingMode, IBackgroundBoxStyle } from '@leafer-ui/interface'
|
|
5
5
|
import { TextData } from '@leafer-ui/data'
|
|
@@ -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,
|
|
12
|
+
const { copyAndSpread, includes, setList } = BoundsHelper, { stintSet } = DataHelper
|
|
13
13
|
|
|
14
14
|
@registerUI()
|
|
15
15
|
export class Text<TConstructorData = ITextInputData> extends UI<TConstructorData> implements IText {
|
|
@@ -128,11 +128,12 @@ export class Text<TConstructorData = ITextInputData> extends UI<TConstructorData
|
|
|
128
128
|
this.__updateTextDrawData() // layout text
|
|
129
129
|
|
|
130
130
|
const { bounds: contentBounds } = data.__textDrawData
|
|
131
|
+
console.log(contentBounds)
|
|
131
132
|
const b = layout.boxBounds
|
|
132
133
|
|
|
133
134
|
layout.contentBounds = contentBounds
|
|
134
135
|
|
|
135
|
-
if (data.__lineHeight < fontSize)
|
|
136
|
+
if (data.__lineHeight < fontSize) layout.renderChanged = true
|
|
136
137
|
|
|
137
138
|
if (autoWidth || autoHeight) {
|
|
138
139
|
b.x = autoWidth ? contentBounds.x : 0
|
|
@@ -159,6 +160,9 @@ export class Text<TConstructorData = ITextInputData> extends UI<TConstructorData
|
|
|
159
160
|
override __updateRenderSpread(): IFourNumber {
|
|
160
161
|
let spread = super.__updateRenderSpread()
|
|
161
162
|
if (!spread) spread = this.isOverflow ? 1 : 0
|
|
163
|
+
|
|
164
|
+
const { __lineHeight, fontSize } = this.__
|
|
165
|
+
if (__lineHeight < fontSize) spread = FourNumberHelper.max(spread, (fontSize - __lineHeight) / 2)
|
|
162
166
|
return spread
|
|
163
167
|
}
|
|
164
168
|
|
package/src/UI.ts
CHANGED
|
@@ -211,7 +211,7 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
|
|
|
211
211
|
public dragBounds?: IBoundsData | 'parent'
|
|
212
212
|
|
|
213
213
|
@dataType('auto')
|
|
214
|
-
dragBoundsType?: IDragBoundsType
|
|
214
|
+
public dragBoundsType?: IDragBoundsType
|
|
215
215
|
|
|
216
216
|
|
|
217
217
|
@dataType(false)
|