import { World } from '@antv/g-webgpu' ; import { Container } from './Container' ; import { Mark } from './Mark' ; export interface IRendererOptions { canvas : HTMLCanvasElement ; containerMap : Record < string , Container > ; mark : Mark ; onPick : ( event : { x : number ; y : number ; featureId : number | undefined ; } ) => void ; } export class Renderer { private world : World ; private frameId : number ; constructor ( private options ) { } public onHover = ( { x , y } ) => { } ; public init ( ) { this . world = World . create ( { canvas : this . options . canvas , } ) ; this . options . canvas . addEventListener ( 'mousemove' , this . onHover ) ; this . options . mark . buildAttributesForAllContainers ( this . options . containerMap ) ; } public render ( { layout } ) { } public destroy ( ) { window . cancelAnimationFrame ( this . frameId ) ; this . world . destroy ( ) ; } }