fix: skip coastline out points wip

This commit is contained in:
max 2022-07-23 15:02:25 +03:00
parent 3215b6f0d2
commit 19d7f239c1
9 changed files with 262 additions and 64 deletions

View file

@ -8,6 +8,27 @@ export function unique<T>(array: T[]) {
return [...new Set(array)];
}
export function sliceFragment<T>(array: T[], index: number, zone: number) {
if (zone + 1 + zone >= array.length) {
return array.slice();
}
const start = index - zone;
const end = index + zone;
if (start < 0) {
return array.slice(0, end).concat(array.slice(start));
}
if (end >= array.length) {
return array.slice(start).concat(array.slice(0, end % array.length));
}
return array.slice(start, end);
}
window.sliceFragment = sliceFragment;
interface ICreateTypesArrayLength {
maxValue: number;
length: number;