From 82ac1d56e0bcd0ac62c746b2fb74fe1c1f65b491 Mon Sep 17 00:00:00 2001 From: flop Date: Fri, 22 May 2026 17:50:33 +0200 Subject: [PATCH] fix: sections change instead of deleteing --- ts/src/browser.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ts/src/browser.ts b/ts/src/browser.ts index f4c650d..0e6fc78 100644 --- a/ts/src/browser.ts +++ b/ts/src/browser.ts @@ -218,14 +218,17 @@ function setSectionField(si: number, key: string, val: any) { function setSectionType(si: number, sectionType: string) { const sec = getSectionByIndex(si); if (!sec) return; + const wasElementsSection = sec.sectionType !== MonoDisplay.SectionType.CustomFont; (sec as any).sectionType = MonoDisplay.StringToSectionType[sectionType as MonoDisplay.SectionTypeName]; if ((sec as any).sectionType === MonoDisplay.SectionType.CustomFont) { (sec as any).fontData = new Uint8Array(); delete (sec as any).elements; delete (sec as any).flags; } else { - (sec as any).elements = []; - (sec as any).flags = {}; + if (!wasElementsSection) { + (sec as any).elements = []; + (sec as any).flags = {}; + } delete (sec as any).fontData; if ((sec as any).sectionType === MonoDisplay.SectionType.ElementsTimespan) { const now = BigInt(Math.floor(Date.now() / 1000));