Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/lib/NodeArrayProperty.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,23 @@
min-width: 24px;
cursor: pointer;
}

/* Reserve room at the scroll edges so the browser's caret-follow scroll
(when typing at the end of an overflowing node) can't pin the caret
flush against the array's clip edge. Without this padding, scrollLeft
stops just short of `scrollWidth - clientWidth - EDGE_TOLERANCE_PX`,
leaving `edge_map.last` false; the trailing gap never gains
`.positioned`, and the user sees the caret at the edge with no gap to
click. The default is 2 × edge-gap (≈ enough for the gap plus a
click margin); override per-array via the custom properties. */
:global([data-type="node_array"]) {
scroll-padding-inline: var(
--node-caret-scroll-padding-inline,
calc(var(--node-caret-edge-gap, 24px) * 2)
);
scroll-padding-block: var(
--node-caret-scroll-padding-block,
calc(var(--node-caret-edge-gap, 24px) * 2)
);
}
</style>
12 changes: 8 additions & 4 deletions src/lib/NodeGapMarkers.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@
if (sorted[0] === 0 && edge_state?.first === true) {
add_offset(0);
}
// Mid gaps: between consecutive visible nodes. The gap at offset N
// sits between node N-1 and node N — emit when both are visible.
for (let i = 0; i < sorted.length - 1; i++) {
if (sorted[i + 1] === sorted[i] + 1) add_offset(sorted[i + 1]);
// Mid gaps: anchor to the previous node. Emit a marker whenever the
// prev flank is visible, even if next falls outside the overscan —
// mirrors the NodeGap gate in node_visibility.svelte.js. Wrap/grid
// layouts whose row height exceeds the overscan (e.g. tetris with
// tall cells) would otherwise lose every between-row marker even
// while the user can see and click the underlying NodeGap.
for (const i of sorted) {
if (i + 1 > 0 && i + 1 < count) add_offset(i + 1);
}
// Edge gap-after.last: same gate as gap-before but on the trailing edge.
if (sorted[sorted.length - 1] === count - 1 && edge_state?.last === true) {
Expand Down
Loading