koenbok / Framer

Framer - Design Everything
https://framer.com
MIT License
5.85k stars 477 forks source link

Layer.once happening more than once #169

Closed uxdiogenes closed 9 years ago

uxdiogenes commented 9 years ago

I'm seeing an issue where layer.once is happening more than once. In a click handler setting a once event on Events.animationEnd. Even though only one click happens, the layer.once handle runs twice. Here's an example. Click the layer before the 5 delay is done and you will see the .once happens a second time.

iconLayer = new Layer width:256, height:256, backgroundColor: 'blue'
iconLayer.center()

anim_end_count = 0
click_count = 0

iconLayer.on Events.Click, ->
    print 'click count was' + anim_end_count++ 
    iconLayer.once Events.AnimationEnd, ->
        print 'animation count was ' + anim_end_count++

    iconLayer.animate {
        properties: {
            x: iconLayer.x + 100
        },
        time: 0.2
    }

Utils.delay 5, ->
    iconLayer.animate {
        properties: {
            x: iconLayer.x + 100
        },
        time: 0.3
    }
uxdiogenes commented 9 years ago

Download this sample, made in the latest Framer Studio, here: https://dl.dropboxusercontent.com/u/1334233/more-than-once.framer.zip

koenbok commented 9 years ago

Fixed! Thanks so much for reporting!

uxdiogenes commented 9 years ago

Can I get this fix by running the update framer command in Framer Studio?

On Mon, Feb 2, 2015 at 2:30 AM, Koen Bok notifications@github.com wrote:

Fixed! Thanks so much for reporting!

Reply to this email directly or view it on GitHub: https://github.com/koenbok/Framer/issues/169#issuecomment-72435295

koenbok commented 9 years ago

Yup. Whatever you see here on master is always what you pull in then (assuming the tests don't fail).

uxdiogenes commented 9 years ago

Awesome, thanks.

On Mon, Feb 2, 2015 at 9:09 AM, Koen Bok notifications@github.com wrote:

Yup. Whatever you see here on master is always what you pull in then (assuming the tests don't fail).

Reply to this email directly or view it on GitHub: https://github.com/koenbok/Framer/issues/169#issuecomment-72494953

uxdiogenes commented 9 years ago

While you are in there, you might be able to close this one out: https://github.com/koenbok/Framer/issues/172

The .once handler doesn't seem to get passed the sam args as .on.