|
|
|
@ -6,6 +6,10 @@ import _ from 'lodash'; |
|
|
|
|
* @param align Y level |
|
|
|
|
*/ |
|
|
|
|
export function alignYLevel(yaxis, alignLevel) { |
|
|
|
|
if (isNaN(alignLevel) || !checkCorrectAxis(yaxis)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var [yLeft, yRight] = yaxis; |
|
|
|
|
moveLevelToZero(yLeft, yRight, alignLevel); |
|
|
|
|
|
|
|
|
@ -92,6 +96,14 @@ function restoreLevelFromZero(yLeft, yRight, alignLevel) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function checkCorrectAxis(axis) { |
|
|
|
|
return axis.length === 2 && checkCorrectAxes(axis[0]) && checkCorrectAxes(axis[1]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function checkCorrectAxes(axes) { |
|
|
|
|
return 'min' in axes && 'max' in axes; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function checkOneSide(yLeft, yRight) { |
|
|
|
|
// on the one hand with respect to zero
|
|
|
|
|
return (yLeft.min >= 0 && yRight.min >= 0) || (yLeft.max <= 0 && yRight.max <= 0); |
|
|
|
|