]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Line points need always need to pivot after regardless of whether or not bezier point... 2649/head
authorEvert Timberg <evert.timberg+github@gmail.com>
Fri, 27 May 2016 00:02:46 +0000 (20:02 -0400)
committerEvert Timberg <evert.timberg+github@gmail.com>
Fri, 27 May 2016 00:02:46 +0000 (20:02 -0400)
src/controllers/controller.line.js

index 4c692d5aba1ead96c33b16d0518840484e694db8..ef3f2b65d4b22731c0322edbad516de5572bdb9d 100644 (file)
@@ -32,11 +32,12 @@ module.exports = function(Chart) {
                addElementAndReset: function(index) {
                        var me = this;
                        var options = me.chart.options;
+                       var meta = me.getMeta();
 
                        Chart.DatasetController.prototype.addElementAndReset.call(me, index);
 
                        // Make sure bezier control points are updated
-                       if (options.showLines && options.elements.line.tension !== 0) {
+                       if (options.showLines && meta.dataset._model.tension !== 0) {
                                me.updateBezierControlPoints();
                        }
                },
@@ -92,9 +93,14 @@ module.exports = function(Chart) {
                                me.updateElement(points[i], i, reset);
                        }
 
-                       if (options.showLines && lineElementOptions.tension !== 0) {
+                       if (options.showLines && line._model.tension !== 0) {
                                me.updateBezierControlPoints();
                        }
+
+                       // Now pivot the point for animation
+                       for (i=0, ilen=points.length; i<ilen; ++i) {
+                               points[i].pivot();
+                       }
                },
 
                getPointBackgroundColor: function(point, index) {
@@ -244,9 +250,6 @@ module.exports = function(Chart) {
                                model.controlPointPreviousY = Math.max(Math.min(controlPoints.previous.y, area.bottom), area.top);
                                model.controlPointNextX = Math.max(Math.min(controlPoints.next.x, area.right), area.left);
                                model.controlPointNextY = Math.max(Math.min(controlPoints.next.y, area.bottom), area.top);
-
-                               // Now pivot the point for animation
-                               point.pivot();
                        }
                },