SwiftMessages icon indicating copy to clipboard operation
SwiftMessages copied to clipboard

Fade out dim while the centered view is going out of screen

Open Jasperav opened this issue 5 years ago • 4 comments

I am using the new feature with the centered view which can be pushed away by the user. It look amazing. However, I have one little request. When the user 'pushes' the view away, the dim mode stays dark (does not fade out) while the view is going out of screen (by the physics).

So the user sees the UIView flying away with a dimmed background. I think for appearance it would be great that the dim mode will fade out while the UIView is flying out out of the screen. Else I think the user just needs to wait a little to long to use the screen again. It looks more like he is forced to see the animation and can not continue using the app.

It looks like it can be partly solved by changing this line: animator.delegate?.hide(animator: animator) that is around line 122 in PhysicsPanHandler.swift. If it gets moved a few lines down under if energy > 200 && speed > 600 {, it looks a bit better. However, now the UIView gets dismissed to soon and makes weird movements.

The further away the user drags the UIView from the middle (starting point), the lighter the dimmode should be, that would look amazing :)

Jasperav avatar Sep 02 '18 20:09 Jasperav

Thanks for the suggestion. I'll look into it when I get a chance.

wtmoose avatar Sep 03 '18 17:09 wtmoose

@wtmoose Thank you very much. Maybe you can also have a look ad adding the dragging at the eventListeners enum. I got the following issue:

I got a tableview inside the centered view. When the user taps on one of the cells, the cell gets highlighted. If the user now drag around his finger, the tableview will drag with his finger (which is great). However, when the user stops dragging and releases his finger, the tableview bounces back but the cell is still highlighted. If an event case gets added like: startedDrag, endedDrag, I can tackle this problem easy :). I can make a separate issue for this though.

Thanks!

Above issue isn't valid anymore

Jasperav avatar Sep 03 '18 18:09 Jasperav

I'm a little confused by your last comment. Scroll views have their own gesture recognizers, so I don't see why you'd want your table view's behavior to depend on SwiftMessages.

wtmoose avatar Sep 04 '18 00:09 wtmoose

@wtmoose Nvm, I subclasses a UIButton, with custom touch down events. They were not called anymore after dragging around the centered view. After I added a UIControlEvent with type 'touchCancel', it worked. So last comment isn't valid anymore.

Jasperav avatar Sep 04 '18 17:09 Jasperav