import { BaseMesh } from '@turbox3d/graphic-view' ; import { Vec2 } from '@turbox3d/shared' ; import * as PIXI from 'pixi.js' ; import { Scene2dContext } from '../Scene2D/context' ; export abstract class Mesh2D < Props = { } , State = never > extends BaseMesh < Props , State , PIXI . Application , never , never , never , PIXI . Container , PIXI . DisplayObject , PIXI . Sprite , Vec2 > { static contextType = Scene2dContext ; constructor ( props ) { super ( props ) ; if ( this . view instanceof PIXI . Container ) { this . view . sortableChildren = true ; } } createDefaultView ( ) { return new PIXI . Container ( ) ; } addChildView ( view ) { if ( this . view instanceof PIXI . Container ) { this . view . addChild ( view ) ; } } clearView ( ) { if ( this . view instanceof PIXI . Graphics ) { this . view . clear ( ) ; } } removeFromWorld ( ) { try { if ( this . view instanceof PIXI . Container ) { this . view . destroy ( { children : false } ) ; } else { this . view . destroy ( ) ; } } catch ( e ) { console . log ( 'destroy error' ) ; } } setViewInteractive ( interactive ) { this . view . interactive = interactive ; } addViewToScene ( ) { } }