예제 #1
0
    private void CalculateScaledMouseCoordinates(MouseEventData data,
                                                 CoherentUIGTView view,
                                                 bool invertY)
    {
        float camWidth;
        float camHeight;

        var isOnSurface = (view.RenderingCamera == null);

        if (!isOnSurface)
        {
            Camera cameraComponent = view.RenderingCamera;
            camWidth  = cameraComponent.pixelWidth;
            camHeight = cameraComponent.pixelHeight;
        }
        else
        {
            camWidth  = view.Width;
            camHeight = view.Height;
        }

        float factorX = view.WidthToCamWidthRatio(camWidth);
        float factorY = view.HeightToCamHeightRatio(camHeight);

        float y = (invertY) ? (camHeight - data.Y) : data.Y;

        data.X = (int)(data.X * factorX);
        data.Y = (int)(y * factorY);
    }
 public override void HandleClickEvent(MouseEventData e)
 {
     if (e.Equals("aClickOnThisUIElement"))
     {
         Click();
     }
 }
예제 #3
0
        public static void GenerateMouseMoveEvent(ref MouseEventData mouseMoveEvent)
        {
            mouseMoveEvent.Type   = MouseEventData.EventType.MouseMove;
            mouseMoveEvent.Button = MouseEventData.MouseButton.ButtonNone;

            mouseMoveEvent.MouseModifiers.IsLeftButtonDown   = Input.GetMouseButton(0);
            mouseMoveEvent.MouseModifiers.IsMiddleButtonDown = Input.GetMouseButton(2);
            mouseMoveEvent.MouseModifiers.IsRightButtonDown  = Input.GetMouseButton(1);

            mouseMoveEvent.Modifiers.IsCtrlDown  = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
            mouseMoveEvent.Modifiers.IsAltDown   = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
            mouseMoveEvent.Modifiers.IsShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
            mouseMoveEvent.Modifiers.IsCapsOn    = false;          // Indeterminate
            mouseMoveEvent.Modifiers.IsNumLockOn = false;          // Indeterminate

            if (mouseMoveEvent.MouseModifiers.IsLeftButtonDown)
            {
                mouseMoveEvent.Button = MouseEventData.MouseButton.ButtonLeft;
            }
            else if (mouseMoveEvent.MouseModifiers.IsMiddleButtonDown)
            {
                mouseMoveEvent.Button = MouseEventData.MouseButton.ButtonMiddle;
            }
            else if (mouseMoveEvent.MouseModifiers.IsRightButtonDown)
            {
                mouseMoveEvent.Button = MouseEventData.MouseButton.ButtonRight;
            }

            mouseMoveEvent.X      = (int)Input.mousePosition.x;
            mouseMoveEvent.Y      = (int)Input.mousePosition.y;
            mouseMoveEvent.WheelX = 0;
            mouseMoveEvent.WheelY = 0;
        }
        private void InitializeGlControl()
        {
            // TODO: в более надлежащее место
            OpenGlApplication.Setup();

            _glControl = new GLControl
            {
                Parent = openTkControlContainer,
                Dock   = DockStyle.Fill
            };

            _glControl.CreateControl();
            _glControl.Resize += GlControlOnResize;

            GL.Viewport(Point.Empty, _glControl.Size);
            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);

            OpenGlApplication.EnableDebugMessages();

            // TODO: в более надлежащее место
            Singleton.Get <OpenClApplication>().SetupUsingOpenGLContext();

            _glControl.Paint += GlControlOnPaint;

            _glControl.MouseClick       += (sender, args) => _tool?.MouseEvent(MouseEventData.FromMouseClickEvent(args));
            _glControl.MouseDoubleClick += (sender, args) => _tool?.MouseEvent(MouseEventData.FromMouseDoubleClickEvent(args));
            _glControl.MouseDown        += (sender, args) => _tool?.MouseEvent(MouseEventData.FromMouseDownEvent(args));
            _glControl.MouseUp          += (sender, args) => _tool?.MouseEvent(MouseEventData.FromMouseUpEvent(args));
            _glControl.MouseMove        += (sender, args) => _tool?.MouseEvent(MouseEventData.FromMouseMoveEvent(args));
            _glControl.MouseWheel       += (sender, args) => _tool?.MouseEvent(MouseEventData.FromMouseWheelEvent(args));
        }
예제 #5
0
        public void Drag2()
        {
            DragPanel dp = new DragPanel
            {
                Width  = 10,
                Height = 10
            };
            RectangleView r = new RectangleView
            {
                PreferredHeight = 3,
                PreferredWidth  = 3,
                Position        = new Point(3, 3)
            };

            dp.Children.Add(r);

            MouseEventData mev = new MouseEventData(MouseEvent.MOUSE_PRESSED, new Point(3, 3), 1);

            UIElement.HandleMouseEvent(dp, mev);

            mev = new MouseEventData(MouseEvent.MOUSE_DRAGGED, new Point(1, 1), 1);
            UIElement.HandleMouseEvent(dp, mev);
            Assert.AreEqual(new Point(1, 1), r.Position);

            mev = new MouseEventData(MouseEvent.MOUSE_RELEASED, new Point(1, 1), 1);
            UIElement.HandleMouseEvent(dp, mev);
            Assert.AreEqual(new Point(1, 1), r.Position);
        }
예제 #6
0
        /// <see cref="UIElement.OnMouseEventPreview(MouseEventData)"/>
        protected override void OnMouseEventPreview(MouseEventData eventData)
        {
            if (eventData.Id == MouseEvent.MOUSE_PRESSED)
            {
                _previousCursorPosition = eventData.MousePosition;
            }

            base.OnMouseEventPreview(eventData);
        }
예제 #7
0
    //--------------------------------------------------------------------------------------------------

    public override bool OnMouseUp(MouseEventData data, bool shiftSelected)
    {
        if (!IsFinished)
        {
            ProcessMouseInput(data);
            IsFinished = SelectedEntity != null;
        }
        return(true);
    }
예제 #8
0
    //--------------------------------------------------------------------------------------------------

    public override bool OnMouseMove(MouseEventData data)
    {
        if (!IsFinished)
        {
            ProcessMouseInput(data);

            return(base.OnMouseMove(data));
        }
        return(false);
    }
예제 #9
0
    //--------------------------------------------------------------------------------------------------

    void ProcessMouseInput(MouseEventData data)
    {
        if (data.DetectedEntities.Count == 1)
        {
            SelectedEntity = data.DetectedEntities[0] as T;
        }
        else
        {
            SelectedEntity = null;
        }
    }
예제 #10
0
        public void MouseClickFunctionalityEventOutsideLabel()
        {
            _labelView.Position         = new Point(0, 0);
            _labelView.CanLeaveEditMode = true;
            MouseEventData mouseEventData =
                new MouseEventData(MouseEvent.MOUSE_CLICKED, new Point(_labelView.Width + 1, _labelView.Height + 1), 1);

            UIElement.HandleMouseEvent(_labelView, mouseEventData);

            // Edit mode should still be false.
            Assert.IsFalse(_labelView.IsInEditMode);
        }
        /// <summary>
        ///   Receives click events. Called at mouse down and at mouse up.
        /// </summary>
        /// <param name = "mouseData"></param>
        private void OnMouseClick3DAction(MouseEventData mouseData)
        {
            // Filter mouse up events
            if (!mouseData.MouseDown)
            {
                return;
            }

            var coordinate = new Point(mouseData.X, mouseData.Y);

            UpdateCoordinate(coordinate);
        }
        /// <summary>
        ///   Receives mouse move events. The mouse move can be made having a button pressed or not
        /// </summary>
        /// <param name = "mouseData"></param>
        private void OnMouseMove3DAction(MouseEventData mouseData)
        {
            // Clear the previous rectangle
            if (_firstPoint)
            {
                return;
            }

            var coordinate = new Point(mouseData.X, mouseData.Y);

            UpdateRectangleCoordinate(coordinate);
        }
        private void MouseEventHandler(MouseEventData mouseData)
        {
            if (mouseData.MouseDown != _previousMouseDown)
            {
                OnMouseClick3DAction(mouseData);
            }
            else
            {
                OnMouseMove3DAction(mouseData);
            }

            _previousMouseDown = mouseData.MouseDown;
        }
        private void MouseHandler(MouseEventData mouseData)
        {
            if (mouseData.MouseDown != PreviousMouseDown)
            {
                _context.Select(true);
            }
            else
            {
                _context.MoveTo(mouseData.X, mouseData.Y, _view);
            }

            PreviousMouseDown = mouseData.MouseDown;
        }
