Skip to content

Commit 84fbe09

Browse files
committed
Simpler code, less comparison.
1 parent a7185f9 commit 84fbe09

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/plots/cartesian/set_convert.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,12 @@ module.exports = function setConvert(ax, fullLayout) {
451451
var r0 = ax.r2l(ax.range[0]);
452452
var r1 = ax.r2l(ax.range[1]);
453453

454-
return Math.min(r0, r1) <= coord && coord <= Math.max(r0, r1);
454+
if(r0 < r1) {
455+
return r0 <= coord && coord <= r1;
456+
} else {
457+
// Reversed axis case.
458+
return r1 <= coord && coord <= r0;
459+
}
455460
};
456461

457462
ax.clearCalc = function() {

0 commit comments

Comments
 (0)