Skip to content

CanvasContainer

The canvas container acts as the foundational entry point to utilizing the canvas, orchestrating the setup of transformations, the integration of event listeners, and the execution of device-agnostic rendering logic. This ensures that the canvas is not only fully responsive but also optimized for interaction and display across all devices, facilitating a seamless development experience and superior performance for end-users.

It's crucial to understand that the CanvasContainer in RCK manages three distinct canvas layers: main, top, and internal. The main layer is the primary canvas where most components and visuals are rendered. The top layer is designated for elements that aren't directly part of the main painting process, such as indicators for other users' cursor positions. Lastly, the internal layer is reserved for RCK's own use, including functionalities like scrollbar rendering. Notably, any call to requestRedraw('main') triggers a redraw of the internal layer, ensuring consistent and synchronized updates across the layers.

The container takes 3 props

PropertyDefault: TypeDescription
offsetTop0:numberIn some cases, you may have a static navbar at the top of your page. If this is the case, set the offset to the number of pixels your navbar occupies.
modedark or lightAdjusts the dot colors to ensure they blend appropriately with the background, optimizing visibility without being overly prominent. ^1.2.0
includeScrollBarsfalse: booleanControls the rendering of scrollbars when content tracking is enabled. This feature is still in beta; currently, scrollbars are rendered but do not support click-and-drag functionality. beta
fullScreentrue: booleanDetermines if the canvas should occupy the full screen or be contained within a parent element. Currently, only full screen mode is supported. beta

Released under the MIT License.