當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript layoutProvider.IWhitespaceManager類代碼示例

本文整理匯總了TypeScript中vs/editor/browser/viewLayout/layoutProvider.IWhitespaceManager的典型用法代碼示例。如果您正苦於以下問題:TypeScript IWhitespaceManager類的具體用法?TypeScript IWhitespaceManager怎麽用?TypeScript IWhitespaceManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了IWhitespaceManager類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: addZone

	public addZone(zone: IViewZone): number {
		let props = this._computeWhitespaceProps(zone);
		let whitespaceId = this._whitespaceManager.addWhitespace(props.afterViewLineNumber, this._getZoneOrdinal(zone), props.heightInPx);

		let myZone: IMyViewZone = {
			whitespaceId: whitespaceId,
			delegate: zone,
			isVisible: false
		};

		this._safeCallOnComputedHeight(myZone.delegate, props.heightInPx);

		myZone.delegate.domNode.style.position = 'absolute';
		myZone.delegate.domNode.style.width = '100%';
		StyleMutator.setDisplay(myZone.delegate.domNode, 'none');
		myZone.delegate.domNode.setAttribute('monaco-view-zone', myZone.whitespaceId.toString());
		this.domNode.appendChild(myZone.delegate.domNode);

		if (myZone.delegate.marginDomNode) {
			myZone.delegate.marginDomNode.style.position = 'absolute';
			myZone.delegate.marginDomNode.style.width = '100%';
			StyleMutator.setDisplay(myZone.delegate.marginDomNode, 'none');
			myZone.delegate.marginDomNode.setAttribute('monaco-view-zone', myZone.whitespaceId.toString());
			this.marginDomNode.appendChild(myZone.delegate.marginDomNode);
		}

		this._zones[myZone.whitespaceId.toString()] = myZone;


		this.setShouldRender();

		return myZone.whitespaceId;
	}
開發者ID:StateFarmIns,項目名稱:vscode,代碼行數:33,代碼來源:viewZones.ts

示例2: render

	public render(ctx: IRestrictedRenderingContext): void {
		let visibleWhitespaces = this._whitespaceManager.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.delegate.domNode.setAttribute('monaco-visible-view-zone', 'true');
					zone.isVisible = true;
				}
				this._safeCallOnDomNodeTop(zone.delegate, ctx.getScrolledTopFromAbsoluteTop(visibleZones[id].verticalOffset));
			} else {
				if (zone.isVisible) {
					zone.delegate.domNode.removeAttribute('monaco-visible-view-zone');
					zone.isVisible = false;
				}
				this._safeCallOnDomNodeTop(zone.delegate, ctx.getScrolledTopFromAbsoluteTop(-1000000));
			}
			StyleMutator.setTop(zone.delegate.domNode, newTop);
			StyleMutator.setHeight(zone.delegate.domNode, newHeight);
			StyleMutator.setDisplay(zone.delegate.domNode, newDisplay);

			if (zone.delegate.marginDomNode) {
				StyleMutator.setTop(zone.delegate.marginDomNode, newTop);
				StyleMutator.setHeight(zone.delegate.marginDomNode, newHeight);
				StyleMutator.setDisplay(zone.delegate.marginDomNode, newDisplay);
			}
		}

		if (hasVisibleZone) {
			StyleMutator.setWidth(this.domNode, Math.max(ctx.scrollWidth, this._contentWidth));
			StyleMutator.setWidth(this.marginDomNode, this._contentLeft);
		}
	}
開發者ID:StateFarmIns,項目名稱:vscode,代碼行數:51,代碼來源:viewZones.ts

示例3: layoutZone

	public layoutZone(id: number): boolean {
		let changed = false;
		if (this._zones.hasOwnProperty(id.toString())) {
			let zone = this._zones[id.toString()];
			let props = this._computeWhitespaceProps(zone.delegate);
			// let newOrdinal = this._getZoneOrdinal(zone.delegate);
			changed = this._whitespaceManager.changeWhitespace(zone.whitespaceId, props.afterViewLineNumber, props.heightInPx) || changed;
			// TODO@Alex: change `newOrdinal` too

			if (changed) {
				this.setShouldRender();
			}
		}
		return changed;
	}
開發者ID:Elflyy,項目名稱:vscode,代碼行數:15,代碼來源:viewZones.ts

示例4: _recomputeWhitespacesProps

	private _recomputeWhitespacesProps(): boolean {
		let hadAChange = false;

		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 props = this._computeWhitespaceProps(zone.delegate);
			if (this._whitespaceManager.changeWhitespace(parseInt(id, 10), props.afterViewLineNumber, props.heightInPx)) {
				this._safeCallOnComputedHeight(zone.delegate, props.heightInPx);
				hadAChange = true;
			}
		}

		return hadAChange;
	}
開發者ID:StateFarmIns,項目名稱:vscode,代碼行數:16,代碼來源:viewZones.ts

示例5: removeZone

	public removeZone(id:number): boolean {
		if (this._zones.hasOwnProperty(id.toString())) {
			var zone = this._zones[id.toString()];
			delete this._zones[id.toString()];
			this._whitespaceManager.removeWhitespace(zone.whitespaceId);

			zone.delegate.domNode.removeAttribute('monaco-visible-view-zone');
			zone.delegate.domNode.removeAttribute('monaco-view-zone');
			zone.delegate.domNode.parentNode.removeChild(zone.delegate.domNode);

			this.setShouldRender();

			return true;
		}
		return false;
	}
開發者ID:yxbdali,項目名稱:vscode,代碼行數:16,代碼來源:viewZones.ts


注:本文中的vs/editor/browser/viewLayout/layoutProvider.IWhitespaceManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。