Ejemplo n.º 1
0
        void ISelectable.MouseSelecting(MouseSelectingArgs e)
        {
            //validate
            if (!IsSelectable)
            {
                e.Select = false;
                return;
            }

            _selectedButton = IsButton(e.SubObject);
            if (_mouseEnteredButton)
            {
                SetHilight(true, _selectedColor, 1);

                //press the button
                GetButton().Pressed = true;
            }
            else
            {
                SetHilight(true, _selectedColor, 0);
                SetHilight(true, _selectedColor, 2);

                //get starting positions
                _mousePosition = Application.Input.GetMousePositionOrTouchPosition();
                _origKnobPos   = GetKnob().Position;

                //using touch
                _usingTouch = Application.Input.IsTouching();
            }
        }
Ejemplo n.º 2
0
        void ISelectable.MouseSelecting(MouseSelectingArgs e)
        {
            //validate
            if (!IsSelectable)
            {
                e.Select = false;
                return;
            }

            //set to hilight color
            _origColor = Node.GetComponent <Urho.Shapes.Shape>().Color;
            var color = Color.Red;

            if (_origColor.ToUInt() == color.ToUInt())
            {
                color = Color.Yellow;
            }
            Node.RunActionsAsync(new TintTo(.2f, color.R, color.G, color.B));

            //get selection plane for moving within
            if (e.Ray != null)
            {
                _plane  = new Plane(e.Ray.Value.Normal, e.Ray.Value.Position);
                _offset = e.Ray.Value.Node.Position - e.Ray.Value.Position;
            }

            //change to kinamatic
            var r = Node.GetComponent <RigidBody>();

            if (r != null)
            {
                _origKinematic = r.Kinematic;
                r.Kinematic    = true;
            }

            //using touch
            _usingTouch = Application.Input.IsTouching();
        }
Ejemplo n.º 3
0
            void ISelectable.MouseSelecting(MouseSelectingArgs e)
            {
                SetHilight(true);

                _transformGimbal.MouseSelecting(e, _key);
            }
Ejemplo n.º 4
0
        void MouseSelecting(MouseSelectingArgs e, string key)
        {
            //get selection plane for moving within
            if (e.Ray != null)
            {
                //select corect plane
                var cameraDir = (Application as App).CameraNode.Direction;
                switch (key)
                {
                case "x":
                    if (Math.Abs(cameraDir.Y) > Math.Abs(cameraDir.X))
                    {
                        _plane = new Urho.Plane(Vector3.Forward, Node.Position);
                    }
                    else
                    {
                        _plane = new Urho.Plane(Vector3.Up, Node.Position);
                    }
                    break;

                case "y":
                    if (Math.Abs(cameraDir.X) > Math.Abs(cameraDir.Z))
                    {
                        _plane = new Urho.Plane(Vector3.Right, Node.Position);
                    }
                    else
                    {
                        _plane = new Urho.Plane(Vector3.Forward, Node.Position);
                    }
                    break;

                case "z":
                    if (Math.Abs(cameraDir.X) > Math.Abs(cameraDir.Y))
                    {
                        _plane = new Urho.Plane(Vector3.Right, Node.Position);
                    }
                    else
                    {
                        _plane = new Urho.Plane(Vector3.Up, Node.Position);
                    }
                    break;

                case "xz":
                    _plane = new Urho.Plane(Vector3.Up, Node.Position);
                    break;

                case "yx":
                    _plane = new Urho.Plane(Vector3.Forward, Node.Position);
                    break;

                case "zy":
                    _plane = new Urho.Plane(Vector3.Right, Node.Position);
                    break;
                }
                _offset = Node.Position - e.Ray.Value.Position;
            }

            //using touch
            _usingTouch = Application.Input.IsTouching();

            //fire event
            Grabbed?.Invoke(this, new GrabbedEventArgs()
            {
                IsGrabbed = true
            });
        }