Пример #1
0
        void EventManagerDragSample_Loaded(object sender, RoutedEventArgs e)
        {
            Ab3d.Utilities.VisualEventSource3D eventSource3D;

            _eventManager = new Ab3d.Utilities.EventManager3D(Viewport3D1);

            // Exclude TransparentPlaneVisual3D from hit testing
            _eventManager.RegisterExcludedVisual3D(TransparentPlaneVisual3D);



            //eventSource3D = new Ab3d.Utilities.VisualEventSource3D();
            //eventSource3D.TargetVisual3D = LowerBoxVisual3D;
            //eventSource3D.Name = "Lower";
            //eventSource3D.IsDragSurface = true;

            //eventManager.RegisterEventSource3D(eventSource3D);


            //eventSource3D = new Ab3d.Utilities.VisualEventSource3D();
            //eventSource3D.TargetVisual3D = PassageBoxVisual3D;
            //eventSource3D.Name = "Passage";
            //eventSource3D.IsDragSurface = true;

            //eventManager.RegisterEventSource3D(eventSource3D);


            //eventSource3D = new Ab3d.Utilities.VisualEventSource3D();
            //eventSource3D.TargetVisual3D = UpperBoxVisual3D;
            //eventSource3D.Name = "Upper";
            //eventSource3D.IsDragSurface = true;

            //eventManager.RegisterEventSource3D(eventSource3D);


            Ab3d.Utilities.MultiVisualEventSource3D multiEventSource3D;

            multiEventSource3D = new Ab3d.Utilities.MultiVisualEventSource3D();
            multiEventSource3D.TargetVisuals3D = new Visual3D[] { LowerBoxVisual3D, PassageBoxVisual3D, UpperBoxVisual3D };
            multiEventSource3D.IsDragSurface   = true;

            _eventManager.RegisterEventSource3D(multiEventSource3D);


            eventSource3D = new Ab3d.Utilities.VisualEventSource3D();
            eventSource3D.TargetVisual3D = MovableBoxVisual3D;
            eventSource3D.Name           = "Movable";
            eventSource3D.MouseEnter    += new Ab3d.Common.EventManager3D.Mouse3DEventHandler(eventSource3D_MouseEnter);
            eventSource3D.MouseLeave    += new Ab3d.Common.EventManager3D.Mouse3DEventHandler(eventSource3D_MouseLeave);
            eventSource3D.MouseClick    += new Ab3d.Common.EventManager3D.MouseButton3DEventHandler(movableEventSource3D_MouseClick);
            eventSource3D.MouseDrag     += new Ab3d.Common.EventManager3D.MouseDrag3DEventHandler(movableEventSource3D_MouseDrag);

            _eventManager.RegisterEventSource3D(eventSource3D);
        }
Пример #2
0
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            LoadSelectedScene();

            _eventManager = new Ab3d.Utilities.EventManager3D(MainViewport);

            // Exclude some Visuals from hit testing - without this we would not get MouseUp events
            _eventManager.RegisterExcludedVisual3D(StartLineVisual3D, EndLineVisual3D, DistanceLineVisual3D, TextPlaneVisual3D);

            var eventSource3D = new Ab3d.Utilities.VisualEventSource3D();

            eventSource3D.TargetVisual3D = ContentVisual;
            eventSource3D.MouseMove     += EventSource3DOnMouseMove;
            eventSource3D.MouseUp       += EventSource3DOnMouseUp;

            _eventManager.RegisterEventSource3D(eventSource3D);
        }