@@ -21,12 +21,17 @@ import {
2121 createAlignmentGuidesStore ,
2222 AlignmentGuidesStore ,
2323} from "@/store/alignmentGuidesStore"
24+ import {
25+ createEdgeGeometryStore ,
26+ EdgeGeometryStore ,
27+ } from "@/store/edgeGeometryStore"
2428import {
2529 DiagramStoreContext ,
2630 MetadataStoreContext ,
2731 PopoverStoreContext ,
2832 AssessmentSelectionStoreContext ,
2933 AlignmentGuidesStoreContext ,
34+ EdgeGeometryStoreContext ,
3035} from "./store/context"
3136import { MessageType , SendBroadcastMessage , YjsSync } from "./sync/yjsSync"
3237import * as Y from "yjs"
@@ -76,6 +81,7 @@ export class ApollonEditor {
7681 private readonly popoverStore : StoreApi < PopoverStore >
7782 private readonly assessmentSelectionStore : StoreApi < AssessmentSelectionStore >
7883 private readonly alignmentGuidesStore : StoreApi < AlignmentGuidesStore >
84+ private readonly edgeGeometryStore : StoreApi < EdgeGeometryStore >
7985 private subscribers : Apollon . Subscribers = { }
8086 constructor ( element : HTMLElement , options ?: Apollon . ApollonOptions ) {
8187 if ( ! ( element instanceof HTMLElement ) ) {
@@ -91,6 +97,7 @@ export class ApollonEditor {
9197 this . popoverStore = createPopoverStore ( )
9298 this . assessmentSelectionStore = createAssessmentSelectionStore ( )
9399 this . alignmentGuidesStore = createAlignmentGuidesStore ( )
100+ this . edgeGeometryStore = createEdgeGeometryStore ( )
94101 this . syncManager = new YjsSync (
95102 this . ydoc ,
96103 this . diagramStore ,
@@ -179,22 +186,26 @@ export class ApollonEditor {
179186 < AlignmentGuidesStoreContext . Provider
180187 value = { this . alignmentGuidesStore }
181188 >
182- < AppWithProvider
183- onReactFlowInit = { this . setReactFlowInstance . bind ( this ) }
184- collaboration = { collaboration }
185- awareness = { {
186- setLocalAwarenessCursor :
187- this . syncManager . setLocalAwarenessCursor ,
188- setLocalAwarenessSelectedElement :
189- this . syncManager . setLocalAwarenessSelectedElement ,
190- subscribeToAwarenessChanges :
191- this . syncManager . subscribeToAwarenessChanges ,
192- subscribeToCollaboratorChanges :
193- this . syncManager . subscribeToCollaboratorChanges ,
194- getLocalAwarenessClientId :
195- this . syncManager . getLocalAwarenessClientId ,
196- } }
197- />
189+ < EdgeGeometryStoreContext . Provider
190+ value = { this . edgeGeometryStore }
191+ >
192+ < AppWithProvider
193+ onReactFlowInit = { this . setReactFlowInstance . bind ( this ) }
194+ collaboration = { collaboration }
195+ awareness = { {
196+ setLocalAwarenessCursor :
197+ this . syncManager . setLocalAwarenessCursor ,
198+ setLocalAwarenessSelectedElement :
199+ this . syncManager . setLocalAwarenessSelectedElement ,
200+ subscribeToAwarenessChanges :
201+ this . syncManager . subscribeToAwarenessChanges ,
202+ subscribeToCollaboratorChanges :
203+ this . syncManager . subscribeToCollaboratorChanges ,
204+ getLocalAwarenessClientId :
205+ this . syncManager . getLocalAwarenessClientId ,
206+ } }
207+ />
208+ </ EdgeGeometryStoreContext . Provider >
198209 </ AlignmentGuidesStoreContext . Provider >
199210 </ AssessmentSelectionStoreContext . Provider >
200211 </ PopoverStoreContext . Provider >
@@ -320,6 +331,7 @@ export class ApollonEditor {
320331 const popoverStore = createPopoverStore ( )
321332 const assessmentSelectionStore = createAssessmentSelectionStore ( )
322333 const alignmentGuidesStore = createAlignmentGuidesStore ( )
334+ const edgeGeometryStore = createEdgeGeometryStore ( )
323335 const diagramId = Math . random ( ) . toString ( 36 ) . substring ( 2 , 15 )
324336
325337 let setReactFlowInstance : ( instance : ReactFlowInstance ) => void = ( ) => { }
@@ -347,11 +359,13 @@ export class ApollonEditor {
347359 < AlignmentGuidesStoreContext . Provider
348360 value = { alignmentGuidesStore }
349361 >
350- < AppWithProvider
351- onReactFlowInit = { setReactFlowInstance }
352- collaboration = { disabledCollaboration }
353- awareness = { noopCollaborationAwareness }
354- />
362+ < EdgeGeometryStoreContext . Provider value = { edgeGeometryStore } >
363+ < AppWithProvider
364+ onReactFlowInit = { setReactFlowInstance }
365+ collaboration = { disabledCollaboration }
366+ awareness = { noopCollaborationAwareness }
367+ />
368+ </ EdgeGeometryStoreContext . Provider >
355369 </ AlignmentGuidesStoreContext . Provider >
356370 </ AssessmentSelectionStoreContext . Provider >
357371 </ PopoverStoreContext . Provider >
0 commit comments