Browse Source

fixed isWithinBar() crash when there were less than 2 items in pathSegList

pull/1550/head
Andy Dufilie 9 years ago
parent
commit
d088646098
  1. 3
      src/shape.bar.js

3
src/shape.bar.js

@ -113,6 +113,9 @@ c3_chart_internal_fn.generateGetBarPoints = function (barIndices, isSub) {
}; };
}; };
c3_chart_internal_fn.isWithinBar = function (that) { c3_chart_internal_fn.isWithinBar = function (that) {
if (that.pathSegList.numberOfItems < 2) {
return false;
}
var mouse = this.d3.mouse(that), box = that.getBoundingClientRect(), var mouse = this.d3.mouse(that), box = that.getBoundingClientRect(),
seg0 = that.pathSegList.getItem(0), seg1 = that.pathSegList.getItem(1), seg0 = that.pathSegList.getItem(0), seg1 = that.pathSegList.getItem(1),
x = Math.min(seg0.x, seg1.x), y = Math.min(seg0.y, seg1.y), x = Math.min(seg0.x, seg1.x), y = Math.min(seg0.y, seg1.y),

Loading…
Cancel
Save