提交 ebb0ac31 编写于 作者: M Matt Bierner

Reduce state

上级 3490cfe9
......@@ -239,9 +239,8 @@ export class ZoomStatusbarItem extends Disposable {
private statusbarItem?: IStatusbarEntryAccessor;
onSelectScale?: (scale: Scale) => void;
constructor(
private readonly onSelectScale: (scale: Scale) => void,
@IEditorService editorService: IEditorService,
@IContextMenuService private readonly contextMenuService: IContextMenuService,
@IStatusbarService private readonly statusbarService: IStatusbarService,
......@@ -255,15 +254,11 @@ export class ZoomStatusbarItem extends Disposable {
}));
}
updateStatusbar(scale: Scale, onSelectScale?: (scale: Scale) => void): void {
updateStatusbar(scale: Scale): void {
const entry: IStatusbarEntry = {
text: this.zoomLabel(scale)
};
if (onSelectScale) {
this.onSelectScale = onSelectScale;
}
if (!this.statusbarItem) {
this.statusbarItem = this.statusbarService.addEntry(entry, 'status.imageZoom', nls.localize('status.imageZoom', "Image Zoom"), StatusbarAlignment.RIGHT, 101 /* to the left of editor status (100) */);
......@@ -354,7 +349,8 @@ class InlineImageView {
) {
const disposables = new DisposableStore();
const zoomStatusbarItem = disposables.add(instantiationService.createInstance(ZoomStatusbarItem));
const zoomStatusbarItem = disposables.add(instantiationService.createInstance(ZoomStatusbarItem,
newScale => updateScale(newScale)));
const context: ResourceViewerContext = {
layout(dimension: DOM.Dimension) { },
......@@ -414,7 +410,7 @@ class InlineImageView {
InlineImageView.imageStateCache.set(cacheKey, { scale: scale, offsetX: newScrollLeft, offsetY: newScrollTop });
}
zoomStatusbarItem.updateStatusbar(scale, updateScale);
zoomStatusbarItem.updateStatusbar(scale);
scrollbar.scanDomNode();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册