提交 f19bbe27 编写于 作者: A Alex Dima

Always paint when `layoutContentWidget` is called

上级 5fa72be1
......@@ -721,12 +721,11 @@ export class View extends ViewEventHandler implements editorBrowser.IView, IDisp
throw new Error('ViewImpl.layoutContentWidget: View is disposed');
}
let newPosition = widgetData.position ? widgetData.position.position : null;
let newPreference = widgetData.position ? widgetData.position.preference : null;
let shouldRender = this.contentWidgets.setWidgetPosition(widgetData.widget, newPosition, newPreference);
if (shouldRender) {
this._scheduleRender();
}
this._renderOnce(() => {
let newPosition = widgetData.position ? widgetData.position.position : null;
let newPreference = widgetData.position ? widgetData.position.preference : null;
this.contentWidgets.setWidgetPosition(widgetData.widget, newPosition, newPreference);
});
}
public removeContentWidget(widgetData: editorBrowser.IContentWidgetData): void {
......
......@@ -9,7 +9,6 @@ import 'vs/css!./contentWidgets';
import * as dom from 'vs/base/browser/dom';
import {StyleMutator} from 'vs/base/browser/styleMutator';
import * as editorCommon from 'vs/editor/common/editorCommon';
import {Position} from 'vs/editor/common/core/position';
import {ClassNames, ContentWidgetPositionPreference, IContentWidget, IRenderingContext, IViewContext} from 'vs/editor/browser/editorBrowser';
import {ViewPart} from 'vs/editor/browser/view/viewPart';
......@@ -160,40 +159,13 @@ export class ViewContentWidgets extends ViewPart {
this.shouldRender = true;
}
private static _contentWidgetPositionPreferenceEqual(a:ContentWidgetPositionPreference[], b:ContentWidgetPositionPreference[]): boolean {
if (!a && !b) {
return true;
}
if (!a || !b) {
return false;
}
if (a.length !== b.length) {
return false;
}
for (let i = 0, len = a.length; i < len; i++) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
}
public setWidgetPosition(widget: IContentWidget, position: editorCommon.IPosition, preference:ContentWidgetPositionPreference[]): boolean {
public setWidgetPosition(widget: IContentWidget, position: editorCommon.IPosition, preference:ContentWidgetPositionPreference[]): void {
let widgetData = this._widgets[widget.getId()];
let somethingChanged = false;
if (!Position.equals(widgetData.position, position)) {
widgetData.position = position;
somethingChanged = true;
}
if (!ViewContentWidgets._contentWidgetPositionPreferenceEqual(widgetData.preference, preference)) {
widgetData.preference = preference;
somethingChanged = true;
}
widgetData.position = position;
widgetData.preference = preference;
this.shouldRender = somethingChanged;
return somethingChanged;
this.shouldRender = true;
}
public removeWidget(widget: IContentWidget): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册