|
|
|
@ -218,14 +218,17 @@ function setSectionField(si: number, key: string, val: any) { |
|
|
|
function setSectionType(si: number, sectionType: string) { |
|
|
|
function setSectionType(si: number, sectionType: string) { |
|
|
|
const sec = getSectionByIndex(si); |
|
|
|
const sec = getSectionByIndex(si); |
|
|
|
if (!sec) return; |
|
|
|
if (!sec) return; |
|
|
|
|
|
|
|
const wasElementsSection = sec.sectionType !== MonoDisplay.SectionType.CustomFont; |
|
|
|
(sec as any).sectionType = MonoDisplay.StringToSectionType[sectionType as MonoDisplay.SectionTypeName]; |
|
|
|
(sec as any).sectionType = MonoDisplay.StringToSectionType[sectionType as MonoDisplay.SectionTypeName]; |
|
|
|
if ((sec as any).sectionType === MonoDisplay.SectionType.CustomFont) { |
|
|
|
if ((sec as any).sectionType === MonoDisplay.SectionType.CustomFont) { |
|
|
|
(sec as any).fontData = new Uint8Array(); |
|
|
|
(sec as any).fontData = new Uint8Array(); |
|
|
|
delete (sec as any).elements; |
|
|
|
delete (sec as any).elements; |
|
|
|
delete (sec as any).flags; |
|
|
|
delete (sec as any).flags; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
if (!wasElementsSection) { |
|
|
|
(sec as any).elements = []; |
|
|
|
(sec as any).elements = []; |
|
|
|
(sec as any).flags = {}; |
|
|
|
(sec as any).flags = {}; |
|
|
|
|
|
|
|
} |
|
|
|
delete (sec as any).fontData; |
|
|
|
delete (sec as any).fontData; |
|
|
|
if ((sec as any).sectionType === MonoDisplay.SectionType.ElementsTimespan) { |
|
|
|
if ((sec as any).sectionType === MonoDisplay.SectionType.ElementsTimespan) { |
|
|
|
const now = BigInt(Math.floor(Date.now() / 1000)); |
|
|
|
const now = BigInt(Math.floor(Date.now() / 1000)); |
|
|
|
|