예제 #15
0
        public void MouseClickFunctionalityEventNoClick()
        {
            _labelView.Position         = new Point(0, 0);
            _labelView.CanLeaveEditMode = true;

            Point          pointInLabel   = new Point(_labelView.Width / 2, _labelView.Height / 2);
            MouseEventData mouseEventData =
                new MouseEventData(MouseEvent.NOBUTTON, pointInLabel, 1);

            UIElement.HandleMouseEvent(_labelView, mouseEventData);

            // Check if expected mouse action occured.
            Assert.IsFalse(_labelView.IsInEditMode);
        }
예제 #16
0
    private void CalculateScaledMouseCoordinates(ref MouseEventData data,
                                                 CoherentUIView view,
                                                 bool invertY)
    {
        var camWidth  = view.gameObject.camera.pixelWidth;
        var camHeight = view.gameObject.camera.pixelHeight;

        float factorX = view.WidthToCamWidthRatio(camWidth);
        float factorY = view.HeightToCamHeightRatio(camHeight);

        float y = (invertY)? (camHeight - data.Y) : data.Y;

        data.X = (int)(data.X * factorX);
        data.Y = (int)(y * factorY);
    }
예제 #17
0
        //--------------------------------------------------------------------------------------------------

        public override bool OnMouseMove(MouseEventData data)
        {
            // Check if we need to scale the trihedron
            if (!_LastGizmoScale.IsEqual(WorkspaceController.ActiveViewport.GizmoScale, 0.001) ||
                !_LastPixelSize.IsEqual(WorkspaceController.ActiveViewport.PixelSize, 0.001))
            {
                _LastGizmoScale = WorkspaceController.ActiveViewport.GizmoScale;
                _LastPixelSize  = WorkspaceController.ActiveViewport.PixelSize;
                //Debug.WriteLine("Gizmo scaled, last is " + _LastGizmoScale);
                Elements.OnGizmoScaleChanged(_TempPoints, Sketch.Segments);
                data.ForceReDetection = true;
            }

            return(base.OnMouseMove(data));
        }
