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 19 - Read on Facebook

TL;DR: Is there anyway to use the event 'Framer.CurrentContext.on "layer:create", (new layer) ->' with layers created in design tab?

I am using Layer.define to create some custom properties on the layer class, for example:
try Layer.define "enableHighlight",
____get: -> @_properties["enableHighlight"]
____set: (value) ->
[email protected]_properties["enableHighlight"] = value

Now i want that every time a new layer is created, this custom property is automatically assigned a default value. For this i am using:
Framer.CurrentContext.on "layer:create", (newLayer) ->
____newLayer.enableHighlight = false

However, this only works with imported layers or layers created in code, how can i make it work with layers created in the design tab?


Rohan K

Jordan Robert Dobson we discussed this in person, and had some sort of a solution around it. but i just can't remember, do you remember what it was? the only thing i could think of was to create some sort of init function and loop it over an array of ALL the layers. but it seems rather inelegant. I'm sure there must be a better way :-/

Read the entire post on Facebook