mirror of
https://github.com/VitalickS/BrightSharp.Toolkit.git
synced 2026-03-21 02:21:15 +00:00
Ok, Just Do It!
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Windows;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
@@ -6,6 +7,7 @@ using System.Windows.Media;
|
||||
|
||||
namespace Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class MoveThumb : Thumb
|
||||
{
|
||||
private RotateTransform rotateTransform;
|
||||
|
||||
@@ -6,9 +6,11 @@ using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Input;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class ResizeThumb : Thumb
|
||||
{
|
||||
private RotateTransform rotateTransform;
|
||||
@@ -86,12 +88,14 @@ namespace Diagrams
|
||||
{
|
||||
case System.Windows.VerticalAlignment.Bottom:
|
||||
deltaVertical = Math.Min(-e.VerticalChange, this.designerItem.ActualHeight - this.designerItem.MinHeight);
|
||||
deltaVertical = Math.Max(deltaVertical, this.designerItem.ActualHeight - this.designerItem.MaxHeight);
|
||||
Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + (this.transformOrigin.Y * deltaVertical * (1 - Math.Cos(-this.angle))));
|
||||
Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) - deltaVertical * this.transformOrigin.Y * Math.Sin(-this.angle));
|
||||
this.designerItem.Height -= deltaVertical;
|
||||
break;
|
||||
case System.Windows.VerticalAlignment.Top:
|
||||
deltaVertical = Math.Min(e.VerticalChange, this.designerItem.ActualHeight - this.designerItem.MinHeight);
|
||||
deltaVertical = Math.Max(deltaVertical, this.designerItem.ActualHeight - this.designerItem.MaxHeight);
|
||||
Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + deltaVertical * Math.Cos(-this.angle) + (this.transformOrigin.Y * deltaVertical * (1 - Math.Cos(-this.angle))));
|
||||
Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + deltaVertical * Math.Sin(-this.angle) - (this.transformOrigin.Y * deltaVertical * Math.Sin(-this.angle)));
|
||||
this.designerItem.Height -= deltaVertical;
|
||||
@@ -104,12 +108,14 @@ namespace Diagrams
|
||||
{
|
||||
case System.Windows.HorizontalAlignment.Left:
|
||||
deltaHorizontal = Math.Min(e.HorizontalChange, this.designerItem.ActualWidth - this.designerItem.MinWidth);
|
||||
deltaHorizontal = Math.Max(deltaHorizontal, this.designerItem.ActualWidth - this.designerItem.MaxWidth);
|
||||
Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + deltaHorizontal * Math.Sin(this.angle) - this.transformOrigin.X * deltaHorizontal * Math.Sin(this.angle));
|
||||
Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + deltaHorizontal * Math.Cos(this.angle) + (this.transformOrigin.X * deltaHorizontal * (1 - Math.Cos(this.angle))));
|
||||
this.designerItem.Width -= deltaHorizontal;
|
||||
break;
|
||||
case System.Windows.HorizontalAlignment.Right:
|
||||
deltaHorizontal = Math.Min(-e.HorizontalChange, this.designerItem.ActualWidth - this.designerItem.MinWidth);
|
||||
deltaHorizontal = Math.Max(deltaHorizontal, this.designerItem.ActualWidth - this.designerItem.MaxWidth);
|
||||
Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) - this.transformOrigin.X * deltaHorizontal * Math.Sin(this.angle));
|
||||
Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + (deltaHorizontal * this.transformOrigin.X * (1 - Math.Cos(this.angle))));
|
||||
this.designerItem.Width -= deltaHorizontal;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
@@ -7,6 +8,7 @@ using System.Windows.Media;
|
||||
|
||||
namespace Diagrams
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public class RotateThumb : Thumb
|
||||
{
|
||||
private double initialAngle;
|
||||
|
||||
Reference in New Issue
Block a user