mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix: ios grapheme layout
This commit is contained in:
parent
0b1f0a7e90
commit
11d65ebf1b
@ -29,12 +29,24 @@ export const parseTextBounds = (
|
|||||||
if (styles.textDecorationLine.length || text.trim().length > 0) {
|
if (styles.textDecorationLine.length || text.trim().length > 0) {
|
||||||
if (FEATURES.SUPPORT_RANGE_BOUNDS) {
|
if (FEATURES.SUPPORT_RANGE_BOUNDS) {
|
||||||
if (!FEATURES.SUPPORT_WORD_BREAKING) {
|
if (!FEATURES.SUPPORT_WORD_BREAKING) {
|
||||||
textBounds.push(
|
const rects = createRange(node, offset, text.length).getClientRects();
|
||||||
new TextBounds(
|
if (rects.length > 1) {
|
||||||
text,
|
let graphemeOffset = 0;
|
||||||
Bounds.fromDOMRectList(context, createRange(node, offset, text.length).getClientRects())
|
splitGraphemes(text).forEach((grapheme) => {
|
||||||
)
|
textBounds.push(
|
||||||
);
|
new TextBounds(
|
||||||
|
grapheme,
|
||||||
|
Bounds.fromDOMRectList(
|
||||||
|
context,
|
||||||
|
createRange(node, graphemeOffset + offset, grapheme.length).getClientRects()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
graphemeOffset += grapheme.length;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
textBounds.push(new TextBounds(text, Bounds.fromDOMRectList(context, rects)));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
textBounds.push(new TextBounds(text, getRangeBounds(context, node, offset, text.length)));
|
textBounds.push(new TextBounds(text, getRangeBounds(context, node, offset, text.length)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user