'use strict' ; import type CSSObject from '../Core/Renderer/CSSObject' ; import type Point from '../Core/Series/Point' ; import type ShadowOptionsObject from '../Core/Renderer/ShadowOptionsObject' ; import type SVGAttributes from '../Core/Renderer/SVG/SVGAttributes' ; import type SVGElement from '../Core/Renderer/SVG/SVGElement' ; import type SVGRenderer from '../Core/Renderer/SVG/SVGRenderer' ; namespace DrawPointComposition { export declare class Composition extends Point { public draw ( params ) ; public shouldDraw ( ) ; } export interface DrawParams { animatableAttribs : SVGAttributes ; attribs : SVGAttributes ; css ? : CSSObject ; group : SVGElement ; onComplete ? : Function ; isNew ? : boolean ; renderer : SVGRenderer ; shadow ? : ( boolean | Partial < ShadowOptionsObject > ) ; shapeArgs ? : SVGAttributes ; shapeType : 'arc' | 'circle' | 'path' | 'rect' | 'text' ; } const composedClasses = [ ] ; private export function compose < T extends typeof Composition > ( PointClass ) { if ( composedClasses . indexOf ( PointClass ) === - 1 ) { composedClasses . push ( PointClass ) ; const pointProto = PointClass . prototype as Composition ; pointProto . draw = draw ; if ( ! pointProto . shouldDraw ) { pointProto . shouldDraw = shouldDraw ; } } return PointClass as ( T & typeof Composition ) ; } private todo todo function draw ( this , params ) { const { animatableAttribs , onComplete , css , renderer } = params ; const animation = ( this . series && this . series . chart . hasRendered ) ? void 0 : ( this . series && this . series . options . animation ) ; let graphic = this . graphic ; params . attribs = params . attribs || { } ; params . attribs [ 'class' ] = this . getClassName ( ) ; if ( this . shouldDraw ( ) ) { if ( ! graphic ) { this . graphic = graphic = params . shapeType === 'text' ? renderer . text ( ) : renderer [ params . shapeType ] ( params . shapeArgs || { } ) ; graphic . add ( params . group ) ; } if ( css ) { graphic . css ( css ) ; } graphic . attr ( params . attribs ) . animate ( animatableAttribs , params . isNew ? false : animation , onComplete ) ; } else if ( graphic ) { const destroy = ( ) : void => { this . graphic = graphic = ( graphic && graphic . destroy ( ) ) ; if ( typeof onComplete === 'function' ) { onComplete ( ) ; } } ; if ( Object . keys ( animatableAttribs ) . length ) { graphic . animate ( animatableAttribs , void 0 , function ( ) : void { destroy ( ) ; } ) ; } else { destroy ( ) ; } } } private function shouldDraw ( this ) { return ! this . isNull ; } } export default DrawPointComposition ;