This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Rohan K
Posted Dec 31 - Read on Facebook

Few quick questions about working with classes. I'm defining a class by extending a layer to add a custom boolean property, selectable.
1. Can I define default states on / off as part of the constructor function and switch between states based on whether selected is true or not
2. How can I make it such that IF the on/off states for the layer are defined, THEN the default states get overwritten (similar to how I am doing it with the selected property)?

class Selectable extends Layer
--- constructor: (@options={}) ->
------ @options.selected ?= false
------ super @options

--- @define 'selected',
------ get: ->
--------- @options.selected
------ set: (value) ->
--------- @options.selected = value

3 Comments

Jordan Robert Dobson

If you're still in Seattle, we can look at this at the next meetup or over Slack.

Rohan K

Jordan Robert Dobson id love to talk to you. There's so much I need to ask you! I'll ping you separately today evening.

Read the entire post on Facebook