Hi,
I’ve just upgraded to version 0.21 (on OS X) and the code with AlternateRoot is broken. I show a Settings page with AlternateRoot. When the page is opened it can either be closed by clicking the close image or the Save button. After the upgrade the ‘clicks’ are not working: it seems like they are forwarded to the ParentNode! In the following sample:
- When you click the cog wheel image on the title, Settings Dialog will appear.
- But clicking the close image or save button won’t work (debug_log outputs nothing)
- In iPhone 6 mode of local preview, the Save button of Settings dialog and the Instructions text of MainView overlaps. So when you click the overlapping area you can see from the debug_log that actually Instructions Text is clicked.
MainView.ux
<App>
<JavaScript>
exports.instClicked = function() {
debug_log('Instructions text is clicked!');
};
</JavaScript>
<ClientPanel>
<!-- Place on top of all others, serves as root for modals -->
<Panel ux:Name="FullWindow" Layer="Overlay"/>
<ResourceObject Key="FullWindow" Value="FullWindow"/>
<Page ux:Class="PageWithTitle" ux:Name="self" HitTestMode="LocalBoundsAndChildren">
<DockLayout />
<float4 ux:Property="HeaderColor" />
<float4 ux:Property="HeaderTextColor" />
<string ux:Property="Instructions" />
<StackPanel Dock="Top" Orientation="Horizontal" ContentAlignment="Center" Color="{Property self.HeaderColor}" Height="45">
<Text Value="{Property self.Title}" FontSize="22"
Alignment="VerticalCenter" TextColor="{Property self.HeaderTextColor}"/>
<SettingsDialog Alignment="CenterRight" />
</StackPanel>
<Panel Height="10%" Color="#0008" Alignment="Bottom" Clicked="{instClicked}">
<WhileActive Invert="true" Threshold="0.4">
<Move RelativeTo="Size" Y="1" Duration="0.4" Easing="CircularInOut"/>
</WhileActive>
<Text Value="{Property self.Instructions}" Margin="20" TextColor="#fff" Alignment="Center" />
</Panel>
</Page>
<PageWithTitle Title="Basic animation" HeaderColor="#595FFF" HeaderTextColor="#fff"
Color="#FEFDFC" Instructions="Sample Instructions">
</PageWithTitle>
</ClientPanel>
</App>
SettingsDialog.ux
<DockPanel ux:Class="SettingsDialog">
<JavaScript>
exports.save = function() {
debug_log('Save button is clicked!');
};
exports.clicked = function() {
debug_log('Close button is clicked!');
}
</JavaScript>
<FileImageSource File="./Assets/ic_close_white_2x.png" ux:Global="closeImage" />
<SolidColor Color="#5096E9" ux:Global="TopBarColor" />
<Text ux:Class="TopBarTitleText" FontSize="20" Alignment="VerticalCenter" TextAlignment="Center"
TextColor="#fff" />
<Image Row="1" File="./Assets/cog1_white.png" Width="25" Height="25" Margin="10">
<Clicked>
<Set settingsDlg.IsEnabled="true"/>
</Clicked>
</Image>
<AlternateRoot ux:Name="settingsDlg" IsEnabled="false" ParentNode="{Resource FullWindow}">
<DockPanel Margin="20,40">
<Rectangle Fill="Gray" CornerRadius="8" Layer="Background" />
<Panel Dock="Top" Height="40">
<Rectangle CornerRadius="4,4,0,0" Layer="Background" Fill="{Resource TopBarColor}"/>
<Grid Columns="1*, 8*, 1*">
<TopBarTitleText Column="1" Value="Settings" Alignment="Center" />
<Image ux:Name="imgCloseDlg" Column="2" Margin="7,5,5,5" Source="closeImage"
Width="30" Height="30">
<Clicked>
<Callback Handler="{clicked}" />
<Set settingsDlg.IsEnabled="false"/>
</Clicked>
</Image>
</Grid>
</Panel>
<Button Dock="Bottom" Height="50">
<Panel ux:Template="GraphicsAppearance" HitTestMode="LocalBounds">
<Text Value="Save" TextColor="#FFF" Alignment="Center" TextAlignment="Center" Margin="10" />
<Rectangle CornerRadius="0,0,4,4" Layer="Background" Fill="#2FBE68"/>
</Panel>
<Clicked>
<Callback Handler="{save}" />
<Set settingsDlg.IsEnabled="false"/>
</Clicked>
</Button>
</DockPanel>
</AlternateRoot>
</DockPanel>
Here is the sample app:
Thanks in advance,
Ipek!