Navigation Menu

Skip to content

Commit

Permalink
Fix index set at creation
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbok committed Feb 15, 2015
1 parent d69bbfe commit efc5aa4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion framer/Layer.coffee
Expand Up @@ -88,7 +88,7 @@ class exports.Layer extends BaseClass
# @_element.id = "FramerLayer-#{@id}"

for k in ["minX", "midX", "maxX", "minY", "midY", "maxY"]
if options.hasOwnProperty k
if options.hasOwnProperty(k)
@[k] = options[k]

# Insert the layer into the dom or the superLayer element
Expand All @@ -97,6 +97,10 @@ class exports.Layer extends BaseClass
else
@superLayer = options.superLayer

# If an index was set, we would like to use that one
if options.hasOwnProperty("index")
@index = options.index

# Set needed private variables
@_subLayers = []

Expand Down
5 changes: 5 additions & 0 deletions test/tests/LayerTest.coffee
Expand Up @@ -517,6 +517,11 @@ describe "Layer", ->

describe "Layering", ->

it "should set at creation", ->

layer = new Layer index:666
layer.index.should.equal 666

it "should change index", ->

layer = new Layer
Expand Down

0 comments on commit efc5aa4

Please sign in to comment.