Sha256: 790960eadb18b48ce3da0502f0fbb1f341f195454b03670684e19d130d9adc8d

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

var isFn = function (x) {
    return typeof x === 'function';
};

/**
 * Handles the drawing of a point.
 *
 * @private
 * @function draw
 *
 * @param {object} params
 *        Parameters.
 *
 * @todo
 * - add type checking.
 */
var draw = function draw(params) {
    var point = this,
        graphic = point.graphic,
        animatableAttribs = params.animatableAttribs,
        onComplete = params.onComplete,
        css = params.css,
        renderer = params.renderer;

    if (point.shouldDraw()) {
        if (!graphic) {
            point.graphic = graphic =
                renderer[params.shapeType](params.shapeArgs).add(params.group);
        }
        graphic
            .css(css)
            .attr(params.attribs)
            .animate(
                animatableAttribs,
                params.isNew ? false : undefined,
                onComplete
            );
    } else if (graphic) {
        graphic.animate(animatableAttribs, undefined, function () {
            point.graphic = graphic = graphic.destroy();
            if (isFn(onComplete)) {
                onComplete();
            }
        });
    }
    if (graphic) {
        graphic.addClass(point.getClassName(), true);
    }
};

export default draw;

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aw-highstock_rails-7.0.3 vendor/assets/javascripts/highstock/es-modules/mixins/draw-point.js