-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Segment Behavior: Shopping Cart/Trolley Queue Metaphor - Super Slow Redraw #32
Comments
Update: Here is a working example using layer selection.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@b-ma Hoping you might be able to take a look at this custom behavior I've been working on for a few days and give some feedback on my approach.
Here is the gist
https://gist.github.com/justinlevi/fa6afbe108620c9806c39b325c17bdef
Summary:
I'm trying to recreate the shopping cart/ train car queue/ (trolly) metaphor. In other words, if you drag a segment left or right, it will respect the boundary of a neighbor/sibling and then push the the neighbor/sibling along the track as well.
I have this working, kind of. The redraw is jittery and slow, which makes me think there must be a better approach.
My first attempt was to create my own queue array, and during the drag, test to see if the current item's start/end (depending on direction) overlaps with a neighbor's start/end. Then, in the overridden
_move
method, I am looping through my queue array calling `shape.x(segment, renderingContext.timeToPixel.invert(targetX));After reading through the code closer, I'm noticing there is an internal mechanism to track
selectedItems
on the Layer class. I'm wondering if there is a built in mechanism that all selected items would receive an edit callback from the Layer?Ultimately I'm looking for a smooth UX when dragging any number of segments left/right.
As you can see, I also clearly got a bit overboard with my destructuring syntax. I very likely have some super inefficient code. Any feedback you might have would be greatly appreciated.
Full custom behavior below as well:
The text was updated successfully, but these errors were encountered: