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

Add custom action for long press on existing event #42

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

Fawxy
Copy link
Contributor

@Fawxy Fawxy commented Dec 18, 2018

This PR adds a delegate method if the user long presses on a current event. I use this to let the user perform actions other than move the event. For example, I present an action menu on an event.

I did this quite quickly so open to your review and comments!

Example of how we use it:
simulator screen shot - iphone 8 - 2018-12-18 at 15 13 23

@zjfjack
Copy link
Owner

zjfjack commented Dec 19, 2018

Hi, Chris.

Thanks for helping me to improve this project. I love your idea of this custom long press type.

I checked your code, this custom type long press is based on pressing on an existed cell hasItemAtPoint. Also, the delegate is only called when the gesture begins, what if the user wants to track the gesture all the time?

Do you think it is a better idea to do the custom type long press to support both pressing on nothing and an existed cell by tracking the whole cycle of the long press?

I think the difficulty for users is to get the date info when long pressing the view, but in fact they can use the function getDateForPoint(pointCollectionView: CGPoint) -> Date to get the date easily and they can even add their own longPress gesture.

Your custom gesture is more like a tapGesture. What do you think? Do you think any idea?

@Fawxy
Copy link
Contributor Author

Fawxy commented Dec 19, 2018

I don't see why not, it would just change the move functionality... I will refactor this and see what happens :). Btw with this PR, move and custom cannot be used at the same time

@zjfjack
Copy link
Owner

zjfjack commented Dec 19, 2018

Okay, thanks.
What do you think for customAdd and customMove?

@zjfjack
Copy link
Owner

zjfjack commented Dec 27, 2018

Hi

I made some improvements for the longPressView in branch improvement-longPressHold.

This one is mainly improved the longPressGesture "Hold" status.

For current longPress, if the user holds the longPress and without changing the longPress location, the longPress listener will not be called. As a result, when you try to move the event vertically or horizontally then reach the edge and hold, it won't scroll to correspond offset. However, if you keep moving (change longPress state changed), then the view will start scrolling.

In order to resolve this problem, I add a timer to call the updateScroll and timeLabel every 0.2s. Also, I removed the update code in change state.

If you have time, could you try it first and give me some feedbacks before I push it to master because you are doing some related stuff recently.

Thanks

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

Successfully merging this pull request may close these issues.

2 participants