fix(trajectory): refine timeline drag and tooltips
This commit is contained in:
@@ -321,6 +321,13 @@
|
||||
width: 76px;
|
||||
}
|
||||
|
||||
.kindSlot :global([role='tooltip']) {
|
||||
border: 1px solid var(--dsw-alias-border-l2);
|
||||
background: var(--dsw-alias-bg-layer-2);
|
||||
box-shadow: var(--dsw-shadow-lv2);
|
||||
color: var(--dsw-alias-label-primary);
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-left: 4px !important;
|
||||
color: var(--dsw-alias-label-primary);
|
||||
|
||||
@@ -1868,7 +1868,10 @@ export function TrajectoryTable({
|
||||
<span
|
||||
className={css.kindSlot}
|
||||
>
|
||||
<Tooltip label={KIND_LABEL[record.cell.kind]} side="bottom">
|
||||
<Tooltip
|
||||
label={KIND_LABEL[record.cell.kind]}
|
||||
side="right"
|
||||
>
|
||||
<span
|
||||
className={`${css.kindTag} ${
|
||||
record.cell.kind === 'system'
|
||||
|
||||
@@ -70,11 +70,17 @@ function rangeFraction(
|
||||
range: TrajectoryTimeRange,
|
||||
start: number,
|
||||
duration: number,
|
||||
minimum: number,
|
||||
maximum: number,
|
||||
): FractionRange {
|
||||
return orderedRange(
|
||||
clampFraction((range.start - start) / duration),
|
||||
clampFraction((range.end - start) / duration),
|
||||
const bounded = orderedRange(
|
||||
Math.min(maximum, Math.max(minimum, range.start)),
|
||||
Math.min(maximum, Math.max(minimum, range.end)),
|
||||
)
|
||||
return {
|
||||
start: (bounded.start - start) / duration,
|
||||
end: (bounded.end - start) / duration,
|
||||
}
|
||||
}
|
||||
|
||||
function LaneLabels() {
|
||||
@@ -185,10 +191,10 @@ export const TrajectoryTimeline = memo(function TrajectoryTimeline({
|
||||
} as CSSProperties
|
||||
const committed = model === null || range === null
|
||||
? null
|
||||
: rangeFraction(range, domainStart, domainDuration)
|
||||
: rangeFraction(range, domainStart, domainDuration, model.start, model.end)
|
||||
const draftFraction = model === null || draft === null
|
||||
? null
|
||||
: rangeFraction(draft, domainStart, domainDuration)
|
||||
: rangeFraction(draft, domainStart, domainDuration, model.start, model.end)
|
||||
const visibleRange = draftFraction ?? committed
|
||||
const activeRange = draft ?? range
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user