@leafer-ui/display 1.0.6 → 1.0.7
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 +3 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
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.0.
|
|
26
|
-
"@leafer-ui/data": "1.0.
|
|
27
|
-
"@leafer-ui/display-module": "1.0.
|
|
28
|
-
"@leafer-ui/decorator": "1.0.
|
|
29
|
-
"@leafer-ui/external": "1.0.
|
|
25
|
+
"@leafer/core": "1.0.7",
|
|
26
|
+
"@leafer-ui/data": "1.0.7",
|
|
27
|
+
"@leafer-ui/display-module": "1.0.7",
|
|
28
|
+
"@leafer-ui/decorator": "1.0.7",
|
|
29
|
+
"@leafer-ui/external": "1.0.7"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.0.
|
|
33
|
-
"@leafer-ui/interface": "1.0.
|
|
32
|
+
"@leafer/interface": "1.0.7",
|
|
33
|
+
"@leafer-ui/interface": "1.0.7"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Text.ts
CHANGED
|
@@ -137,7 +137,7 @@ export class Text extends UI implements IText {
|
|
|
137
137
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize)
|
|
138
138
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize)
|
|
139
139
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined
|
|
140
|
-
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2
|
|
140
|
+
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2 // 基线位置
|
|
141
141
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`
|
|
142
142
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize
|
|
143
143
|
|
|
@@ -170,16 +170,14 @@ export class Text extends UI implements IText {
|
|
|
170
170
|
super.__updateBoxBounds()
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
if (italic) b.width += fontSize * 0.16
|
|
173
|
+
if (italic) b.width += fontSize * 0.16 // 倾斜会导致文本的bounds增大
|
|
174
174
|
|
|
175
175
|
const contentBounds = includes(b, bounds) ? b : bounds
|
|
176
176
|
if (!isSame(contentBounds, layout.contentBounds)) {
|
|
177
177
|
layout.contentBounds = contentBounds
|
|
178
178
|
layout.renderChanged = true
|
|
179
179
|
setList(data.__textBoxBounds = {} as IBoundsData, [b, bounds])
|
|
180
|
-
} else
|
|
181
|
-
data.__textBoxBounds = contentBounds
|
|
182
|
-
}
|
|
180
|
+
} else data.__textBoxBounds = contentBounds
|
|
183
181
|
|
|
184
182
|
}
|
|
185
183
|
|