/// <summary>
 /// Initializes a new instance of the <see cref="T:KimonoCore.KimonoHandle"/> class.
 /// </summary>
 /// <param name="x">The x coordinate.</param>
 /// <param name="y">The y coordinate.</param>
 /// <param name="state">State.</param>
 public KimonoHandle(float x, float y, KimonoShapeState state)
 {
     // Initialize
     X     = x;
     Y     = y;
     State = state;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:KimonoCore.KimonoHandle"/> class.
 /// </summary>
 /// <param name="x">The x coordinate.</param>
 /// <param name="y">The y coordinate.</param>
 /// <param name="constraint">Constraint.</param>
 /// <param name="state">State.</param>
 public KimonoHandle(float x, float y, KimonoHandleConstraint constraint, KimonoShapeState state)
 {
     // Initialize
     X          = x;
     Y          = y;
     Constraint = constraint;
     State      = state;
 }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:KimonoCore.KimonoBounds"/> class.
        /// </summary>
        /// <param name="left">Left.</param>
        /// <param name="top">Top.</param>
        /// <param name="right">Right.</param>
        /// <param name="bottom">Bottom.</param>
        /// <param name="state">State.</param>
        public KimonoBounds(float left, float top, float right, float bottom, KimonoShapeState state)
        {
            // Initialize
            Rect = new SKRect(left, top, right, bottom);

            // Is the bounds selected?
            if (state == KimonoShapeState.Selected)
            {
                Select();
            }

            // Save state
            State = state;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:KimonoCore.KimonoShapeLine"/> class.
 /// </summary>
 /// <param name="left">Left.</param>
 /// <param name="top">Top.</param>
 /// <param name="right">Right.</param>
 /// <param name="bottom">Bottom.</param>
 /// <param name="state">State.</param>
 public KimonoShapeLine(float left, float top, float right, float bottom, KimonoShapeState state) : base(left, top, right, bottom, state)
 {
     Initialize();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:KimonoCore.KimonoShapeRoundRect"/> class.
 /// </summary>
 /// <param name="left">Left.</param>
 /// <param name="top">Top.</param>
 /// <param name="right">Right.</param>
 /// <param name="bottom">Bottom.</param>
 /// <param name="cornerRadius">Corner radius.</param>
 /// <param name="state">State.</param>
 public KimonoShapeRoundRect(float left, float top, float right, float bottom, float cornerRadius, KimonoShapeState state) : base(left, top, right, bottom, state)
 {
     Initialize();
     CornerRadius = cornerRadius;
 }
Exemple #6
0
        /// <summary>
        /// Adds the control handles to the bounds
        /// </summary>
        internal void AddHandles(KimonoShapeState state)
        {
            // Create the four corner drag handles
            TopLeftHandle     = new KimonoHandle(Left - KimonoHandle.DrawOffset, Top - KimonoHandle.DrawOffset, state);
            TopRightHandle    = new KimonoHandle(Right - KimonoHandle.DrawOffset, Top - KimonoHandle.DrawOffset, state);
            BottomRightHandle = new KimonoHandle(Right - KimonoHandle.DrawOffset, Bottom - KimonoHandle.DrawOffset, state);
            BottomLeftHandle  = new KimonoHandle(Left - KimonoHandle.DrawOffset, Bottom - KimonoHandle.DrawOffset, state);

            // Wire-up events
            TopLeftHandle.Moved += (point) =>
            {
                SavePreviousBounds();
                Rect.Left = point.X;
                Rect.Top  = point.Y;
                BoundsChanged();
            };
            TopRightHandle.Moved += (point) =>
            {
                SavePreviousBounds();
                Rect.Right = point.X;
                Rect.Top   = point.Y;
                BoundsChanged();
            };
            BottomRightHandle.Moved += (point) =>
            {
                SavePreviousBounds();
                Rect.Right  = point.X;
                Rect.Bottom = point.Y;
                BoundsChanged();
            };
            BottomLeftHandle.Moved += (point) =>
            {
                SavePreviousBounds();
                Rect.Left   = point.X;
                Rect.Bottom = point.Y;
                BoundsChanged();
            };

            // Create the top and bottom drag handles if the bounds
            // is wide enough
            if (Width >= 50)
            {
                // Add handles
                TopHandle    = new KimonoHandle(HorizontalCenter - KimonoHandle.DrawOffset, Top - KimonoHandle.DrawOffset, KimonoHandleConstraint.Vertical, state);
                BottomHandle = new KimonoHandle(HorizontalCenter - KimonoHandle.DrawOffset, Bottom - KimonoHandle.DrawOffset, KimonoHandleConstraint.Vertical, state);

                // Wire-up events
                TopHandle.Moved += (point) =>
                {
                    Top = point.Y;
                };
                BottomHandle.Moved += (point) =>
                {
                    Bottom = point.Y;
                };
            }

            // Create the left and right drag handles if the bounds
            // is tall enough
            if (Height >= 50)
            {
                // Add handle
                LeftHandle  = new KimonoHandle(Left - KimonoHandle.DrawOffset, VerticalCenter - KimonoHandle.DrawOffset, KimonoHandleConstraint.Horizontal, state);
                RightHandle = new KimonoHandle(Right - KimonoHandle.DrawOffset, VerticalCenter - KimonoHandle.DrawOffset, KimonoHandleConstraint.Horizontal, state);

                // Wire-up events
                LeftHandle.Moved += (point) =>
                {
                    Left = point.X;
                };
                RightHandle.Moved += (point) =>
                {
                    Right = point.X;
                };
            }
        }