FlatRedBall.Gui.TimeLine.ClickEvent C# (CSharp) Method

ClickEvent() protected method

Method raised when the user clicks on the Window. This moves the position bar to the appropriate location.
protected ClickEvent ( Window callingWindow ) : void
callingWindow Window The window raising this event.
return void
        protected virtual void ClickEvent(Window callingWindow)
        {
            mBeforeChangeValue = mCurrentValue;

            #region SpriteFrame Drawn
            if (GuiManagerDrawn == false)
            {
                float x = 0;
                float y = 0;

                mCursor.GetCursorPosition(out x, out y, SpriteFrame.Z);

                CurrentValue = PositionToValueAbsolute(x);


                FixBar();

                mCurrentValue = PositionToValueRelative((float)positionBar.WorldUnitRelativeX);

                if (this.GuiChange != null)
                    this.GuiChange(this);
            }
            #endregion

            #region GuiManager Drawn
            else
            {
                // make sure the cursor is not on the move bar
                if (IsCursorOnMoveBar(mCursor) == false)
                {
                    double newValue = PositionToValueAbsolute((float)(mCursor.XForUI));

                    // make sure the value isn't outside of what's visible.
                    newValue = System.Math.Max(mStart, newValue);
                    newValue = System.Math.Min(mStart + mValueWidth, newValue);

                    CurrentValue = newValue;

                    FixBar();
                    if (this.GuiChange != null)
                        this.GuiChange(this);
                }
            }
            #endregion
        }