10-01-2019, 01:53 AM
I am using the ZoomPanel to navigate around a map image that is 21600x21600. The ZoomPanel itself is 2160x2952 (this is on a 4K display). On the map are markers (like GoogleMap markers). The location of the markers are relative to the map image, so a given marker's location might be 15850,9720.
In general, the zoom panel works great. However, based on user activity, I need to programmatically center a given marker in the viewbox (or as near to center as the map limits allows). I have tried all the various "Translate" methods, and none of them work as I would have expected. When I call the Translate methods, the map moves within the ZoomPanel, but it doesn't move where I expect it to.
For example, when I call TranslateToCenter(new Point(10800,10800)) or TranlateToCenterRelative(new Point(0.5, 0.5)), I would expect the map to move to the center of the map image , but it only moves the map a short (and seemingly random) distance towards the center.
What is the correct method of programmatically setting the center point to a specific x,y location, or getting the given x,y location as close to the center as possible without violating the Viewbox limits?
Here is the xaml for the ZoomPanel:
<ab2d:ZoomPanel x:Name="exploreMapZoom" IsViewboxLimited="True" ViewboxLimits="0 0 1 1" ViewboxMinSize="0.1 0.1" Stretch="UniformToFill" CenterPosition="0.5 0.5" CenterPositionUnits="Relative" IsAnimated="True">
<Grid x:Name="exploreMapGrid" Width="21600" Height="21600">
<Image x:Name="exploreMapImage" HorizontalAlignment="Left" VerticalAlignment="Top" Source="ExploreMap.jpg"/>
</Grid>
</ab2d:ZoomPanel>
Attached is a screen capture of the map within the ZoomPanel, including a ZoomPanelDump.
In general, the zoom panel works great. However, based on user activity, I need to programmatically center a given marker in the viewbox (or as near to center as the map limits allows). I have tried all the various "Translate" methods, and none of them work as I would have expected. When I call the Translate methods, the map moves within the ZoomPanel, but it doesn't move where I expect it to.
For example, when I call TranslateToCenter(new Point(10800,10800)) or TranlateToCenterRelative(new Point(0.5, 0.5)), I would expect the map to move to the center of the map image , but it only moves the map a short (and seemingly random) distance towards the center.
What is the correct method of programmatically setting the center point to a specific x,y location, or getting the given x,y location as close to the center as possible without violating the Viewbox limits?
Here is the xaml for the ZoomPanel:
<ab2d:ZoomPanel x:Name="exploreMapZoom" IsViewboxLimited="True" ViewboxLimits="0 0 1 1" ViewboxMinSize="0.1 0.1" Stretch="UniformToFill" CenterPosition="0.5 0.5" CenterPositionUnits="Relative" IsAnimated="True">
<Grid x:Name="exploreMapGrid" Width="21600" Height="21600">
<Image x:Name="exploreMapImage" HorizontalAlignment="Left" VerticalAlignment="Top" Source="ExploreMap.jpg"/>
</Grid>
</ab2d:ZoomPanel>
Attached is a screen capture of the map within the ZoomPanel, including a ZoomPanelDump.