Exemple #1
0
        public override bool Intersect(Vector2 pt)
        {
            Scrollview sv       = this.parent as Scrollview;
            Rect       rcGlobal = new Rect(this.position.x + this.parent.position.x - sv.scrollPosition.x, this.position.y + this.parent.position.y - sv.scrollPosition.y, this.position.width, this.position.height);

            return(rcGlobal.Contains(pt));
        }
Exemple #2
0
        public override bool OnRender()
        {
            base.OnRender();

            //body background
            if (this._focus)
            {
                GUI.DrawTexture(this._rcBody, this._textureBgFocus, ScaleMode.StretchToFill);
            }
            else
            {
                GUI.DrawTexture(this._rcBody, this._textureBg, ScaleMode.StretchToFill);
            }

            //bar
            GUI.DrawTexture(this._rcBar, this._textureBar, ScaleMode.StretchToFill);

            //text
            GUI.Label(this._rcTxt, this.nodeName);

            //index
            GUI.Label(this._rcIndex, this.nodeIndex.ToString());

            //line
            if (this._mouseDownBar)
            {
                Scrollview sv  = this.parent as Scrollview;
                Vector2    ptA = new Vector2(this._rcBar.x, this._rcBar.y + this._rcBar.height / 2);
                Vector2    ptB = new Vector2(this._ptMouseLast.x - sv.position.x + sv.scrollPosition.x, this._ptMouseLast.y - sv.position.y + sv.scrollPosition.y);
                Handles.BeginGUI();
                Handles.DrawLine(new Vector3(ptA.x, ptA.y), new Vector3(ptB.x, ptB.y));
                Handles.EndGUI();
            }
            else
            {
                if (this.nodeParent != null)
                {
                    Vector2 ptA = new Vector2(this._rcBar.x, this._rcBar.y + this._rcBar.height / 2);
                    Vector2 ptB = new Vector2(this.nodeParent.position.x + this.nodeParent.position.width, this.nodeParent.position.y + this.nodeParent.position.height / 2);
                    Handles.BeginGUI();
                    Handles.DrawLine(new Vector3(ptA.x, ptA.y), new Vector3(ptB.x, ptB.y));
                    Handles.EndGUI();
                }
            }

            if (this._editMode)
            {
                if (!this.OnRenderEditMode())
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #3
0
        protected virtual void CheckMouseHitArea(Vector2 pt)
        {
            Scrollview sv         = this.parent as Scrollview;
            Vector2    relativePt = new Vector2(pt.x - sv.position.x + sv.scrollPosition.x, pt.y - sv.position.y + sv.scrollPosition.y);

            if (this._rcBody.Contains(relativePt))
            {
                this._mouseDownBody = true;
                this._mouseDownBar  = false;
            }
            else
            {
                this._mouseDownBody = false;
                this._mouseDownBar  = true;
            }
        }