Skip to content
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

Get drag events while dragging. #86

Open
KalpeshTalkar opened this issue Nov 18, 2016 · 4 comments
Open

Get drag events while dragging. #86

KalpeshTalkar opened this issue Nov 18, 2016 · 4 comments

Comments

@KalpeshTalkar
Copy link

To get drag events while dragging, I used I3DragRenderDelegate.
But after implementing the delegate, the snapshot view is not rendered.
Why do I need to implement all the methods if I implement I3DragRenderDelegate?
How will I get a snapshot view?

@SteveFortune
Copy link
Member

SteveFortune commented Nov 18, 2016

Hi there,

The I3DragRenderDelegate is responsible for rendering drag events. I3GestureCoordinator delegates everything to do with drawing the snapshot view to I3DragRenderDelegate, so if you've implemented your own it has to draw the snapshot itself.

One option might be to extend I3BasicRenderDelegate and override -(void) renderDraggingFromCoordinator:. That way you can hook into the drag event and allow the base class to do all the rendering. Remember to call the superclass in -(void) renderDraggingFromCoordinator:.

Here is an example of how to extend I3BasicRenderDelegate to implement a custom renderer. Take a look at these lines.

Out of interest, why do you want to capture dragging events? The drag renderer is only really meant to be for drawing things on screen. If you want to do some business logic, it might be worth me adding another method to I3DragDataSource that's called here... what do you think?

Thanks,
Steve.

@KalpeshTalkar
Copy link
Author

Hi Steve,

So basically I only want the drag events when drag started, while dragging, drag canceled, drag ended. I want the position of the gesture recognizer on the screen while dragging so that I can highlight the tableview on which I hover.

Thanks,
Kalpesh

@SteveFortune
Copy link
Member

SteveFortune commented Nov 19, 2016

Hi Kalpesh,

Ok. Take a look at this use case. It shows you how to implement a custom renderer that will 'shake' the dragging item when its hovering over one of the tables, which you could easily adapt to highlight the actual table also.

Again, take a look at this implementation of - (void)renderDraggingFromCoordinator:.

Hope this helps.

Thanks,
Steve.

@KalpeshTalkar
Copy link
Author

Hi Steve,

Thanks for the guidance.

I wanted to achieve the drag and drop functionality like Trello (https://trello.com/).
For Android, I got a library here: https://github.com/woxblom/DragListView
The android library is very fluid.

I have created a demo project here: https://github.com/KalpeshTalkar/DragDropBoard
The scrolling is not smooth. Please help in enhancing the code if possible.

Thanks,
Kalpesh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants