Section Click Behavior
The booking renderer changes how section clicks behave when the entire venue is visible at once. Two further hooks, onCartClick and decrementGaOnClick, decide what a click does to the cart.
Behavior at full view
When the venue is fully zoomed out – that is, the entire venue fits within the visible area at zoom-to-fit scale – clicking a section fires onSectionClick instead of zooming and panning into the section. This applies regardless of the interactionZoomStrategy configured on the renderer.
The interactionZoomStrategy option controls how the renderer handles zoom on section click during normal (non-full-view) interaction. At full view, this setting is overridden and the click always fires the callback instead of zooming.
Resuming normal zoom behavior
When the user zooms in past the full-view threshold, the renderer returns to the normal zoom-to-section behavior: clicking a section zooms and pans to focus on that section.
Programmatic zoom after click
If you want to preserve the zoom-to-section behavior at full view, call renderer.zoomToSection() inside your onSectionClick callback:
import { SeatmapBookingRenderer } from '@seatmap.pro/renderer';
const renderer = new SeatmapBookingRenderer(document.getElementById('renderer-container'), {
publicKey: 'your-public-key',
onSectionClick: (section) => {
renderer.zoomToSection(section.id);
},
});
renderer.loadEvent('your-event-id');
This lets you decide at runtime whether to zoom programmatically, show a tooltip, update external UI state, or any combination of these.
Hold a click before it changes the cart
onCartClick fires when a click or tap is about to add a seat, a general admission area or a priced table to the cart, or take it out, before anything changes. Return false to hold the click: the map and the cart stay as they are, with no loading or error state on the seat, until you call event.apply(). Phones and touch screens have no hover, so this lets a tap show the seat or section first, in a tooltip with an Add to cart button for example, and add it from there. event.pointerType tells a tap from a mouse click.
const renderer = new SeatmapBookingRenderer(document.getElementById('renderer-container'), {
publicKey: 'your-public-key',
onCartClick: (event) => {
if (event.pointerType === 'mouse') return;
showDetails(event.seat ?? event.section, {
action: event.inCart ? 'Remove from cart' : 'Add to cart',
onAction: () => event.apply(),
});
return false;
},
});
The event carries seat or section, inCart, pointerType and apply(). Only a plain false holds the click, so an async handler, which returns a promise, cannot, and a handler that throws holds it. Any other return value lets the click go ahead, and so does calling event.apply() before returning. apply() checks the seat or section again first and does nothing when it can no longer change the cart.
onCartClick does not fire for a locked seat, for a seat whose custom state blocks selecting it, or for general admission and priced tables under disableCartInteractions. onSeatSelect, onSeatDeselect, onOrphanSeatsBlocked and the section click callbacks fire after it, when the click goes ahead or event.apply() runs.
Remove one general admission ticket per click
By default a click on a general admission section that is already in the cart removes the whole item. With decrementGaOnClick: true, the click removes one ticket instead: the last ticket removes the item, a click on an empty section adds one ticket, and the section stays selected while tickets remain.
const renderer = new SeatmapBookingRenderer(document.getElementById('renderer-container'), {
publicKey: 'your-public-key',
decrementGaOnClick: true,
});
disableCartInteractions takes precedence. The click updates the cart before the section callbacks run, and addGaToCart adds to the remaining quantity, so remove the item first when a callback replaces the quantity.