computeYViewport (src/y-viewport.ts)

platform · packages/gantt/src/y-viewport.ts · typescript · EPL-2.0
ui, tag:embed-classified

Pure TypeScript logic to compute visible rows and padding for virtualized Gantt view.

// Source: https://github.com/hcengineering/platform | License: EPL-2.0 | Modified files must remain under EPL-2.0
// Modifications to this file must remain under EPL-2.0.
// Provided via justclaw.it.com; keep this notice with the code.
//
// Copyright © 2026 Hardcore Engineering Inc.
// SPDX-License-Identifier: EPL-2.0
//

/**
 * Y-Viewport manager for the Gantt sidebar + canvas + arrow
 * layer. Single source of truth: given the outer scroller's `scrollTop` +
 * `viewportHeight` + the flattened row geometry, returns:
 *
 *   - which row indices are visible (with `overscan` rows above + below),
 *   - the total scroll height (so the scroller knows how far it can scroll),
 *   - the `paddingTop` / `paddingBottom` spacer heights for the sidebar to
 *     keep the absolute-positioned visible

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key