I’ve a ck editor. So I’ve set max peak and width of the ck editor field.
I’ve written a code the place it’ll test if max line is reached then you definately get an error message.
So now what is occurring is that i zoom out my browser to 67% and that i write one thing contained in the CK editor until i’m allowed to write down as per the under code which works nice after which i enhance the zoom to 75% what i see is that i get the warning that’s You could have exceeded the variety of printed strains allowed as per my code. However how come it’s altering when the zoom will increase.
I’m assuming that const printedParagraphHeight: quantity = this.printPreviewContainer.nativeElement.offsetHeight;
is getting modified when the zoom degree will increase.
Are you able to assist me what i’m doing fallacious.
CODE :
personal calculateHeight() {
const maxHeightAllowed = parseFloat(this.peak.exchange('px', ''));
const maxNumberOfLines = Math.ground(maxHeightAllowed / this.printLineHeight);
const printedParagraphHeight: quantity = this.printPreviewContainer.nativeElement.offsetHeight;
const currentNumberOfLines = Math.ground(printedParagraphHeight / this.printLineHeight);
const currentHeightPercentage = Math.ground(currentNumberOfLines / maxNumberOfLines * 100);
this._eventService.EmitEvent('onLineLimitRemoved', this.headerText);
if (printedParagraphHeight >= 0) {
if (currentHeightPercentage > 100) {
this.makeTooltip(`You could have exceeded the variety of printed strains allowed. Presently utilizing ${currentNumberOfLines} of ${maxNumberOfLines} complete printable strains, or ${currentHeightPercentage}%`, true);
this._eventService.EmitEvent('onlineLimitReached', this.headerText);
} else {
this.makeTooltip(`Presently utilizing ${currentNumberOfLines} of ${maxNumberOfLines} complete printable strains, or ${currentHeightPercentage}%`, false);
}
}
}