本文整理汇总了TypeScript中vs/base/browser/dom.getDomNodePagePosition函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getDomNodePagePosition函数的具体用法?TypeScript getDomNodePagePosition怎么用?TypeScript getDomNodePagePosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getDomNodePagePosition函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(e:MouseEvent, editorViewDomNode: HTMLElement) {
super(e);
this.editorPos = dom.getDomNodePagePosition(editorViewDomNode);
this.viewportx = this.posx - window.scrollX;
this.viewporty = this.posy - window.scrollY;
}
开发者ID:firebull1,项目名称:vscode,代码行数:7,代码来源:editorDom.ts
示例2: _layoutBoxInPage
private _layoutBoxInPage(topLeft: Coordinate, bottomLeft: Coordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult | null {
let aboveLeft0 = topLeft.left - ctx.scrollLeft;
let belowLeft0 = bottomLeft.left - ctx.scrollLeft;
if (aboveLeft0 < 0 || aboveLeft0 > this._contentWidth) {
// Don't render if position is scrolled outside viewport
return null;
}
let aboveTop = topLeft.top - height;
let belowTop = bottomLeft.top + this._lineHeight;
let aboveLeft = aboveLeft0 + this._contentLeft;
let belowLeft = belowLeft0 + this._contentLeft;
let domNodePosition = dom.getDomNodePagePosition(this._viewDomNode.domNode);
let absoluteAboveTop = domNodePosition.top + aboveTop - dom.StandardWindow.scrollY;
let absoluteBelowTop = domNodePosition.top + belowTop - dom.StandardWindow.scrollY;
let absoluteAboveLeft = domNodePosition.left + aboveLeft - dom.StandardWindow.scrollX;
let absoluteBelowLeft = domNodePosition.left + belowLeft - dom.StandardWindow.scrollX;
let INNER_WIDTH = window.innerWidth || document.documentElement!.clientWidth || document.body.clientWidth;
let INNER_HEIGHT = window.innerHeight || document.documentElement!.clientHeight || document.body.clientHeight;
// Leave some clearance to the bottom
let TOP_PADDING = 22;
let BOTTOM_PADDING = 22;
let fitsAbove = (absoluteAboveTop >= TOP_PADDING),
fitsBelow = (absoluteBelowTop + height <= INNER_HEIGHT - BOTTOM_PADDING);
if (absoluteAboveLeft + width + 20 > INNER_WIDTH) {
let delta = absoluteAboveLeft - (INNER_WIDTH - width - 20);
absoluteAboveLeft -= delta;
aboveLeft -= delta;
}
if (absoluteBelowLeft + width + 20 > INNER_WIDTH) {
let delta = absoluteBelowLeft - (INNER_WIDTH - width - 20);
absoluteBelowLeft -= delta;
belowLeft -= delta;
}
if (absoluteAboveLeft < 0) {
let delta = absoluteAboveLeft;
absoluteAboveLeft -= delta;
aboveLeft -= delta;
}
if (absoluteBelowLeft < 0) {
let delta = absoluteBelowLeft;
absoluteBelowLeft -= delta;
belowLeft -= delta;
}
if (this._fixedOverflowWidgets) {
aboveTop = absoluteAboveTop;
belowTop = absoluteBelowTop;
aboveLeft = absoluteAboveLeft;
belowLeft = absoluteBelowLeft;
}
return { fitsAbove, aboveTop, aboveLeft, fitsBelow, belowTop, belowLeft };
}
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:60,代码来源:contentWidgets.ts
示例3: _onMouseDown
private _onMouseDown(e: IMouseEvent): void {
let domNodePosition = DomUtils.getDomNodePagePosition(this.domNode.domNode);
this._setDesiredScrollPositionNow(this._scrollbarState.getDesiredScrollPositionFromOffset(this._mouseDownRelativePosition(e, domNodePosition)));
if (e.leftButton) {
e.preventDefault();
this._sliderMouseDown(e, () => { /*nothing to do*/ });
}
}
开发者ID:pavelfeldman,项目名称:vscode,代码行数:8,代码来源:abstractScrollbar.ts
示例4: _layoutBoxInPage
private _layoutBoxInPage(position: Position, domNode: HTMLElement, ctx: IRenderingContext): IBoxLayoutResult {
let visibleRange = ctx.visibleRangeForPosition(position);
if (!visibleRange) {
return null;
}
let left0 = visibleRange.left - ctx.viewportLeft;
let width = domNode.clientWidth,
height = domNode.clientHeight;
if (left0 + width < 0 || left0 > this._contentWidth) {
return null;
}
let aboveTop = visibleRange.top - height;
let belowTop = visibleRange.top + this._lineHeight;
let left = left0 + this._contentLeft;
let domNodePosition = dom.getDomNodePagePosition(this._viewDomNode);
let absoluteAboveTop = domNodePosition.top + aboveTop - dom.StandardWindow.scrollY;
let absoluteBelowTop = domNodePosition.top + belowTop - dom.StandardWindow.scrollY;
let absoluteLeft = domNodePosition.left + left - dom.StandardWindow.scrollX;
let INNER_WIDTH = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
let INNER_HEIGHT = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
// Leave some clearance to the bottom
let TOP_PADDING = 22;
let BOTTOM_PADDING = 22;
let fitsAbove = (absoluteAboveTop >= TOP_PADDING),
fitsBelow = (absoluteBelowTop + height <= INNER_HEIGHT - BOTTOM_PADDING);
if (absoluteLeft + width + 20 > INNER_WIDTH) {
let delta = absoluteLeft - (INNER_WIDTH - width - 20);
absoluteLeft -= delta;
left -= delta;
}
if (absoluteLeft < 0) {
let delta = absoluteLeft;
absoluteLeft -= delta;
left -= delta;
}
if (this._context.configuration.editor.viewInfo.fixedOverflowWidgets) {
aboveTop = absoluteAboveTop;
belowTop = absoluteBelowTop;
left = absoluteLeft;
}
return { aboveTop, fitsAbove, belowTop, fitsBelow, left };
}
开发者ID:pk-codebox-evo,项目名称:ide-microsoft-vscode,代码行数:54,代码来源:contentWidgets.ts
示例5: _toCoords
private _toCoords(position: IPosition): { x: number, y: number } {
this._editor.revealPosition(position);
this._editor.render();
// Translate to absolute editor position
const cursorCoords = this._editor.getScrolledVisiblePosition(this._editor.getPosition());
const editorCoords = getDomNodePagePosition(this._editor.getDomNode());
const x = editorCoords.left + cursorCoords.left;
const y = editorCoords.top + cursorCoords.top + cursorCoords.height;
return { x, y };
}
开发者ID:StateFarmIns,项目名称:vscode,代码行数:13,代码来源:quickFixWidget.ts
示例6: _toCoords
private _toCoords(position: Position): { x: number, y: number } {
if (!this._editor.hasModel()) {
return { x: 0, y: 0 };
}
this._editor.revealPosition(position, ScrollType.Immediate);
this._editor.render();
// Translate to absolute editor position
const cursorCoords = this._editor.getScrolledVisiblePosition(position);
const editorCoords = getDomNodePagePosition(this._editor.getDomNode());
const x = editorCoords.left + cursorCoords.left;
const y = editorCoords.top + cursorCoords.top + cursorCoords.height;
return { x, y };
}
开发者ID:PKRoma,项目名称:vscode,代码行数:15,代码来源:codeActionWidget.ts
示例7: _onMouseDown
private _onMouseDown(e: IMouseEvent): void {
let offsetX: number;
let offsetY: number;
if (e.target === this.domNode.domNode && typeof e.browserEvent.offsetX === 'number' && typeof e.browserEvent.offsetY === 'number') {
offsetX = e.browserEvent.offsetX;
offsetY = e.browserEvent.offsetY;
} else {
const domNodePosition = DomUtils.getDomNodePagePosition(this.domNode.domNode);
offsetX = e.posx - domNodePosition.left;
offsetY = e.posy - domNodePosition.top;
}
this._setDesiredScrollPositionNow(this._scrollbarState.getDesiredScrollPositionFromOffset(this._mouseDownRelativePosition(offsetX, offsetY)));
if (e.leftButton) {
e.preventDefault();
this._sliderMouseDown(e, () => { /*nothing to do*/ });
}
}
开发者ID:AllureFer,项目名称:vscode,代码行数:17,代码来源:abstractScrollbar.ts
示例8: createEditorPagePosition
export function createEditorPagePosition(editorViewDomNode: HTMLElement): EditorPagePosition {
let editorPos = dom.getDomNodePagePosition(editorViewDomNode);
return new EditorPagePosition(editorPos.left, editorPos.top, editorPos.width, editorPos.height);
}
开发者ID:diarmaidm,项目名称:vscode,代码行数:4,代码来源:editorDom.ts
示例9: _onMouseDown
private _onMouseDown(e: IMouseEvent): void {
let domNodePosition = DomUtils.getDomNodePagePosition(this.domNode.domNode);
let desiredSliderPosition = this._mouseDownRelativePosition(e, domNodePosition) - this._scrollbarState.getArrowSize() - this._scrollbarState.getSliderSize() / 2;
this.setDesiredScrollPosition(this._scrollbarState.convertSliderPositionToScrollPosition(desiredSliderPosition));
this._sliderMouseDown(e);
}
开发者ID:1Hgm,项目名称:vscode,代码行数:6,代码来源:abstractScrollbar.ts
注:本文中的vs/base/browser/dom.getDomNodePagePosition函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论