fixed scrolling conflict on description editor
This commit is contained in:
parent
9e7559b078
commit
df0f5c7a87
|
@ -9,7 +9,7 @@
|
||||||
<ng-container >
|
<ng-container >
|
||||||
|
|
||||||
<span class="table-entry"
|
<span class="table-entry"
|
||||||
(click)="toggleExpand(idx);navigateToFieldSet(entry, $event); onEntrySelected(entry)"
|
(click)="onScrollStarted(entry); toggleExpand(idx);navigateToFieldSet(entry, $event); onEntrySelected(entry);"
|
||||||
[ngStyle]="calculateStyle(entry)"
|
[ngStyle]="calculateStyle(entry)"
|
||||||
[ngClass]="calculateClass(entry)"
|
[ngClass]="calculateClass(entry)"
|
||||||
>
|
>
|
||||||
|
@ -41,6 +41,8 @@
|
||||||
[propertiesFormGroup]="propertiesFormGroup"
|
[propertiesFormGroup]="propertiesFormGroup"
|
||||||
[parentId]="entry.id"
|
[parentId]="entry.id"
|
||||||
[parentMap]="updatedMap"
|
[parentMap]="updatedMap"
|
||||||
|
(scrollFinished)="onScrollFinished($event)"
|
||||||
|
(scrollStarted)="onScrollStarted($event)"
|
||||||
>
|
>
|
||||||
|
|
||||||
</table-of-contents-internal>
|
</table-of-contents-internal>
|
||||||
|
|
|
@ -19,6 +19,8 @@ export class TableOfContentsInternal implements OnInit, OnDestroy {
|
||||||
@Input() selected: ToCEntry = null;
|
@Input() selected: ToCEntry = null;
|
||||||
// @Input() visibilityRules:Rule[] = [];
|
// @Input() visibilityRules:Rule[] = [];
|
||||||
@Output() entrySelected = new EventEmitter<ToCEntry>();
|
@Output() entrySelected = new EventEmitter<ToCEntry>();
|
||||||
|
@Output() scrollStarted = new EventEmitter<ToCEntry>();
|
||||||
|
@Output() scrollFinished = new EventEmitter<ToCEntry>();
|
||||||
@Input() propertiesFormGroup: UntypedFormGroup;
|
@Input() propertiesFormGroup: UntypedFormGroup;
|
||||||
|
|
||||||
expandChildren: boolean[];
|
expandChildren: boolean[];
|
||||||
|
@ -162,18 +164,28 @@ export class TableOfContentsInternal implements OnInit, OnDestroy {
|
||||||
const element = document.getElementById(fieldSetId);
|
const element = document.getElementById(fieldSetId);
|
||||||
if (element) {
|
if (element) {
|
||||||
element.scrollIntoView({ behavior: 'smooth' });
|
element.scrollIntoView({ behavior: 'smooth' });
|
||||||
|
// element.focus({preventScroll: true});
|
||||||
|
setTimeout(() => {
|
||||||
|
this.scrollFinished.emit(entry);
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onEntrySelected(entry: ToCEntry) {
|
onEntrySelected(entry: ToCEntry) {
|
||||||
this.entrySelected.emit(entry);
|
this.entrySelected.emit(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onScrollStarted(entry: ToCEntry) {
|
||||||
|
this.scrollStarted.emit(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
onScrollFinished(entry: ToCEntry) {
|
||||||
|
this.scrollFinished.emit(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
calculateStyle(entry: ToCEntry) {
|
calculateStyle(entry: ToCEntry) {
|
||||||
const style = {};
|
const style = {};
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
[visibilityRulesService]="visibilityRulesService"
|
[visibilityRulesService]="visibilityRulesService"
|
||||||
[propertiesFormGroup]="formGroup"
|
[propertiesFormGroup]="formGroup"
|
||||||
[parentMap]="pageToFieldSetMap"
|
[parentMap]="pageToFieldSetMap"
|
||||||
|
(scrollFinished)="onScrollFinished($event)"
|
||||||
|
(scrollStarted)="onScrollStarted($event)"
|
||||||
>
|
>
|
||||||
|
|
||||||
</table-of-contents-internal>
|
</table-of-contents-internal>
|
||||||
|
|
|
@ -55,6 +55,7 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
|
||||||
|
|
||||||
private _tocentrySelected: ToCEntry = null;
|
private _tocentrySelected: ToCEntry = null;
|
||||||
private isSelecting: boolean = false;
|
private isSelecting: boolean = false;
|
||||||
|
private isScrolling: boolean = false;
|
||||||
private _intersectionObserver: IntersectionObserver;
|
private _intersectionObserver: IntersectionObserver;
|
||||||
private _actOnObservation: boolean = true;
|
private _actOnObservation: boolean = true;
|
||||||
public hiddenEntries: string[] = [];
|
public hiddenEntries: string[] = [];
|
||||||
|
@ -219,15 +220,30 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.forEach(ie => {
|
entries.forEach(ie => {
|
||||||
|
if (this.isScrolling) return;
|
||||||
|
|
||||||
if (ie.isIntersecting) {
|
if (ie.isIntersecting) {
|
||||||
try {
|
try {
|
||||||
const target_id = ie.target.id;
|
if(!this.isScrolling) {
|
||||||
if (this.visibilityRulesService.isVisibleMap[target_id] ?? true) {
|
const target_id = ie.target.id;
|
||||||
this.onToCentrySelected(this._findTocEntryById(target_id, this.tocentries));
|
if (this.visibilityRulesService.isVisibleMap[target_id] ?? true) {
|
||||||
|
this.onToCentrySelected(this._findTocEntryById(target_id, this.tocentries));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setTimeout(() => {
|
||||||
|
// try {
|
||||||
|
// if(!this.isSelecting) {
|
||||||
|
// const target_id = ie.target.id;
|
||||||
|
// if (this.visibilityRulesService.isVisibleMap[target_id] ?? true) {
|
||||||
|
// this.onToCentrySelected(this._findTocEntryById(target_id, this.tocentries));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch {
|
||||||
|
// }
|
||||||
|
// }, 1000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, options);
|
}, options);
|
||||||
|
@ -428,6 +444,14 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onScrollStarted(entry: ToCEntry) {
|
||||||
|
this.isScrolling = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
onScrollFinished(entry: ToCEntry) {
|
||||||
|
this.isScrolling = false;
|
||||||
|
}
|
||||||
|
|
||||||
private _findTocEntryById(id: string, tocentries: ToCEntry[]): ToCEntry {
|
private _findTocEntryById(id: string, tocentries: ToCEntry[]): ToCEntry {
|
||||||
if (!tocentries || !tocentries.length) {
|
if (!tocentries || !tocentries.length) {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue