本文整理匯總了TypeScript中vs/editor/common/viewModel/viewModel.IViewLayout.getWhitespaceViewportData方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript IViewLayout.getWhitespaceViewportData方法的具體用法?TypeScript IViewLayout.getWhitespaceViewportData怎麽用?TypeScript IViewLayout.getWhitespaceViewportData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/editor/common/viewModel/viewModel.IViewLayout
的用法示例。
在下文中一共展示了IViewLayout.getWhitespaceViewportData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: render
public render(ctx: IRestrictedRenderingContext): void {
let visibleWhitespaces = this._viewLayout.getWhitespaceViewportData();
let visibleZones: { [id: string]: editorCommon.IViewWhitespaceViewportData; } = {};
let hasVisibleZone = false;
for (let i = 0, len = visibleWhitespaces.length; i < len; i++) {
visibleZones[visibleWhitespaces[i].id.toString()] = visibleWhitespaces[i];
hasVisibleZone = true;
}
let keys = Object.keys(this._zones);
for (let i = 0, len = keys.length; i < len; i++) {
let id = keys[i];
let zone = this._zones[id];
let newTop = 0;
let newHeight = 0;
let newDisplay = 'none';
if (visibleZones.hasOwnProperty(id)) {
newTop = visibleZones[id].verticalOffset - ctx.bigNumbersDelta;
newHeight = visibleZones[id].height;
newDisplay = 'block';
// zone is visible
if (!zone.isVisible) {
zone.domNode.setAttribute('monaco-visible-view-zone', 'true');
zone.isVisible = true;
}
this._safeCallOnDomNodeTop(zone.delegate, ctx.getScrolledTopFromAbsoluteTop(visibleZones[id].verticalOffset));
} else {
if (zone.isVisible) {
zone.domNode.removeAttribute('monaco-visible-view-zone');
zone.isVisible = false;
}
this._safeCallOnDomNodeTop(zone.delegate, ctx.getScrolledTopFromAbsoluteTop(-1000000));
}
zone.domNode.setTop(newTop);
zone.domNode.setHeight(newHeight);
zone.domNode.setDisplay(newDisplay);
if (zone.marginDomNode) {
zone.marginDomNode.setTop(newTop);
zone.marginDomNode.setHeight(newHeight);
zone.marginDomNode.setDisplay(newDisplay);
}
}
if (hasVisibleZone) {
this.domNode.setWidth(Math.max(ctx.scrollWidth, this._contentWidth));
this.marginDomNode.setWidth(this._contentLeft);
}
}