コード例 #1
0
        /// <summary>Called when the thumb is being dragged.</summary>
        public override bool OnDrag(PowerUI.DragEvent mouseEvent)
        {
            // Get the amount of pixels the pointer moved by:
            float deltaX = AllowX ? mouseEvent.deltaX : 0f;
            float deltaY = AllowY ? mouseEvent.deltaY : 0f;

            if (deltaX == 0f && deltaY == 0f)
            {
                return(false);
            }

            // Resize now!
            ComputedStyle cs = ToResize_.Style.Computed;

            if (deltaX != 0f)
            {
                // Width is..
                Css.Value width = cs[Css.Properties.Width.GlobalProperty];

                // Update it:
                deltaX += width.GetDecimal(ToResize_.RenderData, Css.Properties.Width.GlobalProperty);

                // Write it back out:
                cs.ChangeProperty(Css.Properties.Width.GlobalProperty, new Css.Units.DecimalUnit(deltaX));
            }

            if (deltaY != 0f)
            {
                // Height is..
                Css.Value height = cs[Css.Properties.Height.GlobalProperty];

                // Update it:
                deltaY += height.GetDecimal(ToResize_.RenderData, Css.Properties.Height.GlobalProperty);

                // Write it back out:
                cs.ChangeProperty(Css.Properties.Height.GlobalProperty, new Css.Units.DecimalUnit(deltaY));
            }

            return(false);
        }
コード例 #2
0
ファイル: scrollthumb.cs プロジェクト: HippoAR/DemoPowerUI
        /// <summary>Called when the thumb is being dragged.</summary>
        public override bool OnDrag(PowerUI.DragEvent mouseEvent)
        {
            float delta;

            if (IsVertical)
            {
                delta = mouseEvent.clientY - mouseEvent.trigger.DownDocumentY;
            }
            else
            {
                delta = mouseEvent.clientX - mouseEvent.trigger.DownDocumentX;
            }

            if (delta == 0)
            {
                return(false);
            }

            ScrollBy(delta, false, true);

            return(false);
        }
コード例 #3
0
ファイル: Element.cs プロジェクト: labiel1/DreamHouse_Gaminp
 /// <summary>Called repeatedly when this element is being dragged.</summary>
 public virtual bool OnDrag(PowerUI.DragEvent e)
 {
     return(true);
 }