コード例 #1
0
ファイル: SnapManager.cs プロジェクト: ninchistudios/helios
        private void CheckRightSnap(Rect dragRectangle, SnapTarget target, ref double currentHorizontalOffset, ref bool isSnap)
        {
            if ((Math.Abs(target.Rectangle.Left - dragRectangle.Right) <= Math.Abs(currentHorizontalOffset)))
            {
                currentHorizontalOffset = target.Rectangle.Left - dragRectangle.Right;
                isSnap = true;
            }

            if ((Math.Abs(target.Rectangle.Right - dragRectangle.Right) <= Math.Abs(currentHorizontalOffset)))
            {
                currentHorizontalOffset = target.Rectangle.Right - dragRectangle.Right;
                isSnap = true;
            }
        }
コード例 #2
0
ファイル: SnapManager.cs プロジェクト: ninchistudios/helios
        private void CheckBottomSnap(Rect dragRectangle, SnapTarget target, ref double currentVerticalOffset, ref bool isSnap)
        {
            if ((Math.Abs(target.Rectangle.Top - dragRectangle.Bottom) <= Math.Abs(currentVerticalOffset)))
            {
                currentVerticalOffset = target.Rectangle.Top - dragRectangle.Bottom;
                isSnap = true;
            }

            if ((Math.Abs(target.Rectangle.Bottom - dragRectangle.Bottom) <= Math.Abs(currentVerticalOffset)))
            {
                currentVerticalOffset = target.Rectangle.Bottom - dragRectangle.Bottom;
                isSnap = true;
            }
        }