<Page DataContext="{Binding RelativeSource={RelativeSource Self}}"
      Style="{StaticResource A_Style_Page_Generic}"
      mc:Ignorable="d"
      x:Class="ForzaUI.Scenes.Anthem.A_IconTestMap"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:ForzaUI;assembly="
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Map}" />
    </local:UIPageTransitionManager.TransitionManager>

    <Page.Resources>
        <Style x:Key="A_Style_FZTextBlock_DebugText_Large" TargetType="local:FZTextBlock">
            <Setter Property="FontSize" Value="24"/>
            <Setter Property="Color" Value="#FFFFFFFF"/>
            <Setter Property="FontFamily" Value="Horizon_A"/>
            <Setter Property="Margin" Value="0,0,0,8"/>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_DebugText_LargeValue" TargetType="local:FZTextBlock">
            <Setter Property="FontSize" Value="24"/>
            <Setter Property="Color" Value="#FFFFFFFF"/>
            <Setter Property="FontFamily" Value="Horizon_B"/>
            <Setter Property="Margin" Value="0,0,0,4"/>
        </Style>
    </Page.Resources>

    <Grid>
       <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />
        <Grid Style="{StaticResource A_Style_FrameworkElement_SnapTransition_0}">
        <local:RoutedEventCommand x:Name="MouseUpRoutedEventCommand" RoutedEvent="Mouse.MouseUp"
                                  Command="{Binding OnMouseUp}" />
        <local:RoutedEventCommand x:Name="MouseLeftButtonDownRoutedEventCommand" RoutedEvent="UIElement.MouseLeftButtonDown"
                                  Command="{Binding OnLeftMouseDown}" />
        <local:FZMaterial x:Name="MouseClickHelperMaterial" GreedyMeasure="True"
                            local:RoutedEventCommand.Action="{Binding ElementName=MouseUpRoutedEventCommand}"
                            local:RoutedEventCommand.Action2="{Binding ElementName=MouseLeftButtonDownRoutedEventCommand}" />

        <local:MapViewControllerInteractive x:Name="IconTestMapView"
                                            MinMapDistance="600"
                                            MaxMapDistance="2500"
                                            MinCursorSpeed="1000"
                                            MaxCursorSpeed="2000"
                                            MinCursorZoom="0"
                                            MaxCursorZoom="1"
                                            ZoomSpeed="3.0"
                                            MouseZoomSpeed="15.0"
                                            InputAccelerationStart="1"
                                            InputAccelerationTime="1"
                                            InputLinearity="2"
                                            MapInteriaSpring="100"
                                            MapInteriaDamping="20"
                                            MapZoomInteriaSpring="300"
                                            MapZoomInteriaDamping="40"
                                            MapDeadArea=".4"
                                            CursorDistance="200"
                                            CursorScaleFactor="0.75" />
        <Canvas DataContext="{Binding MapView, ElementName=mapCustomRenderElement}"
                x:Name="LayoutRoot">
            <local:MapCustomRenderElement MapId="IconTestMap"
                                          Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=Page}}"
                                          Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=Page}}"
                                          x:Name="mapCustomRenderElement"
                                          MapView="{Binding ElementName=IconTestMapView}" />
            <local:FZMaterialGlassCapture />
        </Canvas>

        <Canvas DataContext="{Binding MapView, ElementName=mapCustomRenderElement}">
            <Grid>
                <Grid.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform />
                        <SkewTransform />
                        <RotateTransform />
                        <TranslateTransform X="{Binding ActualWidth, ElementName=PinContainer, Converter={StaticResource A_Converter_PinXPosition}}"
                                            Y="{Binding ActualHeight, ElementName=PinContainer, Converter={StaticResource A_Converter_PinYPosition}}" />
                    </TransformGroup>
                </Grid.RenderTransform>

                <Decorator x:Name="PinContainer">
                    <Decorator.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform />
                            <SkewTransform />
                            <RotateTransform />
                            <TranslateTransform X="{Binding MapView.CursorX, ElementName=mapCustomRenderElement}"
                                                Y="{Binding MapView.CursorY, ElementName=mapCustomRenderElement}" />
                        </TransformGroup>
                    </Decorator.RenderTransform>

                    <Decorator Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
                               Height="Auto"
                               Width="Auto"
                               HorizontalAlignment="Stretch"
                               VerticalAlignment="Stretch">
                        <ContentControl Content="{Binding SnapContext, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}"
                                        Style="{StaticResource A_Style_ContentControl_MapPin}"
                                        x:Name="Pin" />
                    </Decorator>
                </Decorator>
            </Grid>
        </Canvas>

            <!-- Right Sidebar -->
        <Grid HorizontalAlignment="Right" VerticalAlignment="Stretch" Width="300">
            <local:FZMaterial Color="#80000000">
                <Grid Margin="16" VerticalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="80"/>
                            <RowDefinition Height="600"/>
                        </Grid.RowDefinitions>
                            <StackPanel Grid.Row="0">
                            <local:FZTextBlock Text="MAP PROFILE" Style="{StaticResource A_Style_FZTextBlock_DebugText_Large}"/>
                            <local:FZTextBlock Text="{Binding CurrentMapProfile}" Style="{StaticResource A_Style_FZTextBlock_DebugText_LargeValue}"/>
                        </StackPanel>
                        <StackPanel Grid.Row="1">
                            <local:FZTextBlock Text="FILTERS" Style="{StaticResource A_Style_FZTextBlock_DebugText_Large}" Visibility="{Binding CurrentFilters, Converter={StaticResource A_StringVisConverter}}"/>
                            <local:FZTextBlock Text="{Binding CurrentFilters}" Style="{StaticResource A_Style_FZTextBlock_DebugText_LargeValue}"/>
                            <Decorator Height="40"/>
                            <local:FZTextBlock Text="SELECTION TAGS" Style="{StaticResource A_Style_FZTextBlock_DebugText_Large}" Visibility="{Binding SelectionFilters, Converter={StaticResource A_StringVisConverter}}"/>
                            <local:FZTextBlock Text="{Binding SelectionFilters}" Style="{StaticResource A_Style_FZTextBlock_DebugText_LargeValue}"/>
                        </StackPanel>
                </Grid>
            </local:FZMaterial>
        </Grid>

        <local:RoutedEventCommand x:Name="MapZoomInRoutedEventCommand"
                                  RoutedEvent="UIElement.MouseLeftButtonDown"
                                  Command="{Binding MapZoomInCommand}" />
        <local:RoutedEventCommand x:Name="MapZoomOutRoutedEventCommand"
                                  RoutedEvent="UIElement.MouseLeftButtonDown"
                                  Command="{Binding MapZoomOutCommand}" />
        <local:RoutedEventCommand x:Name="UpMapZoomStopRoutedEventCommand"
                                  RoutedEvent="UIElement.MouseLeftButtonUp"
                                  Command="{Binding MapStopZoomCommand}" />
        <local:RoutedEventCommand x:Name="LeaveMapZoomStopRoutedEventCommand"
                                  RoutedEvent="UIElement.MouseLeave"
                                  Command="{Binding MapStopZoomCommand}" />

        <local:RoutedEventCommand x:Name="ButtonBarDisableMouseCursorMovement"
                                  RoutedEvent="UIElement.MouseEnter"
                                  Command="{Binding DisableMouseCursorMovement}" />
        <local:RoutedEventCommand x:Name="ButtonBarEnableMouseCursorMovement"
                                  RoutedEvent="UIElement.MouseLeave"
                                  Command="{Binding EnableMouseCursorMovement}" />

        <Grid x:Name="ExtraBottomBarBackground" Height="500" Margin="-250,0,-250,-250" VerticalAlignment="Bottom">
            <local:FZMaterial Color="Black"
                              Opacity="0.25"
                              Preset="{StaticResource A_FZMaterialPresetRoundtangle_Vignette}"
                              IsHitTestVisible="False" />
        </Grid>
        
        <ContentControl Style="{StaticResource A_Style_ButtonBar}"
                        x:Name="BottomBar">
            <local:FZMaterial x:Name="MouseButtonBarHitHelper"
                                  Height="30"
                                  Width="Auto"
                                  local:RoutedEventCommand.Action="{Binding ElementName=ButtonBarDisableMouseCursorMovement}"
                                  local:RoutedEventCommand.Action2="{Binding ElementName=ButtonBarEnableMouseCursorMovement}"
                                  Color="#00000000">
                <local:ControllerButtonPanel x:Name="HelpPanel"
                                             Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
                    <local:ControllerButtonControl Button="B"
                                                       Description="{local:Loc HelpButtons.IDS_Resume}" />
                    <local:ControllerButtonControl Button="Y" Description="Change Filter"/>
                    <local:ControllerButtonControl Button="LBumper" Description="Previous Profile"/>
                    <local:ControllerButtonControl Button="RBumper" Description="Next Profile"/>
                    <local:ControllerButtonControl Button="RThumb" />
                    <local:ControllerButtonControl SupportsControllerInput="False"
                                                       InputOverride="{local:Input Command=INPUTCMD_UI_RIGHT_Y_AXIS, Context=INPUTCONTEXT_UI}"
                                                       Visibility="{Binding ShowMouseZoomButtons, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                                       UseHighKeyIfLinearCommand="True"
                                                       Description="{local:Loc HelpButtons.IDS_MapZoomIn}"
                                                       local:RoutedEventCommand.Action="{Binding ElementName=MapZoomInRoutedEventCommand}"
                                                       local:RoutedEventCommand.Action2="{Binding ElementName=UpMapZoomStopRoutedEventCommand}"
                                                       local:RoutedEventCommand.Action3="{Binding ElementName=LeaveMapZoomStopRoutedEventCommand}" />
                    <local:ControllerButtonControl SupportsControllerInput="False"
                                                       InputOverride="{local:Input Command=INPUTCMD_UI_RIGHT_Y_AXIS, Context=INPUTCONTEXT_UI}"
                                                       Visibility="{Binding ShowMouseZoomButtons, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                                       UseHighKeyIfLinearCommand="False"
                                                       Description="{local:Loc HelpButtons.IDS_MapZoomOut}"
                                                       local:RoutedEventCommand.Action="{Binding ElementName=MapZoomOutRoutedEventCommand}"
                                                       local:RoutedEventCommand.Action2="{Binding ElementName=UpMapZoomStopRoutedEventCommand}"
                                                       local:RoutedEventCommand.Action3="{Binding ElementName=LeaveMapZoomStopRoutedEventCommand}" />
                </local:ControllerButtonPanel>
            </local:FZMaterial>
        </ContentControl>
        </Grid>
    </Grid>
</Page>
