diff --git a/src/core/core.scale.js b/src/core/core.scale.js index c8fc02bbc..ae3a2697c 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -2,7 +2,7 @@ import defaults from './core.defaults'; import Element from './core.element'; import {_alignPixel, _measureText} from '../helpers/helpers.canvas'; import {callback as call, each, isArray, isFinite, isNullOrUndef, isObject, valueOrDefault} from '../helpers/helpers.core'; -import {_factorize, toDegrees, toRadians} from '../helpers/helpers.math'; +import {_factorize, toDegrees, toRadians, _int32Range} from '../helpers/helpers.math'; import {toFont, resolve, toPadding} from '../helpers/helpers.options'; import Ticks from './core.ticks'; @@ -981,7 +981,7 @@ export default class Scale extends Element { decimal = 1 - decimal; } - return me._startPixel + decimal * me._length; + return _int32Range(me._startPixel + decimal * me._length); } /** diff --git a/src/helpers/helpers.math.js b/src/helpers/helpers.math.js index b01c9b292..2fc9043c1 100644 --- a/src/helpers/helpers.math.js +++ b/src/helpers/helpers.math.js @@ -172,3 +172,7 @@ export function _angleBetween(angle, start, end) { export function _limitValue(value, min, max) { return Math.max(min, Math.min(max, value)); } + +export function _int32Range(value) { + return _limitValue(value, -2147483648, 2147483647); +}