예제 #18
0
        public static MouseEventData ProcessMouseEvent(Event evt)
        {
            MouseEventData eventData = new MouseEventData();

            EventMouseModifiersState mouseMods = new EventMouseModifiersState();

            mouseMods.IsLeftButtonDown   = Input.GetMouseButton(0);
            mouseMods.IsMiddleButtonDown = Input.GetMouseButton(2);
            mouseMods.IsRightButtonDown  = Input.GetMouseButton(1);

            eventData.Modifiers      = GetEventModifiersState(evt);
            eventData.MouseModifiers = mouseMods;

            if (evt.type == EventType.ScrollWheel)
            {
                eventData.WheelX = evt.delta.x * UNITY_WHEEL_TICK_FACTOR;
                eventData.WheelY = -evt.delta.y * UNITY_WHEEL_TICK_FACTOR;
            }
            eventData.X = (int)evt.mousePosition.x;
            eventData.Y = (int)evt.mousePosition.y;

            eventData.Button = MouseEventData.MouseButton.ButtonNone;
            if (evt.button == 0)
            {
                eventData.Button = MouseEventData.MouseButton.ButtonLeft;
            }
            else if (evt.button == 2)
            {
                eventData.Button = MouseEventData.MouseButton.ButtonMiddle;
            }
            else if (evt.button == 1)
            {
                eventData.Button = MouseEventData.MouseButton.ButtonRight;
            }

            // eventData.Type is left uninitialized
            return(eventData);
        }
    private void CalculateScaledMouseCoordinates(ref MouseEventData data,
                                                 CoherentUIView view,
                                                 bool invertY)
    {
        float camWidth;
        float camHeight;

        var isOnSurface = view.gameObject.camera == null;

        if (!isOnSurface)
        {
            camWidth  = view.gameObject.camera.pixelWidth;
            camHeight = view.gameObject.camera.pixelHeight;
        }
        else
        {
            var surfaceCameraObj =
                view.gameObject.transform.Find
                    ("CoherentRenderingCamera" + view.View.GetId());
            if (surfaceCameraObj != null && surfaceCameraObj.camera != null)
            {
                camWidth  = surfaceCameraObj.camera.pixelWidth;
                camHeight = surfaceCameraObj.camera.pixelHeight;
            }
            else
            {
                return;
            }
        }

        float factorX = view.WidthToCamWidthRatio(camWidth);
        float factorY = view.HeightToCamHeightRatio(camHeight);

        float y = (invertY)? (camHeight - data.Y) : data.Y;

        data.X = (int)(data.X * factorX);
        data.Y = (int)(y * factorY);
    }
예제 #20
0
        public void EventResponse(SimpleEvent simpleEvent)
        {
            MouseEventData data = (MouseEventData)simpleEvent.Data;

            if (data.RightButtonState == ButtonStates.PRESSED_THIS_FRAME)
            {
                if (!emitterList.Active)
                {
                    emitterList.Activate(Vector2.Zero);
                    groupList.Activate(Vector2.Zero);
                }
                else
                {
                    emitterList.Active = false;
                    groupList.Active   = false;
                }
            }

            if (emitterList.Active)
            {
                CheckSelection(emitterList, data);
            }
        }
