From d8af4381b5c7530ce8dec49ffbd9e9b5cd216372 Mon Sep 17 00:00:00 2001 From: Dmitry Kuzin Date: Mon, 22 Apr 2024 17:34:32 +0400 Subject: [PATCH] Do not use row.visibleElement in pdf --- src/flat_layout/flat_survey.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/flat_layout/flat_survey.ts b/src/flat_layout/flat_survey.ts index 4f64ad5..d0dc334 100644 --- a/src/flat_layout/flat_survey.ts +++ b/src/flat_layout/flat_survey.ts @@ -70,12 +70,13 @@ export class FlatSurvey { const width: number = SurveyHelper.getPageAvailableWidth(controller); let nextMarginLeft: number = controller.margins.left; const rowFlats: IPdfBrick[] = []; - for (let i: number = 0; i < row.visibleElements.length; i++) { - let element: IElement = row.visibleElements[i]; + const visibleElements = row.elements.filter(el => el.isVisible); + for (let i: number = 0; i < visibleElements.length; i++) { + let element: IElement = visibleElements[i]; if (!element.isVisible) continue; const persWidth: number = SurveyHelper.parseWidth(element.renderWidth, - width - (row.visibleElements.length - 1) * controller.unitWidth, - row.visibleElements.length); + width - (visibleElements.length - 1) * controller.unitWidth, + visibleElements.length); controller.margins.left = nextMarginLeft + ((i !== 0) ? controller.unitWidth : 0); controller.margins.right = controller.paperWidth - controller.margins.left - persWidth; currPoint.xLeft = controller.margins.left;