public DiagramViewportViewModel( IModelService modelService, IDiagramService diagramService, IDiagramShapeUiFactory diagramShapeUiFactory, double minZoom, double maxZoom, double initialZoom) : base(modelService, diagramService) { MinZoom = minZoom; MaxZoom = maxZoom; _diagramNodeToViewModelMap = new Map <ModelNodeId, DiagramNodeViewModel>(); _diagramConnectorToViewModelMap = new Map <ModelRelationshipId, DiagramConnectorViewModel>(); _diagramShapeUiFactory = diagramShapeUiFactory; _diagramShapeUiFactory.Initialize(modelService, this); ViewportCalculator = new AutoMoveViewportViewModel(modelService, diagramService, minZoom, maxZoom, initialZoom); DiagramNodeViewModels = new ThreadSafeObservableCollection <DiagramNodeViewModel>(); DiagramConnectorViewModels = new ThreadSafeObservableCollection <DiagramConnectorViewModel>(); MiniButtonPanelViewModel = new MiniButtonPanelViewModel(); DiagramNodeDoubleClickedCommand = new DelegateCommand <IDiagramNode>(i => DiagramNodeInvoked?.Invoke(i)); ViewportCalculator.TransformChanged += OnViewportTransformChanged; DiagramService.DiagramChanged += OnDiagramChanged; AddDiagram(diagramService.LatestDiagram); }
private void OnDiagramNodeInvoked(IDiagramNode diagramNode) { DiagramNodeInvoked?.Invoke(diagramNode); }
public DiagramViewportViewModel( [NotNull] IModelEventSource modelEventSource, [NotNull] IDiagramEventSource diagramEventSource, [NotNull] IDiagramShapeUiFactory diagramShapeUiFactory, [NotNull] IDecorationManager <IMiniButton, IDiagramShapeUi> miniButtonManager, double minZoom, double maxZoom, double initialZoom) : base(modelEventSource, diagramEventSource) { MinZoom = minZoom; MaxZoom = maxZoom; _diagramNodeToViewModelMap = new Map <ModelNodeId, DiagramNodeViewModel>(); _diagramConnectorToViewModelMap = new Map <ModelRelationshipId, DiagramConnectorViewModel>(); DiagramShapeUiFactory = diagramShapeUiFactory; MiniButtonPanelViewModel = (MiniButtonPanelViewModel)miniButtonManager; ViewportCalculator = new AutoMoveViewportViewModel(modelEventSource, diagramEventSource, minZoom, maxZoom, initialZoom); DiagramNodeViewModels = new ThreadSafeObservableCollection <DiagramNodeViewModel>(); DiagramConnectorViewModels = new ThreadSafeObservableCollection <DiagramConnectorViewModel>(); DiagramNodeDoubleClickedCommand = new DelegateCommand <IDiagramNode>(i => DiagramNodeInvoked?.Invoke(i)); ViewportCalculator.TransformChanged += OnViewportTransformChanged; DiagramEventSource.DiagramChanged += OnDiagramChanged; AddDiagram(diagramEventSource.LatestDiagram); }