(focus: Record<LineIndex, true | ColumnIndex[]>)
| 76 | } |
| 77 | |
| 78 | export function getFocusSize(focus: Record<LineIndex, true | ColumnIndex[]>) { |
| 79 | const lineIndexList = Object.keys(focus).map(k => +k); |
| 80 | const focusStart = Math.min.apply(Math, lineIndexList); |
| 81 | const focusEnd = Math.max.apply(Math, lineIndexList); |
| 82 | return { |
| 83 | focusCenter: (focusStart + focusEnd + 1) / 2, |
| 84 | focusCount: focusEnd - focusStart + 1 |
| 85 | }; |
| 86 | } |
| 87 | |
| 88 | export class LineOrColumnNumberError extends Error { |
| 89 | constructor() { |