@@ -74,7 +74,6 @@ class WorkspaceProvider extends StateHandler {
7474
7575 Color _nextObjectColor = Colors .yellow;
7676
77- // NEW: State for drawing a connector
7877 String ? _connectorSourceId;
7978 Alignment ? _connectorSourceAlignment;
8079 Offset ? _connectorDragPosition;
@@ -99,7 +98,6 @@ class WorkspaceProvider extends StateHandler {
9998 TextEditingController get workspaceNameController => _workspaceNameController;
10099 SupabaseService get supabaseService => _supabaseService;
101100
102- // NEW: Getter for temporary connector state for the painter
103101 String ? get connectorSourceId => _connectorSourceId;
104102 Alignment ? get connectorSourceAlignment => _connectorSourceAlignment;
105103 Offset ? get connectorDragPosition => _connectorDragPosition;
@@ -117,7 +115,6 @@ class WorkspaceProvider extends StateHandler {
117115 notifyListeners ();
118116 }
119117
120- // ... (rest of the provider is the same until getIconForObjectType)
121118 void _onQuillContentChanged () {
122119 if (_currentlySelectedObjectId != null &&
123120 _interactionMode == InteractionMode .editingText) {
@@ -296,7 +293,9 @@ class WorkspaceProvider extends StateHandler {
296293 }
297294
298295 void onPanEnd (DragEndDetails details) async {
299- // NEW: Logic for completing a connector
296+ // If we are in hand mode, do nothing.
297+ if (_currentMode == DrawMode .hand) return ;
298+
300299 if (_interactionMode == InteractionMode .drawingConnector &&
301300 _connectorSourceId != null ) {
302301 final target = _findConnectionTarget (_cursorPosition);
@@ -309,7 +308,7 @@ class WorkspaceProvider extends StateHandler {
309308 );
310309 _canvasObjects[newConnector.id] = newConnector;
311310 await _saveCanvasObjectToDb (newConnector.id);
312- syncCanvasObject (_cursorPosition); // Sync the new connector
311+ syncCanvasObject (_cursorPosition);
313312 }
314313 } else if (_currentlySelectedObjectId != null &&
315314 _interactionMode != InteractionMode .editingText) {
@@ -358,7 +357,6 @@ class WorkspaceProvider extends StateHandler {
358357 } else {
359358 final selectedObject = _canvasObjects[id];
360359 if (selectedObject is ConnectorObject ) {
361- // Don't load anything for connectors
362360 _tempQuillController.clear ();
363361 } else if (selectedObject? .textDelta != null ) {
364362 try {
@@ -509,6 +507,7 @@ class WorkspaceProvider extends StateHandler {
509507 );
510508 break ;
511509 case DrawMode .pointer:
510+ case DrawMode .hand: // Do nothing for pointer or hand mode
512511 break ;
513512 }
514513
@@ -527,10 +526,9 @@ class WorkspaceProvider extends StateHandler {
527526 }
528527 }
529528
530- // Helper method to find if a point is over a connection point
531529 Map <String , dynamic >? _findConnectionTarget (Offset point) {
532530 for (final object in _canvasObjects.values) {
533- if (object is ConnectorObject ) continue ; // Cannot connect to a connector
531+ if (object is ConnectorObject ) continue ;
534532
535533 const alignments = [
536534 Alignment .topCenter,
@@ -549,6 +547,11 @@ class WorkspaceProvider extends StateHandler {
549547 }
550548
551549 void onPanDown (DragDownDetails details) {
550+ // If in hand mode, do nothing and let the InteractiveViewer handle panning.
551+ if (_currentMode == DrawMode .hand) {
552+ return ;
553+ }
554+
552555 _cursorPosition = details.globalPosition;
553556 _panStartPoint = details.globalPosition;
554557
@@ -563,7 +566,6 @@ class WorkspaceProvider extends StateHandler {
563566 }
564567
565568 if (_currentMode == DrawMode .pointer) {
566- // NEW: Check for connection point interaction first
567569 final connectionTarget = _findConnectionTarget (details.globalPosition);
568570 if (connectionTarget != null ) {
569571 _interactionMode = InteractionMode .drawingConnector;
@@ -574,7 +576,6 @@ class WorkspaceProvider extends StateHandler {
574576 return ;
575577 }
576578
577- // Check for resize handle interaction
578579 if (_currentlySelectedObjectId != null ) {
579580 final selectedObject = _canvasObjects[_currentlySelectedObjectId! ];
580581 if (selectedObject != null && selectedObject is ! ConnectorObject ) {
@@ -645,9 +646,13 @@ class WorkspaceProvider extends StateHandler {
645646 }
646647
647648 void onPanUpdate (DragUpdateDetails details) {
649+ // If in hand mode, do nothing and let the InteractiveViewer handle panning.
650+ if (_currentMode == DrawMode .hand) {
651+ return ;
652+ }
653+
648654 _cursorPosition = details.globalPosition;
649655
650- // NEW: Update the connector drag position
651656 if (_interactionMode == InteractionMode .drawingConnector) {
652657 _connectorDragPosition = details.globalPosition;
653658 notifyListeners ();
@@ -699,7 +704,7 @@ class WorkspaceProvider extends StateHandler {
699704 break ;
700705 case InteractionMode .none:
701706 case InteractionMode .editingText:
702- case InteractionMode .drawingConnector: // Already handled
707+ case InteractionMode .drawingConnector:
703708 break ;
704709 }
705710
0 commit comments