fix: refine floating workspace controls
Keep ScaleInfo pinned to the map corner and move the centered timeline above collisions, preventing the previous conditional offset from lifting the scale. Remove collapsed Agent rail width reservation and add timeline state transitions.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { ScheduledConditionItem } from "../types";
|
||||
import {
|
||||
canDockMapScaleBesideTimeline,
|
||||
canCenterTimelineBesideMapScale,
|
||||
clusterOperationalEvents,
|
||||
createOperationalEvents
|
||||
createOperationalEvents,
|
||||
resolveTimelineScaleLayout
|
||||
} from "./operational-timeline-model";
|
||||
|
||||
const workOrder: ScheduledConditionItem = {
|
||||
@@ -44,9 +45,20 @@ describe("operational timeline model", () => {
|
||||
expect(clusters.find((cluster) => cluster.lane === "plan")?.events).toHaveLength(2);
|
||||
});
|
||||
|
||||
it("docks scale info beside a floating timeline only when the business area is wide enough", () => {
|
||||
expect(canDockMapScaleBesideTimeline(2048, "expanded", true)).toBe(true);
|
||||
expect(canDockMapScaleBesideTimeline(1380, "expanded", true)).toBe(false);
|
||||
expect(canDockMapScaleBesideTimeline(1380, "expanded", false)).toBe(true);
|
||||
it("keeps a centered timeline beside scale info only when both side margins are wide enough", () => {
|
||||
expect(canCenterTimelineBesideMapScale(2560, "expanded", true)).toBe(true);
|
||||
expect(canCenterTimelineBesideMapScale(2048, "expanded", true)).toBe(false);
|
||||
expect(canCenterTimelineBesideMapScale(1380, "expanded", false)).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps scale info in the map corner and moves the timeline when horizontal space is tight", () => {
|
||||
expect(resolveTimelineScaleLayout(2560, "expanded", true)).toEqual({
|
||||
scaleBottom: 0,
|
||||
timelineBottom: 24
|
||||
});
|
||||
expect(resolveTimelineScaleLayout(2048, "expanded", true)).toEqual({
|
||||
scaleBottom: 0,
|
||||
timelineBottom: 56
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user