1

From what I understand from Famo.us, the life cycle of a Renderable is managed by the framework and as a result is we can remove node from the render tree.

I found that RenderController is responsible from showing or hiding elements. The problem with RenderController or even with the Lightbox is that I can't stack views. As soon as I call myRenderController.show(surfaceA); myRenderController.show(surfaceB);

The surfaceA fade off and isn't visible anymore.

How can I create a kind of stacked layout where I can manage visility of each layer ?

2
  • 1
    you can use multiple render controllers. I use 4 in the present app I'm working on. One for the header, one for the menu, one for the content, and one for a modal that sits a top everything.
    – aintnorest
    Oct 28, 2014 at 18:11
  • I upvoted what @aintnorest says, because he is correct. I answered with an example to show exactly what is meant in his comment.
    – talves
    Oct 30, 2014 at 18:43

1 Answer 1

1

The RenderController applies the control to one node in the render tree. Add a render controller for each node you wish to control.

Working Example Here

The code link above shows a simple example of how the RenderController can be used to swap surfaces as well as hiding them from view.

Two RenderControllers:

  var rendererOne = new RenderController();
  var rendererTwo = new RenderController();

  mainContext.add(modTop).add(rendererOne);
  mainContext.add(modBottom).add(rendererTwo);

  // Show both surfaces first
  rendererOne.show(surfaceOne);
  rendererTwo.show(surfaceTwo);

  // Swaps who has visibility on a double click
  var showing = true;
  Engine.on('dblclick', function(e){
    if (showing) {
      rendererTwo.hide();
      rendererOne.show(surfaceOne);
    } else {
      rendererOne.hide();
      rendererTwo.show(surfaceTwo);
    }
    showing = !showing;
  });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.