private static void UpdateConnectionPosition(DiagramScrollingInfo diagramInfo, Point mousePosition, Point transformedPosition)
        {
            var arguments = new PointerArgs(mousePosition, transformedPosition);

            diagramInfo.ConnectionTool.MouseMove(arguments);
            diagramInfo.ConnectionManipulationTool.MouseMove(arguments);
        }
        public bool MouseDown(PointerArgs e)
        {
            this.areCtrlShiftDown = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift &&
                                    (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control;

            if (this.areCtrlShiftDown)
            {
                RadDiagramShape topShape = this.HitService.GetTopItemNearPoint(e.Point, 0) as RadDiagramShape;
                if (topShape != null)
                {
                    RadDiagramConnector connector = new RadDiagramConnector() { }; 
                    connector.Name = "NewConnector" + connector.GetHashCode().ToString();

                    double xRatio = (e.Point.X - topShape.Bounds.X) / topShape.Width;
                    double yRatio = (e.Point.Y - topShape.Bounds.Y) / topShape.Height;

                    connector.Offset = new Point(xRatio, yRatio);
                    topShape.Connectors.Add(connector);

                    this.lastUsedShape = topShape;
                    return true;
                }
            }
            return false;
        }
Ejemplo n.º 3
0
        public void OnPointerDown(PointerEventData eventData)
        {
            if (RectTransformUtility.RectangleContainsScreenPoint(m_timelineArea, eventData.position, eventData.pressEventCamera))
            {
                UpdatePointerPosition(eventData);
            }
            else
            {
                Vector2Int coord;
                if (!GetKeyframeCoord(eventData, true, out coord))
                {
                    coord = new Vector2Int(-1, -1);
                }


                if (PointerDown != null)
                {
                    PointerArgs args = new PointerArgs();
                    args.Col   = coord.x;
                    args.Row   = coord.y;
                    args.Range = Range;
                    PointerDown(args);
                }
            }
        }
Ejemplo n.º 4
0
        protected override void HandlePointerEventRaised(PointerArgs args)
        {
            base.HandlePointerEventRaised(args);
            if (SelectedInteractable == null)
            {
                return;
            }

            if (args.Identifier != Identifier &&
                (args.PointerEvent == PointerEvent.Select || args.PointerEvent == PointerEvent.Unselect))
            {
                Pose toPose = PoseUtils.Multiply(_trackedGripPose, _snapOffset);
                if (SelectedInteractable.ResetGrabOnGrabsUpdated)
                {
                    if (SelectedInteractable.CalculateBestPose(toPose, Hand.Scale, Hand.Handedness,
                        ref _cachedBestHandPose, ref _cachedBestSnapPoint,
                        out bool usesHandPose, out float poseScore))
                    {
                        bool usePinchPoint = _currentSnap.SnappedToPinch;
                        HandPose handPose = usesHandPose ? _cachedBestHandPose : null;
                        _currentSnap.Set(SelectedInteractable, handPose, _cachedBestSnapPoint, usePinchPoint);
                    }
                }

                Pose fromPose = _currentSnap.WorldSnapPose;
                _movement = SelectedInteractable.GenerateMovement(fromPose, toPose);
                SelectedInteractable.PointableElement.ProcessPointerEvent(
                    new PointerArgs(Identifier, PointerEvent.Move, fromPose));
            }
        }
 private void HandlePointerEventRaised(PointerArgs args)
 {
     if (args.PointerEvent == PointerEvent.Select || args.PointerEvent == PointerEvent.Unselect)
     {
         AbortSelfAligment();
     }
 }
Ejemplo n.º 6
0
        public override bool MouseUp(PointerArgs e)
        {
            RadDiagramShape shape = this.HitService.GetTopItemNearPoint(e.Point, 0) as RadDiagramShape;

            // Normal execution if we release the mouse over connector.
            if (shape != null && this.IsActiveConnectorUnderPoint(shape, e.Point))
            {
                return base.MouseUp(e);
            }

            // Add custom connector.
            if (shape != null && this.InitialPoint != null && shape != this.HitItem && this.HitItem != null)
            {
                Point intersectPoint = new Point();
                Utils.IntersectionPointOnRectangle(shape.Bounds, this.InitialPoint.Value, e.Point, ref intersectPoint);
                lastCustomConnector = new RadDiagramConnector() { };
                lastCustomConnector.Name = "CustomConnector" + lastCustomConnector.GetHashCode().ToString();

                double xRatio = (intersectPoint.X - shape.Bounds.X) / shape.Width;
                double yRatio = (intersectPoint.Y - shape.Bounds.Y) / shape.Height;

                lastCustomConnector.Offset = new Point(xRatio, yRatio);
                shape.Connectors.Add(lastCustomConnector);
            }

            // This will create the new connection.
            base.MouseUp(e);

            // Repositions the added connection to the custom connector we created.
            if (this.ActiveConnection != null && this.lastCustomConnector != null)
            {
                this.ActiveConnection.Attach(this.ActiveConnection.SourceConnectorResult, lastCustomConnector);
            }
            return false;
        }
 public bool MouseUp(PointerArgs e)
 {
     if (areCtrlShiftDown && lastUsedShape != null)
     {
         this.diagram.SelectedItems.OfType<IDiagramItem>().ToList().ForEach(x => x.IsSelected = false);
         lastUsedShape.IsSelected = true;
         return true;
     }
     return false;
 }
Ejemplo n.º 8
0
        public bool MouseDown(PointerArgs e)
        {
            this.isShiftDown = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift;
            if (this.isShiftDown)
            {
                this.ToolService.ActivateTool(ShapeTool.ToolName);
                this.startPoint = e.TransformedPoint;
                return true;
            }

            return false;
        }
Ejemplo n.º 9
0
        public bool MouseDown(PointerArgs e)
        {
            this.isShiftDown = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift;
            if (this.isShiftDown)
            {
                this.ToolService.ActivateTool(ShapeTool.ToolName);
                this.startPoint = e.TransformedPoint;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 10
0
        public bool MouseUp(PointerArgs e)
        {
            if (this.IsActive)
            {
                this.Graph.AddShape(new RadDiagramShape()
                {
                    Width    = this.rectangleTransformed.Width,
                    Height   = this.rectangleTransformed.Height,
                    Position = this.rectangleTransformed.TopLeft()
                }, isUndoable: true);

                this.Graph.UpdateRectSelection(Rect.Empty);
                this.ToolService.ActivatePrimaryTool();
            }

            return(false);
        }
Ejemplo n.º 11
0
        public bool MouseUp(PointerArgs e)
        {
            if (this.IsActive)
            {
                this.Graph.AddShape(new RadDiagramShape()
                {
                    Width = this.rectangleTransformed.Width,
                    Height = this.rectangleTransformed.Height,
                    Position = this.rectangleTransformed.TopLeft()
                }, isUndoable: true);

                this.Graph.UpdateRectSelection(Rect.Empty);
                this.ToolService.ActivatePrimaryTool();
            }

            return false;
        }
Ejemplo n.º 12
0
        public bool MouseMove(PointerArgs e)
        {
            if (this.IsActive)
            {
                var width = Math.Abs(this.startPoint.X - e.TransformedPoint.X);
                var height = Math.Abs(this.startPoint.Y - e.TransformedPoint.Y);
                var x = Math.Min(this.startPoint.X, e.TransformedPoint.X);
                var y = Math.Min(this.startPoint.Y, e.TransformedPoint.Y);
                this.rectangleTransformed = new Rect(x, y, width, height);

                this.Graph.UpdateRectSelection(this.rectangleTransformed);

                return true;
            }

            return false;
        }
Ejemplo n.º 13
0
        public bool MouseMove(PointerArgs e)
        {
            if (this.IsActive)
            {
                var width  = Math.Abs(this.startPoint.X - e.TransformedPoint.X);
                var height = Math.Abs(this.startPoint.Y - e.TransformedPoint.Y);
                var x      = Math.Min(this.startPoint.X, e.TransformedPoint.X);
                var y      = Math.Min(this.startPoint.Y, e.TransformedPoint.Y);
                this.rectangleTransformed = new Rect(x, y, width, height);

                this.Graph.UpdateRectSelection(this.rectangleTransformed);

                return(true);
            }

            return(false);
        }
Ejemplo n.º 14
0
        public override bool MouseUp(PointerArgs e)
        {
            RadDiagramShape shape = this.HitService.GetTopItemNearPoint(e.Point, 0) as RadDiagramShape;

            // Normal execution if we release the mouse over connector.
            if (shape != null && this.IsActiveConnectorUnderPoint(shape, e.Point))
            {
                return(base.MouseUp(e));
            }

            // Add custom connector.
            if (shape != null && this.InitialPoint != null && shape != this.HitItem && this.HitItem != null)
            {
                Point intersectPoint = new Point();
                Utils.IntersectionPointOnRectangle(shape.Bounds, this.InitialPoint.Value, e.Point, ref intersectPoint);
                lastCustomConnector = new RadDiagramConnector()
                {
                };
                lastCustomConnector.Name = "CustomConnector" + lastCustomConnector.GetHashCode().ToString();

                double xRatio = (intersectPoint.X - shape.Bounds.X) / shape.Width;
                double yRatio = (intersectPoint.Y - shape.Bounds.Y) / shape.Height;

                lastCustomConnector.Offset = new Point(xRatio, yRatio);
                shape.Connectors.Add(lastCustomConnector);

                this.diagram.ItemsChanged += DiagramItemsChanged;
            }

            // This will create the new connection.
            base.MouseUp(e);

            // Repositions the added connection to the custom connector we created.
            if (this.lastAddedConnection != null && this.lastCustomConnector != null)
            {
                lastAddedConnection.Attach(lastAddedConnection.SourceConnectorResult, lastCustomConnector);
            }
            return(false);
        }
Ejemplo n.º 15
0
 public override bool MouseMove(PointerArgs e)
 {
     return false;
 }
        private static void UpdateConnectionPosition(DiagramScrollingInfo diagramInfo, Point mousePosition, Point transformedPosition)
        {
            var arguments = new PointerArgs(mousePosition, transformedPosition);

            diagramInfo.ConnectionTool.MouseMove(arguments);
            diagramInfo.ConnectionManipulationTool.MouseMove(arguments);
        }
 public bool MouseMove(PointerArgs e)
 {
     return false;
 }
 public override bool MouseMove(PointerArgs e)
 {
     return(false);
 }
 public bool MouseDoubleClick(PointerArgs e)
 {
     return false;
 }
        private void GeneratePointerEvent(PointerEvent pointerEvent)
        {
            PointerArgs args = new PointerArgs(Identifier, pointerEvent, Pose);

            _pointableElement.ProcessPointerEvent(args);
        }