예제 #21
0
		public static void GenerateMouseMoveEvent (ref MouseEventData mouseMoveEvent)
		{
			mouseMoveEvent.Type = MouseEventData.EventType.MouseMove;
			mouseMoveEvent.Button = MouseEventData.MouseButton.ButtonNone;
		
			mouseMoveEvent.MouseModifiers.IsLeftButtonDown = Input.GetMouseButton (0);
			mouseMoveEvent.MouseModifiers.IsMiddleButtonDown = Input.GetMouseButton (2);
			mouseMoveEvent.MouseModifiers.IsRightButtonDown = Input.GetMouseButton (1);
		
			mouseMoveEvent.Modifiers.IsCtrlDown = Input.GetKey (KeyCode.LeftControl) || Input.GetKey (KeyCode.RightControl);
			mouseMoveEvent.Modifiers.IsAltDown = Input.GetKey (KeyCode.LeftAlt) || Input.GetKey (KeyCode.RightAlt);
			mouseMoveEvent.Modifiers.IsShiftDown = Input.GetKey (KeyCode.LeftShift) || Input.GetKey (KeyCode.RightShift);
			mouseMoveEvent.Modifiers.IsCapsOn = false; // Indeterminate
			mouseMoveEvent.Modifiers.IsNumLockOn = false; // Indeterminate
		
			if (mouseMoveEvent.MouseModifiers.IsLeftButtonDown) {
				mouseMoveEvent.Button = MouseEventData.MouseButton.ButtonLeft;
			} else if (mouseMoveEvent.MouseModifiers.IsMiddleButtonDown) {
				mouseMoveEvent.Button = MouseEventData.MouseButton.ButtonMiddle;
			} else if (mouseMoveEvent.MouseModifiers.IsRightButtonDown) {
				mouseMoveEvent.Button = MouseEventData.MouseButton.ButtonRight;
			}
		
			mouseMoveEvent.X = (int)Input.mousePosition.x;
			mouseMoveEvent.Y = (int)Input.mousePosition.y;
			mouseMoveEvent.WheelX = 0;
			mouseMoveEvent.WheelY = 0;
		}
    public virtual void OnGUI()
    {
        if (m_Views == null)
        {
            return;
        }

                #if UNITY_ANDROID || COHERENT_SIMULATE_MOBILE_IN_EDITOR || COHERENT_SIMULATE_MOBILE_IN_PLAYER
        if (Event.current.isMouse && !IsPointInsideAnyView(
                (int)Event.current.mousePosition.x,
                (int)Event.current.mousePosition.y))
        {
            var evt = Event.current;
            int x   = (int)evt.mousePosition.x;
            int y   = (int)evt.mousePosition.y;

            switch (evt.type)
            {
            case EventType.MouseDown:
                CoherentUI.InputManager.ProcessTouchEvent(
                    (int)TouchPhase.Began, evt.button, x, y);
                break;

            case EventType.MouseUp:
                CoherentUI.InputManager.ProcessTouchEvent(
                    (int)TouchPhase.Ended, evt.button, x, y);
                break;

            case EventType.MouseDrag:
                CoherentUI.InputManager.ProcessTouchEvent(
                    (int)TouchPhase.Moved, evt.button, x, y);
                break;
            }
        }
                #endif

                #if COHERENT_UNITY_STANDALONE
        MouseEventData mouseEventData   = null;
        KeyEventData   keyEventData     = null;
        KeyEventData   keyEventDataChar = null;

        switch (Event.current.type)
        {
        case EventType.MouseDown:
        {
            mouseEventData      = Coherent.UI.InputManager.ProcessMouseEvent(Event.current);
            mouseEventData.Type = MouseEventData.EventType.MouseDown;
        }
        break;

        case EventType.MouseUp:
        {
            mouseEventData      = Coherent.UI.InputManager.ProcessMouseEvent(Event.current);
            mouseEventData.Type = MouseEventData.EventType.MouseUp;
        }
        break;

        case EventType.ScrollWheel:
        {
            if (Event.current.delta.SqrMagnitude() > 0)
            {
                mouseEventData      = Coherent.UI.InputManager.ProcessMouseEvent(Event.current);
                mouseEventData.Type = MouseEventData.EventType.MouseWheel;
            }
        }
        break;

        case EventType.KeyDown:
            if (Event.current.keyCode != KeyCode.None)
            {
                keyEventData      = Coherent.UI.InputManager.ProcessKeyEvent(Event.current);
                keyEventData.Type = KeyEventData.EventType.KeyDown;

                if (keyEventData.KeyCode == 0)
                {
                    keyEventData = null;
                }
            }
            if (Event.current.character != 0)
            {
                keyEventDataChar = Coherent.UI.InputManager.ProcessCharEvent(Event.current);

                if (keyEventDataChar.KeyCode == 10)
                {
                    keyEventDataChar.KeyCode = 13;
                }
            }
            break;

        case EventType.KeyUp:
        {
            keyEventData      = Coherent.UI.InputManager.ProcessKeyEvent(Event.current);
            keyEventData.Type = KeyEventData.EventType.KeyUp;

            if (keyEventData.KeyCode == 0)
            {
                keyEventData = null;
            }
        }
        break;
        }

        foreach (var item in m_Views)
        {
            var view = item.View;
                        #if COHERENT_SIMULATE_MOBILE_IN_EDITOR || COHERENT_SIMULATE_MOBILE_IN_PLAYER
            bool forwardInput = (item.InputState !=
                                 CoherentUIView.CoherentViewInputState.TakeNone);
                        #else
            bool forwardInput = item.ReceivesInput;
                        #endif
            if (forwardInput && view != null)
            {
                if (mouseEventData != null)
                {
                    if (item.MouseX != -1 && item.MouseY != -1)
                    {
                        mouseEventData.X = item.MouseX;
                        mouseEventData.Y = item.MouseY;
                    }

                    //Check if there is a camera attached to the view's parent
                    //Views attached on surfaces do not have such camera.
                    var isOnSurface = item.gameObject.camera == null;

                    if (!isOnSurface)
                    {
                        CalculateScaledMouseCoordinates(ref mouseEventData,
                                                        item,
                                                        false);
                    }

                    view.MouseEvent(mouseEventData);

                    //Note: The Event.current.Use() marks the event as used,
                    //and makes the other GUI elements to ignore it, but does
                    //not destroy the event immediately
                    Event.current.Use();
                }
                if (keyEventData != null)
                {
                    view.KeyEvent(keyEventData);
                    Event.current.Use();
                }
                if (keyEventDataChar != null)
                {
                    view.KeyEvent(keyEventDataChar);
                    Event.current.Use();
                }
            }
        }
                #endif
    }
