Commit 909ca782 authored by 罗超's avatar 罗超

支持文字拖拽的大小读取

parent a71eee39
......@@ -16,11 +16,12 @@ export const ResolveText = (item: any, index: number,offsetLeft:number,offsetTop
const { left, top, width, height, value, font, transform } = f
const { colors, styles, alignment, sizes, names, weights } = font
let fontSize = 24.0
if (sizes && sizes[0]) {
let newSizes = sizes?sizes:[12]
if (newSizes && newSizes[0]) {
if (transform.yy !== 1) {
fontSize = (Math.round((sizes[0] * transform.yy) * 100) * 0.01)
fontSize = (Math.round((newSizes[0] * transform.yy) * 100) * 0.01)
} else {
fontSize = sizes[0]
fontSize = newSizes[0]
}
}
if(transform){
......@@ -33,7 +34,7 @@ export const ResolveText = (item: any, index: number,offsetLeft:number,offsetTop
const { StyleSheetData } = StyleSheet
const tracking = fontSize * (StyleSheetData.Tracking / 1000)
const lineHeight = StyleSheetData.Leading
let leading = (Math.round((lineHeight * transform.yy) * 100) * 0.01) / fontSize
let leading = sizes?(Math.round((lineHeight * transform.yy) * 100) * 0.01) / fontSize:1
let objectEFFFects = item.layer.objectEffects ? item.layer.objectEffects() : null
let color = `rgba(${colors[0][0]},${colors[0][1]},${colors[0][2]},${(parseFloat(colors[0][3]) / 255.0).toFixed(2)})`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment