Setting text on Konva.Text, treat undefined width or height as 'auto'

Similar to how it's handled in getWidth() and getHeight() of Konva.Text,
let _setTextData() treat undefined values of the 'width' and 'height'
attributes as if they are set to 'auto', not as if they are fixed.
This commit is contained in:
VladimirTechMan
2019-01-06 22:06:37 +03:00
parent a3767bdf3d
commit 4be6ed7ac8

View File

@@ -342,8 +342,8 @@ export class Text extends Shape {
lineHeightPx = this.lineHeight() * fontSize,
width = this.attrs.width,
height = this.attrs.height,
fixedWidth = width !== AUTO,
fixedHeight = height !== AUTO,
fixedWidth = width !== AUTO && width !== undefined,
fixedHeight = height !== AUTO && height !== undefined,
padding = this.padding(),
maxWidth = width - padding * 2,
maxHeightPx = height - padding * 2,