Skip to content

Commit

Permalink
Work around for ts compile error
Browse files Browse the repository at this point in the history
Signed-off-by: andreasma <maand@gmx.de>
Change-Id: I98d96979c18e43c6fb4b1976cbac968ce15baffa
  • Loading branch information
andreasma committed Jun 22, 2024
1 parent 051336e commit 7d08b6c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions browser/src/canvas/CanvasSectionContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,9 @@ class CanvasSectionContainer {
section.size[1] = Math.round(section.size[1]);
}


private calculateSectionInitialPosition(section: CanvasSectionObject, index: number): number {
// @ts-expect-error because alternative got type 'never'.
if (typeof section.anchor[index] === 'string' || section.anchor[index].length === 1) {
var anchor: string = typeof section.anchor[index] === 'string' ? section.anchor[index]: section.anchor[index][0];
if (index === 0)
Expand All @@ -1540,11 +1542,13 @@ class CanvasSectionContainer {
// Count should always be an odd number. Because last variable will be used as a fallback to canvas's edges (top, bottom, right or left).
// See anchor explanation on top of this file.
// Correct example: ["header", "bottom", "top"] => Look for section "header", if found, use its bottom, if not found, use canvas's top.
// @ts-expect-error because type never has no attribute length.
if (section.anchor[index].length % 2 === 0) { // eslint-disable-line no-lonely-if
console.error('Section: ' + section.name + '. Wrong anchor definition.');
return 0;
}
else {
// @ts-expect-error because type never has no attribute length.
var count: number = section.anchor[index].length;
var targetSection: CanvasSectionObject = null;
var targetEdge: string = null;
Expand Down

0 comments on commit 7d08b6c

Please sign in to comment.