@leafer-ui/display 2.1.0 → 2.1.2

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-ui/display",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
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.0",
26
- "@leafer-ui/data": "2.1.0",
27
- "@leafer-ui/display-module": "2.1.0",
28
- "@leafer-ui/decorator": "2.1.0",
29
- "@leafer-ui/external": "2.1.0"
25
+ "@leafer/core": "2.1.2",
26
+ "@leafer-ui/data": "2.1.2",
27
+ "@leafer-ui/display-module": "2.1.2",
28
+ "@leafer-ui/decorator": "2.1.2",
29
+ "@leafer-ui/external": "2.1.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "2.1.0",
33
- "@leafer-ui/interface": "2.1.0"
32
+ "@leafer/interface": "2.1.2",
33
+ "@leafer-ui/interface": "2.1.2"
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, spread, setList } = BoundsHelper, { stintSet } = DataHelper
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 {
@@ -132,7 +132,7 @@ export class Text<TConstructorData = ITextInputData> extends UI<TConstructorData
132
132
 
133
133
  layout.contentBounds = contentBounds
134
134
 
135
- if (data.__lineHeight < fontSize) spread(contentBounds, fontSize / 2)
135
+ if (data.__lineHeight < fontSize) layout.renderChanged = true
136
136
 
137
137
  if (autoWidth || autoHeight) {
138
138
  b.x = autoWidth ? contentBounds.x : 0
@@ -159,6 +159,9 @@ export class Text<TConstructorData = ITextInputData> extends UI<TConstructorData
159
159
  override __updateRenderSpread(): IFourNumber {
160
160
  let spread = super.__updateRenderSpread()
161
161
  if (!spread) spread = this.isOverflow ? 1 : 0
162
+
163
+ const { __lineHeight, fontSize } = this.__
164
+ if (__lineHeight < fontSize) spread = FourNumberHelper.max(spread, (fontSize - __lineHeight) / 2)
162
165
  return spread
163
166
  }
164
167
 
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)