Skip to content

Build in interactions

RCK enhances your React applications with built-in user interactions, drawing inspiration from the intuitive mouse and trackpad gestures found in leading canvas tools. These interactions are seamlessly integrated with the CanvasContainer, enabling natural navigation and manipulation of the canvas content.

It's crucial to note that invoking preventDefault on any of the supported events will deactivate the corresponding RCK interaction. This feature allows for customization but should be used judiciously to preserve the intuitive user experience RCK aims to provide.

Below is a comprehensive list of default interactions supported by RCK, along with the events they're tied to and their effects:

InteractionEventDescription
Ctrl/Cmd & +keyupZoom in the canvas at the center
Ctrl/Cmd & -keyupZoom out the canvas at the center
Pinch In and outwheelZooms in and out, keeping the pointer's position in focus.
Ctrl/Cmd & WheelwheelZooms in and out, maintaining the pointer's position.
Aux (mouse wheel) Hold & Dragmousedown, mousemove, mouseupDrags (Pan) the canvas
Space & Dragkeydown + mousemoveDrags the canvas
ScrollwheelScrolls vertically through the canvas.
Shift & Scrollkeydown + wheelAllows for horizontal scrolling.

Released under the MIT License.