You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.9 KiB

4 months ago
import type { Cursor, IRenderer } from '@antv/g';
import type { Canvas, CanvasConfig } from '../runtime/canvas';
/**
* <zh/>
*
* <en/> Canvas spec
* @public
*/
export interface CanvasOptions {
/**
* <zh/>
*
* <en/> canvas container
*/
container?: string | HTMLElement | Canvas;
/**
* <zh/>
*
* <en/> canvas width
* @remarks
* <zh/>
*
* <en/> If not set, the container width will be automatically obtained
*/
width?: number;
/**
* <zh/>
*
* <en/> canvas height
* @remarks
* <zh/>
*
* <en/> If not set, the container height will be automatically obtained
*/
height?: number;
/**
* <zh/>
*
* <en/> manually set renderer
* @remarks
* <zh/> G6 backgroundmainlabeltransient
*
* <en/> G6 adopts a layered rendering method, divided into four layers: background, main, label, transient. Users can set the renderer of each layer canvas separately through this configuration item
*/
renderer?: (layer: 'background' | 'main' | 'label' | 'transient') => IRenderer;
/**
* <zh/>
*
* <en/> whether to auto resize canvas
* @defaultValue false
* @remarks
* <zh/> window.onresize
*
* <en/> Automatically adjust the canvas size based on the window.onresize event
*/
autoResize?: boolean;
/**
* <zh/>
*
* <en/> canvas background color
* @remarks
* <zh/>
*
* <en/> This color is used as the background color when exporting images
*/
background?: string;
/**
* <zh/>
*
* <en/> device pixel ratio
* @remarks
* <zh/> [window.devicePixelRatio](https://developer.mozilla.org/zh-CN/docs/Web/API/Window/devicePixelRatio)
*
* <en/> Device pixel ratio for high-definition screens, default is [window.devicePixelRatio](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio)
*/
devicePixelRatio?: number;
/**
* <zh/>
*
* <en/> cursor style
*/
cursor?: Cursor;
/**
* <zh/>
*
* <en/> canvas config
* @remarks
* <zh/> GraphOptions canvas
*
* <en/> The related configuration items under GraphOptions are shortcut configuration items, which will be converted to canvas configuration items
*/
canvas?: CanvasConfig;
}