Skip to content

Commit a8ad99f

Browse files
committed
feat: remove snapping circle functionality to simplify port interaction visuals and theme configuration
1 parent 4c6bf46 commit a8ad99f

File tree

2 files changed

+8
-40
lines changed

2 files changed

+8
-40
lines changed

packages/vyuh_node_flow/lib/src/ports/port_theme.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class PortTheme {
4343
/// - [connectedColor]: Color when the port has active connections
4444
/// - [highlightColor]: Color when port is highlighted during connection drag
4545
/// - [highlightBorderColor]: Border color when port is highlighted
46-
/// - [snappingColor]: Color for the snapping circle shown around port during hover
4746
/// - [borderColor]: Color of the port's border
4847
/// - [borderWidth]: Width of the port's border in logical pixels
4948
/// - [showLabel]: Whether to show port labels globally (default: false)
@@ -57,7 +56,6 @@ class PortTheme {
5756
required this.connectedColor,
5857
required this.highlightColor,
5958
required this.highlightBorderColor,
60-
required this.snappingColor,
6159
required this.borderColor,
6260
required this.borderWidth,
6361
this.shape = MarkerShapes.capsuleHalf,
@@ -96,12 +94,6 @@ class PortTheme {
9694
/// that the port is a valid target.
9795
final Color highlightBorderColor;
9896

99-
/// The color for the snapping circle shown around the port during hover.
100-
///
101-
/// This semi-transparent circle provides visual feedback for the snap area
102-
/// around the port where connections can be made.
103-
final Color snappingColor;
104-
10597
/// The color of the port's border.
10698
///
10799
/// When [borderWidth] is greater than 0, this color is used for the
@@ -173,7 +165,6 @@ class PortTheme {
173165
Color? connectedColor,
174166
Color? highlightColor,
175167
Color? highlightBorderColor,
176-
Color? snappingColor,
177168
Color? borderColor,
178169
double? borderWidth,
179170
MarkerShape? shape,
@@ -188,7 +179,6 @@ class PortTheme {
188179
connectedColor: connectedColor ?? this.connectedColor,
189180
highlightColor: highlightColor ?? this.highlightColor,
190181
highlightBorderColor: highlightBorderColor ?? this.highlightBorderColor,
191-
snappingColor: snappingColor ?? this.snappingColor,
192182
borderColor: borderColor ?? this.borderColor,
193183
borderWidth: borderWidth ?? this.borderWidth,
194184
shape: shape ?? this.shape,
@@ -217,7 +207,6 @@ class PortTheme {
217207
connectedColor: Color(0xFF2196F3),
218208
highlightColor: Color(0xFF42A5F5),
219209
highlightBorderColor: Color(0xFF000000),
220-
snappingColor: Color(0x4042A5F5),
221210
borderColor: Colors.transparent,
222211
borderWidth: 0.0,
223212
showLabel: false,
@@ -247,7 +236,6 @@ class PortTheme {
247236
connectedColor: Color(0xFF64B5F6),
248237
highlightColor: Color(0xFF90CAF9),
249238
highlightBorderColor: Color(0xFFFFFFFF),
250-
snappingColor: Color(0x4090CAF9),
251239
borderColor: Colors.transparent,
252240
borderWidth: 0.0,
253241
showLabel: false,

packages/vyuh_node_flow/lib/src/ports/port_widget.dart

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -337,45 +337,25 @@ class _PortWidgetState<T> extends State<PortWidget<T>> {
337337
builder: (_) {
338338
// Access observables directly inside Observer for MobX tracking
339339
final isHighlighted = widget.port.highlighted.value;
340-
// Use getter which accesses .value internally for MobX reactivity
341-
final isConnecting =
342-
widget.controller.interaction.isCreatingConnection;
343340

344-
// During connection drag: only show snapping circle for valid (highlighted) targets
345-
// When idle: show snapping circle on hover for visual feedback
346-
final showSnappingCircle = isConnecting
347-
? isHighlighted
348-
: _isHovered;
341+
// Port highlights when:
342+
// 1. Hovered over (idle state) - provides interactive feedback
343+
// 2. Valid target during connection drag - isHighlighted set by controller
344+
final showHighlight = _isHovered || isHighlighted;
349345

350-
return UnboundedStack(
346+
return Stack(
351347
clipBehavior: Clip.none,
352348
children: [
353-
// Snapping circle - shows on hover OR when highlighted during connection drag
354-
if (showSnappingCircle)
355-
Positioned(
356-
left: -widget.snapDistance,
357-
top: -widget.snapDistance,
358-
right: -widget.snapDistance,
359-
bottom: -widget.snapDistance,
360-
child: IgnorePointer(
361-
child: DecoratedBox(
362-
decoration: BoxDecoration(
363-
color: widget.theme.snappingColor,
364-
shape: BoxShape.circle,
365-
),
366-
),
367-
),
368-
),
369-
// Marker shape - visual appearance reacts to highlighted state
349+
// Marker shape - visual appearance reacts to hover and highlight state
370350
Positioned.fill(
371351
child: IgnorePointer(
372352
child: PortShapeWidget(
373353
shape: widget.port.shape ?? widget.theme.shape,
374354
position: widget.port.position,
375355
size: effectiveSize,
376-
color: _getPortColorFromHighlight(isHighlighted),
356+
color: _getPortColorFromHighlight(showHighlight),
377357
borderColor: _getBorderColorFromHighlight(
378-
isHighlighted,
358+
showHighlight,
379359
),
380360
borderWidth: _getBorderWidth(),
381361
),

0 commit comments

Comments
 (0)