Привет У меня есть случай, когда пользователь должен иметь возможность масштабировать эллипс, выбрав штрих (границу) эллипса. Я попытался использовать событие формы Pointer Pressed и Pointermove для достижения этой цели. Но масштабирование не является непрерывным (плавным). У любого есть представление о том, как лучше достичь этого. Это очень поможет, спасибо
private void PostureDifficultyPath_PointerPressed(object sender, PointerRoutedEventArgs e)
{
Path selectedPath = sender as Path;
if (selectedPath != null)
{
selectedPath.Stroke = new SolidColorBrush(Colors.DarkBlue);
PointerPoint ptrPt = e.GetCurrentPoint(selectedPath);
mousePressedPoint = new Point(ptrPt.Position.X, ptrPt.Position.Y);
}
e.Handled = true;
}
private void PostureDifficultyPath_PointerMoved(object sender, PointerRoutedEventArgs e)
{
Pointer ptr = e.Pointer;
double mouseCurrentPosition;
if (ptr.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse)
{
PointerPoint ptrPt = e.GetCurrentPoint(DifficultyUpperPath);
if (ptrPt.Properties.IsLeftButtonPressed)
{//this is a variable which i update using mvvm
//this scale factor should be like a value which makes smooth scaling
ScaleFactor -= 0.1111411;//
}
else { mouseCurrentPosition= ptrPt.Position.X; }
}
e.Handled = true;
}
<Path>
<Path.Data>
<PathGeometry>
<PathFigure x:Name="UpperCircle" StartPoint="{x:Bind UpperStartPoint,Mode=TwoWay }">
<ArcSegment IsLargeArc="True" x:Name="UpperArc"
Size="{x:Bind UpperArcRadius,Mode=TwoWay}"
Point="{x:Bind UpperArcEndPoint,Mode=TwoWay}"
SweepDirection="Clockwise" />
</PathFigure>
</PathGeometry>
</Path.Data>
<Path.RenderTransform>
<ScaleTransform
CenterX="125" CenterY="100"
ScaleX="{x:Bind ScaleFactor,Mode=TwoWay}"
ScaleY="{x:Bind ScaleFactor,Mode=TwoWay}"/>
</Path.RenderTransform>
</Path>