本文整理汇总了TypeScript中@ephox/dom-globals.ClientRect.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ClientRect.default方法的具体用法?TypeScript ClientRect.default怎么用?TypeScript ClientRect.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/dom-globals.ClientRect
的用法示例。
在下文中一共展示了ClientRect.default方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: deflate
return Arr.bind(tds, (td) => {
const rect = deflate(roundRect(td.getBoundingClientRect()), -1);
return [
{ x: rect.left, y: getYAxisValue(rect), cell: td },
{ x: rect.right, y: getYAxisValue(rect), cell: td }
];
});
示例2: getBrClientRect
const getBoundingClientRect = (item: Element | Range): ClientRect => {
let clientRect, clientRects;
clientRects = item.getClientRects();
if (clientRects.length > 0) {
clientRect = GeomClientRect.clone(clientRects[0]);
} else {
clientRect = GeomClientRect.clone(item.getBoundingClientRect());
}
if (!isRange(item) && isBr(item) && isZeroRect(clientRect)) {
return getBrClientRect(item);
}
if (isZeroRect(clientRect) && isRange(item)) {
return getBoundingClientRectWebKitText(item);
}
return clientRect;
};
示例3: function
const addCharacterOffset = function (container, offset) {
const range = createRange(container.ownerDocument);
if (offset < container.data.length) {
if (ExtendingChar.isExtendingChar(container.data[offset])) {
return clientRects;
}
// WebKit returns two client rects for a position after an extending
// character a\uxxx|b so expand on "b" and collapse to start of "b" box
if (ExtendingChar.isExtendingChar(container.data[offset - 1])) {
range.setStart(container, offset);
range.setEnd(container, offset + 1);
if (!isHiddenWhiteSpaceRange(range)) {
addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false));
return clientRects;
}
}
}
if (offset > 0) {
range.setStart(container, offset - 1);
range.setEnd(container, offset);
if (!isHiddenWhiteSpaceRange(range)) {
addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false));
}
}
if (offset < container.data.length) {
range.setStart(container, offset);
range.setEnd(container, offset + 1);
if (!isHiddenWhiteSpaceRange(range)) {
addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), true));
}
}
};
示例4: hide
const show = (before: boolean, element: HTMLElement): Range => {
let clientRect, rng;
hide();
if (isTableCell(element)) {
return null;
}
if (isBlock(element)) {
caretContainerNode = CaretContainer.insertBlock('p', element, before);
clientRect = getAbsoluteClientRect(root, element, before);
DomQuery(caretContainerNode).css('top', clientRect.top);
const caret = DomQuery('<div class="mce-visual-caret" data-mce-bogus="all"></div>').css(clientRect).appendTo(root)[0];
lastVisualCaret.set(Option.some({ caret, element, before }));
lastVisualCaret.get().each((caretState) => {
if (before) {
DomQuery(caretState.caret).addClass('mce-visual-caret-before');
}
});
startBlink();
rng = element.ownerDocument.createRange();
rng.setStart(caretContainerNode, 0);
rng.setEnd(caretContainerNode, 0);
} else {
caretContainerNode = CaretContainer.insertInline(element, before);
rng = element.ownerDocument.createRange();
if (isContentEditableFalse(caretContainerNode.nextSibling)) {
rng.setStart(caretContainerNode, 0);
rng.setEnd(caretContainerNode, 0);
} else {
rng.setStart(caretContainerNode, 1);
rng.setEnd(caretContainerNode, 1);
}
return rng;
}
return rng;
};
示例5: getAbsoluteClientRect
lastVisualCaret.get().each((caretState) => {
const clientRect = getAbsoluteClientRect(root, caretState.element, caretState.before);
DomQuery(caretState.caret).css(clientRect);
});