本文整理汇总了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);
}
示例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
);
}
示例3: validateViewRange
public validateViewRange(viewRange: Range, expectedModelRange: Range): Range {
return this._coordinatesConverter.validateViewRange(viewRange, expectedModelRange);
}