API reference
@searsuite/sear-render-coord
Conversions between document, viewport, screen, and host-view coordinates.
4 exportsderived from source
- classCoordinateEnginesource ↗
-
class CoordinateEngine extends Plugin<SearCoreSheet, CellProperties, CoordinateState>Sheet plugin that tracks pointer and scroll coordinates.
CoordinateEngine is the plugin-facing facade over CoordinateTransformer: it caches the latest host pointer position, reads ScrollManager state, and exposes conversions between view and world coordinates.
constructorconstructor CoordinateEngine(scrollManager: ScrollManager, coordinates: CoordinateTransformer): CoordinateEngineConstructs the coordinate engine and subscribes it to scroll updates.
scrollManager: ScrollManagerScroll state manager for the current sheet.
coordinates: CoordinateTransformerShared coordinate transformer.
propertydepth depth: numberCoordinate state is metadata and should render before visible plugins if queried.
propertypluginKeystatic readonly pluginKey: PluginKeyStable plugin key for coordinate state registration.
propertysymbolstatic readonly symbol: symbolDI token for resolving the coordinate engine.
methodapply apply(state: CoordinateState, _transaction: Transaction): CoordinateState | nullKeeps coordinate state unchanged for data transactions.
ReturnsThe unchanged coordinate state.
state: CoordinateStateCurrent coordinate state.
_transaction: Transaction
methodgetCoordinateState getCoordinateState(): CoordinateStateReturns a detached projection of the current input and viewport coordinates.
methodgetCurrentMouseScreen getCurrentMouseScreen(): CoordinatePointReturns the latest pointer position in host-event coordinates.
ReturnsCurrent pointer coordinate as recorded from mouse events.
methodgetCurrentMouseView getCurrentMouseView(): CoordinatePointReturns the latest pointer position in viewport coordinates.
methodgetCurrentMouseWorld getCurrentMouseWorld(): CoordinatePointReturns the latest pointer position in scrolled sheet-world coordinates.
ReturnsCurrent pointer converted through the active scroll transform.
methodgetPluginConfig getPluginConfig(): unknownCoordinateEngine has no plugin-specific configuration.
methodgetVisibleScreenRect getVisibleScreenRect(): PositionRect<unknown>Returns the current host-view viewport rectangle.
ReturnsVisible screen-space rectangle starting at the viewport origin.
methodgetVisibleWorldRect getVisibleWorldRect(): PositionRect<unknown>Returns the currently visible sheet-world rectangle.
ReturnsVisible world-space viewport rectangle.
methodonMouseMove onMouseMove(_searCore: SearCoreSheet, event: EventWithOffsetAndTarget<CellProperties>): voidTracks the latest pointer position from sheet mouse-move events.
_searCore: SearCoreSheetevent: EventWithOffsetAndTarget<CellProperties>Pointer event carrying host-view offsets.
methodregisterState registerState(): { dataEngine: { enabled: boolean }; key: PluginKey; state: CoordinateState }Registers coordinate state under the plugin key.
methodrender render(): Node<CellProperties>[] | nullCoordinateEngine does not render scene nodes directly.
methodscreenToView screenToView(screenX: number, screenY: number): CoordinatePointConverts a host-event point into an unscrolled viewport point.
screenX: numberscreenY: number
methodscreenToWorld screenToWorld(screenX: number, screenY: number): CoordinatePointConverts a host-event point into sheet-world coordinates.
ReturnsPoint in sheet-world coordinates.
screenX: numberHost-event x-coordinate.
screenY: numberHost-event y-coordinate.
methodworldToScreen worldToScreen(worldX: number, worldY: number): CoordinatePointConverts a sheet-world point into host-view coordinates.
ReturnsPoint in host-view coordinates.
worldX: numberSheet-world x-coordinate.
worldY: numberSheet-world y-coordinate.
Inherited members 28
Inherited from Plugin.
- documentState
- interestedIn
- pluginKey
- transactionHistory
- transactionOT
- warnOnDuplicateDepth
- key
- dirtyRect
- enforceRuntimeWriteBoundary
- enforceStateWriteBoundary
- getState
- hasStateWriteBoundary
- lockCommittedState
- onClick
- onDblClick
- onInitialDataCell
- onInitialDataComplete
- onMouseDown
- onMouseUp
- onResize
- onScroll
- onTransactionCommitted
- projectTransaction
- registerConfig
- sealRuntimeMetadata
- sealRuntimeMethods
- sealRuntimeWrites
- setState
- interfaceCoordinatePointsource ↗
-
interface CoordinatePointTwo-dimensional point in the sheet coordinate system returned by this engine.
- interfaceCoordinateStatesource ↗
-
interface CoordinateStateLocal coordinate state tracked by CoordinateEngine.
propertymouseScreenX mouseScreenX: numberLatest pointer x-position in host-event view coordinates.
propertymouseScreenY mouseScreenY: numberLatest pointer y-position in host-event view coordinates.
propertyscrollX scrollX: numberLatest horizontal scroll offset in world coordinates.
propertyscrollY scrollY: numberLatest vertical scroll offset in world coordinates.
- functioncreateDefaultCoordinateStatesource ↗
-
createDefaultCoordinateState(): CoordinateStateCreates the default coordinate plugin state.
ReturnsInitial pointer and scroll coordinates.
No public exports match that search.