From fa1e3daa6fa8ed20c138765f44f0893436225c80 Mon Sep 17 00:00:00 2001 From: PMKuipers Date: Tue, 18 Jul 2023 13:40:30 +0200 Subject: [PATCH] sudyline header height fix --- amd/src/studyplan-editor-components.js | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/amd/src/studyplan-editor-components.js b/amd/src/studyplan-editor-components.js index 09fcd3f..7437e1c 100644 --- a/amd/src/studyplan-editor-components.js +++ b/amd/src/studyplan-editor-components.js @@ -1525,26 +1525,18 @@ export default { // When one of those updates is received, record the height and recalculate the total height of the // header if(lineid == this.value.id){ - let offset = ""; - if(this.value.sequence==1 || this.value.sequence==this.numlines) { - const cstyle = getComputedStyle(this.$refs.mainEl); - offset = " + " +cstyle.borderTopWidth + " + " + cstyle.borderBottomWidth; - //debug.info("Adding extra height to offset border",cstyle); - } - const items = document.querySelectorAll( - `.t-studyplan-content-edit .t-studyline-slot-0[data-studyline='${this.value.id}']`); + `.t-studyline-slot-0[data-studyline='${this.value.id}']`); + // determine the height of all the lines and add them up. let heightSum = 0; - for(const ix in items){ - debug.info(items[ix]); - const height = items[ix].clientHeight; + items.forEach((el) => { + const height = el.offsetHeight; heightSum += height; - } + }); - debug.info(`Line height change line ${lineid} layer ${layerid}`, items, heightSum); - const heightStyle=`calc( ${heightSum}px ${offset})`; - //debug.info(`Received line height change line ${lineid} to ${heightStyle}`); + const heightStyle=`${heightSum-0.5}px`; + debug.info(`Received line height change line ${lineid} to ${heightStyle}`); this.$refs.mainEl.style.height = heightStyle; } }