I wanted to try out a simple UI, which has elements overlapping each other (in this example they are complete covering each other).
var Engine = require('famous/core/Engine');
var Surface = require('famous/core/Surface');
var mainContext = Engine.createContext();
var foreground = new Surface({
content: 'hello first',
properties: {
color: 'white',
textAlign: 'center',
backgroundColor: '#FA5C4F'
}
});
var background = new Surface({
content: 'hello second',
properties: {
color: 'white',
textAlign: 'center',
backgroundColor: '#FA5C4F'
}
});
mainContext.add(background);
mainContext.add(foreground);
My expectation would be that in the famous-container div there are two divs with famous-surface classes. First the background surface and as a sibling afterwards the foreground surface.
Actually it is the opposite, no matter how I change the order of the surfaces added to the context.
<div class="famous-container">
<div class="famous-surface" style="-webkit-transform-origin: 0% 0%; opacity: 0.999999; -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); color: white; text-align: center; background-color: rgb(250, 92, 79); width: 966px; height: 604px;">
hello forground
</div>
<div class="famous-surface" style="-webkit-transform-origin: 0% 0%; opacity: 0.999999; -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); color: white; text-align: center; background-color: rgb(250, 92, 79); width: 966px; height: 604px;">
hello background
</div>
</div>
Is it only possible to layout surfaces in a predictive way using modifiers and handling explicit the z-index?