private ViewportCalculatorViewModel(
            IModelEventSource modelEventSource,
            IDiagramEventSource diagramEventSource,
            double minZoom,
            double maxZoom,
            double initialZoom,
            Size sizeInScreenSpace,
            Point centerInDiagramSpace)
            : base(modelEventSource, diagramEventSource)
        {
            _minZoom = minZoom;
            _maxZoom = maxZoom;
            _defaultExponentialZoom = initialZoom;
            _exponentialZoom        = initialZoom;
            _sizeInScreenSpace      = sizeInScreenSpace;
            _centerInDiagramSpace   = centerInDiagramSpace;
            _diagramContentRect     = diagramEventSource.LatestDiagram.Rect.ToWpf();

            ResizeCommand        = new ResizeDelegateCommand(Resize);
            PanCommand           = new PanDelegateCommand(Pan);
            ZoomToContentCommand = new ZoomToContentDelegateCommand(ZoomToContent);
            ZoomCommand          = new ZoomDelegateCommand(ZoomWithCenterTo);

            UpdateCalculatedProperties(TransitionSpeed.Instant);

            DiagramEventSource.DiagramChanged += OnDiagramChanged;
        }
Exemple #2
0
        private ViewportCalculatorViewModel(IArrangedDiagram diagram, double minZoom, double maxZoom, double initialZoom,
                                            Size sizeInScreenSpace, Point centerInDiagramSpace)
            : base(diagram)
        {
            _minZoom = minZoom;
            _maxZoom = maxZoom;
            _defaultExponentialZoom = initialZoom;
            _exponentialZoom        = initialZoom;
            _sizeInScreenSpace      = sizeInScreenSpace;
            _centerInDiagramSpace   = centerInDiagramSpace;

            ResizeCommand        = new ResizeDelegateCommand(Resize);
            PanCommand           = new PanDelegateCommand(Pan);
            ZoomToContentCommand = new ZoomToContentDelegateCommand(ZoomToContent);
            ZoomCommand          = new ZoomDelegateCommand(ZoomWithCenterTo);

            UpdateCalculatedProperties(TransitionSpeed.Instant);
        }