The pictogram a seat carries: wheelchair wins over companion. Null for other seats.
function accessibleGlyphKind(
seat: Pick<Seat, "accessibility">,
): AccessibleGlyphKind | null;@openseat/renderer-konva/src/glyphs.ts
Canvas renderer, layoutToSvg · Browser (SVG: Node too)
Konva canvas renderer for OpenSeat layouts: drawing, hit testing, pan/zoom, selection and transforms.
Draws OpenSeat layouts on a Konva canvas, with pan and zoom, hit testing, selection outlines, drag-to-move, rotate/resize handles, box selection, touch and pinch, and viewport culling. Framework-independent; @openseat/react wraps it.
npm i @openseat/renderer-konva konvaInstall commands show the public npm names. The first npm release is pending; the packages are free and MIT licensed.
depends on @openseat/core, @openseat/theme-default · peers konva
import {
layoutToSvg,
SeatMapRenderer,
SeatMapViewRenderer,
fitBounds,
GestureTracker,
} from "@openseat/renderer-konva";The pictogram a seat carries: wheelchair wins over companion. Null for other seats.
function accessibleGlyphKind(
seat: Pick<Seat, "accessibility">,
): AccessibleGlyphKind | null;@openseat/renderer-konva/src/glyphs.ts
Maps a layout point through a selection transform (same matrix as core's transformObjects).
function applyToPoint(t: SelectionTransform, p: Point): Point;@openseat/renderer-konva/src/group-transform.ts
Start and end points of an arc marking, for drawing it as an SVG path.
| Parameter | Type | Description |
|---|---|---|
shape | { readonly centre: Point; readonly radius: number; readonly startAngle: number; readonly endAngle: number; } |
@openseat/renderer-konva/src/markings.ts
The colour a section's or GA area's fill is drawn in, as a colour and an opacity: the tint (style or category colour) at AREA_TINT_ALPHA, or at full strength in "solid" mode; the theme fill when there is no tint.
function areaFill(
tint: string | undefined,
themeFill: string,
mode?: AreaFillMode,
): { readonly colour: string; readonly opacity: number };| Parameter | Type | Description |
|---|---|---|
tint | string | undefined | |
themeFill | string | |
modeoptional | AreaFillMode | Default |
{ readonly colour: string; readonly opacity: number; }@openseat/renderer-konva/src/nodes.ts
Where an area's label sits, in its local space: the pole of inaccessibility of the boundary (the interior point furthest from the edges, so labels stay inside concave shapes), plus a section's labelOffset.
@openseat/renderer-konva/src/nodes.ts
Paint of a GA area, booth or table in a visual state. Available keeps base; selected and held keep the fill and take the state's colour as a thicker outline; booked is greyed ("Sold out"); blocked is greyed and hatched ("Not for sale"). Greyed labels keep AA contrast.
function areaStatePaint(
base: AreaStyle,
state: SeatVisualState | undefined,
theme: Theme,
): AreaStatePaint;@openseat/renderer-konva/src/glyphs.ts
Bounds used for indexing. Rows have no shape of their own, but their labels still need culling: with seatsOf the bounds cover the labels at both ends (null when the row shows none); without it, a label left of row.position.
function boundsFor(
obj: LayoutObject,
seatsOf?: (row: Row) => readonly Seat[],
layout?: LayoutDocument | null,
): Bounds | null;| Parameter | Type | Description |
|---|---|---|
obj | LayoutObject | |
seatsOfoptional | (row: Row) => readonly Seat[] | |
layoutoptional | LayoutDocument | null |
Bounds | null@openseat/renderer-konva/src/scene.ts
Light tint and stronger stroke of a category (or style) colour, for GA areas and booths. The label is a dark shade of the colour when that keeps AA contrast (4.5:1) on the tint, else the theme's label colour.
function categoryPaint(colour: string, theme: Theme): CategoryPaint;@openseat/renderer-konva/src/glyphs.ts
function clampScale(scale: number, limits?: ZoomLimits): number;| Parameter | Type | Description |
|---|---|---|
scale | number | |
limitsoptional | ZoomLimits | Default |
number@openseat/renderer-konva/src/viewport.ts
The selection transform that takes the proxy from initialRect to finalAttrs (Konva's attributes after the user dragged the transformer): pivot = initial centre, translate = new centre - pivot, rotation and scale relative to the initial rect.
function computeGroupTransform(
initialRect: ProxyRect,
finalAttrs: ProxyRect,
): SelectionTransform;@openseat/renderer-konva/src/group-transform.ts
Margin around a fitted layout: 32 px, or 4% of a small container's shorter side (at least 10 px).
function defaultFitPadding(size: {
readonly width: number;
readonly height: number;
}): number;| Parameter | Type | Description |
|---|---|---|
size | { readonly width: number; readonly height: number; } |
number@openseat/renderer-konva/src/renderer.ts
Default hit rules. View mode: seats, zones (GA areas and sections shown as zones, showSeats: false, sold by quantity) and booths with an inventory key. Edit mode: everything but rows. The rows, seats and tables inside a zone section are never hit (the scene suppresses them).
function defaultIsHittable(
obj: LayoutObject,
mode: RendererMode,
): boolean;@openseat/renderer-konva/src/renderer.ts
The pieces of a divider (a path with a caption) that are drawn, in its local space: the polyline with the stretch under the caption cut out, so the line stops on both sides of the text. gap is the length cut out, centred caption.distance along the path. A closed path is walked back to its first point.
function dividerPieces(
path: Pick<CustomPath, "points" | "closed">,
caption: PathCaptionPlacement,
gap: number,
): Point[][];| Parameter | Type | Description |
|---|---|---|
path | Pick<CustomPath, "points" | "closed"> | |
caption | PathCaptionPlacement | |
gap | number |
Point[][]@openseat/renderer-konva/src/shapes.ts
The row labels that are drawn: core resolveRowLabelPlacements (each label pushed outward along the row until it clears every drawn seat in the layout), without the ones that could not be cleared. Without a layout (a preview of objects not added yet) the plain placements are used.
function drawnRowLabels(
layout: LayoutDocument | null | undefined,
row: Row,
seats: readonly Seat[],
): readonly (RowLabelPlacement & {
readonly fontSize: number;
readonly box?: Bounds;
})[];| Parameter | Type | Description |
|---|---|---|
layout | LayoutDocument | null | undefined | |
row | Row | |
seats | readonly Seat[] |
readonly (RowLabelPlacement & { readonly fontSize: number; readonly box?: Bounds; })[]@openseat/renderer-konva/src/scene.ts
Edge auto-pan: the pan step (screen pixels per frame, ready for panBy) while a drag holds the pointer within margin pixels of the container edge. Zero when the pointer is further in. The step grows linearly to maxStep at the edge (and beyond it), and moves the content so that more of the side the pointer is near comes into view.
| Parameter | Type | Description |
|---|---|---|
point | Point | |
size | Size | |
marginoptional | number | Default |
maxStepoptional | number | Default |
@openseat/renderer-konva/src/viewport.ts
IDs of objects hidden themselves or through an ancestor. Cheap when nothing is hidden, which is the common case for large booking maps.
function effectivelyHidden(layout: LayoutDocument): Set<string>;@openseat/renderer-konva/src/scene.ts
Escapes text for use in SVG element content and attribute values. Code points that XML cannot represent at all are removed, so a stray control character in a label never makes the document unparseable.
function escapeXml(text: string): string;| Parameter | Type | Description |
|---|---|---|
text | string |
string@openseat/renderer-konva/src/svg-export.ts
The markings of a rink, court or pitch, scaled to the stage's width and height. The long side is the length of the field, so a stage taller than it is wide gets a vertical field. Pure: the canvas and SVG renderers both draw exactly these shapes. Empty without (or with unknown) markings.
function fieldMarkingShapes(stage: {
readonly width: number;
readonly height: number;
readonly markings?: string;
}): FieldMarkingShape[];| Parameter | Type | Description |
|---|---|---|
stage | { readonly width: number; readonly height: number; readonly markings?: string; } |
@openseat/renderer-konva/src/markings.ts
Viewport that fits bounds inside size with padding screen pixels on every side, centred.
function fitBounds(
bounds: Bounds,
size: Size,
padding?: number,
limits?: ZoomLimits,
): Viewport;| Parameter | Type | Description |
|---|---|---|
bounds | Bounds | |
size | Size | |
paddingoptional | number | Default |
limitsoptional | ZoomLimits | Default |
@openseat/renderer-konva/src/viewport.ts
Paint of a GA area, drawn as a zone (see zonePaintOf): its style or category colour as the tier tint, mixed toward white as an opaque pastel fill with a tier-colour border and a dark label of at least 4.5:1 contrast. Booked is the sold-out paint (light grey, grey text); blocked (Not for sale) is the same with a hatch. areaFillMode no longer changes zones: their fill is opaque in both modes.
function gaPaint(
obj: Extract<LayoutObject, { type: "ga" }>,
theme: Theme,
categoryColour: string | undefined,
options?: Pick<NodeOptions, "areaFillMode" | "areaState">,
): GaPaint;| Parameter | Type | Description |
|---|---|---|
obj | Extract<LayoutObject, { type: "ga"; }> | |
theme | Theme | |
categoryColour | string | undefined | |
optionsoptional | Pick<NodeOptions, "areaFillMode" | "areaState"> | Default |
@openseat/renderer-konva/src/nodes.ts
Path data of a pictogram.
function glyphPath(kind: AccessibleGlyphKind): string;@openseat/renderer-konva/src/glyphs.ts
Scale from path units to layout units that fits a pictogram inside a seat of radius radius. compact halves it (seat labels are shown, and the pictogram moves below the number).
function glyphScale(
kind: AccessibleGlyphKind,
radius: number,
compact?: boolean,
): number;| Parameter | Type | Description |
|---|---|---|
kind | AccessibleGlyphKind | |
radius | number | |
compactoptional | boolean | Default |
number@openseat/renderer-konva/src/glyphs.ts
Grid line spacing in layout units for a grid of size at scale: the grid size, doubled until lines are at least minPx screen pixels apart, so a zoomed-out grid never turns into a solid fill.
function gridStep(
size: number,
scale: number,
minPx?: number,
): number;| Parameter | Type | Description |
|---|---|---|
size | number | |
scale | number | |
minPxoptional | number | Default |
number@openseat/renderer-konva/src/viewport.ts
The tooltip for a handle hit, or null for no hit.
function handleHint(hit: HandleHit | null): string | null;@openseat/renderer-konva/src/handles.ts
Diagonal hatch lines (running from lower left to upper right) clipped to an outline, as segments in its local space. Computed geometrically rather than with a clip path, so the SVG export needs no <clipPath> references.
function hatchSegments(
outline: HatchOutline,
): { readonly a: Point; readonly b: Point }[];@openseat/renderer-konva/src/glyphs.ts
Spacing of hatch lines for an outline whose shorter side is size: about six lines across, at least 4 units apart.
function hatchSpacing(size: number): number;| Parameter | Type | Description |
|---|---|---|
size | number |
number@openseat/renderer-konva/src/glyphs.ts
Stroke width of the hatch lines drawn over an outline.
function hatchStrokeWidth(outline: HatchOutline): number;@openseat/renderer-konva/src/glyphs.ts
Stroke width of hatch lines at a given spacing.
function hatchWidth(spacing: number): number;| Parameter | Type | Description |
|---|---|---|
spacing | number |
number@openseat/renderer-konva/src/glyphs.ts
The row handle under point, within radius layout units.
@openseat/renderer-konva/src/handles.ts
The vertex or midpoint handle under point (vertices win), within radius layout units.
function hitVertexHandles(
handles: VertexHandles,
point: Point,
radius: number,
): HandleHit | null;@openseat/renderer-konva/src/handles.ts
The inventory key of an object sold as a unit, which seat state maps (and booking statuses) use for it: a GA area's or booth's inventoryId, the object ID of a table booked as a whole, or the ID of a section shown as a zone (showSeats: false). Undefined for everything else.
function inventoryKeyOf(obj: LayoutObject): string | undefined;@openseat/renderer-konva/src/glyphs.ts
True for a seat flagged wheelchair or companion.
function isAccessibleSeat(obj: LayoutObject): boolean;@openseat/renderer-konva/src/glyphs.ts
Whether a click adds to the selection: Shift or Cmd (meta) anywhere, Ctrl everywhere but macOS, where Ctrl+click opens the context menu instead.
function isAdditiveClick(
evt: {
readonly shiftKey: boolean;
readonly ctrlKey: boolean;
readonly metaKey: boolean;
},
isMac: boolean,
): boolean;| Parameter | Type | Description |
|---|---|---|
evt | { readonly shiftKey: boolean; readonly ctrlKey: boolean; readonly metaKey: boolean; } | |
isMac | boolean |
boolean@openseat/renderer-konva/src/renderer.ts
True on macOS, where Ctrl+click is a secondary (context menu) click rather than an additive one.
function isMacPlatform(): boolean;boolean@openseat/renderer-konva/src/renderer.ts
True when a seat carries the "marked" tag.
function isMarkedSeat(obj: LayoutObject): boolean;@openseat/renderer-konva/src/nodes.ts
True when keyboard input is going to a text field, so canvas shortcuts (Space to pan, for example) must not react.
function isTypingTarget(target: EventTarget | null): boolean;| Parameter | Type | Description |
|---|---|---|
target | EventTarget | null |
boolean@openseat/renderer-konva/src/gestures.ts
True for an object drawn as a zone: a GA area, or a section shown as a zone (showSeats: false).
function isZoneObject(obj: LayoutObject): obj is GaArea | Section;@openseat/renderer-konva/src/shapes.ts
Dark or light label text, whichever contrasts more with fill.
function labelColourOn(fill: string, dark: string): string;| Parameter | Type | Description |
|---|---|---|
fill | string | |
dark | string |
string@openseat/renderer-konva/src/nodes.ts
Konva fontStyle for a label's bold and italic flags.
function labelFontStyle(
style: { readonly bold?: boolean; readonly italic?: boolean } | undefined,
): string;| Parameter | Type | Description |
|---|---|---|
style | { readonly bold?: boolean; readonly italic?: boolean; } | undefined |
string@openseat/renderer-konva/src/nodes.ts
function layerFor(obj: LayoutObject): LayerName;@openseat/renderer-konva/src/nodes.ts
Renders a layout as a standalone SVG document: venue, areas, zones, stages, booths, tables, seats (coloured by category or seat state, with the wheelchair pictogram or companion mark on accessible seats), labels, dividers, row labels and section titles. Text goes where the canvas puts it at the "detail" level (core label layout): section titles in a header band clear of the seats, row labels pushed off seats, zone sections labelled inside. Deterministic for a given input, with all text XML-escaped. The viewBox is the content bounds (venue and titles included) plus padding. Hidden objects are skipped, and so is everything inside a hidden row, table or section and the contents of zone sections (showSeats: false), which draw as one zone; sections with outline "none" draw only their title, as in view mode.
function layoutToSvg(
layout: LayoutDocument,
opts?: SvgExportOptions,
): string;| Parameter | Type | Description |
|---|---|---|
layout | LayoutDocument | |
optsoptional | SvgExportOptions | Default |
stringimport { writeFileSync } from "node:fs";
import { buildTemplate } from "@openseat/core/templates";
import { layoutToSvg } from "@openseat/renderer-konva"; // not @openseat/core
const { layout } = buildTemplate("performance.auditorium.annual-day", null, { name: "Annual Day 2026" });
writeFileSync("annual-day.svg", layoutToSvg(layout)); // standalone, deterministic, no canvas or DOM@openseat/renderer-konva/src/svg-export.ts
Stroke colour of a field marking: the theme's rink red or blue, or a line that contrasts with the stage fill.
function markingColour(
colour: MarkingColour,
theme: Theme,
stageFill: string,
): string;@openseat/renderer-konva/src/nodes.ts
Member kind for an object's main node.
function memberKindFor(obj: LayoutObject): MemberKind;@openseat/renderer-konva/src/group-transform.ts
The shorter side of an outline's box, which sets its hatch spacing.
function outlineShorterSide(outline: HatchOutline): number;@openseat/renderer-konva/src/glyphs.ts
@openseat/renderer-konva/src/viewport.ts
Transformer rotation snapping: every 15 degrees by default (0, 15 … 345, within 7.5 degrees, so every angle snaps), right angles with Shift (within 10 degrees), and free rotation with Alt.
function rotationSnapsFor(modifiers: {
readonly shift: boolean;
readonly alt: boolean;
}): { readonly snaps: number[]; readonly tolerance: number };| Parameter | Type | Description |
|---|---|---|
modifiers | { readonly shift: boolean; readonly alt: boolean; } |
{ readonly snaps: number[]; readonly tolerance: number; }@openseat/renderer-konva/src/group-transform.ts
SVG path data of a closed polygon with its corners rounded by radius (core roundedPolygonPath: each corner clamped to half of its edges). Arcs are SVG A commands, so Konva and SVG draw true arcs.
function roundedPathData(
points: readonly Point[],
radius: number,
): string;@openseat/renderer-konva/src/shapes.ts
Seats to add (positive) or remove (negative) at a handle's end for a pointer at pointer: the pointer projected onto the end tangent, in whole seat spacings. Never removes more than seatCount - 1 seats.
number@openseat/renderer-konva/src/handles.ts
The two "+" handles of a row, beyond its first and last seat. Empty for a row without seats.
@openseat/renderer-konva/src/handles.ts
Deprecated. Use rowLabelPlacementsFor, which handles both ends, curved and vertical rows. Without seats this falls back to a point left of row.position.
Where a row's start label is anchored.
@openseat/renderer-konva/src/scene.ts
Layout-space box of a row label drawn at placement.
function rowLabelBounds(
text: string,
placement: RowLabelPlacement,
): Bounds | null;@openseat/renderer-konva/src/scene.ts
Where a row's labels would go before they are pushed clear of seats: before the first seat and/or after the last one along the row's tangent, following row.labelPosition. seats are the row's seats in row order.
The renderer and the SVG export draw core resolveRowLabelPlacements instead (see drawnRowLabels), which moves a label off any seat it would cover and leaves out one that cannot be cleared.
function rowLabelPlacementsFor(
row: Row,
seats: readonly Seat[],
): RowLabelPlacement[];@openseat/renderer-konva/src/scene.ts
Slot spacing used to turn a handle drag into a seat count: the layout's, else the first gap.
@openseat/renderer-konva/src/handles.ts
@openseat/renderer-konva/src/viewport.ts
Viewport that scrolls the minimum distance needed to bring bounds fully on screen (with padding), without changing zoom. Used for keyboard focus.
@openseat/renderer-konva/src/viewport.ts
A seat's radius: a circle's radius, or half the shorter side of a rectangle.
function seatRadius(seat: Pick<Seat, "shape">): number;@openseat/renderer-konva/src/glyphs.ts
Colour of a section's label: the theme colour, or (over a solid fill) dark or white text, whichever reads better on the fill.
function sectionLabelColour(
theme: Theme,
solidFill?: string,
): string;@openseat/renderer-konva/src/nodes.ts
The size a section label is drawn at: its labelSize (default 16), but no more than 0.45 × the shorter side of the outline's box in section space, so a label fits inside a small section. Never shrunk below 8.
function sectionLabelFontSize(
section: Pick<Section, "boundary" | "labelSize">,
): number;@openseat/renderer-konva/src/scene.ts
Corner radius a stage is drawn with: its own cornerRadius, else theme.stage.cornerRadiusFraction × its shorter side (rect and thrust stages; round stages are not rounded further).
@openseat/renderer-konva/src/shapes.ts
The text a stage shows: its label, upper-cased when the theme says so.
function stageLabelText(label: string, theme: Theme): string;@openseat/renderer-konva/src/nodes.ts
Paint of a stage: its own style where set, the theme's stage colours otherwise (a soft light grey with a thin border and a muted label). A stage with its own fill (a sports field, a dark stage) keeps it, with dark or white label text, whichever reads better on it.
@openseat/renderer-konva/src/nodes.ts
SVG path data of a stage's outline in its local space (core stageOutline): a rounded rect, a thrust (T) with a runway toward the audience, an ellipse, or a semicircle. Corners are rounded by stageCornerRadius.
@openseat/renderer-konva/src/shapes.ts
IDs of objects that are not drawn and cannot be hit: hidden ones (effectivelyHidden) plus the rows, tables and seats of sections shown as zones (showSeats: false), whatever the mode. A zone section is drawn as one zone instead; its contents stay in the document.
function suppressedObjects(layout: LayoutDocument): Set<string>;@openseat/renderer-konva/src/scene.ts
Where a member node goes for a selection transform, from its pose when the transform started. For "scaled" nodes the node is stretched by how much the map stretches its own axes, and turned to follow its local +x axis.
function transformNodePose(
pose: NodePose,
kind: MemberKind,
t: SelectionTransform,
): NodePose;@openseat/renderer-konva/src/group-transform.ts
True when a seat of radius layout units, drawn at pixelsPerUnit, gets the ring instead of the pictogram.
function usesAccessibleRing(
radius: number,
pixelsPerUnit: number,
): boolean;| Parameter | Type | Description |
|---|---|---|
radius | number | |
pixelsPerUnit | number |
boolean@openseat/renderer-konva/src/glyphs.ts
Layout-space bounds of a venue outline.
@openseat/renderer-konva/src/scene.ts
The venue outline plus its name when shown.
@openseat/renderer-konva/src/scene.ts
Layout-space box of a venue's name, or null when it is not shown.
@openseat/renderer-konva/src/scene.ts
Where a venue's name is drawn: centred above the outline's top edge, its baseline about half a font size above it. at is the centre of the text.
| Parameter | Type | Description |
|---|---|---|
venue | Venue |
{ readonly at: Point; readonly fontSize: number; }@openseat/renderer-konva/src/scene.ts
Vertex handles of an object with an editable outline (section, GA area, polygon, aisle, path), or null.
function vertexHandlesFor(obj: LayoutObject): VertexHandles | null;@openseat/renderer-konva/src/handles.ts
Layout-space rectangle visible on screen, grown by margin screen pixels so edges do not pop in.
@openseat/renderer-konva/src/viewport.ts
Decides what a wheel event does:
function wheelAction(e: WheelInput, mode: WheelMode): WheelAction;@openseat/renderer-konva/src/gestures.ts
#rrggbb (or #rgb) colour with an alpha channel, as rgba(...). Other formats are returned unchanged.
function withAlpha(colour: string, alpha: number): string;| Parameter | Type | Description |
|---|---|---|
colour | string | |
alpha | number |
string@openseat/renderer-konva/src/nodes.ts
@openseat/renderer-konva/src/viewport.ts
Corner radius a zone is drawn with: its own cornerRadius, else the theme fallback for zone sections (GA areas: none).
@openseat/renderer-konva/src/shapes.ts
Paint of a zone (a GA area, or a section shown as a zone) in a visual state: its style or category colour as the tier tint (else the theme's GA or section outline colour) through zoneStatePaint. An available zone keeps its own style.stroke.
function zonePaintOf(
zone: GaArea | Section,
theme: Theme,
categoryColour: string | undefined,
state?: SeatVisualState,
): AreaStatePaint;| Parameter | Type | Description |
|---|---|---|
zone | GaArea | Section | |
theme | Theme | |
categoryColour | string | undefined | |
stateoptional | SeatVisualState |
@openseat/renderer-konva/src/nodes.ts
SVG path data of a zone's outline in its local space, its corners rounded by zoneCornerRadius.
@openseat/renderer-konva/src/shapes.ts
Paint of a zone (a GA area or a section shown as a zone) in tier colour tint and a visual state. Available: the theme's zonePaint (pastel fill, tier-colour border, dark label). Selected and held keep it with the state's colour as a thicker outline. Booked is the theme's sold-out paint (light grey, grey text, no tint); blocked is the same plus the not-for-sale hatch.
function zoneStatePaint(
tint: string,
state: SeatVisualState | undefined,
theme: Theme,
): AreaStatePaint;@openseat/renderer-konva/src/glyphs.ts
Zooms by factor while keeping the layout point under screenPoint fixed, so zooming follows the cursor or pinch centre.
function zoomAt(
vp: Viewport,
screenPoint: Point,
factor: number,
limits?: ZoomLimits,
): Viewport;| Parameter | Type | Description |
|---|---|---|
vp | Viewport | |
screenPoint | Point | |
factor | number | |
limitsoptional | ZoomLimits | Default |
@openseat/renderer-konva/src/viewport.ts
Turns raw pointer down/move/up into taps, drags and two-finger pinches.
DOM-free so it can be tested directly: the renderer feeds it pointer events and reacts to what it returns. Rules:
class GestureTracker| Member | Type | Description |
|---|---|---|
constructorconstructor | (options?: GestureOptions) | |
isActivegetter | boolean | |
isDragginggetter | boolean | |
downmethod | (id: number, point: Point, info: PointerInfo) => GestureEvent[] | |
movemethod | (id: number, point: Point) => GestureEvent[] | |
upmethod | (id: number, point: Point) => GestureEvent[] | |
cancelmethod | (id: number) => GestureEvent[] | Pointer lost (pointercancel, window blur). Cancels any drag without a tap. |
abortmethod | () => GestureEvent[] | Abandons the current gesture (for example on Escape). A drag reports |
Every member is readonly.
@openseat/renderer-konva/src/gestures.ts
Renderer-independent model of what is drawn: object lookup, paint order, bounds, and a spatial index for culling and hit testing.
Updates are diffed by object reference, so hosts must update layouts immutably (replace an object to change it). That is what makes re-rendering a 2,000-seat layout after moving one seat cost one node, not 2,000.
class Scene| Member | Type | Description |
|---|---|---|
ghostHiddenSeats | boolean | In the designer, a seat hidden on its own is still drawn (faintly) and can be clicked, so it can be shown again; seats of a hidden row, table or section stay hidden with it. Off for buyers. |
constructorconstructor | (cellSize?: number) | |
layoutgetter | LayoutDocument | null | |
drawOrdergetter | readonly string[] | |
objectsByIdgetter | ReadonlyMap<string, LayoutObject> | |
setLayoutmethod | (layout: LayoutDocument) => SceneDiff | |
resetmethod | () => void | Forgets everything, so the next |
refreshHiddenmethod | () => boolean | Recomputes the hidden and ghost sets from the current layout (after |
isHiddenmethod | (id: string) => boolean | True when the object or an ancestor (its row, table or section) is hidden, or it is inside a section shown as a zone: it is not drawn and cannot be hit. |
isGhostmethod | (id: string) => boolean | True for a seat hidden on its own that the designer draws faintly (see |
isLockedmethod | (id: string) => boolean | True when the object or an ancestor (its row, table or section) is locked. |
getmethod | (id: string) => LayoutObject | undefined | |
rankmethod | (id: string) => number | |
boundsOfmethod | (id: string) => Bounds | undefined | |
objectIdForSeatmethod | (seatId: string) => string | undefined | Seat object ID for a public seat ID. |
objectIdForInventorymethod | (key: string) => string | undefined | Object ID of a GA area, booth or whole-booked table for its inventory key ( |
categoryColourmethod | (categoryId: string | undefined) => string | undefined | |
querymethod | (area: Bounds) => string[] | IDs whose bounds intersect |
hitTestmethod | (point: Point, tolerance?: number, filter?: (obj: LayoutObject) => boolean) => string | null | Topmost object containing |
queryContainedmethod | (area: Bounds, filter?: (obj: LayoutObject) => boolean) => string[] | Objects whose bounds lie entirely inside |
rowSeatsmethod | (row: Row) => Seat[] | A row's seats in row order (missing or non-seat members skipped). |
contentBoundsmethod | () => Bounds | null | Union of all object bounds, the venue outline and the section titles (which may sit in a header band outside their section), or null for an empty layout. |
@openseat/renderer-konva/src/scene.ts
The seat map renderer: draws a layout on a Konva canvas, in view mode (a booking map) or edit mode (the designer, with resize and rotate handles).
It lives in its own module, apart from SeatMapViewRenderer, so a page that only shows a map (a booking page, through BookingMap) never imports Konva's Transformer.
class SeatMapRenderer extends SeatMapViewRendererExtends SeatMapViewRenderer: its public members apply here too.
| Member | Type | Description |
|---|---|---|
constructorconstructor | (options: SeatMapRendererOptions) |
@openseat/renderer-konva/src/edit-renderer.ts
The seat map renderer without Konva's Transformer, for pages that only show and sell a layout (a booking map): everything SeatMapRenderer does, except that edit mode draws no resize or rotate handles. Bundlers then leave the Transformer out of such pages. Use SeatMapRenderer for editing.
class SeatMapViewRenderer| Member | Type | Description |
|---|---|---|
constructorconstructor | (options: SeatMapRendererOptions, edit?: RendererEditSupport) |
|
setLayoutmethod | (layout: LayoutDocument) => void | |
getLayoutmethod | () => LayoutDocument | null | |
setSeatStatesmethod | (states: ReadonlyMap<string, SeatVisualState>) => void | |
setZoneNotesmethod | (notes: ReadonlyMap<string, string> | null) => void | Notes drawn under GA zone names in view mode, by inventory key: a buyer's map shows each zone's price there, as the big ticketing sites do. A zone too short for two lines shows its name only. Null clears. |
setHighlightmethod | (opts: HighlightOptions | null) => void | Emphasises a class of seats and dims every other seat, for a buyer filter. |
getHighlightmethod | () => HighlightOptions | null | |
setSelectionmethod | (ids: readonly string[]) => void | |
getSelectionmethod | () => readonly string[] | |
setFocusmethod | (objectId: string | null) => void | Draws a keyboard focus ring and scrolls the object into view. |
setModemethod | (mode: RendererMode) => void | |
getModemethod | () => RendererMode | |
setThememethod | (theme: Theme) => void | |
setEventsmethod | (events: RendererEvents) => void | |
setSnapMovemethod | (snapMove: SeatMapRendererOptions["snapMove"]) => void | |
setResolveTargetmethod | (fn: ((hitId: string) => string | null) | null) => void | Maps a hit to the object a drag moves; null makes the hit not draggable. Pass null to reset. |
setMarqueeOnAreasmethod | (enabled: boolean) => void | When on (the default), dragging on an unselected area (section, polygon) box-selects instead of moving it. |
setFocusScopemethod | (ids: readonly string[] | null) => void | Limits interaction to a set of objects (an "entered" section or group). Everything else is dimmed and not hittable. Null clears the scope. |
setIssueHighlightsmethod | (ids: readonly string[]) => void | Outlines objects with validation issues. Pass an empty array to clear. |
setVertexEditingmethod | (objectId: string | null) => void | Shows vertex handles for an object's outline (section, GA area, polygon, aisle, path). Null hides them. |
setRowHandlesmethod | (rowId: string | null) => void | Shows the "+" handles that extend or shorten a row. Null hides them. |
setGridmethod | (grid: GridOptions) => void | Grid lines inside the canvas, edit mode only. |
setWheelModemethod | (mode: WheelMode) => void | What a plain mouse wheel does: zoom at the cursor (default) or pan. |
setSeatVisibilitymethod | (visibility: SeatVisibility, hideScale?: number) => void | Hide individual seats when zoomed out below |
setAreaFillModemethod | (mode: AreaFillMode) => void | Fills coloured sections and GA areas with a translucent tint (default) or solidly. |
getAreaFillModemethod | () => AreaFillMode | |
setPanOnDragmethod | (enabled: boolean) => void | In edit mode, make primary-button drags pan instead of moving or marquee-selecting (a hand tool). |
setDrawOnDragmethod | (enabled: boolean) => void | In edit mode, make primary-button drags report |
setPreviewmethod | (objects: readonly LayoutObject[]) => void | Draws objects that are not part of the layout yet, such as rows being drawn, above everything else. They are not hittable. Pass an empty array to clear. |
setGuidesmethod | (guides: readonly Guide[]) => void | Draws alignment guides. Pass an empty array to clear them. |
setCursormethod | (cursor: string | null) => void | Forces a cursor (for example |
isGestureActivemethod | () => boolean | True while the user is in the middle of an edit gesture: a transformer rotate or resize, a vertex or row handle drag, a marquee, a drawing drag or an object drag. Panning and pinching are not edit gestures. Hosts use it to hold back keyboard commands (undo, delete) mid-gesture. |
cancelGesturemethod | () => void | Abandons the gesture in progress (Escape) and restores what was drawn before it, without a commit event: a move, marquee or draw is cancelled as if a second finger interrupted it (nodes snap back, the draw reports |
getViewportmethod | () => Viewport | |
setViewportmethod | (viewport: Viewport, emit?: boolean) => void | |
fitToScreenmethod | (padding?: number) => void | Fits the content to the container. In edit mode the canvas area is included, so its outline is in view. The default margin is 32 px, less on a small container (4% of its shorter side, at least 10 px), so a phone map shows the venue as large as it can. |
getFitViewportmethod | (padding?: number) => Viewport | The viewport |
getContentBoundsmethod | () => Bounds | null | Layout-space bounds of everything drawn (objects, row labels, the venue and its name), or null when empty. |
zoomToBoundsmethod | (bounds: Bounds, padding?: number) => void | Fits a layout-space rectangle into the container (for "zoom to selection" or a section). |
zoomBymethod | (factor: number, around?: Point) => void | Zooms around a screen point (the container centre by default). |
panBymethod | (dx: number, dy: number) => void | |
scrollObjectIntoViewmethod | (objectId: string) => void | |
worldToScreenmethod | (point: Point) => Point | |
screenToWorldmethod | (point: Point) => Point | |
hitTestmethod | (screenPoint: Point, pointerType?: PointerKind) => string | null | Object under a container-relative screen point, using the current mode's hit rules and scope. |
boundsOfObjectmethod | (objectId: string) => Bounds | null | Layout-space bounds of an object. Rows report the union of their seats, sections include their contents. |
resizemethod | (width: number, height: number) => void | |
getSizemethod | () => Size | |
getElementmethod | () => HTMLDivElement | The canvas wrapper element that receives pointer events. |
getStatsmethod | () => RendererStats | |
flushmethod | () => void | Draws synchronously. Normally drawing is batched to animation frames; tests and exports use this. |
exportImagemethod | (opts?: ExportImageOptions) => string | Renders the layout to a PNG data URL. The area is temporarily fitted into the container (edit helpers, selection and handles hidden), captured, and the view restored. The output is capped at 8192 px per side by lowering the pixel ratio. |
getTextBoxmethod | (objectId: string, kind: TextBoxKind) => Bounds | null | Layout-space box of the text drawn now for one object: a section's title ( |
destroymethod | () => void |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
How an area in a given state is painted, and whether it carries the not-for-sale hatch.
interface AreaStatePaint extends AreaStyleExtends AreaStyle
| Member | Type | Description |
|---|---|---|
hatch | boolean | |
noteoptional | string | Replaces the capacity line of a GA label: "Not for sale" or "Sold out". |
fill | string | From |
stroke | string | From |
strokeWidth | number | From |
labelColour | string | From |
Every member is readonly.
@openseat/renderer-konva/src/glyphs.ts
interface BackgroundClickEvent| Member | Type | Description |
|---|---|---|
additive | boolean | |
pointerType | PointerKind | |
point | Point | Where the click landed, in layout coordinates. |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
Category-coloured paint: a light tint of the colour as the fill, and a stronger shade of it as the stroke.
interface CategoryPaint| Member | Type | Description |
|---|---|---|
fill | string | Opaque light tint (the colour at the area tint strength over white). |
stroke | string | |
labelColour | string | Label text with at least 4.5:1 contrast on |
Every member is readonly.
@openseat/renderer-konva/src/glyphs.ts
interface ContextMenuEvent| Member | Type | Description |
|---|---|---|
objectId | string | null | The object under the pointer (raw hit, before |
point | Point | Layout coordinates. |
screenPoint | Point | Client (viewport) coordinates, for positioning a menu. |
pointerType | PointerKind |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
A drawing drag (see setDrawOnDrag). Points are in layout coordinates.
interface DrawEvent| Member | Type | Description |
|---|---|---|
start | Point | |
point | Point | |
pointerType | PointerKind |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
interface ExportImageOptions| Member | Type | Description |
|---|---|---|
pixelRatiooptional | number | Output pixels per screen pixel of the fitted view. Default 2; reduced to keep the image within 8192 px. |
paddingoptional | number | Screen pixels around the area. Default 24. Default |
areaoptional | "content" | "canvas" | "content" (default): the objects and venue. "canvas": the layout's canvas rectangle. |
backgroundoptional | string | Background colour. Default the theme's canvas background. |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
How a GA area is painted: fill (CSS colour, translucent for a tint), outline, label colour and state cues.
interface GaPaint| Member | Type | Description |
|---|---|---|
fill | string | |
stroke | string | |
strokeWidth | number | |
labelColour | string | |
hatch | boolean | |
noteoptional | string |
Every member is readonly.
@openseat/renderer-konva/src/nodes.ts
interface GestureOptions| Member | Type | Description |
|---|---|---|
dragThresholdoptional | number | Screen pixels a mouse or pen must travel before a press becomes a drag. |
touchDragThresholdoptional | number | Larger threshold for touch, since fingers jitter while tapping. |
Every member is readonly.
@openseat/renderer-konva/src/gestures.ts
interface GridOptions| Member | Type | Description |
|---|---|---|
size | number | Grid spacing in layout units. |
visible | boolean |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
A transform of a whole selection through the group transformer.
interface GroupTransformEvent| Member | Type | Description |
|---|---|---|
ids | readonly string[] | The selected objects (members are implied). |
transform | SelectionTransform | Pivot is the initial centre of the selection's bounds. Apply with core's |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
An alignment guide: a vertical line at x = value or a horizontal line at y = value, in layout units.
interface Guide| Member | Type | Description |
|---|---|---|
axis | "x" | "y" | |
value | number |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
What setHighlight emphasises. Everything else is dimmed.
interface HighlightOptions| Member | Type | Description |
|---|---|---|
accessibleoptionalreadonly | boolean | Keep wheelchair and companion seats at full strength and dim every other seat (an "Accessible seats" filter). |
@openseat/renderer-konva/src/renderer.ts
interface MarqueeSelectEvent| Member | Type | Description |
|---|---|---|
objectIds | readonly string[] | |
additive | boolean |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
interface MoveEvent| Member | Type | Description |
|---|---|---|
objectIds | readonly string[] | Objects the user dragged. Members (seats of rows, contents of sections) are implied, not listed. |
delta | Point | Movement in layout units, after snapping. |
modifiers | MoveModifiers |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
Modifier keys held during a move.
interface MoveModifiers| Member | Type | Description |
|---|---|---|
alt | boolean | Alt (Option) was held when the drag started: hosts turn this into a duplicate-drag. |
shift | boolean | Shift is held now: hosts usually constrain the move. |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
Context some nodes need beyond the object itself.
interface NodeOptions| Member | Type | Description |
|---|---|---|
modeoptional | "view" | "edit" | Edit mode draws helpers (dashed outlines of hidden sections). Default "view". Default |
rowSeatsoptional | readonly Seat[] | A row's seats in row order, which place its labels. Without them a row draws no labels. |
layoutoptional | LayoutDocument | null | The layout the object belongs to. Row labels are pushed clear of every seat in it (core |
areaFillModeoptional | AreaFillMode | How sections and GA areas with a colour are filled. Default "tint". Default |
areaStateoptional | SeatVisualState | Visual state of a GA area, booth or table booked whole (looked up by its inventory key). "blocked" draws it greyed and hatched (Not for sale), "booked" greyed (Sold out). Absent means available. |
zoneNoteoptional | string | View mode: a short second line under a zone's name, such as its price ("₹1,499"). Drawn only when the zone is tall enough for both lines. |
Every member is readonly.
@openseat/renderer-konva/src/nodes.ts
A Konva node's own transform: Konva composes translate · rotate · scale.
interface NodePose| Member | Type | Description |
|---|---|---|
x | number | |
y | number | |
rotation | number | |
scaleX | number | |
scaleY | number |
Every member is readonly.
@openseat/renderer-konva/src/group-transform.ts
interface ObjectClickEvent| Member | Type | Description |
|---|---|---|
objectId | string | |
seatIdoptional | string | Public seat ID when the clicked object is a seat. |
additive | boolean | True when Shift or Cmd was held, or Ctrl on platforms other than macOS (where Ctrl+click opens the context menu): hosts usually treat this as "add to selection". See isAdditiveClick. |
pointerType | PointerKind | |
point | Point | Where the click landed, in layout coordinates. |
button | number | DOM button: always 0 (primary), since other buttons do not click. |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
interface PointerInfo| Member | Type | Description |
|---|---|---|
pointerType | PointerKind | |
button | number | DOM |
shiftKey | boolean | |
ctrlKey | boolean | |
metaKey | boolean | |
altKey | boolean |
Every member is readonly.
@openseat/renderer-konva/src/gestures.ts
The proxy rectangle as Konva sees it: (x, y) is the top-left corner before rotation.
interface ProxyRect| Member | Type | Description |
|---|---|---|
x | number | |
y | number | |
width | number | |
height | number | |
rotationoptional | number | Degrees. Default 0. Default |
scaleXoptional | number | |
scaleYoptional | number |
Every member is readonly.
@openseat/renderer-konva/src/group-transform.ts
What edit mode needs that a view-only page does not: Konva's Transformer (resize and rotate handles, about 7 kB gzip). SeatMapRenderer passes it; SeatMapViewRenderer leaves it out.
interface RendererEditSupport| Member | Type | Description |
|---|---|---|
Transformerreadonly | typeof Transformer |
@openseat/renderer-konva/src/renderer.ts
interface RendererEvents| Member | Type | Description |
|---|---|---|
onObjectClickoptionalmethod | (event: ObjectClickEvent) => void | |
onBackgroundClickoptionalmethod | (event: BackgroundClickEvent) => void | |
onHoverChangeoptionalmethod | (objectId: string | null) => void | |
onViewportChangeoptionalmethod | (viewport: Viewport) => void | |
onMoveStartoptionalmethod | (event: { readonly objectIds: readonly string[]; }) => void | |
onMoveoptionalmethod | (event: MoveEvent) => void | Fires during a drag, for live feedback such as alignment guides. Do not commit changes here. |
onMoveEndoptionalmethod | (event: MoveEvent) => void | Fires once per drag gesture. Commit the move here, then call |
onTransformEndoptionalmethod | (event: TransformEndEvent) => void | |
onGroupTransformoptionalmethod | (event: GroupTransformEvent) => void | Live group transform (once per frame at most). Do not commit here. |
onGroupTransformEndoptionalmethod | (event: GroupTransformEvent) => void | Commit a group transform here. |
onMarqueeSelectoptionalmethod | (event: MarqueeSelectEvent) => void | |
onDrawStartoptionalmethod | (event: DrawEvent) => void | Drawing drags, while |
onDrawoptionalmethod | (event: DrawEvent) => void | |
onDrawEndoptionalmethod | (event: DrawEvent) => void | |
onDrawCanceloptionalmethod | () => void | A drawing drag was interrupted (for example by a second finger starting a pinch). |
onPointerMoveoptionalmethod | (event: { readonly point: Point; readonly pointerType: PointerKind; }) => void | The mouse or pen moved with no button pressed. Point in layout coordinates. |
onContextMenuoptionalmethod | (event: ContextMenuEvent) => void | Secondary click (or long press) in edit mode. The browser menu is suppressed. |
onVertexDragoptionalmethod | (event: VertexDragEvent) => void | A vertex handle is being dragged (once per frame at most). |
onVertexDragEndoptionalmethod | (event: VertexDragEvent) => void | |
onVertexInsertoptionalmethod | (event: VertexInsertEvent) => void | A midpoint handle was clicked. |
onVertexRemoveoptionalmethod | (event: VertexRemoveEvent) => void | Alt+click or double-click on a vertex handle. |
onRowHandleDragoptionalmethod | (event: RowHandleDragEvent) => void | A row's "+" handle was dragged far enough to change its seat count. |
onRowHandleDragEndoptionalmethod | (event: RowHandleDragEvent) => void | |
onRowHandleCanceloptionalmethod | () => void |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
interface RendererStats| Member | Type | Description |
|---|---|---|
objectCount | number | |
nodeCount | number | |
visibleNodeCount | number | |
seatLabelNodeCount | number | |
frames | number | |
lastFrameMs | number | |
accessibleSeats | number | Seats drawn as accessible (wheelchair or companion): with a pictogram, or with the ring when tiny on screen. |
accessibleRingSeats | number | Of those, the seats currently drawn with the ring because they are under 5 px in radius on screen. |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
interface RowHandle| Member | Type | Description |
|---|---|---|
end | "start" | "end" | |
position | Point | Where the "+" is drawn. |
origin | Point | Centre of the end seat the handle extends from. |
direction | Point | Unit vector pointing away from the row along its end tangent. |
Every member is readonly.
@openseat/renderer-konva/src/handles.ts
interface RowHandleDragEvent| Member | Type | Description |
|---|---|---|
rowId | string | |
end | "start" | "end" | |
count | number | Seats to add (positive) or remove (negative) at that end. |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
interface SceneDiff| Member | Type | Description |
|---|---|---|
added | readonly string[] | |
removed | readonly string[] | |
changed | readonly string[] | Objects whose reference changed. Unchanged references are assumed unchanged (immutable updates). |
orderChanged | boolean |
Every member is readonly.
@openseat/renderer-konva/src/scene.ts
interface SeatMapRendererOptions| Member | Type | Description |
|---|---|---|
container | HTMLDivElement | |
layout | LayoutDocument | |
themeoptional | Theme | |
modeoptional | RendererMode | |
seatStatesoptional | ReadonlyMap<string, SeatVisualState> | Visual state per public seat ID. Seats not listed are drawn as available. |
highlightoptional | HighlightOptions | null | Initial highlight (see |
selectionoptional | readonly string[] | Object IDs drawn with a selection outline. |
zoomLimitsoptional | Partial<ZoomLimits> | |
seatLabelMinScaleoptional | number | Zoom level at which seat labels appear. Default 1.6. Default |
rowLabelMinScaleoptional | number | Zoom level at which row labels appear. Default 0.35. Default |
hitToleranceoptional | { readonly mouse?: number; readonly touch?: number; } | Extra hit radius in screen pixels. Defaults: mouse 2, touch 10. |
isHittableoptional | (obj: LayoutObject, mode: RendererMode) => boolean | Decides which objects respond to pointer input. Defaults to seats, sellable booths and GA areas in view mode, everything but rows in edit mode. |
resolveTargetoptional | (hitId: string) => string | null | Maps the object under the pointer to what a drag moves (for example a seat to its section at the top level). Null means "not draggable". Default: the hit itself. |
snapMoveoptional | (input: { readonly objectIds: readonly string[]; readonly delta: Point; readonly modifiers?: MoveModifiers; }) => Point | Adjusts a drag delta, for grid snapping or alignment guides. |
eventsoptional | RendererEvents | |
autoResizeoptional | boolean | Track container size with a ResizeObserver. Default true. Default |
initialFitoptional | boolean | Fit the layout to the container on creation. Default true. Default |
wheelModeoptional | WheelMode | What a plain mouse wheel does. Default "zoom". Default |
seatVisibilityoptional | SeatVisibility | Default "always". "hidden-below-scale" hides seats (sections still draw) when zoomed out. Default |
seatHideScaleoptional | number | Scale below which seats are hidden with "hidden-below-scale". Default 0.5. Default |
areaFillModeoptional | AreaFillMode | How sections and GA areas with a style or category colour are filled: "tint" (default) washes them with the colour so seats read on top; "solid" fills them with it, for an overview where seats are hidden. |
zoneNotesoptional | ReadonlyMap<string, string> | View mode: a second line under a GA zone's name ("₹1,499"), by its inventory key. See |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
interface Size| Member | Type | Description |
|---|---|---|
width | number | |
height | number |
Every member is readonly.
@openseat/renderer-konva/src/viewport.ts
Stage fields the renderer reads beyond core's base schema. Declared structurally so the renderer compiles whether or not the installed core types already include them.
interface StageDecor| Member | Type | Description |
|---|---|---|
styleoptional | { readonly fill?: string; readonly stroke?: string; readonly strokeWidth?: number; } | |
markingsoptional | FieldMarkings |
Every member is readonly.
@openseat/renderer-konva/src/markings.ts
interface SvgExportOptions| Member | Type | Description |
|---|---|---|
themeoptional | Theme | |
paddingoptional | number | Layout units around the content. Default 24. Default |
seatStatesoptional | ReadonlyMap<string, SeatVisualState> | Visual state per public seat ID, and per inventory key for GA areas, booths and tables booked whole (as in the canvas renderer). Objects not listed are available. |
seatLabelsoptional | boolean | Draw seat labels inside seats. Default false. Default |
rowLabelsoptional | boolean | Draw row labels. Default true. Default |
backgroundoptional | string | Background fill. Default the theme's canvas background; "none" for transparent. |
areaFillModeoptional | AreaFillMode | How coloured sections and GA areas are filled, as in the canvas renderer. Default "tint". Default |
Every member is readonly.
@openseat/renderer-konva/src/svg-export.ts
interface TransformEndEvent| Member | Type | Description |
|---|---|---|
objectId | string | |
position | Point | |
rotation | number | |
scaleX | number | Scale applied by the resize handles. The host turns this into new dimensions. |
scaleY | number |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
interface VertexDragEvent| Member | Type | Description |
|---|---|---|
objectId | string | |
index | number | |
point | Point | New vertex position in layout (world) coordinates. |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
interface VertexHandles| Member | Type | Description |
|---|---|---|
vertices | readonly Point[] | The outline's vertices, in layout space. |
midpoints | readonly Point[] | Midpoint of edge i (vertex i to vertex i + 1), where a click inserts a vertex. |
closed | boolean |
Every member is readonly.
@openseat/renderer-konva/src/handles.ts
interface VertexInsertEvent| Member | Type | Description |
|---|---|---|
objectId | string | |
edgeIndex | number | The edge from vertex |
point | Point | Layout coordinates of the new vertex. |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
interface VertexRemoveEvent| Member | Type | Description |
|---|---|---|
objectId | string | |
index | number |
Every member is readonly.
@openseat/renderer-konva/src/renderer.ts
Maps layout space to screen space: screen = world * scale + (x, y). Screen coordinates are CSS pixels relative to the renderer container.
interface Viewport| Member | Type | Description |
|---|---|---|
x | number | |
y | number | |
scale | number |
Every member is readonly.
@openseat/renderer-konva/src/viewport.ts
The parts of a DOM WheelEvent that decide what it does.
interface WheelInput| Member | Type | Description |
|---|---|---|
deltaX | number | |
deltaY | number | |
deltaMode | number | 0 pixels, 1 lines, 2 pages. |
ctrlKey | boolean | |
metaKey | boolean | |
shiftKey | boolean |
Every member is readonly.
@openseat/renderer-konva/src/gestures.ts
interface ZoomLimits| Member | Type | Description |
|---|---|---|
minScale | number | |
maxScale | number |
Every member is readonly.
@openseat/renderer-konva/src/viewport.ts
Which pictogram a seat carries: the wheelchair symbol, the companion mark, or none.
type AccessibleGlyphKind = "wheelchair" | "companion";@openseat/renderer-konva/src/glyphs.ts
How sections and GA areas with a style or category colour are filled: "tint" (a translucent wash, seats drawn on top) or "solid" (the full colour, for an overview where seats are hidden).
type AreaFillMode = "tint" | "solid";@openseat/renderer-konva/src/nodes.ts
Sports field markings drawn inside a stage.
type FieldMarkings = "rink" | "court" | "pitch";@openseat/renderer-konva/src/markings.ts
One marking in the stage's local space (origin at the stage centre, x along its width). Angles are degrees, measured clockwise from +x as on screen; an arc runs clockwise from startAngle to endAngle.
type FieldMarkingShape =
| {
readonly kind: "line";
readonly points: readonly Point[];
readonly closed: boolean;
readonly colour: MarkingColour;
readonly strokeWidth: number;
}
| {
readonly kind: "circle";
readonly centre: Point;
readonly radius: number;
readonly colour: MarkingColour;
readonly strokeWidth: number;
}
| {
readonly kind: "arc";
readonly centre: Point;
readonly radius: number;
readonly startAngle: number;
readonly endAngle: number;
readonly colour: MarkingColour;
readonly strokeWidth: number;
};| Discriminant | Type | Description |
|---|---|---|
kind: "line" | { readonly kind: "line"; readonly points: readonly Point[]; readonly closed: boolean; readonly colour: MarkingColour; readonly strokeWidth: number; } | |
kind: "circle" | { readonly kind: "circle"; readonly centre: Point; readonly radius: number; readonly colour: MarkingColour; readonly strokeWidth: number; } | |
kind: "arc" | { readonly kind: "arc"; readonly centre: Point; readonly radius: number; readonly startAngle: number; readonly endAngle: number; readonly colour: MarkingColour; readonly strokeWidth: number; } |
@openseat/renderer-konva/src/markings.ts
type GestureEvent =
| {
readonly type: "tap";
readonly point: Point;
readonly info: PointerInfo;
}
| {
readonly type: "dragstart";
readonly start: Point;
readonly point: Point;
readonly info: PointerInfo;
}
| {
readonly type: "dragmove";
readonly start: Point;
readonly point: Point;
readonly step: Point;
readonly info: PointerInfo;
}
| {
readonly type: "dragend";
readonly start: Point;
readonly point: Point;
readonly info: PointerInfo;
}
| {
readonly type: "dragcancel";
readonly info: PointerInfo;
// … 14 more lines (type truncated)This type is long; its declaration is shortened here.
| Discriminant | Type | Description |
|---|---|---|
type: "tap" | { readonly type: "tap"; readonly point: Point; readonly info: PointerInfo; } | |
type: "dragstart" | { readonly type: "dragstart"; readonly start: Point; readonly point: Point; readonly info: PointerInfo; } | |
type: "dragmove" | { readonly type: "dragmove"; readonly start: Point; readonly point: Point; readonly step: Point; readonly info: PointerInfo; } | |
type: "dragend" | { readonly type: "dragend"; readonly start: Point; readonly point: Point; readonly info: PointerInfo; } | |
type: "dragcancel" | { readonly type: "dragcancel"; readonly info: PointerInfo; } | The current drag was abandoned, for example because a second finger turned it into a pinch. |
type: "pinchstart" | { readonly type: "pinchstart"; readonly center: Point; } | |
type: "pinch" | { readonly type: "pinch"; readonly center: Point; readonly factor: number; readonly step: Point; } | |
type: "pinchend" | { readonly type: "pinchend"; } |
@openseat/renderer-konva/src/gestures.ts
type HandleHit =
| {
readonly kind: "vertex";
readonly index: number;
}
| {
readonly kind: "midpoint";
readonly edgeIndex: number;
}
| {
readonly kind: "row";
readonly end: "start" | "end";
};| Discriminant | Type | Description |
|---|---|---|
kind: "vertex" | { readonly kind: "vertex"; readonly index: number; } | |
kind: "midpoint" | { readonly kind: "midpoint"; readonly edgeIndex: number; } | |
kind: "row" | { readonly kind: "row"; readonly end: "start" | "end"; } |
@openseat/renderer-konva/src/handles.ts
Outline a hatch is clipped to, in the object's local space.
type HatchOutline =
| {
readonly kind: "polygon";
readonly points: readonly Point[];
}
| {
readonly kind: "rect";
readonly width: number;
readonly height: number;
}
| {
readonly kind: "circle";
readonly radius: number;
};| Discriminant | Type | Description |
|---|---|---|
kind: "polygon" | { readonly kind: "polygon"; readonly points: readonly Point[]; } | |
kind: "rect" | { readonly kind: "rect"; readonly width: number; readonly height: number; } | |
kind: "circle" | { readonly kind: "circle"; readonly radius: number; } |
@openseat/renderer-konva/src/glyphs.ts
Which Konva layer an object's node belongs on.
type LayerName = "areas" | "seats" | "top";@openseat/renderer-konva/src/nodes.ts
Colour role of a marking: the rink's red and blue lines (theme fieldMarking tokens), or a neutral line that contrasts with the stage fill.
type MarkingColour = "red" | "blue" | "line";@openseat/renderer-konva/src/markings.ts
How a member node follows a group transform:
type MemberKind = "rigid" | "scaled" | "frame" | "point";@openseat/renderer-konva/src/group-transform.ts
type PointerKind = "mouse" | "pen" | "touch";@openseat/renderer-konva/src/gestures.ts
type RendererMode = "view" | "edit";@openseat/renderer-konva/src/renderer.ts
Whether individual seats are drawn at every zoom, or only once zoomed in past seatHideScale.
type SeatVisibility = "always" | "hidden-below-scale";@openseat/renderer-konva/src/renderer.ts
type WheelAction =
| {
readonly kind: "zoom";
readonly factor: number;
}
| {
readonly kind: "pan";
readonly dx: number;
readonly dy: number;
};| Discriminant | Type | Description |
|---|---|---|
kind: "zoom" | { readonly kind: "zoom"; readonly factor: number; } | Multiply the scale by |
kind: "pan" | { readonly kind: "pan"; readonly dx: number; readonly dy: number; } | Pan by screen pixels. |
@openseat/renderer-konva/src/gestures.ts
What a plain mouse wheel does: zoom at the cursor, or pan.
type WheelMode = "zoom" | "pan";@openseat/renderer-konva/src/gestures.ts
Below this on-screen seat radius (in pixels) the pictogram is not legible, so an accessible seat is drawn with a ring in the glyph colour instead.
const ACCESSIBLE_RING_MIN_RADIUS_PX = 5@openseat/renderer-konva/src/glyphs.ts
Width of that ring, in screen pixels.
const ACCESSIBLE_RING_WIDTH_PX = 2@openseat/renderer-konva/src/glyphs.ts
Fill opacity of sections and GA areas tinted by a style or category colour.
const AREA_TINT_ALPHA = 0.35@openseat/renderer-konva/src/nodes.ts
Vertical offset of a compact pictogram below the seat centre, and of the seat label above it, as × radius.
const COMPACT_GLYPH_OFFSET = 0.42@openseat/renderer-konva/src/glyphs.ts
const COMPACT_LABEL_OFFSET = -0.32@openseat/renderer-konva/src/glyphs.ts
Konva name of the companion mark node drawn over a companion seat.
const COMPANION_GLYPH_NAME = "companion-mark"@openseat/renderer-konva/src/nodes.ts
Companion-seat mark: a small head-and-shoulders figure, centred on the origin in a box about 11 units tall. Visibly different from the wheelchair.
const COMPANION_GLYPH_PATH: string@openseat/renderer-konva/src/glyphs.ts
Height of COMPANION_GLYPH_PATH's box, in path units.
const COMPANION_GLYPH_SIZE = 11@openseat/renderer-konva/src/glyphs.ts
const DEFAULT_ZOOM_LIMITS: ZoomLimits@openseat/renderer-konva/src/viewport.ts
Space left between a divider line and its caption on each side, × the caption font size.
const DIVIDER_CAPTION_PAD = 0.6@openseat/renderer-konva/src/shapes.ts
Konva name of each drawn piece of a divider line (broken around its caption).
const DIVIDER_LINE_NAME = "divider-line"@openseat/renderer-konva/src/nodes.ts
Handle radius in screen pixels.
const HANDLE_RADIUS_PX = 6@openseat/renderer-konva/src/handles.ts
Tooltip of an edge midpoint handle.
const MIDPOINT_HANDLE_HINT =
"Click to add a corner here (or drag to place it)"@openseat/renderer-konva/src/handles.ts
Smallest size a section label is shrunk to for a small outline.
const MIN_SECTION_LABEL_SIZE = 8@openseat/renderer-konva/src/scene.ts
Konva name of the diagonal hatch drawn over a not-for-sale GA area, booth or table.
const NOT_FOR_SALE_HATCH_NAME = "not-for-sale-hatch"@openseat/renderer-konva/src/nodes.ts
Tooltip of the transformer's resize handles.
const RESIZE_HANDLE_HINT = "Drag to resize"@openseat/renderer-konva/src/handles.ts
Tooltip of the transformer's rotate handle.
const ROTATE_HANDLE_HINT =
"Drag to rotate (hold Shift for 90\u00B0 steps)"@openseat/renderer-konva/src/handles.ts
Distance from a row's end seat edge to its "+" handle, in layout units.
const ROW_HANDLE_GAP = 12@openseat/renderer-konva/src/handles.ts
Tooltip of a row's "+" handle (shown as the canvas container's title while hovered).
const ROW_HANDLE_HINT =
"Add a seat to this row (drag to add several)"@openseat/renderer-konva/src/handles.ts
const ROW_LABEL_FONT_SIZE = 11@openseat/renderer-konva/src/scene.ts
Gap between the edge of a row's end seat and its row label, in layout units.
const ROW_LABEL_GAP = 8@openseat/renderer-konva/src/scene.ts
Default section label size, in layout units.
const SECTION_LABEL_SIZE = 16@openseat/renderer-konva/src/scene.ts
Konva name of a stage's outline path.
const STAGE_OUTLINE_NAME = "stage-outline"@openseat/renderer-konva/src/nodes.ts
Konva attribute naming what a text node is (a core TextBoxKind), on every section title, row label, zone, stage, table and booth label, free label and divider caption. The renderer's text-box test hooks read it.
const TEXT_KIND_ATTR = "openseatTextKind"@openseat/renderer-konva/src/nodes.ts
Tooltip of a vertex handle.
const VERTEX_HANDLE_HINT =
"Drag to move this corner (Alt+click or double-click to remove it)"@openseat/renderer-konva/src/handles.ts
Konva name of the wheelchair pictogram node drawn over an accessible seat.
const WHEELCHAIR_GLYPH_NAME = "accessible-glyph"@openseat/renderer-konva/src/nodes.ts
Wheelchair pictogram as SVG path data, centred on the origin in a box about 20 units tall: head, body and leg, and a wheel (a ring: its inner circle winds the other way, so the nonzero fill rule leaves a hole). Drawn with a fill only, so it renders the same in Konva and in SVG without fonts.
const WHEELCHAIR_GLYPH_PATH: string@openseat/renderer-konva/src/glyphs.ts
Height of WHEELCHAIR_GLYPH_PATH's box, in path units.
const WHEELCHAIR_GLYPH_SIZE = 20@openseat/renderer-konva/src/glyphs.ts