Test Setup and Task Description
I’m using Fuse 0.33.0 on OS X 10.11.6. And the described behaviour also appears with Fuse 0.32.0. I have not used versions of Fuse older than 0.32.0.
I need to lay out a dynamic list of items on the screen, in the style of a table view or a list view. Each item contains a background and some content. Items’ backgrounds are not rectangular and I need them to overlap if I am to achieve the interface appearance I’m tasked with achieving. The overlapping part I tried to achieve by placing the background of the item in the Background
layer of the containing element. I’ve put together a simplified test scenario which you can see in the code snippet below. You can generate a new project with fuse create app NewTestProject
and then replace the contents of MainView.ux with the contents of the code snippet below. Items’ backgrounds are rectangular in the example below, for simplicity. For best results preview with the Fuse Preview app, using “iPhone 6” device profile.
<App>
<JavaScript>
function Item(text, color)
{
this.text = text;
this.color = color;
}
var theItems = [
new Item("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", [0.9, 0.3, 0.3, 1.0]),
new Item("Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", [0.3, 0.9, 0.3, 1.0]),
];
module.exports =
{
items: theItems,
};
</JavaScript>
<ScrollView>
<StackPanel>
<Each Items={items}>
<Panel Margin="30, 80, 30, 30">
<Rectangle Y="-30" Width="120%" Height="270" Color={color} Layer="Background"/>
<Text Value={text} TextWrapping="Wrap"/>
</Panel>
</Each>
</StackPanel>
</ScrollView>
</App>
Observed Behaviour
The first item’s background overlaps the second item, as it appears that <Each>
has drawn the second item in the list behind the first one.
Expected Behaviour
The second item to appear drawn in front of the first one.