예제 #23
0
	private void CalculateScaledMouseCoordinates(ref MouseEventData data,
		CoherentUIView view,
		bool invertY)
	{
		float camWidth;
		float camHeight;

		var isOnSurface = view.gameObject.camera == null;

		if (!isOnSurface)
		{
			camWidth = view.gameObject.camera.pixelWidth;
			camHeight = view.gameObject.camera.pixelHeight;
		}
		else
		{
			var surfaceCameraObj =
				view.gameObject.transform.Find
					("CoherentRenderingCamera" + view.View.GetId());
			if (surfaceCameraObj != null && surfaceCameraObj.camera != null)
			{
				camWidth = surfaceCameraObj.camera.pixelWidth;
				camHeight = surfaceCameraObj.camera.pixelHeight;
			}
			else
			{
				return;
			}
		}

		float factorX = view.WidthToCamWidthRatio(camWidth);
		float factorY = view.HeightToCamHeightRatio(camHeight);

		float y = (invertY)? (camHeight - data.Y) : data.Y;

		data.X = (int)(data.X * factorX);
		data.Y = (int)(y * factorY);
	}
예제 #24
0
 public void RunOnMouseEvent(MouseEventData e)
 {
     OnMouseEvent(e);
 }
예제 #25
0
    //--------------------------------------------------------------------------------------------------

    public override bool OnMouseDown(MouseEventData data)
    {
        return(true); // Supress Rubberband Selection
    }
예제 #26
0
		public static MouseEventData ProcessMouseEvent (Event evt)
		{
			MouseEventData eventData = new MouseEventData ();

			EventMouseModifiersState mouseMods = new EventMouseModifiersState ();
			mouseMods.IsLeftButtonDown = Input.GetMouseButton (0);
			mouseMods.IsMiddleButtonDown = Input.GetMouseButton (2);
			mouseMods.IsRightButtonDown = Input.GetMouseButton (1);

			eventData.Modifiers = GetEventModifiersState (evt);
			eventData.MouseModifiers = mouseMods;
		
			if (evt.type == EventType.ScrollWheel) {
				eventData.WheelX = evt.delta.x * UNITY_WHEEL_TICK_FACTOR;
				eventData.WheelY = -evt.delta.y * UNITY_WHEEL_TICK_FACTOR;
			}
			eventData.X = (int)evt.mousePosition.x;
			eventData.Y = (int)evt.mousePosition.y;
		
			eventData.Button = MouseEventData.MouseButton.ButtonNone;
			if (evt.button == 0) {
				eventData.Button = MouseEventData.MouseButton.ButtonLeft;
			} else if (evt.button == 2) {
				eventData.Button = MouseEventData.MouseButton.ButtonMiddle;
			} else if (evt.button == 1) {
				eventData.Button = MouseEventData.MouseButton.ButtonRight;
			}
		
			// eventData.Type is left uninitialized
			return eventData;            
		}
예제 #27
0
    public virtual void OnGUI()
    {
        if (m_Views == null)
        {
            return;
        }

                #if UNITY_EDITOR || COHERENT_UNITY_STANDALONE
        MouseEventData mouseEventData   = null;
        KeyEventData   keyEventData     = null;
        KeyEventData   keyEventDataChar = null;

        switch (Event.current.type)
        {
        case EventType.MouseDown:
        {
            mouseEventData      = Coherent.UI.InputManager.ProcessMouseEvent(Event.current);
            mouseEventData.Type = MouseEventData.EventType.MouseDown;
        }
        break;

        case EventType.MouseUp:
        {
            mouseEventData      = Coherent.UI.InputManager.ProcessMouseEvent(Event.current);
            mouseEventData.Type = MouseEventData.EventType.MouseUp;
        }
        break;

        case EventType.ScrollWheel:
        {
            if (Event.current.delta.SqrMagnitude() > 0)
            {
                mouseEventData      = Coherent.UI.InputManager.ProcessMouseEvent(Event.current);
                mouseEventData.Type = MouseEventData.EventType.MouseWheel;
            }
        }
        break;

        case EventType.KeyDown:
            if (Event.current.keyCode != KeyCode.None)
            {
                keyEventData      = Coherent.UI.InputManager.ProcessKeyEvent(Event.current);
                keyEventData.Type = KeyEventData.EventType.KeyDown;

                if (keyEventData.KeyCode == 0)
                {
                    keyEventData = null;
                }
            }
            if (Event.current.character != 0)
            {
                keyEventDataChar = Coherent.UI.InputManager.ProcessCharEvent(Event.current);
            }
            break;

        case EventType.KeyUp:
        {
            keyEventData      = Coherent.UI.InputManager.ProcessKeyEvent(Event.current);
            keyEventData.Type = KeyEventData.EventType.KeyUp;

            if (keyEventData.KeyCode == 0)
            {
                keyEventData = null;
            }
        }
        break;
        }

        foreach (var item in m_Views)
        {
            var view = item.View;
            if (item.ReceivesInput && view != null)
            {
                if (mouseEventData != null)
                {
                    if (item.MouseX != -1 && item.MouseY != -1)
                    {
                        mouseEventData.X = item.MouseX;
                        mouseEventData.Y = item.MouseY;
                    }
                    view.MouseEvent(mouseEventData);
                    Event.current.Use();
                }
                if (keyEventData != null)
                {
                    view.KeyEvent(keyEventData);
                    Event.current.Use();
                }
                if (keyEventDataChar != null)
                {
                    view.KeyEvent(keyEventDataChar);
                    Event.current.Use();
                }
            }
        }
                #endif
    }
예제 #28
0
파일: MouseEvent.cs 프로젝트: monry/UniFlow
 public override IObservable <EventMessage> OnPublishAsObservable() =>
 OnEventAsObservable()
 .Select(_ => EventMessage.Create(EventType.MouseEvent, Component, MouseEventData.Create(MouseEventType)));
예제 #29
0
 private void CheckSelection(SelectionList list, MouseEventData data)
 {
 }
예제 #30
0
	private void CalculateScaledMouseCoordinates(ref MouseEventData data,
		CoherentUIView view,
		bool invertY)
	{
		var camWidth = view.gameObject.camera.pixelWidth;
		var camHeight = view.gameObject.camera.pixelHeight;

		float factorX = view.WidthToCamWidthRatio(camWidth);
		float factorY = view.HeightToCamHeightRatio(camHeight);

		float y = (invertY)? (camHeight - data.Y) : data.Y;

		data.X = (int)(data.X * factorX);
		data.Y = (int)(y * factorY);
	}
 public abstract void HandleClickEvent(MouseEventData e);
예제 #32
0
파일: MouseDevice.cs 프로젝트: uxifiit/UXC
        private void OnMouseEvent(MouseEventType eventType, MouseEventArgs args, DateTime timestamp)
        {
            var eventData = new MouseEventData(eventType, args.X, args.Y, (MouseButton)args.Button, args.Delta, timestamp);

            Data?.Invoke(this, eventData);
        }