import '../../../globals.js';
// Copyright 2017-2024, University of Colorado Boulder
/**
 * Controller that creates and keeps an SVG radial gradient up-to-date with a Scenery RadialGradient
 *
 * SVG gradients, see http://www.w3.org/TR/SVG/pservers.html
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import Pool from '../../../phet-core/js/Pool.js';
import { scenery, SVGGradient, svgns } from '../imports.js';
class SVGRadialGradient extends SVGGradient {
    constructor(svgBlock, gradient) {
        super(svgBlock, gradient);
    }
    initialize(svgBlock, radialGradient) {
        sceneryLog && sceneryLog.Paints && sceneryLog.Paints(`[SVGRadialGradient] initialize ${radialGradient.id}`);
        sceneryLog && sceneryLog.Paints && sceneryLog.push();
        super.initialize(svgBlock, radialGradient);
        // Radial-specific setup
        this.definition.setAttribute('cx', '' + radialGradient.largePoint.x);
        this.definition.setAttribute('cy', '' + radialGradient.largePoint.y);
        this.definition.setAttribute('r', '' + radialGradient.maxRadius);
        this.definition.setAttribute('fx', '' + radialGradient.focalPoint.x);
        this.definition.setAttribute('fy', '' + radialGradient.focalPoint.y);
        sceneryLog && sceneryLog.Paints && sceneryLog.pop();
        return this;
    }
    /**
     * Creates the gradient-type-specific definition.
     */
    createDefinition() {
        return document.createElementNS(svgns, 'radialGradient');
    }
    freeToPool() {
        SVGRadialGradient.pool.freeToPool(this);
    }
}
SVGRadialGradient.pool = new Pool(SVGRadialGradient);
export default SVGRadialGradient;
scenery.register('SVGRadialGradient', SVGRadialGradient);
//# sourceMappingURL=SVGRadialGradient.js.map