Skip to main content

mapper.view_elements.canvas()

mapper.view_elements.canvas(param_table)

This function creates a Canvas view element object.

Parameters

ParameterTypeDescription
param_tabletableThis parameter is in associative array table format, meaning it's specified by keys rather than parameter positions. See the Parameters Table section.

Parameters Table

KeyTypeDescription
rendererfunctionSpecifies the renderer function for the Canvas object to be created.
This parameter is required.
valueAny typeSpecifies the initial value of the value property for the Canvas object to be created.
The default is nil.
translucencybooleanThis parameter indicates whether the Canvas object has transparent or translucent areas. When multiple Canvas objects overlap, if this parameter is set to false, it avoids redrawing the Canvas objects in the background, reducing processing costs. If set to true, it redraws overlapping Canvas objects from the back, ensuring correct rendering of translucent results.
The default is false.
logical_widthnumberSpecifies the logical width of the canvas.
It determines the aspect ratio of the canvas, along with logical_height, and sets the unit length in the logical coordinate system. If this parameter is specified, the coordinate system for the canvas will be absolute coordinate system.
This parameter and aspect_ratio are mutually exclusive.
logical_heightnumberSpecifies the logical height of the canvas. Refer to the description for lgical_width.
aspect_rationumberSpecifies the aspect ratio of the canvas.
If this parameter is specified, the coordinate system for the canvas will be relative coordinate system.
This parameter and the pair of logical_width and logical_height are mutually exclusive.
horizontal_alignmentstringSpecifies how to align the canvas horizontally when the aspect ratio of the view element region and the aspect ratio of the canvas differ. It specifies either of center, left, or right.
The default is center.
vertical_alignmentstringSpecifies how to align the canvas vertically when the aspect ratio of the view element retion and the aspect ratio of the canvas differ. It specifies either of center, top, or bottom.
The default is center.

Return Values

This function returns a Canvas object.

See Also