Keep a selected block lifted as its resize lands (#141)

This commit is contained in:
2026-10-09 19:15:54 +02:00
parent 97dbdcad0c
commit 99970b3bb9
@@ -481,6 +481,10 @@ class TimelineDragController {
var settledOnGrid: Boolean by mutableStateOf(false)
private set
/** Whether the settling drop is the selected event, whose block lands still lifted. */
var settlingSelected: Boolean = false
private set
/**
* The abandoned-move counter, read at the drop so the mark can't be a
* composition behind the tick it is compared against.
@@ -579,6 +583,7 @@ class TimelineDragController {
settledOnGrid = false
settledOrigin = null
settledEnd = null
settlingSelected = false
}
/**
@@ -635,6 +640,7 @@ class TimelineDragController {
val clipOffset = clipOffsetMin
cancel()
if (landed == null || landed.slot == origin) return null
settlingSelected = selection?.event?.instanceId == landed.event.instanceId
// An edge piece is a hint for the finger, not a preview of the landing
// slot: the event belongs to a day this timeline has no column for, so
// [noteGrid] can never seat it and it would sit at the top of today for
@@ -697,6 +703,7 @@ class TimelineDragController {
val origin = originSlot
cancel()
if (landed == null || landed.slot == origin) return null
settlingSelected = selection?.event?.instanceId == landed.event.instanceId
settling = if (landed.edgeOnly) landed.copy(pieces = emptyList()) else landed
liftedInstanceId = landed.event.instanceId
settledOrigin = landed.event.eventId to landed.event.start
@@ -804,6 +811,7 @@ class TimelineDragController {
settling = null
settledOnGrid = false
settledEnd = null
settlingSelected = false
handOver()
}
@@ -1026,7 +1034,8 @@ fun TimelineDragOverlay(controller: TimelineDragController, modifier: Modifier =
// Landed: the copy sinks back to the grid's own plane while the write runs.
val landed = controller.drag == null
val lift by animateFloatAsState(
targetValue = if (landed || reduceMotion) 0f else 1f,
// A selected event's block is lifted too: sinking first made it shrink, then grow back.
targetValue = if (reduceMotion || (landed && !controller.settlingSelected)) 0f else 1f,
label = "drag-lift",
)
val copyAlpha by animateFloatAsState(