-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZoomContentControl
does not work with ScrollViewer
#1290
Comments
@vatsashah45 Please tag @kucint to ask for additional information regarding this issue |
Hi @kucint! Could you please share some additional information about this issue? What exactly is the problem, and what are the steps to reproduce it? Thanks! |
Hi @vatsashah45, I am on my way to give you some feedback. Need a bit of time though... |
Hi @vatsashah45, I investigated the
I created the repo project, quite simple, and I will try to explain my issues with help of it. Issue 1:App works on Issue 2:The code is quite simple: it draws <utu:ZoomContentControl IsZoomAllowed="True" IsPanAllowed="True" >
<Canvas x:Name="MyCanvas"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Loaded="Canvas_Loaded">
<!--Quadrant 1: (+, +) -->
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightCoral" Canvas.Left="0" Canvas.Top="0"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightCoral" Canvas.Left="500" Canvas.Top="0"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightCoral" Canvas.Left="0" Canvas.Top="500"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightCoral" Canvas.Left="500" Canvas.Top="500"/>
<!--Quadrant 2: (-, +) -->
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightBlue" Canvas.Left="-20" Canvas.Top="0"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightBlue" Canvas.Left="-500" Canvas.Top="0"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightBlue" Canvas.Left="-20" Canvas.Top="500"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightBlue" Canvas.Left="-500" Canvas.Top="500"/>
<!--Quadrant 3: (-, -) -->
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightGreen" Canvas.Left="-20" Canvas.Top="-20"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightGreen" Canvas.Left="-500" Canvas.Top="-20"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightGreen" Canvas.Left="-20" Canvas.Top="-500"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="LightGreen" Canvas.Left="-500" Canvas.Top="-500"/>
<!--Quadrant 4: (+, -) -->
<Rectangle Width="20" Height="20" Stroke="Black" Fill="Wheat" Canvas.Left="0" Canvas.Top="-20"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="Wheat" Canvas.Left="500" Canvas.Top="-20"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="Wheat" Canvas.Left="0" Canvas.Top="-500"/>
<Rectangle Width="20" Height="20" Stroke="Black" Fill="Wheat" Canvas.Left="500" Canvas.Top="-500"/>
</Canvas>
</utu:ZoomContentControl> In "code behind" I calculate the area occupied by all rectangles in all quadrants and modify the size of a canvas to fit them all. private void UpdateCanvasSize()
{
Rect totalArea = CalculateCanvasTotalArea();
MyCanvas.Width = totalArea.Width;
MyCanvas.Height = totalArea.Height;
}
private Rect CalculateCanvasTotalArea()
{
Rect totalArea = default;
var canvasItems = MyCanvas.Children;
foreach (UIElement canvasItem in canvasItems)
{
Vector2 size = canvasItem.ActualSize;
Vector3 pos = canvasItem.ActualOffset;
var nodeArea = new Rect(pos.X, pos.Y, size.X, size.Y);
if (totalArea == default)
{
totalArea = nodeArea;
}
else
{
totalArea.Union(nodeArea);
}
}
return totalArea;
} Problem: Issue 3:zoom out shall automatically pan Issue 4:zoom into mouse position shall be optional Issue 5:I would like to have a possibility to define what triggers the 'pan' action.
Hi @vatsashah45, |
@vatsashah45, |
@kucint! Thanks for getting back to me with the details! Issue 1:The WinAppSdk build should be fixed by this PR: #1297 Issue 2:Issue 3:(waiting for more details) Issue 4:(waiting for more details) Issue 5:Currently, the ZoomContentControl supports panning when using Shift + Zoom In/Out, but it sounds like you’d like additional flexibility in defining how panning is triggered. Could you clarify your requirements? Thanks. And here's the link to the documentation of ZoomContentControl |
@vatsashah45 would you mind splitting this issue in 5 issues? Thanks! |
Current behavior
the size seems to not be updated correctly and scrollbars do not pop up as they should
Expected behavior
How to reproduce it (as minimally and precisely as possible)
Nuget Package:
Package Version(s):
Affected platform(s):
IDE:
Relevant plugins:
Anything else we need to know?
The text was updated successfully, but these errors were encountered: