Exemple #1
0
        public void Pan_By100()
        {
            Shared.PrepareZoomImage(out Border border, out ScaleTransform scaleTranform, out TranslateTransform translateTransform);

            PanHandler panHandler = new PanHandler(border);

            panHandler.StartPan(new Point(0, 0));
            panHandler.Pan(new Point(100, 100));
            panHandler.EndPan();

            Assert.Equal(1, scaleTranform.ScaleX);
            Assert.Equal(1, scaleTranform.ScaleY);
            Assert.Equal(100, translateTransform.X);
            Assert.Equal(100, translateTransform.Y);
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Viewport3DX" /> class.
        /// </summary>
        public Viewport3DX()
        {
            this.perspectiveCamera = new PerspectiveCamera();
            this.orthographicCamera = new OrthographicCamera();
            this.perspectiveCamera.Reset();
            this.orthographicCamera.Reset();

            this.Camera = this.Orthographic ? (ProjectionCamera)this.orthographicCamera : this.perspectiveCamera;

            //this.Children = new Element3DCollection();

            this.rotateHandler = new RotateHandler(this);
            this.panHandler = new PanHandler(this);
            this.zoomHandler = new ZoomHandler(this);
            this.changeFieldOfViewHandler = new ZoomHandler(this, true);
            this.zoomRectangleHandler = new ZoomRectangleHandler(this);

            this.CommandBindings.Add(new CommandBinding(ViewportCommands.ZoomExtents, this.ZoomExtentsHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.SetTarget, this.SetTargetHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.Reset, this.ResetHandler));

            this.CommandBindings.Add(new CommandBinding(ViewportCommands.Zoom, this.zoomHandler.Execute));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.Pan, this.panHandler.Execute));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.Rotate, this.rotateHandler.Execute));
            this.CommandBindings.Add(
                new CommandBinding(ViewportCommands.ChangeFieldOfView, this.changeFieldOfViewHandler.Execute));
            this.CommandBindings.Add(
                new CommandBinding(ViewportCommands.ZoomRectangle, this.zoomRectangleHandler.Execute));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.BottomView, this.BottomViewHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.TopView, this.TopViewHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.FrontView, this.FrontViewHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.BackView, this.BackViewHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.LeftView, this.LeftViewHandler));
            this.CommandBindings.Add(new CommandBinding(ViewportCommands.RightView, this.RightViewHandler));

            this.SetDefaultGestures();

            this.fpsWatch.Start();

            this.renderingEventListener = new RenderingEventListener(this.OnCompositionTargetRendering);

            this.Loaded += this.ControlLoaded;
            this.Unloaded += this.ControlUnloaded;
        }
Exemple #3
0
 public InteractiveCanvasView()
 {
     panHandler       = new PanHandler(this);
     dragHandler      = new DragHandler(this);
     selectionHandler = new RectangleSelectionHandler(this);
 }