123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- 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;
|