Visible() public method

Gets whether the page is visible or not
public Visible ( ) : bool
return bool
Beispiel #1
0
    void OnGUI()
    {
        // get the attached view component
        UWKWebView view = gameObject.GetComponent <UWKWebView>();

        // if we have a view attached and it is visible
        if (view != null && view.Visible())
        {
            // draw it
            Rect r = new Rect(Position.x, Position.y, view.Width, view.Height);
            view.DrawTexture(r);

            // if we have focus, handle input
            if (HasFocus)
            {
                // get the mouse coordinate
                Vector3 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;

                // translate based on position
                mousePos.x -= Position.x;
                mousePos.y -= Position.y;

                view.ProcessMouse(mousePos);

                // process keyboard
                if (Event.current.isKey)
                {
                    view.ProcessKeyboard(Event.current);
                }
            }
        }
    }
Beispiel #2
0
    void OnGUI()
    {
        UWKWebView view = gameObject.GetComponent <UWKWebView>();

        if (view != null && view.Visible())
        {
            Rect r = new Rect(Position.x + X, Position.y + Y, view.CurrentWidth, view.CurrentHeight);
            view.DrawTexture(r);

            if (HasFocus)
            {
                Vector3 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;

                mousePos.x -= Position.x + X;
                mousePos.y -= Position.y + Y;

                view.ProcessMouse(mousePos);

                if (Event.current.isKey)
                {
                    view.ProcessKeyboard(Event.current);
                }
            }
        }
    }
Beispiel #3
0
    void OnGUI()
    {
        time += Time.deltaTime;

        if (time > .25)
        {
            time = 0;

            if (direction)
            {
                width  += 16;
                height += 16;

                zoom += 0.05f;

                if (zoom > 3.0f)
                {
                    zoom = 3.0f;
                }

                if (width > MaxWidth || height > MaxHeight)
                {
                    direction = !direction;
                    width     = MaxWidth;
                    height    = MaxHeight;
                }
            }
            else
            {
                width  -= 16;
                height -= 16;

                zoom -= 0.05f;

                if (zoom < 0.25f)
                {
                    zoom = 0.25f;
                }

                if (width < 32 || height < 32)
                {
                    width     = 32;
                    height    = 32;
                    direction = !direction;
                }
            }

            //Debug.Log("" + width + " x " + height + " at zoom " + zoom);

            view.SetCurrentSize(width, height);
            if (TestZoom)
            {
                view.SetZoomFactor(zoom);
            }
        }

        if (view != null && view.Visible() && HasFocus)
        {
            if (Event.current.type == EventType.Layout)
            {
                Vector3 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                view.ProcessMouse(mousePos);
            }

            if (Event.current.isKey)
            {
                view.ProcessKeyboard(Event.current);
            }
        }

        if (view != null && view.Visible())
        {
            if (Event.current.type == EventType.Repaint)
            {
                Rect r = new Rect(Positon.x, Positon.y, view.CurrentWidth, view.CurrentHeight);
                GUI.DrawTexture(r, view.WebTexture);
            }
        }
    }