Home

Common Questions

Here is a collection of questions about common issues you might encounter while developing applications in Famo.us 0.3. If you are running into a problem that you don’t see listed as a question here, please contact us. We want to make sure this guide is as helpful as it can be.

Why is my surface behind this second surface?

There are a few reasons this could happen.

1. The order in which surfaces are instantiated can affect surface display order. Surfaces that are instantiated first end up being rendered behind newer surfaces because their associated DOM element is created first.

2. Famo.us translations could be affecting your surface’s position. Check your code to see if you have any modifiers affecting your surface’s translation in z-space.

3. CSS z-indexing can also affect the display position of surfaces. Look carefully at any CSS you might have included in your application that includes z-index properties. For surfaces that share the same translation in z-space, default DOM layering will be overridden by explicit CSS z-index values.

Why is my surface not getting this click?

Most likely there is an invisible surface on top of the one you are trying to click. This can happen when a surface has an opacity of 0 but still exists in the DOM. If you inspect the element you are trying to click, you may get insight into the exact DOM element you are targeting.

How do I find the absolute position of a surface?

By design this is not possible. Instead, you’ll need to implement your positioning logic using align and origin or via translations using transforms.

When should I be using a new context?

New contexts should be used when various sections of your application require different perspectives to be set.

A great example is having an overlay or HUD. It would make sense to have a context for a 3D scene and a second context for a flat HUD sitting on top of the 3D scene. This same technique is also useful when implementing modals.

Be careful with the amount of contexts that are created. Each context created triggers another full render cycle for the engine to calculate; overuse of contexts can lead to performance loss.