From f8896ddfdb5e60f1df4b31ea7779d218985e6adc Mon Sep 17 00:00:00 2001 From: PMKuipers Date: Mon, 10 Jul 2023 23:11:23 +0200 Subject: [PATCH] Implemented height fixer for header --- amd/src/studyplan-editor-components.js | 46 +++++++++++++++++++++++--- amd/src/studyplan-processor.js | 1 - 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/amd/src/studyplan-editor-components.js b/amd/src/studyplan-editor-components.js index 372c893..f0015ac 100644 --- a/amd/src/studyplan-editor-components.js +++ b/amd/src/studyplan-editor-components.js @@ -1362,7 +1362,8 @@ export default { :slotindex="index" :line="line" :plan="value" - :class= "'t-studyline ' + (line.sequence==1?' first':'') + (line.sequence==numlines?' last':'')" + :class= "'t-studyline ' + (line.sequence==1?' first':'') + + (line.sequence==value.studylines.length?' last':'')" >
{{ value.shortname }} @@ -1602,6 +1622,23 @@ export default { }, }, + mounted() { + const self=this; + if(self.type == "gradable" && self.slotindex == 1){ + debug.info(`Creating height listener for line ${self.line.id} type ${self.type} slot ${self.slotindex}`, + "element",self.$refs.sizeElement); + self.resizeListener = new ResizeObserver(() => { + const height = self.$refs.sizeElement.clientHeight; + debug.info(`Sending height change event line ${self.line.id} height ${height}`); + ItemEventBus.$emit('lineHeightChange', self.line.id, height); + }).observe(self.$refs.sizeElement); + } + }, + unmounted() { + if(this.resizeListener) { + this.resizeListener.disconnect(); + } + }, computed: { listtype() { return this.type; @@ -1616,6 +1653,7 @@ export default { }, data() { return { + resizeListener: null, }; }, methods: { @@ -1755,7 +1793,7 @@ export default { template: `