Oops, fix type error.
rodzic
aa87e3b77e
commit
9ac1243249
14
lib/specs.ts
14
lib/specs.ts
|
@ -106,11 +106,8 @@ function sortedPoints(points: PointWithNormal[]): PointWithNormal[] {
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortedPointConcat(
|
function concat<T>(first: T[] | undefined, second: T[]): T[] {
|
||||||
first: PointWithNormal[] | undefined,
|
return first ? [...first, ...second] : second;
|
||||||
second: PointWithNormal[]
|
|
||||||
): PointWithNormal[] {
|
|
||||||
return first ? sortedPoints([...first, ...second]) : sortedPoints(second);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ATTACHMENT_COLOR_MAP = new Map(
|
const ATTACHMENT_COLOR_MAP = new Map(
|
||||||
|
@ -126,9 +123,8 @@ function updateSpecs(fill: string, path: string, specs: Specs): Specs {
|
||||||
if (attachmentType) {
|
if (attachmentType) {
|
||||||
return {
|
return {
|
||||||
...specs,
|
...specs,
|
||||||
[attachmentType]: sortedPointConcat(
|
[attachmentType]: sortedPoints(
|
||||||
specs[attachmentType],
|
concat(specs[attachmentType], getArrowPoints(path))
|
||||||
getArrowPoints(path)
|
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -136,7 +132,7 @@ function updateSpecs(fill: string, path: string, specs: Specs): Specs {
|
||||||
if (fill === colors.NESTING_BOUNDING_BOX_COLOR) {
|
if (fill === colors.NESTING_BOUNDING_BOX_COLOR) {
|
||||||
return {
|
return {
|
||||||
...specs,
|
...specs,
|
||||||
nesting: sortedPointConcat(specs.nesting, getBoundingBoxes(path)),
|
nesting: concat(specs.nesting, getBoundingBoxes(path)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue