You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, I'm noticing some strange issues with the SegmentBehavior code when I have two tracks. Please see the attached animated gif for details.
Problem:
The dragged segment does not stay under the mouse.
What I expect:
the dragged segment to stay under the mouse.
Is this because the time context being used is related to the wrong track?
Although I am using a custom behavior, I can duplicate the issue using the default segment-behavior.js
Hi, I have add this issue before but can't remember the cause, looks like your delta x is twice larger as it should be. Do you have a public repo for your project so I could run it ?
that's it, the fact is that you create 2 tracks on the same DOM element, then the timeline instanciate 1 surface for each track and thus each event is triggered twice.
So, you have 2 options:
you put the 2 layers in the same track, using the top parameter for the layout
you create two tracks in two different DOM elements
(actually, looking at your code, I would go for solution 1, as its just a matter of removing one of the tracks)
I ended up going with two DOM elements as that feels like it is closer to the actual DAW metaphor in this case. Having two layers in the same track doesn't feel as clean.
I wonder if this is something the library might be able to do automatically though? In my mind, I was dedicating a single DOM element to creating a wavejs interface, probably because I'm thinking more from a React perspective. Either way though, could there be some logic applied here that would create a new DOM element if you try to create two tracks on the root DOM? I haven't thought this all through obviously...
I use Screenflow for all of my animated gifs. It's incredibly useful.
Activity
justinlevi commentedon Nov 13, 2017
Here's my code for reference:
b-ma commentedon Nov 14, 2017
Hi, I have add this issue before but can't remember the cause, looks like your delta x is twice larger as it should be. Do you have a public repo for your project so I could run it ?
justinlevi commentedon Nov 14, 2017
@b-ma Here you go
https://bl.ocks.org/justinlevi/9eed1adbb79f30b78eeb464eb3fb04a2
Might take a sec to load as the wav is pretty big
Here's the gist as well.
https://gist.github.com/justinlevi/9eed1adbb79f30b78eeb464eb3fb04a2#file-index-html
Updated my code example above to reflect this example as well.
justinlevi commentedon Nov 15, 2017
@b-ma Here's an interesting discovery. If I add both layers to the same track, the drag functionality works as expected.
Working example here.
https://bl.ocks.org/justinlevi/80349dc50de2b76e58d98bf85a03f3e4
Not sure what this points to other than the fact that multiple tracks seem to be causing the bug
justinlevi commentedon Nov 15, 2017
Here is one more cleaned up example creating the tracks and layers manually instead of using the
timline.addLayer()helper method.https://bl.ocks.org/justinlevi/9340df9dbec02a70ba3655b6862d51f2
Could it be that the drag event is firing twice for some reason?
b-ma commentedon Nov 15, 2017
Hey,
that's it, the fact is that you create 2 tracks on the same DOM element, then the timeline instanciate 1 surface for each track and thus each event is triggered twice.
So, you have 2 options:
topparameter for the layout(actually, looking at your code, I would go for solution 1, as its just a matter of removing one of the tracks)
This should fix the problem.
b-ma commentedon Nov 15, 2017
Side question, which tool do you use for creating these animated gifs?
justinlevi commentedon Nov 15, 2017
BINGO! That did the trick.
https://bl.ocks.org/justinlevi/d2baaf13f2445d29b2d7cd047fca1c29
I ended up going with two DOM elements as that feels like it is closer to the actual DAW metaphor in this case. Having two layers in the same track doesn't feel as clean.
I wonder if this is something the library might be able to do automatically though? In my mind, I was dedicating a single DOM element to creating a wavejs interface, probably because I'm thinking more from a React perspective. Either way though, could there be some logic applied here that would create a new DOM element if you try to create two tracks on the root DOM? I haven't thought this all through obviously...
I use Screenflow for all of my animated gifs. It's incredibly useful.