Exemplo n.º 1
0
        void HandleBeginDrag(VrEventArgs args)
        {
            _frameGfx.Visible = false;

            var hitInstruction = args.HitResult as HitResult <RsMoveInstruction>;
            var hitSegment     = args.HitResult as HitResult <PathSegment>;

            if (hitInstruction != null)
            {
                _dragOffset = args.Frame.InverseRigid() * hitInstruction.HitObject.GetToTarget().Transform.GlobalMatrix;
                WithUndo("VR Drag", () => PathEditingHelper.MoveInstructionToFrame(hitInstruction.HitObject, args.Frame * _dragOffset));
                _newHighlightTarget = hitInstruction?.HitObject?.GetToTarget();
            }
            else if (hitSegment != null)
            {
                WithUndo("VR Drag", () => _newInstruction = PathEditingHelper.InsertMoveInstruction(hitSegment.HitObject, args.Frame));
            }
            else if (args.HitResult != null)
            {
                throw new InvalidOperationException("unrecognized HitResult");
            }
            else
            {
                WithUndo("VR Create Instruction", () => _newInstruction = PathEditingHelper.CreateNewInstructionInActivePath(args.Frame));
                _dragOffset        = Matrix4.Identity;
                args.CreatedObject = () => new HitResult <RsMoveInstruction>(_newInstruction, 0, args.Frame.Translation);
            }
        }
Exemplo n.º 2
0
        void HandleDeltaDrag(VrEventArgs args)
        {
            //_frameGfx.Visible = false;

            var hitInstruction = args.HitResult as HitResult <RsMoveInstruction>;
            var hitSegment     = args.HitResult as HitResult <PathSegment>;

            if (hitInstruction != null)
            {
                WithUndoAppend("VR Drag", () => PathEditingHelper.MoveInstructionToFrame(hitInstruction.HitObject, args.Frame * _dragOffset));
                _newHighlightTarget = hitInstruction?.HitObject?.GetToTarget();
                _forceUpdateLine    = true;
            }
            else if (hitSegment != null)
            {
                WithUndoAppend("VR Drag", () => PathEditingHelper.MoveInstructionToFrame(_newInstruction, args.Frame));
            }
            else if (args.HitResult != null)
            {
                throw new InvalidOperationException("unrecognized HitResult");
            }
        }