提交 d0b1708a 编写于 作者: J Johannes Rieken

breadcrumbs - prevent scrollbar flashing

上级 48345b00
......@@ -114,13 +114,13 @@ export class BreadcrumbsWidget {
}
layout(dim: dom.Dimension): void {
if (!dim) {
this._scrollable.scanDomNode();
} else {
if (dim) {
this._domNode.style.width = `${dim.width}px`;
this._domNode.style.height = `${dim.height}px`;
this._scrollable.scanDomNode();
}
this._scrollable.setRevealOnScroll(false);
this._scrollable.scanDomNode();
this._scrollable.setRevealOnScroll(true);
}
style(style: IBreadcrumbsWidgetStyles): void {
......@@ -206,7 +206,9 @@ export class BreadcrumbsWidget {
private _reveal(nth: number): void {
const node = this._nodes[nth];
if (node) {
this._scrollable.setRevealOnScroll(false);
this._scrollable.setScrollPosition({ scrollLeft: node.offsetLeft });
this._scrollable.setRevealOnScroll(true);
}
}
......
......@@ -163,6 +163,8 @@ export abstract class AbstractScrollableElement extends Widget {
private readonly _hideTimeout: TimeoutTimer;
private _shouldRender: boolean;
private _revealOnScroll: boolean;
private readonly _onScroll = this._register(new Emitter<ScrollEvent>());
public readonly onScroll: Event<ScrollEvent> = this._onScroll.event;
......@@ -221,6 +223,8 @@ export abstract class AbstractScrollableElement extends Widget {
this._mouseIsOver = false;
this._shouldRender = true;
this._revealOnScroll = true;
}
public dispose(): void {
......@@ -286,6 +290,10 @@ export abstract class AbstractScrollableElement extends Widget {
}
}
public setRevealOnScroll(value: boolean) {
this._revealOnScroll = value;
}
// -------------------- mouse wheel scrolling --------------------
private _setListeningToMouseWheel(shouldListen: boolean): void {
......@@ -382,7 +390,9 @@ export abstract class AbstractScrollableElement extends Widget {
this._shouldRender = true;
}
this._reveal();
if (this._revealOnScroll) {
this._reveal();
}
if (!this._options.lazyRender) {
this._render();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册