@react-pdf-kit/viewer 0.0.0-experimental.4 → 0.0.0-experimental.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Combination-479e39c6.js → Combination-136ff99c.js} +184 -187
- package/dist/RPLayout.module-b4b23e29.js +14 -0
- package/dist/assets/style.css +1 -1
- package/dist/assets/style.js +15 -15
- package/dist/components/RPConfig.js +16 -6
- package/dist/components/RPController.js +21 -26
- package/dist/components/RPDropFileZone.js +35 -29
- package/dist/components/RPPages.js +351 -360
- package/dist/components/RPProvider.js +20 -24
- package/dist/components/layout/LayoutContainer.js +1 -1
- package/dist/components/layout/LayoutWrapper.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +12 -13
- package/dist/components/layout/RPLayout.js +28 -28
- package/dist/components/layout/WrapperLayout.js +10 -11
- package/dist/components/layout/sidebar/RPSidebar.js +7 -8
- package/dist/components/layout/sidebar/Thumbnail.js +3 -4
- package/dist/components/layout/sidebar/Thumbnails.js +3 -4
- package/dist/components/layout/toolbar/DarkModeTool.js +4 -4
- package/dist/components/layout/toolbar/DocumentDialog.js +8 -9
- package/dist/components/layout/toolbar/DocumentProperties.js +6 -6
- package/dist/components/layout/toolbar/FileDownloadTool.js +9 -10
- package/dist/components/layout/toolbar/FileUploadTool.js +9 -10
- package/dist/components/layout/toolbar/FullScreenTool.js +6 -6
- package/dist/components/layout/toolbar/MenuItem.js +6 -6
- package/dist/components/layout/toolbar/MenuSeparator.js +6 -6
- package/dist/components/layout/toolbar/MostPageTool.js +9 -10
- package/dist/components/layout/toolbar/OtherTool.js +9 -10
- package/dist/components/layout/toolbar/Paginate.js +7 -8
- package/dist/components/layout/toolbar/PrintTool.js +9 -10
- package/dist/components/layout/toolbar/RPMenuItem.js +6 -6
- package/dist/components/layout/toolbar/RPMoreOptions.js +9 -10
- package/dist/components/layout/toolbar/RPToolbar.js +9 -12
- package/dist/components/layout/toolbar/RPToolbarEnd.js +9 -10
- package/dist/components/layout/toolbar/RotateTool.js +9 -10
- package/dist/components/layout/toolbar/ScrollModeTool.js +6 -6
- package/dist/components/layout/toolbar/SearchCloseButton.js +4 -4
- package/dist/components/layout/toolbar/SearchResultNavigator.js +7 -10
- package/dist/components/layout/toolbar/SearchTool.js +11 -14
- package/dist/components/layout/toolbar/SelectionModeTool.js +6 -6
- package/dist/components/layout/toolbar/ThumbnailTool.js +7 -8
- package/dist/components/layout/toolbar/ToolbarCustom.js +3 -4
- package/dist/components/layout/toolbar/ToolbarDefault.js +9 -12
- package/dist/components/layout/toolbar/ToolbarLayout.js +9 -12
- package/dist/components/layout/toolbar/ViewModeTool.js +6 -6
- package/dist/components/layout/toolbar/ZoomTool.js +9 -10
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +8 -9
- package/dist/components/layout/toolbar/tools/DualPageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +13 -15
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +7 -8
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +7 -8
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +13 -15
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +4 -4
- package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/InputPageTool.js +7 -8
- package/dist/components/layout/toolbar/tools/LastPageTool.js +13 -15
- package/dist/components/layout/toolbar/tools/NextPageTool.js +7 -8
- package/dist/components/layout/toolbar/tools/PageScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +7 -8
- package/dist/components/layout/toolbar/tools/PrintTool.js +7 -8
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +7 -8
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +7 -8
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +4 -4
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +7 -8
- package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +7 -8
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +19 -20
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +7 -8
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +9 -12
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +7 -8
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +9 -10
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +9 -10
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +9 -10
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +9 -10
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +9 -10
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +6 -6
- package/dist/components/page/AnnotationLayer.js +65 -66
- package/dist/components/page/CanvasLayer.js +3 -4
- package/dist/components/page/CustomElement.js +3 -4
- package/dist/components/page/DualPage.js +5 -11
- package/dist/components/page/DualPageWithCover.js +5 -11
- package/dist/components/page/RPPage.js +6 -12
- package/dist/components/page/SinglePage.js +5 -11
- package/dist/components/page/TextHighlightLayer.js +178 -86
- package/dist/components/page/TextLayer.js +170 -125
- package/dist/components/ui/Checkbox.js +2 -2
- package/dist/components/ui/DropDown.js +6 -6
- package/dist/components/ui/LoadingIndicator.js +7 -8
- package/dist/components/ui/RPTooltip.js +411 -197
- package/dist/contexts/ConfigContext.js +5 -4
- package/dist/contexts/DimensionPagesContext.js +5 -6
- package/dist/contexts/DropFileZoneContext.js +4 -5
- package/dist/contexts/ElementPageContext.js +5 -6
- package/dist/contexts/FileInputContext.js +5 -6
- package/dist/contexts/HighlightContext.js +7 -10
- package/dist/contexts/LayoutDropFileZoneContext.js +11 -0
- package/dist/contexts/PagesRotateContext.js +5 -6
- package/dist/contexts/PaginationContext.js +5 -6
- package/dist/contexts/PrintContext.js +16 -17
- package/dist/contexts/RPDocumentContext.js +13 -14
- package/dist/contexts/RenderQueueProvider.js +5 -6
- package/dist/contexts/RotationContext.js +8 -9
- package/dist/contexts/SearchContext.js +5 -8
- package/dist/contexts/ThumbnailsContext.js +4 -5
- package/dist/contexts/ZoomContext.js +5 -6
- package/dist/floating-ui.react-dom-5ec29bd6.js +1327 -0
- package/dist/index-61f59539.js +1198 -0
- package/dist/{index-ada501c4.js → index-655864a7.js} +1 -1
- package/dist/{index-113053cf.js → index-c0faa594.js} +2 -2
- package/dist/{index-23911b43.js → index-e3ee9457.js} +6 -6
- package/dist/main.js +15 -15
- package/dist/polyfills.js +8055 -0
- package/dist/types/components/layout/sidebar/Thumbnail.d.ts +2 -2
- package/dist/types/contexts/LayoutDropFileZoneContext.d.ts +9 -0
- package/dist/types/contexts/RPDocumentContext.d.ts +1 -1
- package/dist/types/contexts/RenderQueueProvider.d.ts +1 -1
- package/dist/types/contexts/RenderedPagesCache.d.ts +2 -2
- package/dist/types/main.d.ts +1 -1
- package/dist/types/utils/annotations.d.ts +2 -2
- package/dist/types/utils/getThumbnailViewport.d.ts +2 -2
- package/dist/types/utils/highlight.d.ts +5 -5
- package/dist/types/utils/hooks/useDropFileZone.d.ts +5 -0
- package/dist/types/utils/hooks/useFlickerSelectText.d.ts +1 -0
- package/dist/types/utils/hooks/useHighlight.d.ts +1 -1
- package/dist/types/utils/hooks/useLoadPdf.d.ts +2 -2
- package/dist/types/utils/hooks/useLoadWorker.d.ts +1 -5
- package/dist/types/utils/hooks/usePdfProperties.d.ts +1 -1
- package/dist/types/utils/hooks/useTextSelection.d.ts +3 -12
- package/dist/types/utils/link_service.d.ts +3 -2
- package/dist/types/utils/renderPage.d.ts +2 -2
- package/dist/types/utils/types.d.ts +8 -5
- package/dist/utils/highlight.js +158 -184
- package/dist/utils/hooks/useCopyText.js +22 -60
- package/dist/utils/hooks/useDropFileZone.js +12 -0
- package/dist/utils/hooks/useFileDownload.js +5 -6
- package/dist/utils/hooks/useFlickerSelectText.js +25 -0
- package/dist/utils/hooks/useHighlight.js +33 -35
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +70 -95
- package/dist/utils/hooks/useLoadWorker.js +14 -4
- package/dist/utils/hooks/usePageRotateContext.js +7 -8
- package/dist/utils/hooks/usePaginate.js +3 -4
- package/dist/utils/hooks/usePinch.js +10 -11
- package/dist/utils/hooks/usePresentPage.js +3 -4
- package/dist/utils/hooks/usePrint.js +55 -54
- package/dist/utils/hooks/useRotate.js +3 -4
- package/dist/utils/hooks/useScrollToPage.js +3 -4
- package/dist/utils/hooks/useSearch.js +15 -18
- package/dist/utils/hooks/useTextSelection.js +73 -2
- package/dist/utils/hooks/useThumbnail.js +17 -18
- package/dist/utils/hooks/useVirtualReactWindow.js +3 -4
- package/dist/utils/link_service.js +19 -18
- package/dist/utils/renderPage.js +1 -1
- package/package.json +13 -4
- package/dist/RPLayout.module-7766e0b4.js +0 -14
- package/dist/contexts/TextSelectionContext.js +0 -191
- package/dist/index-535ad364.js +0 -983
- package/dist/index-d0f0aa9a.js +0 -1542
- package/dist/types/contexts/TextSelectionContext.d.ts +0 -14
- package/dist/types/utils/geometryCache.d.ts +0 -15
- package/dist/types/utils/glyphHitTest.d.ts +0 -12
- package/dist/types/utils/selectionUtils.d.ts +0 -30
- package/dist/utils/geometryCache.js +0 -32
- package/dist/utils/glyphHitTest.js +0 -29
- package/dist/utils/selectionUtils.js +0 -96
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import { HighlightRect } from '../utils/selectionUtils';
|
|
3
|
-
export interface TextSelectionContextType {
|
|
4
|
-
handlePointerDown: (pageIndex: number, e: React.PointerEvent, overlayEl: HTMLElement) => void;
|
|
5
|
-
handlePointerMove: (pageIndex: number, e: React.PointerEvent, overlayEl: HTMLElement) => void;
|
|
6
|
-
handlePointerUp: () => void;
|
|
7
|
-
getPageSelectionRects: (pageIndex: number) => HighlightRect[];
|
|
8
|
-
isSelecting: boolean;
|
|
9
|
-
selectedText: string;
|
|
10
|
-
selectionVersion: number;
|
|
11
|
-
clearSelection: () => void;
|
|
12
|
-
}
|
|
13
|
-
export declare const useTextSelectionContext: () => TextSelectionContextType;
|
|
14
|
-
export declare const TextSelectionProvider: FC<PropsWithChildren>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PageGeometry } from '@pdf-viewer/pdfium';
|
|
2
|
-
/**
|
|
3
|
-
* LRU cache for PageGeometry objects keyed by page index.
|
|
4
|
-
*/
|
|
5
|
-
export declare class GeometryCache {
|
|
6
|
-
private cache;
|
|
7
|
-
private readonly maxSize;
|
|
8
|
-
constructor(maxSize?: number);
|
|
9
|
-
get(pageIndex: number): PageGeometry | undefined;
|
|
10
|
-
set(pageIndex: number, geometry: PageGeometry): void;
|
|
11
|
-
clear(): void;
|
|
12
|
-
get size(): number;
|
|
13
|
-
}
|
|
14
|
-
/** Shared singleton instance */
|
|
15
|
-
export declare const geometryCache: GeometryCache;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PageGeometry } from '@pdf-viewer/pdfium';
|
|
2
|
-
export interface HitResult {
|
|
3
|
-
runIndex: number;
|
|
4
|
-
glyphIndex: number;
|
|
5
|
-
charIndex: number;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Two-pass glyph hit-testing:
|
|
9
|
-
* 1. Exact match against tight bounds
|
|
10
|
-
* 2. Tolerance-expanded match using Manhattan distance
|
|
11
|
-
*/
|
|
12
|
-
export declare function glyphAt(geometry: PageGeometry, x: number, y: number, tolerance?: number): HitResult | null;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { PageGeometry } from '@pdf-viewer/pdfium';
|
|
2
|
-
export interface CharRange {
|
|
3
|
-
start: number;
|
|
4
|
-
end: number;
|
|
5
|
-
}
|
|
6
|
-
export interface HighlightRect {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Expand selection to word boundaries.
|
|
14
|
-
* Walk backward/forward from charIndex until hitting a space (flags=1) or empty (flags=2) glyph.
|
|
15
|
-
*/
|
|
16
|
-
export declare function expandToWordBoundary(geometry: PageGeometry, charIndex: number): CharRange;
|
|
17
|
-
/**
|
|
18
|
-
* Expand selection to line boundaries.
|
|
19
|
-
* Find all runs that vertically overlap >= 50% with the run containing charIndex.
|
|
20
|
-
*/
|
|
21
|
-
export declare function expandToLineBoundary(geometry: PageGeometry, charIndex: number): CharRange;
|
|
22
|
-
/**
|
|
23
|
-
* Compute merged highlight rectangles for a character range.
|
|
24
|
-
* Adjacent glyphs on the same visual line are merged into single rectangles.
|
|
25
|
-
*/
|
|
26
|
-
export declare function rectsForRange(geometry: PageGeometry, startChar: number, endChar: number): HighlightRect[];
|
|
27
|
-
/**
|
|
28
|
-
* Extract text from a character range across all runs.
|
|
29
|
-
*/
|
|
30
|
-
export declare function textForRange(geometry: PageGeometry, startChar: number, endChar: number): string;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var i = Object.defineProperty;
|
|
2
|
-
var a = (t, e, c) => e in t ? i(t, e, { enumerable: !0, configurable: !0, writable: !0, value: c }) : t[e] = c;
|
|
3
|
-
var h = (t, e, c) => (a(t, typeof e != "symbol" ? e + "" : e, c), c);
|
|
4
|
-
class o {
|
|
5
|
-
constructor(e = 50) {
|
|
6
|
-
h(this, "cache", /* @__PURE__ */ new Map());
|
|
7
|
-
h(this, "maxSize");
|
|
8
|
-
this.maxSize = e;
|
|
9
|
-
}
|
|
10
|
-
get(e) {
|
|
11
|
-
const c = this.cache.get(e);
|
|
12
|
-
return c !== void 0 && (this.cache.delete(e), this.cache.set(e, c)), c;
|
|
13
|
-
}
|
|
14
|
-
set(e, c) {
|
|
15
|
-
if (this.cache.has(e) && this.cache.delete(e), this.cache.size >= this.maxSize) {
|
|
16
|
-
const s = this.cache.keys().next().value;
|
|
17
|
-
s !== void 0 && this.cache.delete(s);
|
|
18
|
-
}
|
|
19
|
-
this.cache.set(e, c);
|
|
20
|
-
}
|
|
21
|
-
clear() {
|
|
22
|
-
this.cache.clear();
|
|
23
|
-
}
|
|
24
|
-
get size() {
|
|
25
|
-
return this.cache.size;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const l = new o();
|
|
29
|
-
export {
|
|
30
|
-
o as GeometryCache,
|
|
31
|
-
l as geometryCache
|
|
32
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
function x(g, s, i, u = 4) {
|
|
2
|
-
let e = 0;
|
|
3
|
-
for (let h = 0; h < g.runs.length; h++) {
|
|
4
|
-
const l = g.runs[h];
|
|
5
|
-
for (let n = 0; n < l.glyphs.length; n++) {
|
|
6
|
-
const t = l.glyphs[n];
|
|
7
|
-
if (s >= t.tightX && s <= t.tightX + t.tightWidth && i >= t.tightY && i <= t.tightY + t.tightHeight)
|
|
8
|
-
return { runIndex: h, glyphIndex: n, charIndex: e + n };
|
|
9
|
-
}
|
|
10
|
-
e += l.glyphs.length;
|
|
11
|
-
}
|
|
12
|
-
let c = 1 / 0, o = null;
|
|
13
|
-
e = 0;
|
|
14
|
-
for (let h = 0; h < g.runs.length; h++) {
|
|
15
|
-
const l = g.runs[h];
|
|
16
|
-
for (let n = 0; n < l.glyphs.length; n++) {
|
|
17
|
-
const t = l.glyphs[n];
|
|
18
|
-
if (t.flags === 2)
|
|
19
|
-
continue;
|
|
20
|
-
const f = t.x + t.width / 2, p = t.y + t.height / 2, d = Math.abs(s - f) + Math.abs(i - p), r = u / 2;
|
|
21
|
-
s >= t.x - r && s <= t.x + t.width + r && i >= t.y - r && i <= t.y + t.height + r && d < c && (c = d, o = { runIndex: h, glyphIndex: n, charIndex: e + n });
|
|
22
|
-
}
|
|
23
|
-
e += l.glyphs.length;
|
|
24
|
-
}
|
|
25
|
-
return o;
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
x as glyphAt
|
|
29
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
function M(l) {
|
|
2
|
-
const e = [];
|
|
3
|
-
for (const h of l.runs)
|
|
4
|
-
for (const i of h.glyphs)
|
|
5
|
-
e.push(i);
|
|
6
|
-
return e;
|
|
7
|
-
}
|
|
8
|
-
function w(l, e) {
|
|
9
|
-
const h = M(l);
|
|
10
|
-
if (h.length === 0)
|
|
11
|
-
return { start: e, end: e };
|
|
12
|
-
const i = Math.max(0, Math.min(e, h.length - 1));
|
|
13
|
-
let o = i;
|
|
14
|
-
for (; o > 0 && h[o - 1].flags === 0; )
|
|
15
|
-
o--;
|
|
16
|
-
let r = i;
|
|
17
|
-
for (; r < h.length - 1 && h[r + 1].flags === 0; )
|
|
18
|
-
r++;
|
|
19
|
-
return { start: o, end: r };
|
|
20
|
-
}
|
|
21
|
-
function R(l, e) {
|
|
22
|
-
let h = -1, i = 0;
|
|
23
|
-
for (let t = 0; t < l.runs.length; t++) {
|
|
24
|
-
const a = l.runs[t].glyphs.length;
|
|
25
|
-
if (e < i + a) {
|
|
26
|
-
h = t;
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
i += a;
|
|
30
|
-
}
|
|
31
|
-
if (h === -1)
|
|
32
|
-
return { start: e, end: e };
|
|
33
|
-
const o = l.runs[h].rect, r = o.height;
|
|
34
|
-
let s = 1 / 0, n = -1 / 0, c = 0;
|
|
35
|
-
for (let t = 0; t < l.runs.length; t++) {
|
|
36
|
-
const a = l.runs[t], g = a.rect, x = Math.max(g.y, o.y), y = Math.min(g.y + g.height, o.y + o.height), p = Math.max(0, y - x), u = Math.min(g.height, r);
|
|
37
|
-
if (u > 0 && p / u >= 0.5) {
|
|
38
|
-
const f = c, m = c + a.glyphs.length - 1;
|
|
39
|
-
f < s && (s = f), m > n && (n = m);
|
|
40
|
-
}
|
|
41
|
-
c += a.glyphs.length;
|
|
42
|
-
}
|
|
43
|
-
return s === 1 / 0 ? { start: e, end: e } : { start: s, end: n };
|
|
44
|
-
}
|
|
45
|
-
function v(l, e, h) {
|
|
46
|
-
const i = M(l);
|
|
47
|
-
if (i.length === 0)
|
|
48
|
-
return [];
|
|
49
|
-
const o = Math.max(0, Math.min(e, h)), r = Math.min(i.length - 1, Math.max(e, h)), s = [];
|
|
50
|
-
let n = null;
|
|
51
|
-
for (let c = o; c <= r; c++) {
|
|
52
|
-
const t = i[c];
|
|
53
|
-
if (t.flags === 2)
|
|
54
|
-
continue;
|
|
55
|
-
if (!n) {
|
|
56
|
-
n = { x: t.x, y: t.y, width: t.width, height: t.height };
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
const a = Math.max(n.y, t.y), g = Math.min(
|
|
60
|
-
n.y + n.height,
|
|
61
|
-
t.y + t.height
|
|
62
|
-
), x = Math.max(0, g - a), y = Math.min(n.height, t.height);
|
|
63
|
-
if (y > 0 && x / y >= 0.5) {
|
|
64
|
-
const u = Math.min(n.x, t.x), f = Math.min(n.y, t.y), m = Math.max(n.x + n.width, t.x + t.width), d = Math.max(
|
|
65
|
-
n.y + n.height,
|
|
66
|
-
t.y + t.height
|
|
67
|
-
);
|
|
68
|
-
n = {
|
|
69
|
-
x: u,
|
|
70
|
-
y: f,
|
|
71
|
-
width: m - u,
|
|
72
|
-
height: d - f
|
|
73
|
-
};
|
|
74
|
-
} else
|
|
75
|
-
s.push(n), n = { x: t.x, y: t.y, width: t.width, height: t.height };
|
|
76
|
-
}
|
|
77
|
-
return n && s.push(n), s;
|
|
78
|
-
}
|
|
79
|
-
function B(l, e, h) {
|
|
80
|
-
const i = Math.min(e, h), o = Math.max(e, h);
|
|
81
|
-
let r = "", s = 0;
|
|
82
|
-
for (const n of l.runs) {
|
|
83
|
-
if (s + n.text.length - 1 >= i && s <= o) {
|
|
84
|
-
const t = Math.max(0, i - s), a = Math.min(n.text.length, o - s + 1);
|
|
85
|
-
r += n.text.slice(t, a);
|
|
86
|
-
}
|
|
87
|
-
s += n.glyphs.length;
|
|
88
|
-
}
|
|
89
|
-
return r;
|
|
90
|
-
}
|
|
91
|
-
export {
|
|
92
|
-
R as expandToLineBoundary,
|
|
93
|
-
w as expandToWordBoundary,
|
|
94
|
-
v as rectsForRange,
|
|
95
|
-
B as textForRange
|
|
96
|
-
};
|