Pages: [1]
  Print  
Author Topic: Gaia.api.getPreviousBranch()  (Read 575 times)
pixelbacon
Gaia Novice
*
Posts: 8


« on: December 16, 2010, 12:57:24 PM »

Seems like the simplest thing missing from the framework.
Logged
steven
Gaia Author
Administrator
Gaia Evangelist
*****
Posts: 3871


gaiaframework
WWW
« Reply #1 on: December 16, 2010, 01:22:52 PM »

It's not missing. It's implementation is not as straightforward as you might think.

That method would be misleading if there was an interrupt or if a section had not completely loaded. Would it be based on the afterComplete (when Gaia knows for sure the entire branch has loaded), or the afterGoto (as soon as Gaia starts going to a new branch)? I have found good reasons for both scenarios, and even places in between, and it's very situational. Sometimes, I use both in the same project.

There are other scenarios, as well. It's really up to you to implement it as you need it.

Note that beforeGoto is the proper event to get the "previous branch" from Gaia.api.getCurrentBranch(). Once afterGoto is triggered, getCurrentBranch() returns the branch that Gaia is navigating towards.
Logged

Steven Sacks | Gaia Author
Please support Gaia by donating to the project!  Smiley
pixelbacon
Gaia Novice
*
Posts: 8


« Reply #2 on: December 16, 2010, 02:00:32 PM »

Hey Steven,

I fully understand the points you make in not having it. And I also contemplated what you suggested; but it doesn't fit the bill for a simple scenario...

Scenario: I have a page that has to have a different transitionIn(), if the previous page was a specific page.

onBeforeGoto will work in the reverse way perfectly, where the transitionOut() is dependent upon the new page but since the next page to load won't be able to hear the onBeforeGoto. Our current solution is to make a static class that listens for beforeGoto and updates a static variable from the previous beforeGoto.

Basically two pages have animations that bleed in to each other, but only if you are going between those two pages, otherwise a standard transitionIn/Out play. So, the page loading in has to have a way to see what the previous was.

I'd say it's appropriate to update the Gaia.api.getPreviousBranch at afterPreload, beforeTransitionIn?

I want you to know I see most posts by people being a lack of knowing how to build good stuff; meaning this is the one and only time I have EVER been limited by Gaia. And not even really limited, but surprised that this wasn't in already. Again, fully understand you reasons for not having it, but at the same time afterPreload, so Gaia knows it can in fact move on to the next page, seems like updating it there is harmless.

Glorious framework btw Cheesy
« Last Edit: December 16, 2010, 02:07:56 PM by pixelbacon » Logged
steven
Gaia Author
Administrator
Gaia Evangelist
*****
Posts: 3871


gaiaframework
WWW
« Reply #3 on: December 16, 2010, 04:18:15 PM »

Fair enough. I'll figure out a way to get it into the next version and I will be explicit in the docs about when it is set.

In the meantime, yes, you should write something that "records" the last branch.
Logged

Steven Sacks | Gaia Author
Please support Gaia by donating to the project!  Smiley
freemind
Gaia Novice
*
Posts: 6



WWW
« Reply #4 on: February 10, 2011, 02:29:05 AM »

cheers steven Smiley

has there been any progress regarding this feature (developing a standalone presentation atm, that could benefit from something like this)?
or has somebody already developed some kind of StateManager-class? Wink

thx in advance!

henrik
Logged
Pages: [1]
  Print  
 
Jump to:  

TinyPortal v1.0 beta 4 © Bloc