From f39f8548215d4c01028f9de5ec7286b9e801a7c0 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 26 Sep 2022 21:54:50 +0100 Subject: [PATCH] delay height calculation --- app/static/css/partials/_layout.scss | 7 ------- app/static/css/partials/_text.scss | 24 +++++++++++++++++++++++- app/static/js/ascroll.js | 21 +++++++++++++-------- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/app/static/css/partials/_layout.scss b/app/static/css/partials/_layout.scss index 94307b5..43a4a30 100755 --- a/app/static/css/partials/_layout.scss +++ b/app/static/css/partials/_layout.scss @@ -61,13 +61,6 @@ main { line-height: 1.2em; } -i { - font-style: italic; -} - -b { - font-weight: bold; -} nav { a { diff --git a/app/static/css/partials/_text.scss b/app/static/css/partials/_text.scss index ea2606f..5712c32 100755 --- a/app/static/css/partials/_text.scss +++ b/app/static/css/partials/_text.scss @@ -30,7 +30,13 @@ font-weight: 700; font-style: normal; } - +@font-face { + font-family: 'noto_sans'; + src: url('../../static/fonts/noto-sans/noto-sans-bold-webfont.woff2') format('woff2'), + url('../../static/fonts/noto-sans/noto-sans-bold-webfont.woff') format('woff'); + font-weight: 700; + font-style: bold; +} @font-face { font-family: 'noto_sans'; src: url('noto-sans-bold-italic-webfont.woff2') format('woff2'), @@ -38,6 +44,14 @@ font-weight: 700; font-style: italic; } +@font-face { + font-family: 'noto_sans'; + src: url('noto-sans-bold-italic-webfont.woff2') format('woff2'), + url('noto-sans-bold-italic-webfont.woff') format('woff'); + font-weight: 700; + font-style: bold italic; +} + // Text: Global Classes @@ -52,6 +66,14 @@ strong { em { font-style: italic; } +i { + font-style: italic; +} + +b { + font-weight: bold; + font-weight: 700; +} .font-size-sm { font-size: 18px; diff --git a/app/static/js/ascroll.js b/app/static/js/ascroll.js index 203e420..8f02a34 100644 --- a/app/static/js/ascroll.js +++ b/app/static/js/ascroll.js @@ -445,14 +445,19 @@ function renderSingleMode(config) { annot.style.position = 'absolute' text.appendChild(annot) }) - var height = 0 - text.querySelectorAll('.annotation.single').forEach(annotation => { - var rect = annotation.getBoundingClientRect() - if (rect.height > height) { - height = rect.height - } - }) - text.style.height = height + 'px'; + if (config.annotations.length) { + text.style.height = '72px'; + } + setTimeout(() => { + var height = 0 + text.querySelectorAll('.annotation.single').forEach(annotation => { + var rect = annotation.getBoundingClientRect() + if (rect.height > height) { + height = rect.height + } + }) + text.style.height = height + 'px'; + }, 50) if (frame) { updatePlayer(config.video, frame, config['in'], config['out'], src, config) }