当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript IViewLayout.getWhitespaceViewportData方法代码示例

本文整理汇总了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);
		}
	}
开发者ID:yuit,项目名称:vscode,代码行数:51,代码来源:viewZones.ts


注:本文中的vs/editor/common/viewModel/viewModel.IViewLayout.getWhitespaceViewportData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。