/// <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);
        }
        public virtual void Update(float deltaTime)
        {
            if (Animation == null || Animation.Paused)
            {
                return;
            }

            if (CurrentTime == 0f)
            {
                if (deltaTime > 0.5f)
                {
                    // Block slow frames.
                    // This is almost always only ever the very first one
                    return;
                }

                // Make sure they're the same units.
                if (ValueObject != null && RawStart.GetType() == RawTarget.GetType())
                {
                    // Raw start/end values:
                    StartValue = RawStart.GetRawDecimal();
                    DeltaValue = RawTarget.GetRawDecimal();

                    // Update delta:
                    DeltaValue -= StartValue;
                }
                else
                {
                    // Different units or are non-numeric! Also applies to e.g. "none" -> "x%".
                    // We'll be using pixel values here, but we must use GetDecimal every frame of the animation.

                    // Force it to be a raw decimal:
                    ValueObject = new Css.Units.DecimalUnit(0f);

                    // Write it straight out to the computed style:
                    // (Internally handles any aliases for us)
                    Animation.ComputedStyle[InnerPropertyInfo] = ValueObject;

                    // If it's not an alias, update hostValue:
                    if (!InnerPropertyInfo.IsAlias)
                    {
                        PropertyValueObject = ValueObject;
                    }
                }

                // Setup targets etc.

                // Instant?
                if (Animation.Duration == 0f)
                {
                    Complete();

                    return;
                }
            }

            CurrentTime += deltaTime;

            if (!Animation.Animating.isRooted)
            {
                // Immediately stop - the element was removed (don't call the finished event):
                Stop();

                return;
            }

            // Get the style:
            ComputedStyle computed = Animation.ComputedStyle;

            float progress = CurrentTime / Animation.TotalTime;

            if (progress >= 1f)
            {
                // Done!
                progress = 1f;

                // Make sure we are exactly the right value.
                Complete();

                // Stop there:
                return;
            }

            // Set ActiveValue by sampling from the curve (if there is one):

            if (ProgressSampler != null)
            {
                // Map through the progression curve:
                ProgressSampler.Goto(progress, true);
                progress = ProgressSampler.CurrentValue;
            }

            if (RawStart != ValueObject)
            {
                // Get the current from/to values:
                StartValue = RawStart.GetDecimal(computed.RenderData, InnerPropertyInfo);
                DeltaValue = RawTarget.GetDecimal(computed.RenderData, InnerPropertyInfo);

                // Update delta:
                DeltaValue -= StartValue;
            }

            // Read the value:
            ActiveValue = StartValue + (DeltaValue * progress);

            // Write it out to the CSS value:
            ValueObject.RawValue = ActiveValue;

            if (UpdateCss)
            {
                // And Tell the style it changed:
                // Note that in grouped properties, only the last one actually runs the update.
                computed.ChangeProperty(PropertyInfo, PropertyValueObject);
            }
        }