Skip to content
Snippets Groups Projects
Commit d4bb9e18 authored by jojohoch's avatar jojohoch
Browse files

Fix chromium bug when calculating dynamic rows for text areas

#691

- Due to the width of the scrollbar, text areas change their inner width
under Chromium when the scrollbar is displayed. The use of offsetWidth
instead of contentRect ignores the presence of the scrollbar. The
calculation is therefore less accurate, but sufficient for estimating
the number of rows
parent eecc706e
No related branches found
No related tags found
No related merge requests found
Pipeline #64648 failed
Allgemein
=========
## next
### Fehlerbehebungen
- Behebt "Flackern"-Fehler von Eingabebereichen mit dynamischen Zeilen unter Chromium
## editor/2.5.0+player/2.5.0
### Neue Funktion
- Neues Element: Tabelle
......
import {
AfterViewInit, ChangeDetectorRef, Directive, ElementRef, EventEmitter, Input, NgZone, OnChanges, Output, SimpleChanges
AfterViewInit,
ChangeDetectorRef,
Directive,
ElementRef,
EventEmitter,
Input,
NgZone,
OnChanges,
OnInit,
Output,
SimpleChanges
} from '@angular/core';
@Directive({
selector: '[dynamicRows]'
})
export class DynamicRowsDirective implements AfterViewInit, OnChanges {
export class DynamicRowsDirective implements OnInit, AfterViewInit, OnChanges {
@Input() fontSize!: number;
@Input() expectedCharactersCount!: number;
@Output() dynamicRowsChange: EventEmitter<number> = new EventEmitter<number>();
......@@ -20,9 +30,9 @@ export class DynamicRowsDirective implements AfterViewInit, OnChanges {
) {}
ngOnInit(): void {
this.observer = new ResizeObserver(entries => {
this.observer = new ResizeObserver(() => {
this.zone.run(() => {
this.width = (entries[0].contentRect.width);
this.width = this.elementRef.nativeElement.offsetWidth;
this.calculateDynamicRows();
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment