DiagramEditorContext.withSharedState constructor

DiagramEditorContext.withSharedState(
  1. DiagramEditorContext oldContext, {
  2. required PolicySet policySet,
})

Allows you to create DiagramEditorContext with shared state (eg. canvas position and scale) from another DiagramEditorContext.

Implementation

DiagramEditorContext.withSharedState(
  DiagramEditorContext oldContext, {
  required this.policySet,
})  : _canvasModel = CanvasModel(policySet),
      _canvasState = oldContext.canvasState {
  policySet.initializePolicy(_getReader(), _getWriter());
}