Defines the RevCanvas class, which encapsulates a grid's HTML canvas element and manages its rendering and user interaction. It is the central component for rendering and handling all user interactions with the grid's canvas surface.
The HTML canvas element on which the grid is drawn is passed in via the constructor and can be accessed by the readonly RevCanvas.element field.
The passed in canvas requires the following properties to be set as per below:
Below are the recommended settings for an element:
Some operations require that other HTML elements be overlayed over the canvas element. This includes operations such as cell editing (which may involve overlaying an >input< element) or dragging columns (which uses an overlayed >canvas< element to show where the column will be dropped). In order to position these elements in the correct place, an overlay element must exist over the canvas element. The overlay element can almost any type of HTML element however, its client area must be the same size as the canvas client area and the overlay element must be positioned (ie not have [static](https://developer.mozilla.org/en-US/docs/Web/CSS/position#static) position).
The overlay element can optionally be passed in as a parameter in the constructor via Revgrid options. If this is not provided, then the canvas element's parent element will be used as the overlay element.
If the canvas uses the recommended properties, then the parent element can easily be used. It only requires [position](https://developer.mozilla.org/en-US/docs/Web/CSS/position) to not be [static](https://developer.mozilla.org/en-US/docs/Web/CSS/position#static) and padding to be 0. If you do want some non zero padding, then this can be set provided that the canvas element's margin properties are set to the same value(s).
Creates a CanvasRenderingContext2D for the canvas and then wraps it in a RevCachedCanvasRenderingContext2D object. The RevCachedCanvasRenderingContext2D object caches the context's properties and will not update them unless they are changed. All drawing related operations on the canvas use RevCachedCanvasRenderingContext2D.
Ensures that the canvas element is always resized to match the size of its parent element. Resize related events are debounced to minimise the number of renders when resizing.
Drag events are simulated by:
dragstart events from canvas elementdrag events when canvas mousemove events occur while dragging is activedragEnd events when canvas mouseup of mousecancel events occur while dragging is active