fix mouse cursor

This commit is contained in:
2026-03-02 16:02:32 +01:00
parent abb97d84fb
commit 1cca200eda
2 changed files with 21 additions and 6 deletions

View File

@@ -47,18 +47,31 @@ class DraggableEventPill extends StatelessWidget {
contentWidth: contentWidth,
);
final scope = ZTimelineScope.of(context);
// Wrap pill in a MouseRegion so hovering shows a pointer cursor.
// During an active entry drag, defer to the parent cursor (grabbing).
final cursorPill = ListenableBuilder(
listenable: scope.interaction,
builder: (context, child) => MouseRegion(
cursor: scope.interaction.isDraggingEntry
? MouseCursor.defer
: SystemMouseCursors.click,
child: child,
),
child: pill,
);
if (!enableDrag) {
return Positioned(
top: top,
left: left.clamp(0.0, double.infinity),
width: width.clamp(0.0, double.infinity),
height: laneHeight,
child: pill,
child: cursorPill,
);
}
final scope = ZTimelineScope.of(context);
return Positioned(
top: top,
left: left.clamp(0.0, double.infinity),
@@ -87,7 +100,7 @@ class DraggableEventPill extends StatelessWidget {
),
),
childWhenDragging: Opacity(opacity: 0.3, child: pill),
child: pill,
child: cursorPill,
),
);
}

View File

@@ -221,9 +221,11 @@ class _ZTimelineInteractorState extends State<ZTimelineInteractor> {
listenable: scope.interaction,
builder: (context, child) {
return MouseRegion(
cursor: scope.interaction.isGrabbing
cursor:
scope.interaction.isGrabbing ||
scope.interaction.isDraggingEntry
? SystemMouseCursors.grabbing
: SystemMouseCursors.grab,
: SystemMouseCursors.basic,
child: child,
);
},