Example #1
0
        private void OnMouseDown3DEventHandler(object s, RoutedEventArgs e)
        {
            var arg = e as MouseDown3DEventArgs;

            if (_isToolEditor)
            {
                return;
            }
            if (arg.HitTestResult == null)
            {
                return;
            }
            if ((arg.OriginalInputEventArgs is MouseButtonEventArgs mbeArg) && (mbeArg.ChangedButton != MouseButton.Left))
            {
                return;
            }

            var selectedModel = arg.HitTestResult.ModelHit as GeometryModel3D;


            if (ProbesController.Active)
            {
                var p  = arg.HitTestResult.PointHit;
                var vm = selectedModel.DataContext as MVMIP.IProbableElement;

                vm?.AddProbePoint(new MVMIP.Point()
                {
                    X = p.X, Y = p.Y, Z = p.Z
                });
            }
            else if ((_selectedModel != null) && !ReferenceEquals(selectedModel, _selectedModel) && (selectedModel.DataContext is MVMIH.IPositionHandle ph))
            {
                _moveEventsHandler = new MoveEventsHandler(ph);
            }
            else if ((_selectedModel != null) && !ReferenceEquals(selectedModel, _selectedModel) && (selectedModel.DataContext is MVMIH.IRotationHandle rh))
            {
                _rotateEventHandler = new RotateEventHandler(rh);
            }
            else
            {
                var updateSelection = true;

                if (_selectedModel != null)
                {
                    updateSelection           = !ReferenceEquals(selectedModel, _selectedModel);
                    _selectedModel.IsSelected = false;
                    _selectedModel            = null;
                }

                if (updateSelection)
                {
                    selectedModel.IsSelected = true;
                    _selectedModel           = selectedModel;
                }
            }
        }
Example #2
0
 private void OnMouseUp3DEventHandler(object s, RoutedEventArgs e)
 {
     _moveEventsHandler  = null;
     _rotateEventHandler = null;
 }