getStage() public method

Returns the stage that this element is currently in, or null if not in a stage.
public getStage ( ) : Stage
return Stage
        void setContainerPosition(float x, float y)
        {
            var stage = _targetElement.getStage();

            if (stage == null)
            {
                return;
            }

            _container.pack();
            float offsetX = _manager.offsetX, offsetY = _manager.offsetY, dist = _manager.edgeDistance;
            var   point = _targetElement.localToStageCoordinates(new Vector2(x + offsetX - _container.getWidth() / 2, y - offsetY - _container.getHeight()));

            if (point.Y < dist)
            {
                point = _targetElement.localToStageCoordinates(new Vector2(x + offsetX, y + offsetY));
            }
            if (point.X < dist)
            {
                point.X = dist;
            }
            if (point.X + _container.getWidth() > stage.getWidth() - dist)
            {
                point.X = stage.getWidth() - dist - _container.getWidth();
            }
            if (point.Y + _container.getHeight() > stage.getHeight() - dist)
            {
                point.Y = stage.getHeight() - dist - _container.getHeight();
            }
            _container.setPosition(point.X, point.Y);

            point  = _targetElement.localToStageCoordinates(new Vector2(_targetElement.getWidth() / 2, _targetElement.getHeight() / 2));
            point -= new Vector2(_container.getX(), _container.getY());
            _container.setOrigin(point.X, point.Y);
        }
Esempio n. 2
0
        public void hide()
        {
            if (!listBox.isTouchable() || !hasParent())
            {
                return;
            }

            listBox.setTouchable(Touchable.Disabled);

            if (stage != null)
            {
                if (_previousScrollFocus != null && _previousScrollFocus.getStage() == null)
                {
                    _previousScrollFocus = null;
                }
            }

            _selectBox.onHide(this);
        }
Esempio n. 3
0
        public void hide()
        {
            if (!listBox.isTouchable() || !hasParent())
            {
                return;
            }
            listBox.setTouchable(Touchable.Disabled);

            if (stage != null)
            {
                //stage.removeCaptureListener( hideListener );
                if (_previousScrollFocus != null && _previousScrollFocus.getStage() == null)
                {
                    _previousScrollFocus = null;
                }

                //var element = stage.getScrollFocus();
                //if( element == null || isAscendantOf( element ) )
                //	stage.setScrollFocus( previousScrollFocus );
            }

            //clearActions();
            _selectBox.onHide(this);
        }