Limit the "edges" of the grid.
This commit is contained in:
parent
41fafae501
commit
27a29d9c66
1 changed files with 11 additions and 1 deletions
|
|
@ -166,7 +166,17 @@ function initGridWidget(root, opts = {}) {
|
||||||
|
|
||||||
let prevLineEnd = null;
|
let prevLineEnd = null;
|
||||||
|
|
||||||
const toInt = (n) => Math.round(Number(n) * q);
|
const MAX_DOC_COORD = 1_000_000;
|
||||||
|
const MAX_INT = MAX_DOC_COORD * q;
|
||||||
|
|
||||||
|
const clampInt = (v) => {
|
||||||
|
if (!Number.isFinite(v)) return 0;
|
||||||
|
if (v > MAX_INT) return MAX_INT;
|
||||||
|
if (v < -MAX_INT) return -MAX_INT;
|
||||||
|
return v;
|
||||||
|
};
|
||||||
|
|
||||||
|
const toInt = (n) => clampInt(Math.round(Number(n) * q));
|
||||||
|
|
||||||
const resetRun = () => {
|
const resetRun = () => {
|
||||||
prevKind = null;
|
prevKind = null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue