Hero: Drawing bug with useGlobalCoordinateSpace

Created on 11 Feb 2017  ·  7Comments  ·  Source: HeroTransitions/Hero

HI Luke,

When using .useGlobalCoordinateSpace the animations get wrong on dismissing.
Video for reference: https://cl.ly/3e2S3n1k0V15

Looking at the view hierarchy I found what it may be wrong.
Infact, with .useGlobalCoordinateSpace the three white views appear to be before the background view (which is the highlighted row)
screen shot 2017-02-11 at 19 32 56

Instead without the .useGlobalCoordinateSpace I get the white cards views inside the background view.
screen shot 2017-02-11 at 19 30 57

I understand that in the case of .useGlobalCoordinateSpace not having the views inside the backgroundView is something expected, since we want to animated them separately.
But maybe the background view should appear before the three views? Thoughts?

I'll try to recreate the example ASAP

confirmed bug discussion enhancement

All 7 comments

Hey Alfredo, after looking at it. I noticed that this won't be a easy fix. Currently, Hero inserts all source views first then destination views. Before inserting a destination view, it check if there is a matched source view, and bring that source view to the front of the view hierarchy.

In your case, let say the first VC is A, and second VC is B.
When dismissing from B to A, source VC is B, and destination VC is A.
When Hero is inserting the A's blue card view, it sees that there is a matched view from B. Therefore pulling that matched view from B up the view hierarchy. Hence, covered your white views.

To solve this, Hero will need to know which views need to go above certain views, a dependency system of some sort. And when pulling the source view up, Hero needs to pull all the views that are dependent on the source view. That is what I have in mind, but seems hard to implement. I don't know if you have any better ideas.

I will try to come up with something next week, for now just set the zPosition of the white views. You can use the new beginWith modifier to set the zPosition during the transition:

.beginWith(modifiers:[.zPosition(5)])

This sets the zPosition directly on the snapshot's layer during the animation without animating it.

On a side note, your card example looks awesome! I am updating the README graphics, do you mind if I build something similar to what you have as an example in the README?

Understand, I'll think about it in the next days. Maybe a dependency system with a graph structure wouldn't be too hard, but it definitely require work. Do you think that is something you would like to have for Hero? If so I may want to prepare a PR and/or draft for you.

About the example thing, do you mind if you try to replicate differently? For example a different form for the card, i.e. squared with a different colour. The app is not live yet and this interaction is a main part of the app, so for sure you can replicate it, I'll appreciate if it will be distinct :)

Actually, can you try the latest master. I put up a temp fix.
On Sun, Feb 12, 2017 at 11:20 AM Alfredo Delli Bovi <
[email protected]> wrote:

Understand, I'll think about it in the next days. Maybe a dependency
system with a graph structure wouldn't be too hard, but it definitely
require work. Do you think that is something you would like to have for
Hero? If so I may want to prepare a PR and/or draft for you.

About the example thing, do you mind if you try to replicate differently?
For example a different form for the card, i.e. squared with a different
colour. The app is not live yet and this interaction is a main part of the
app, so for sure you can replicate it, I'll appreciate if it will be
distinct :)


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/lkzhao/Hero/issues/85#issuecomment-279229196, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ADNEav6hjhYfEobNcT1bLOPpXs5fSyj1ks5rbzFagaJpZM4L-Qp9
.

Sure, give me a sec 👍

Come on man!!! It worked 💯 Very well done, how you did at the end?

Just saw the commit, thanks!
A question, do you plan to have starter tasks for this project? I really would like to help more :)

When pulling the source view up, I do a recursive search for subviews and sibling views that might be a dependent. But I am not entirely satisfied with this implementation. If there is a inserted destination view that depend on one of the source view, it won't be pull up. When this happens, the source view will cover that destination view. I have another implementation in mind that might be better. Will try to implement it in a few days.

I will put up a todo list in the projects tab later day. Glad that you are willing to help!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cristinaITdeveloper picture cristinaITdeveloper  ·  4Comments

dimabiserov picture dimabiserov  ·  3Comments

BalestraPatrick picture BalestraPatrick  ·  3Comments

brendan-guegan-orange picture brendan-guegan-orange  ·  4Comments

aloisdeniel picture aloisdeniel  ·  5Comments