Skip to content

Commit

Permalink
increase timeout if new panel expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
novikov82 committed Dec 19, 2024
1 parent 9005919 commit e00ae22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export class PropertyGridViewModel extends Base {
}

private onSurveyChanged() {
if (this.creator["animationEnabled"]) this.searchManager.scrollElementToViewTimeout = 400;
this.survey = this.propertyGridModel.survey;
this.searchManager.setSurvey(this.survey);
if (!!this.survey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ export class SearchManagerPropertyGrid extends SearchManager {
protected getFilterStringPlaceholder(): string { return getLocString("ed.propertyGridFilteredTextPlaceholder"); }
public get propertyGridNoResultsFound(): string { return getLocString("ed.propertyGridNoResultsFound"); }

public scrollElementToViewTimeout = 10;

@property() survey: SurveyModel;
@property() isVisible: boolean;
@property({ defaultValue: [] }) allMatches: Array<Question>;

private lastCollapsedElement: IElement;
private expandAllParents(element: IElement) {
if (!element) return;
if ((<any>element).page && (<any>element).survey) {
(<any>element).survey.currentPage = (<any>element).page;
}
if (element.isCollapsed) {
this.lastCollapsedElement = element;
(element as any).expand(false);
}
this.expandAllParents((<any>element).parent);
Expand All @@ -34,11 +34,13 @@ export class SearchManagerPropertyGrid extends SearchManager {
prevMatch?.updateElementCss(true);
if (!!this.currentMatch && prevMatch !== this.currentMatch) {
this.currentMatch.updateElementCss(true);
const lastCollapsedElement = this.lastCollapsedElement;
this.expandAllParents(this.currentMatch);
const newPanelExpanded = this.lastCollapsedElement != lastCollapsedElement;
setTimeout(() => {
const elementId = this.currentMatch?.id;
scrollElementIntoView(elementId);
}, this.scrollElementToViewTimeout);
}, newPanelExpanded ? 400 : 10);
}
this.updatedMatchCounterText(index);
}
Expand Down

0 comments on commit e00ae22

Please sign in to comment.