示例#1
0
        public void OnTransferredTriggerExit(Rigidbody targetRigidbody, GripperType gripperType)
        {
            if (!this.IsGraspable(targetRigidbody))
            {
                return;
            }

            if (gripperType == GripperType.Left)
            {
                this.leftCollidingObjects.Remove(targetRigidbody);
            }
            if (gripperType == GripperType.Right)
            {
                this.rightCollidingObjects.Remove(targetRigidbody);
            }

            if (this.graspedRigidbody != null)
            {
                if (!this.leftCollidingObjects.Contains(this.graspedRigidbody) && !this.rightCollidingObjects.Contains(this.graspedRigidbody))
                {
                    if (this.graspedRigidbody.constraints == RigidbodyConstraints.FreezeAll)
                    {
                        return;
                    }

                    this.Release();
                }
            }
        }
        public void OnTransferredTriggerExit(HandType handType, GripperType gripperType, Rigidbody targetRigidbody)
        {
            if (this.handType != handType)
            {
                return;
            }

            this.OnTransferredTriggerExit(targetRigidbody, gripperType);
        }
示例#3
0
        public void OnTransferredTriggerEnter(Rigidbody targetRigidbody, GripperType gripperType)
        {
            if (!this.IsGraspable(targetRigidbody))
            {
                return;
            }

            if (gripperType == GripperType.Left)
            {
                this.leftCollidingObjects.Add(targetRigidbody);
            }
            if (gripperType == GripperType.Right)
            {
                this.rightCollidingObjects.Add(targetRigidbody);
            }

            if (this.isGripperClosing && this.graspedRigidbody == null && this.leftCollidingObjects.Contains(targetRigidbody) && this.rightCollidingObjects.Contains(targetRigidbody))
            {
                this.Grasp(targetRigidbody);
            }
        }
示例#4
0
 public override void OnMouseDown()
 {
     if (designService.SelectedControl != null)
     {
         var control        = designService.SelectedControl;
         var pointInSection = control.ParentSection.PointInSectionByAbsolutePoint(designService.MousePoint);
         var location       = control.ControlModel.Location;
         isResizing = false;
         if (pointInSection.Y > location.Y && pointInSection.Y < location.Y + gripSize)
         {
             if (pointInSection.X > location.X && location.X + gripSize > pointInSection.X)
             {
                 isResizing  = true;
                 gripperType = GripperType.NW;
             }
             else if (pointInSection.X > location.X + control.ControlModel.Size.Width - gripSize && location.X + control.ControlModel.Size.Width > pointInSection.X)
             {
                 isResizing  = true;
                 gripperType = GripperType.NE;
             }
         }
         else if (pointInSection.Y > location.Y + control.ControlModel.Size.Height - gripSize && pointInSection.Y < location.Y + control.ControlModel.Size.Height)
         {
             if (pointInSection.X > location.X && location.X + gripSize > pointInSection.X)
             {
                 isResizing  = true;
                 gripperType = GripperType.SW;
             }
             else if (pointInSection.X > location.X + control.ControlModel.Size.Width - gripSize && location.X + control.ControlModel.Size.Width > pointInSection.X)
             {
                 isResizing  = true;
                 gripperType = GripperType.SE;
             }
         }
     }
 }
示例#5
0
        public override void OnMouseDown()
        {
            if (designService.SelectedControl != null) {

                var control = designService.SelectedControl;
                double cw = control.ControlModel.Size.Width;
                double ch = control.ControlModel.Size.Height;
                var pointInSection = control.ParentSection.PointInSectionByAbsolutePoint (designService.MousePoint);
                var location = control.ControlModel.Location;
                isResizing = false;
                double gripperSize = 4 / (designService.Zoom > 1.5 ? (designService.Zoom / 2) : 1);

                if (pointInSection.Y > location.Y && pointInSection.Y < location.Y + gripperSize) {
                    if (pointInSection.X > location.X && location.X + gripperSize > pointInSection.X) {
                        isResizing = true;
                        gripperType = GripperType.NW;
                    } else if (pointInSection.X > location.X + cw - gripperSize && location.X + cw > pointInSection.X) {
                        isResizing = true;
                        gripperType = GripperType.NE;
                    }

                } else if (pointInSection.Y > location.Y + ch - gripperSize && pointInSection.Y < location.Y + ch) {
                    if (pointInSection.X > location.X && location.X + gripperSize > pointInSection.X) {
                        isResizing = true;
                        gripperType = GripperType.SW;
                    } else if (pointInSection.X > location.X + cw - gripperSize && location.X + cw > pointInSection.X) {
                        isResizing = true;
                        gripperType = GripperType.SE;
                    }
                }
            }
        }