void HandleScale(double scale) { var manipOrg = _textEnterUC.RenderTransform.Transform(new Point(0, 0)); ShapeUtils.ApplyTransform(_textEnterUC, new Vector(manipOrg.X, manipOrg.Y), new Vector(0, 0), 0, new Vector(scale, scale)); }
public void ManipulationDelta(object sender, ManipulationDeltaEventArgs e) { ShapeUtils.ApplyTransform(e, _textEnterUC); e.Handled = true; SetBounds(); }
public void ManipulationDelta(object sender, ManipulationDeltaEventArgs e) { ShapeUtils.ApplyTransform(e, _textEnterUC); e.Handled = true; updateUserCursor(); }
private void HandleMove(double dx, double dy) { var manipOrg = GetOrigin(); ShapeUtils.ApplyTransform(_textEnterUC, new Vector(manipOrg.X, manipOrg.Y), new Vector(dx, dy), 0, new Vector(1, 1)); }
private void HandleResize(double deltaX, double deltaY, ShapeUtils.RectSide side) { Rect bounds = GetShapeBounds(); Rect boundsBefore = bounds; try { switch (side) { case ShapeUtils.RectSide.TopLeft: bounds.X += deltaX; bounds.Y += deltaY; bounds.Width -= deltaX; bounds.Height -= deltaY; break; case ShapeUtils.RectSide.TopRight: bounds.Width += deltaX; bounds.Y += deltaY; bounds.Height -= deltaY; break; case ShapeUtils.RectSide.BottomLeft: bounds.X += deltaX; bounds.Width -= deltaX; bounds.Height += deltaY; break; case ShapeUtils.RectSide.BottomRight: bounds.Width += deltaX; bounds.Height += deltaY; break; case ShapeUtils.RectSide.TwoSided: break; } } catch (Exception) { } if (bounds.Width > MIN_SIZE && bounds.Height > MIN_SIZE) { var manipOrg = _textEnterUC.RenderTransform.Transform( new Point(0, 0) ); double xScale = bounds.Width / boundsBefore.Width; double yScale = bounds.Height / boundsBefore.Height; double scaleCoeff = Math.Max(xScale, yScale); var scale = new Vector(yScale, yScale); var translate = new Vector(bounds.X - boundsBefore.X, bounds.Y - boundsBefore.Y); ShapeUtils.ApplyTransform(_textEnterUC, new Vector(manipOrg.X, manipOrg.Y), translate, 0, scale); SetBounds(); } }