@protacon/arrow-ui-react-components
Advanced tools
Comparing version 4.6.2 to 4.6.3
@@ -58,3 +58,10 @@ "use strict"; | ||
var mousePosition = (e.pageX - bounds.left) / bounds.width; | ||
var index = partPositions.findIndex(function (c) { return mousePosition >= c.left && mousePosition < c.right; }); | ||
var index = -1; | ||
var i = partPositions.length; | ||
while (i--) { | ||
if (mousePosition >= partPositions[i].left && mousePosition < partPositions[i].right) { | ||
index = i; | ||
break; | ||
} | ||
} | ||
if (currentPartIndex !== index) | ||
@@ -69,2 +76,9 @@ _this.setState({ currentPartIndex: index }); | ||
}; | ||
_this.getTimelineEnd = function () { | ||
return _this.props.timeline.reduce(function (acc, part) { | ||
if (part.end > acc) | ||
return part.end; | ||
return acc; | ||
}, 0); | ||
}; | ||
return _this; | ||
@@ -93,2 +107,3 @@ } | ||
var timelinePart = timeline[currentPartIndex]; | ||
var endTimeMillis = this.getTimelineEnd(); | ||
return (react_1.default.createElement("div", { className: "timeline" }, | ||
@@ -107,3 +122,3 @@ showLabels && (react_1.default.createElement("div", { className: "start-end-labels" }, | ||
react_1.default.createElement("div", { className: "tooltip" }, renderTooltip ? renderTooltip(currentPartIndex) : timelinePart.text)))), | ||
showLabels && timeline.length > 0 && (react_1.default.createElement("div", { className: "timeline-end-label", style: { width: "calc(" + calculateEndLabelPosition(start, end, timeline[timeline.length - 1].end) + " + 45px" } }, getFormattedDate(timeline[timeline.length - 1].end))))); | ||
showLabels && timeline.length > 0 && (react_1.default.createElement("div", { className: "timeline-end-label", style: { width: "calc(" + calculateEndLabelPosition(start, end, endTimeMillis) + " + 45px" } }, getFormattedDate(endTimeMillis))))); | ||
}; | ||
@@ -110,0 +125,0 @@ return Timeline; |
{ | ||
"name": "@protacon/arrow-ui-react-components", | ||
"version": "4.6.2", | ||
"version": "4.6.3", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "main": "build/lib/index.js", |
Sorry, the diff of this file is not supported yet
205482
2969