Permalink
Browse files

Allow size and point to be a single number as a shortcut

So you can do layer.size = 10 to get a 10 x 10 layer.
  • Loading branch information...
Koen Bok
Koen Bok committed Jan 27, 2016
1 parent 475604f commit 1650f6b507891815bbd23d759560d25f1035d4a3
Showing with 2 additions and 0 deletions.
  1. +2 −0 framer/Layer.coffee
@@ -298,13 +298,15 @@ class exports.Layer extends BaseClass
get: -> _.pick(@, ["x", "y"])
set: (point) ->
return if not point
point = {x: point, y: point} if _.isNumber(point)
for k in ["x", "y"]
@[k] = point[k] if point.hasOwnProperty(k)
@define "size",
get: -> _.pick(@, ["width", "height"])
set: (size) ->
return if not size
size = {width: size, height: size} if _.isNumber(size)
for k in ["width", "height"]
@[k] = size[k] if size.hasOwnProperty(k)

1 comment on commit 1650f6b

@marckrenn

This comment has been minimized.

Contributor

marckrenn commented on 1650f6b Jan 27, 2016

👏👏👏

Please sign in to comment.