Perfect lineout of line heading height matching

This commit is contained in:
PMKuipers 2023-07-18 13:49:41 +02:00
parent fa1e3daa6f
commit b9e531c9ea

View file

@ -1531,12 +1531,13 @@ export default {
// determine the height of all the lines and add them up.
let heightSum = 0;
items.forEach((el) => {
const height = el.offsetHeight;
// getBoundingClientRect() Gets the actual fractional height instead of rounded to integer pixels
const r = el.getBoundingClientRect();
const height = r.height;
heightSum += height;
});
const heightStyle=`${heightSum-0.5}px`;
debug.info(`Received line height change line ${lineid} to ${heightStyle}`);
const heightStyle=`${heightSum}px`;
this.$refs.mainEl.style.height = heightStyle;
}
}
@ -1671,12 +1672,9 @@ 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(() => {
if(self.$refs.sizeElement){
const height = self.$refs.sizeElement.clientHeight;
debug.info(`Sending height change event line ${self.line.id} height ${height}`);
const height = self.$refs.sizeElement.getBoundingClientRect().height;
ItemEventBus.$emit('lineHeightChange', self.line.id, self.layer, height);
}
}).observe(self.$refs.sizeElement);