Skip to content

Commit

Permalink
Copy over style properties in Layer.copy()
Browse files Browse the repository at this point in the history
  • Loading branch information
nvh committed Aug 1, 2016
1 parent 5ee40e2 commit 6e9d16c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion framer/Layer.coffee
Expand Up @@ -636,7 +636,9 @@ class exports.Layer extends BaseClass
return layer

copySingle: ->
return new @constructor(@props)
copy = new @constructor(@props)
copy.style = @style
copy

##############################################################
## IMAGE
Expand Down
11 changes: 11 additions & 0 deletions test/tests/LayerTest.coffee
Expand Up @@ -1156,6 +1156,17 @@ describe "Layer", ->
copy.width.should.equal 100
copy.height.should.equal 100

it "copied Layer should also copy styles", ->
layer = new Layer
style:
"font-family" : "-apple-system"
"font-size" : "1.2em"
"text-align" : "right"

copy = layer.copy()
copy.style["font-family"].should.equal "-apple-system"
copy.style["font-size"].should.equal "1.2em"
copy.style["text-align"].should.equal "right"

describe "Draggable", ->

Expand Down

0 comments on commit 6e9d16c

Please sign in to comment.