Skip to content
Permalink
Browse files

Fix autoSizing TextLayer

when setting text after the constructor

Fixes #482
  • Loading branch information
nvh committed Mar 29, 2017
1 parent f506fc0 commit a4c59b477abfb26043ac54572fb2f75c90cee621
Showing with 11 additions and 1 deletion.
  1. +1 −1 framer/TextLayer.coffee
  2. +10 −0 test/tests/TextLayerTest.coffee
@@ -107,7 +107,7 @@ class exports.TextLayer extends Layer
@style["-webkit-line-clamp"] = @maxVisibleLines()

updateExplicitWidth: (value) =>
return if @enableExplicitUpdating
return if @disableExplicitUpdating
@explicitWidth = true

updateExplicitHeight: (value) =>
@@ -150,6 +150,16 @@ describe "TextLayer", ->
text: shortText
text.point.should.eql x: 180, y: 147

it "should autosize when setting the text multiple times", ->
text = new TextLayer
fontFamily: "Courier, Liberation Mono"
text: "Hi"
text.size.should.eql width: 48, height: 50
text.text = "Hello"
text.size.should.eql width: 120, height: 50
text.text = "Hello there"
text.size.should.eql width: 264, height: 50

describe "Padding", ->
it "should have no padding initially", ->
text = new TextLayer

0 comments on commit a4c59b4

Please sign in to comment.
You can’t perform that action at this time.