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


TypeScript ICoordinatesConverter.validateViewRange方法代码示例

本文整理汇总了TypeScript中vs/editor/common/viewModel/viewModel.ICoordinatesConverter.validateViewRange方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ICoordinatesConverter.validateViewRange方法的具体用法?TypeScript ICoordinatesConverter.validateViewRange怎么用?TypeScript ICoordinatesConverter.validateViewRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vs/editor/common/viewModel/viewModel.ICoordinatesConverter的用法示例。


在下文中一共展示了ICoordinatesConverter.validateViewRange方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: _setState

	private _setState(modelState: SingleCursorState, viewState: SingleCursorState, ensureInEditableRange: boolean): void {
		// Validate new model state
		let selectionStart = this.model.validateRange(modelState.selectionStart);
		let selectionStartLeftoverVisibleColumns = modelState.selectionStart.equalsRange(selectionStart) ? modelState.selectionStartLeftoverVisibleColumns : 0;

		let position = this.model.validatePosition(modelState.position);
		if (ensureInEditableRange) {
			position = this._ensureInEditableRange(position);
		}
		let leftoverVisibleColumns = modelState.position.equals(position) ? modelState.leftoverVisibleColumns : 0;

		modelState = new SingleCursorState(selectionStart, selectionStartLeftoverVisibleColumns, position, leftoverVisibleColumns);

		// Validate new view state
		let viewSelectionStart = this.coordinatesConverter.validateViewRange(viewState.selectionStart, modelState.selectionStart);
		let viewPosition = this.coordinatesConverter.validateViewPosition(viewState.position, modelState.position);
		viewState = new SingleCursorState(viewSelectionStart, selectionStartLeftoverVisibleColumns, viewPosition, leftoverVisibleColumns);

		if (this.modelState && this.viewState && this.modelState.equals(modelState) && this.viewState.equals(viewState)) {
			// No-op, early return
			return;
		}

		this.modelState = modelState;
		this.viewState = viewState;

		this._selStartMarker = this._ensureMarker(this._selStartMarker, this.modelState.selection.startLineNumber, this.modelState.selection.startColumn, true);
		this._selEndMarker = this._ensureMarker(this._selEndMarker, this.modelState.selection.endLineNumber, this.modelState.selection.endColumn, false);
	}
开发者ID:yuit,项目名称:vscode,代码行数:29,代码来源:oneCursor.ts

示例2: restoreState

	public restoreState(state: IOneCursorState): void {
		let position = this.model.validatePosition(state.position);
		let selectionStart: Range;
		if (state.selectionStart) {
			selectionStart = this.model.validateRange(state.selectionStart);
		} else {
			selectionStart = new Range(position.lineNumber, position.column, position.lineNumber, position.column);
		}

		let viewPosition = this.coordinatesConverter.validateViewPosition(new Position(state.viewPosition.lineNumber, state.viewPosition.column), position);
		let viewSelectionStart: Range;
		if (state.viewSelectionStart) {
			viewSelectionStart = this.coordinatesConverter.validateViewRange(new Range(state.viewSelectionStart.startLineNumber, state.viewSelectionStart.startColumn, state.viewSelectionStart.endLineNumber, state.viewSelectionStart.endColumn), selectionStart);
		} else {
			viewSelectionStart = this.coordinatesConverter.convertModelRangeToViewRange(selectionStart);
		}

		this._setState(
			new SingleCursorState(selectionStart, state.selectionStartLeftoverVisibleColumns, position, state.leftoverVisibleColumns),
			new SingleCursorState(viewSelectionStart, state.selectionStartLeftoverVisibleColumns, viewPosition, state.leftoverVisibleColumns),
			false
		);
	}
开发者ID:yuit,项目名称:vscode,代码行数:23,代码来源:oneCursor.ts

示例3: validateViewRange

	public validateViewRange(viewRange: Range, expectedModelRange: Range): Range {
		return this._coordinatesConverter.validateViewRange(viewRange, expectedModelRange);
	}
开发者ID:hungys,项目名称:vscode,代码行数:3,代码来源:cursorCommon.ts


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