Permalink
Browse files

Use nice defaults for GridComponent

  • Loading branch information...
koenbok committed Apr 30, 2016
1 parent 645653b commit ff8eb4da1a6991f74d15e7aef5e4b4d212f85d8e
Showing with 12 additions and 15 deletions.
  1. +7 −15 framer/Components/GridComponent.coffee
  2. +5 −0 framer/Defaults.coffee
@@ -1,23 +1,12 @@
Utils = require "../Utils"
{Defaults} = require "../Defaults"
{Layer} = require "../Layer"
class exports.GridComponent extends Layer
constructor: (options) ->
defaults =
rows: 3
columns: 3
spacing: 0
backgroundColor: "transparent"
options = _.defaults(options, defaults)
super options
_.extend(@, _.pick(options, _.keys(defaults)))
constructor: (options={}) ->
super Defaults.getDefaults("GridComponent", options)
@define "rows",
get: -> @_rows
@@ -43,7 +32,10 @@ class exports.GridComponent extends Layer
get: -> @_renderCell or @_defaultRenderCell
set: (f) ->
return if f is @_renderCell
throw Error "GridComponent.renderCell should be a function, not #{typeof(f)}" unless _.isFunction(f)
if not _.isFunction(f)
throw Error "GridComponent.renderCell should be a function, not #{typeof(f)}"
@_renderCell = f
@render()
View
@@ -67,6 +67,11 @@ Originals =
tension: 500
friction: 10
tolerance: 1
GridComponent:
rows: 3
columns: 3
spacing: 0
backgroundColor: "transparent"
exports.Defaults =

0 comments on commit ff8eb4d

Please sign in to comment.