@embedpdf/plugin-annotation 2.8.0 → 2.9.0
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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +814 -139
- package/dist/index.js.map +1 -1
- package/dist/lib/geometry/cloudy-border.d.ts +90 -0
- package/dist/lib/geometry/index.d.ts +1 -0
- package/dist/lib/handlers/types.d.ts +2 -1
- package/dist/lib/tools/default-tools.d.ts +38 -87
- package/dist/lib/tools/types.d.ts +32 -1
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +352 -239
- package/dist/preact/index.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +352 -239
- package/dist/react/index.js.map +1 -1
- package/dist/shared/components/annotation-container.d.ts +4 -2
- package/dist/shared/components/annotations/circle.d.ts +6 -2
- package/dist/shared/components/annotations/polygon.d.ts +3 -1
- package/dist/shared/components/annotations/square.d.ts +6 -2
- package/dist/shared/components/types.d.ts +6 -2
- package/dist/shared-preact/components/annotation-container.d.ts +4 -2
- package/dist/shared-preact/components/annotations/circle.d.ts +6 -2
- package/dist/shared-preact/components/annotations/polygon.d.ts +3 -1
- package/dist/shared-preact/components/annotations/square.d.ts +6 -2
- package/dist/shared-preact/components/types.d.ts +6 -2
- package/dist/shared-react/components/annotation-container.d.ts +4 -2
- package/dist/shared-react/components/annotations/circle.d.ts +6 -2
- package/dist/shared-react/components/annotations/polygon.d.ts +3 -1
- package/dist/shared-react/components/annotations/square.d.ts +6 -2
- package/dist/shared-react/components/types.d.ts +6 -2
- package/dist/svelte/components/annotations/Circle.svelte.d.ts +3 -1
- package/dist/svelte/components/annotations/Polygon.svelte.d.ts +1 -0
- package/dist/svelte/components/annotations/Square.svelte.d.ts +3 -1
- package/dist/svelte/components/types.d.ts +2 -1
- package/dist/svelte/context/types.d.ts +6 -2
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.cjs.map +1 -1
- package/dist/svelte/index.js +505 -293
- package/dist/svelte/index.js.map +1 -1
- package/dist/vue/components/annotation-container.vue.d.ts +7 -6
- package/dist/vue/components/annotations/circle.vue.d.ts +5 -1
- package/dist/vue/components/annotations/polygon.vue.d.ts +2 -0
- package/dist/vue/components/annotations/square.vue.d.ts +5 -1
- package/dist/vue/components/annotations.vue.d.ts +8 -9
- package/dist/vue/context/types.d.ts +6 -2
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +259 -121
- package/dist/vue/index.js.map +1 -1
- package/package.json +10 -10
package/dist/react/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createPluginPackage } from "@embedpdf/core";
|
|
2
|
-
import { initialDocumentState, AnnotationPlugin, patching, getAnnotationsByPageIndex, getSelectedAnnotationIds, resolveInteractionProp, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
|
|
2
|
+
import { initialDocumentState, AnnotationPlugin, generateCloudyRectanglePath, generateCloudyEllipsePath, patching, generateCloudyPolygonPath, getAnnotationsByPageIndex, getSelectedAnnotationIds, resolveInteractionProp, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
|
|
3
3
|
export * from "@embedpdf/plugin-annotation";
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { createContext, useState, useCallback, useContext, useRef, useEffect, useMemo, useLayoutEffect, Fragment as Fragment$1 } from "react";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
7
|
import { useCapability, usePlugin, useDocumentPermissions, useDocumentState } from "@embedpdf/core/react";
|
|
8
|
-
import { inferRotationCenterFromRects, boundingRectOrEmpty, PdfAnnotationBorderStyle, getContrastStrokeColor, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode, PdfAnnotationSubtype, blendModeToCss
|
|
8
|
+
import { inferRotationCenterFromRects, boundingRectOrEmpty, PdfAnnotationBorderStyle, getContrastStrokeColor, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode, PdfBlendMode, PdfAnnotationSubtype, blendModeToCss } from "@embedpdf/models";
|
|
9
9
|
import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/react";
|
|
10
10
|
import { useSelectionCapability } from "@embedpdf/plugin-selection/react";
|
|
11
11
|
import { useInteractionHandles, useDoublePressProps, CounterRotate } from "@embedpdf/utils/react";
|
|
@@ -115,6 +115,7 @@ function AnnotationContainer({
|
|
|
115
115
|
isRotatable = true,
|
|
116
116
|
lockAspectRatio = false,
|
|
117
117
|
style = {},
|
|
118
|
+
blendMode,
|
|
118
119
|
vertexConfig,
|
|
119
120
|
selectionMenu,
|
|
120
121
|
outlineOffset = 1,
|
|
@@ -371,242 +372,250 @@ function AnnotationContainer({
|
|
|
371
372
|
return currentObject;
|
|
372
373
|
}, [currentObject, explicitUnrotatedRect]);
|
|
373
374
|
const apActive = !!(appearance == null ? void 0 : appearance.normal) && !gestureActive && !isEditing && !trackedAnnotation.dictMode;
|
|
375
|
+
const layerBaseStyle = {
|
|
376
|
+
position: "absolute",
|
|
377
|
+
left: currentObject.rect.origin.x * scale,
|
|
378
|
+
top: currentObject.rect.origin.y * scale,
|
|
379
|
+
width: counterRot ? counterRot.width : aabbWidth,
|
|
380
|
+
height: counterRot ? counterRot.height : aabbHeight,
|
|
381
|
+
pointerEvents: "none",
|
|
382
|
+
zIndex,
|
|
383
|
+
// noRotate: apply counter-rotation matrix so the annotation stays upright
|
|
384
|
+
...counterRot && {
|
|
385
|
+
transform: counterRot.matrix,
|
|
386
|
+
transformOrigin: "0 0"
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
const innerDivBaseStyle = {
|
|
390
|
+
position: "absolute",
|
|
391
|
+
left: innerLeft,
|
|
392
|
+
top: innerTop,
|
|
393
|
+
width: innerWidth,
|
|
394
|
+
height: innerHeight,
|
|
395
|
+
transform: annotationRotation !== 0 ? `rotate(${annotationRotation}deg)` : void 0,
|
|
396
|
+
transformOrigin: innerTransformOrigin
|
|
397
|
+
};
|
|
374
398
|
return /* @__PURE__ */ jsxs("div", { "data-no-interaction": true, children: [
|
|
375
|
-
/* @__PURE__ */
|
|
399
|
+
/* @__PURE__ */ jsx(
|
|
376
400
|
"div",
|
|
377
401
|
{
|
|
378
402
|
style: {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
top: currentObject.rect.origin.y * scale,
|
|
382
|
-
width: counterRot ? counterRot.width : aabbWidth,
|
|
383
|
-
height: counterRot ? counterRot.height : aabbHeight,
|
|
384
|
-
pointerEvents: "none",
|
|
385
|
-
zIndex,
|
|
386
|
-
// noRotate: apply counter-rotation matrix so the annotation stays upright
|
|
387
|
-
...counterRot && {
|
|
388
|
-
transform: counterRot.matrix,
|
|
389
|
-
transformOrigin: "0 0"
|
|
390
|
-
},
|
|
403
|
+
...layerBaseStyle,
|
|
404
|
+
...blendMode && { mixBlendMode: blendMode },
|
|
391
405
|
...style
|
|
392
406
|
},
|
|
393
|
-
...
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
children: /* @__PURE__ */ jsxs("div", { style: { ...innerDivBaseStyle, pointerEvents: "none" }, children: [
|
|
408
|
+
(() => {
|
|
409
|
+
const childrenRender = typeof children === "function" ? children(childObject, { appearanceActive: apActive }) : children;
|
|
410
|
+
const customRender = customAnnotationRenderer == null ? void 0 : customAnnotationRenderer({
|
|
411
|
+
annotation: childObject,
|
|
412
|
+
children: childrenRender,
|
|
413
|
+
isSelected,
|
|
414
|
+
scale,
|
|
415
|
+
rotation,
|
|
416
|
+
pageWidth,
|
|
417
|
+
pageHeight,
|
|
418
|
+
pageIndex,
|
|
419
|
+
onSelect
|
|
420
|
+
});
|
|
421
|
+
return customRender ?? childrenRender;
|
|
422
|
+
})(),
|
|
423
|
+
(appearance == null ? void 0 : appearance.normal) && /* @__PURE__ */ jsx(
|
|
424
|
+
AppearanceImage,
|
|
425
|
+
{
|
|
426
|
+
appearance: appearance.normal,
|
|
427
|
+
style: { display: apActive ? "block" : "none" }
|
|
428
|
+
}
|
|
429
|
+
)
|
|
430
|
+
] })
|
|
431
|
+
}
|
|
432
|
+
),
|
|
433
|
+
/* @__PURE__ */ jsxs("div", { style: layerBaseStyle, ...props, children: [
|
|
434
|
+
rotationActive && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
435
|
+
/* @__PURE__ */ jsx(
|
|
436
|
+
"div",
|
|
437
|
+
{
|
|
438
|
+
style: {
|
|
439
|
+
position: "absolute",
|
|
440
|
+
left: centerX - guideLength / 2,
|
|
441
|
+
top: centerY,
|
|
442
|
+
width: guideLength,
|
|
443
|
+
height: 1,
|
|
444
|
+
backgroundColor: ROTATION_CONNECTOR_COLOR,
|
|
445
|
+
opacity: 0.35,
|
|
446
|
+
pointerEvents: "none"
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
),
|
|
450
|
+
/* @__PURE__ */ jsx(
|
|
451
|
+
"div",
|
|
452
|
+
{
|
|
453
|
+
style: {
|
|
454
|
+
position: "absolute",
|
|
455
|
+
left: centerX,
|
|
456
|
+
top: centerY - guideLength / 2,
|
|
457
|
+
width: 1,
|
|
458
|
+
height: guideLength,
|
|
459
|
+
backgroundColor: ROTATION_CONNECTOR_COLOR,
|
|
460
|
+
opacity: 0.35,
|
|
461
|
+
pointerEvents: "none"
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
),
|
|
465
|
+
/* @__PURE__ */ jsx(
|
|
466
|
+
"div",
|
|
467
|
+
{
|
|
468
|
+
style: {
|
|
469
|
+
position: "absolute",
|
|
470
|
+
left: centerX - guideLength / 2,
|
|
471
|
+
top: centerY,
|
|
472
|
+
width: guideLength,
|
|
473
|
+
height: 1,
|
|
474
|
+
transformOrigin: "center center",
|
|
475
|
+
transform: `rotate(${annotationRotation}deg)`,
|
|
476
|
+
backgroundColor: ROTATION_CONNECTOR_COLOR,
|
|
477
|
+
opacity: 0.8,
|
|
478
|
+
pointerEvents: "none"
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
)
|
|
482
|
+
] }),
|
|
483
|
+
isSelected && effectiveIsRotatable && rotationHandle && ((rotationUI == null ? void 0 : rotationUI.component) ? /* @__PURE__ */ jsx(
|
|
484
|
+
"div",
|
|
485
|
+
{
|
|
486
|
+
onPointerEnter: () => setIsHandleHovered(true),
|
|
487
|
+
onPointerLeave: () => {
|
|
488
|
+
setIsHandleHovered(false);
|
|
489
|
+
setCursorScreen(null);
|
|
490
|
+
},
|
|
491
|
+
onPointerMove: (e) => {
|
|
492
|
+
if (!rotationActive) setCursorScreen({ x: e.clientX, y: e.clientY });
|
|
493
|
+
},
|
|
494
|
+
style: { display: "contents" },
|
|
495
|
+
children: rotationUI.component({
|
|
496
|
+
...rotationHandle.handle,
|
|
497
|
+
backgroundColor: ROTATION_COLOR,
|
|
498
|
+
iconColor: ROTATION_ICON_COLOR,
|
|
499
|
+
connectorStyle: {
|
|
500
|
+
...rotationHandle.connector.style,
|
|
501
|
+
backgroundColor: ROTATION_CONNECTOR_COLOR,
|
|
502
|
+
opacity: rotationActive ? 0 : 1
|
|
503
|
+
},
|
|
504
|
+
showConnector: SHOW_CONNECTOR,
|
|
505
|
+
opacity: rotationActive ? 0 : 1,
|
|
506
|
+
border: {
|
|
507
|
+
color: ROTATION_BORDER_COLOR,
|
|
508
|
+
width: ROTATION_BORDER_WIDTH,
|
|
509
|
+
style: ROTATION_BORDER_STYLE
|
|
510
|
+
}
|
|
511
|
+
})
|
|
512
|
+
}
|
|
513
|
+
) : /* @__PURE__ */ jsxs(
|
|
514
|
+
"div",
|
|
515
|
+
{
|
|
516
|
+
onPointerEnter: () => setIsHandleHovered(true),
|
|
517
|
+
onPointerLeave: () => {
|
|
518
|
+
setIsHandleHovered(false);
|
|
519
|
+
setCursorScreen(null);
|
|
520
|
+
},
|
|
521
|
+
onPointerMove: (e) => {
|
|
522
|
+
if (!rotationActive) setCursorScreen({ x: e.clientX, y: e.clientY });
|
|
523
|
+
},
|
|
524
|
+
style: { display: "contents" },
|
|
525
|
+
children: [
|
|
526
|
+
SHOW_CONNECTOR && /* @__PURE__ */ jsx(
|
|
412
527
|
"div",
|
|
413
528
|
{
|
|
414
529
|
style: {
|
|
415
|
-
|
|
416
|
-
left: centerX,
|
|
417
|
-
top: centerY - guideLength / 2,
|
|
418
|
-
width: 1,
|
|
419
|
-
height: guideLength,
|
|
530
|
+
...rotationHandle.connector.style,
|
|
420
531
|
backgroundColor: ROTATION_CONNECTOR_COLOR,
|
|
421
|
-
opacity: 0
|
|
422
|
-
pointerEvents: "none"
|
|
532
|
+
opacity: rotationActive ? 0 : 1
|
|
423
533
|
}
|
|
424
534
|
}
|
|
425
535
|
),
|
|
426
536
|
/* @__PURE__ */ jsx(
|
|
427
537
|
"div",
|
|
428
538
|
{
|
|
429
|
-
style: {
|
|
430
|
-
position: "absolute",
|
|
431
|
-
left: centerX - guideLength / 2,
|
|
432
|
-
top: centerY,
|
|
433
|
-
width: guideLength,
|
|
434
|
-
height: 1,
|
|
435
|
-
transformOrigin: "center center",
|
|
436
|
-
transform: `rotate(${annotationRotation}deg)`,
|
|
437
|
-
backgroundColor: ROTATION_CONNECTOR_COLOR,
|
|
438
|
-
opacity: 0.8,
|
|
439
|
-
pointerEvents: "none"
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
)
|
|
443
|
-
] }),
|
|
444
|
-
isSelected && effectiveIsRotatable && rotationHandle && ((rotationUI == null ? void 0 : rotationUI.component) ? /* @__PURE__ */ jsx(
|
|
445
|
-
"div",
|
|
446
|
-
{
|
|
447
|
-
onPointerEnter: () => setIsHandleHovered(true),
|
|
448
|
-
onPointerLeave: () => {
|
|
449
|
-
setIsHandleHovered(false);
|
|
450
|
-
setCursorScreen(null);
|
|
451
|
-
},
|
|
452
|
-
onPointerMove: (e) => {
|
|
453
|
-
if (!rotationActive) setCursorScreen({ x: e.clientX, y: e.clientY });
|
|
454
|
-
},
|
|
455
|
-
style: { display: "contents" },
|
|
456
|
-
children: rotationUI.component({
|
|
457
539
|
...rotationHandle.handle,
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
540
|
+
style: {
|
|
541
|
+
...rotationHandle.handle.style,
|
|
542
|
+
backgroundColor: ROTATION_COLOR,
|
|
543
|
+
border: `${ROTATION_BORDER_WIDTH}px ${ROTATION_BORDER_STYLE} ${ROTATION_BORDER_COLOR}`,
|
|
544
|
+
boxSizing: "border-box",
|
|
545
|
+
display: "flex",
|
|
546
|
+
alignItems: "center",
|
|
547
|
+
justifyContent: "center",
|
|
548
|
+
pointerEvents: "auto",
|
|
463
549
|
opacity: rotationActive ? 0 : 1
|
|
464
550
|
},
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
border: {
|
|
468
|
-
color: ROTATION_BORDER_COLOR,
|
|
469
|
-
width: ROTATION_BORDER_WIDTH,
|
|
470
|
-
style: ROTATION_BORDER_STYLE
|
|
471
|
-
}
|
|
472
|
-
})
|
|
473
|
-
}
|
|
474
|
-
) : /* @__PURE__ */ jsxs(
|
|
475
|
-
"div",
|
|
476
|
-
{
|
|
477
|
-
onPointerEnter: () => setIsHandleHovered(true),
|
|
478
|
-
onPointerLeave: () => {
|
|
479
|
-
setIsHandleHovered(false);
|
|
480
|
-
setCursorScreen(null);
|
|
481
|
-
},
|
|
482
|
-
onPointerMove: (e) => {
|
|
483
|
-
if (!rotationActive) setCursorScreen({ x: e.clientX, y: e.clientY });
|
|
484
|
-
},
|
|
485
|
-
style: { display: "contents" },
|
|
486
|
-
children: [
|
|
487
|
-
SHOW_CONNECTOR && /* @__PURE__ */ jsx(
|
|
488
|
-
"div",
|
|
551
|
+
children: /* @__PURE__ */ jsxs(
|
|
552
|
+
"svg",
|
|
489
553
|
{
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
554
|
+
width: Math.round(ROTATION_SIZE * 0.6),
|
|
555
|
+
height: Math.round(ROTATION_SIZE * 0.6),
|
|
556
|
+
viewBox: "0 0 24 24",
|
|
557
|
+
fill: "none",
|
|
558
|
+
stroke: ROTATION_ICON_COLOR,
|
|
559
|
+
strokeWidth: "2",
|
|
560
|
+
strokeLinecap: "round",
|
|
561
|
+
strokeLinejoin: "round",
|
|
562
|
+
children: [
|
|
563
|
+
/* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }),
|
|
564
|
+
/* @__PURE__ */ jsx("path", { d: "M21 3v5h-5" })
|
|
565
|
+
]
|
|
495
566
|
}
|
|
496
|
-
),
|
|
497
|
-
/* @__PURE__ */ jsx(
|
|
498
|
-
"div",
|
|
499
|
-
{
|
|
500
|
-
...rotationHandle.handle,
|
|
501
|
-
style: {
|
|
502
|
-
...rotationHandle.handle.style,
|
|
503
|
-
backgroundColor: ROTATION_COLOR,
|
|
504
|
-
border: `${ROTATION_BORDER_WIDTH}px ${ROTATION_BORDER_STYLE} ${ROTATION_BORDER_COLOR}`,
|
|
505
|
-
boxSizing: "border-box",
|
|
506
|
-
display: "flex",
|
|
507
|
-
alignItems: "center",
|
|
508
|
-
justifyContent: "center",
|
|
509
|
-
pointerEvents: "auto",
|
|
510
|
-
opacity: rotationActive ? 0 : 1
|
|
511
|
-
},
|
|
512
|
-
children: /* @__PURE__ */ jsxs(
|
|
513
|
-
"svg",
|
|
514
|
-
{
|
|
515
|
-
width: Math.round(ROTATION_SIZE * 0.6),
|
|
516
|
-
height: Math.round(ROTATION_SIZE * 0.6),
|
|
517
|
-
viewBox: "0 0 24 24",
|
|
518
|
-
fill: "none",
|
|
519
|
-
stroke: ROTATION_ICON_COLOR,
|
|
520
|
-
strokeWidth: "2",
|
|
521
|
-
strokeLinecap: "round",
|
|
522
|
-
strokeLinejoin: "round",
|
|
523
|
-
children: [
|
|
524
|
-
/* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }),
|
|
525
|
-
/* @__PURE__ */ jsx("path", { d: "M21 3v5h-5" })
|
|
526
|
-
]
|
|
527
|
-
}
|
|
528
|
-
)
|
|
529
|
-
}
|
|
530
|
-
)
|
|
531
|
-
]
|
|
532
|
-
}
|
|
533
|
-
)),
|
|
534
|
-
/* @__PURE__ */ jsxs(
|
|
535
|
-
"div",
|
|
536
|
-
{
|
|
537
|
-
...effectiveIsDraggable && isSelected ? dragProps : {},
|
|
538
|
-
...doubleProps,
|
|
539
|
-
style: {
|
|
540
|
-
position: "absolute",
|
|
541
|
-
left: innerLeft,
|
|
542
|
-
top: innerTop,
|
|
543
|
-
width: innerWidth,
|
|
544
|
-
height: innerHeight,
|
|
545
|
-
transform: annotationRotation !== 0 ? `rotate(${annotationRotation}deg)` : void 0,
|
|
546
|
-
transformOrigin: innerTransformOrigin,
|
|
547
|
-
outline: showOutline ? `${outlineWidth}px ${outlineStyle} ${outlineColor}` : "none",
|
|
548
|
-
outlineOffset: showOutline ? `${outlineOff}px` : "0px",
|
|
549
|
-
pointerEvents: isSelected && !isMultiSelected ? "auto" : "none",
|
|
550
|
-
touchAction: "none",
|
|
551
|
-
cursor: isSelected && effectiveIsDraggable ? "move" : "default"
|
|
552
|
-
},
|
|
553
|
-
children: [
|
|
554
|
-
(() => {
|
|
555
|
-
const childrenRender = typeof children === "function" ? children(childObject, { appearanceActive: apActive }) : children;
|
|
556
|
-
const customRender = customAnnotationRenderer == null ? void 0 : customAnnotationRenderer({
|
|
557
|
-
annotation: childObject,
|
|
558
|
-
children: childrenRender,
|
|
559
|
-
isSelected,
|
|
560
|
-
scale,
|
|
561
|
-
rotation,
|
|
562
|
-
pageWidth,
|
|
563
|
-
pageHeight,
|
|
564
|
-
pageIndex,
|
|
565
|
-
onSelect
|
|
566
|
-
});
|
|
567
|
-
return customRender ?? childrenRender;
|
|
568
|
-
})(),
|
|
569
|
-
(appearance == null ? void 0 : appearance.normal) && /* @__PURE__ */ jsx(
|
|
570
|
-
AppearanceImage,
|
|
571
|
-
{
|
|
572
|
-
appearance: appearance.normal,
|
|
573
|
-
style: { display: apActive ? "block" : "none" }
|
|
574
|
-
}
|
|
575
|
-
),
|
|
576
|
-
isSelected && effectiveIsResizable && !rotationActive && resize.map(
|
|
577
|
-
({ key, ...hProps }) => (resizeUI == null ? void 0 : resizeUI.component) ? resizeUI.component({
|
|
578
|
-
key,
|
|
579
|
-
...hProps,
|
|
580
|
-
backgroundColor: HANDLE_COLOR
|
|
581
|
-
}) : /* @__PURE__ */ jsx(
|
|
582
|
-
"div",
|
|
583
|
-
{
|
|
584
|
-
...hProps,
|
|
585
|
-
style: { ...hProps.style, backgroundColor: HANDLE_COLOR }
|
|
586
|
-
},
|
|
587
|
-
key
|
|
588
|
-
)
|
|
589
|
-
),
|
|
590
|
-
isSelected && canModifyAnnotations && !isMultiSelected && !rotationActive && vertices.map(
|
|
591
|
-
({ key, ...vProps }) => (vertexUI == null ? void 0 : vertexUI.component) ? vertexUI.component({
|
|
592
|
-
key,
|
|
593
|
-
...vProps,
|
|
594
|
-
backgroundColor: VERTEX_COLOR
|
|
595
|
-
}) : /* @__PURE__ */ jsx(
|
|
596
|
-
"div",
|
|
597
|
-
{
|
|
598
|
-
...vProps,
|
|
599
|
-
style: { ...vProps.style, backgroundColor: VERTEX_COLOR }
|
|
600
|
-
},
|
|
601
|
-
key
|
|
602
|
-
)
|
|
603
567
|
)
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
568
|
+
}
|
|
569
|
+
)
|
|
570
|
+
]
|
|
571
|
+
}
|
|
572
|
+
)),
|
|
573
|
+
/* @__PURE__ */ jsxs(
|
|
574
|
+
"div",
|
|
575
|
+
{
|
|
576
|
+
...effectiveIsDraggable && isSelected ? dragProps : {},
|
|
577
|
+
...doubleProps,
|
|
578
|
+
style: {
|
|
579
|
+
...innerDivBaseStyle,
|
|
580
|
+
outline: showOutline ? `${outlineWidth}px ${outlineStyle} ${outlineColor}` : "none",
|
|
581
|
+
outlineOffset: showOutline ? `${outlineOff}px` : "0px",
|
|
582
|
+
pointerEvents: isSelected && !isMultiSelected ? "auto" : "none",
|
|
583
|
+
touchAction: "none",
|
|
584
|
+
cursor: isSelected && effectiveIsDraggable ? "move" : "default"
|
|
585
|
+
},
|
|
586
|
+
children: [
|
|
587
|
+
isSelected && effectiveIsResizable && !rotationActive && resize.map(
|
|
588
|
+
({ key, ...hProps }) => (resizeUI == null ? void 0 : resizeUI.component) ? resizeUI.component({
|
|
589
|
+
key,
|
|
590
|
+
...hProps,
|
|
591
|
+
backgroundColor: HANDLE_COLOR
|
|
592
|
+
}) : /* @__PURE__ */ jsx(
|
|
593
|
+
"div",
|
|
594
|
+
{
|
|
595
|
+
...hProps,
|
|
596
|
+
style: { ...hProps.style, backgroundColor: HANDLE_COLOR }
|
|
597
|
+
},
|
|
598
|
+
key
|
|
599
|
+
)
|
|
600
|
+
),
|
|
601
|
+
isSelected && canModifyAnnotations && !isMultiSelected && !rotationActive && vertices.map(
|
|
602
|
+
({ key, ...vProps }) => (vertexUI == null ? void 0 : vertexUI.component) ? vertexUI.component({
|
|
603
|
+
key,
|
|
604
|
+
...vProps,
|
|
605
|
+
backgroundColor: VERTEX_COLOR
|
|
606
|
+
}) : /* @__PURE__ */ jsx(
|
|
607
|
+
"div",
|
|
608
|
+
{
|
|
609
|
+
...vProps,
|
|
610
|
+
style: { ...vProps.style, backgroundColor: VERTEX_COLOR }
|
|
611
|
+
},
|
|
612
|
+
key
|
|
613
|
+
)
|
|
614
|
+
)
|
|
615
|
+
]
|
|
616
|
+
}
|
|
617
|
+
)
|
|
618
|
+
] }),
|
|
610
619
|
selectionMenu && !isMultiSelected && !rotationActive && /* @__PURE__ */ jsx(
|
|
611
620
|
CounterRotate,
|
|
612
621
|
{
|
|
@@ -1167,7 +1176,7 @@ function GroupSelectionBox({
|
|
|
1167
1176
|
),
|
|
1168
1177
|
document.body
|
|
1169
1178
|
),
|
|
1170
|
-
groupSelectionMenu && /* @__PURE__ */ jsx(
|
|
1179
|
+
groupSelectionMenu && !rotationActive && /* @__PURE__ */ jsx(
|
|
1171
1180
|
CounterRotate,
|
|
1172
1181
|
{
|
|
1173
1182
|
rect: {
|
|
@@ -1208,6 +1217,7 @@ function createRenderer(entry) {
|
|
|
1208
1217
|
render: (props) => entry.render(props),
|
|
1209
1218
|
vertexConfig: entry.vertexConfig,
|
|
1210
1219
|
zIndex: entry.zIndex,
|
|
1220
|
+
defaultBlendMode: entry.defaultBlendMode,
|
|
1211
1221
|
containerStyle: entry.containerStyle,
|
|
1212
1222
|
interactionDefaults: entry.interactionDefaults,
|
|
1213
1223
|
useAppearanceStream: entry.useAppearanceStream,
|
|
@@ -1308,8 +1318,11 @@ function Square({
|
|
|
1308
1318
|
rect,
|
|
1309
1319
|
scale,
|
|
1310
1320
|
onClick,
|
|
1311
|
-
appearanceActive = false
|
|
1321
|
+
appearanceActive = false,
|
|
1322
|
+
cloudyBorderIntensity,
|
|
1323
|
+
rectangleDifferences
|
|
1312
1324
|
}) {
|
|
1325
|
+
const isCloudy = (cloudyBorderIntensity ?? 0) > 0;
|
|
1313
1326
|
const { width, height, x, y } = useMemo(() => {
|
|
1314
1327
|
const outerW = rect.size.width;
|
|
1315
1328
|
const outerH = rect.size.height;
|
|
@@ -1322,8 +1335,17 @@ function Square({
|
|
|
1322
1335
|
y: strokeWidth / 2
|
|
1323
1336
|
};
|
|
1324
1337
|
}, [rect, strokeWidth]);
|
|
1325
|
-
const
|
|
1326
|
-
|
|
1338
|
+
const cloudyPath = useMemo(() => {
|
|
1339
|
+
if (!isCloudy) return null;
|
|
1340
|
+
return generateCloudyRectanglePath(
|
|
1341
|
+
{ x: 0, y: 0, width: rect.size.width, height: rect.size.height },
|
|
1342
|
+
rectangleDifferences,
|
|
1343
|
+
cloudyBorderIntensity,
|
|
1344
|
+
strokeWidth
|
|
1345
|
+
);
|
|
1346
|
+
}, [isCloudy, rect, rectangleDifferences, cloudyBorderIntensity, strokeWidth]);
|
|
1347
|
+
const svgWidth = rect.size.width * scale;
|
|
1348
|
+
const svgHeight = rect.size.height * scale;
|
|
1327
1349
|
const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$4 / scale);
|
|
1328
1350
|
return /* @__PURE__ */ jsxs(
|
|
1329
1351
|
"svg",
|
|
@@ -1337,10 +1359,23 @@ function Square({
|
|
|
1337
1359
|
},
|
|
1338
1360
|
width: svgWidth,
|
|
1339
1361
|
height: svgHeight,
|
|
1340
|
-
viewBox: `0 0 ${width
|
|
1362
|
+
viewBox: `0 0 ${rect.size.width} ${rect.size.height}`,
|
|
1341
1363
|
overflow: "visible",
|
|
1342
1364
|
children: [
|
|
1343
|
-
/* @__PURE__ */ jsx(
|
|
1365
|
+
isCloudy && cloudyPath ? /* @__PURE__ */ jsx(
|
|
1366
|
+
"path",
|
|
1367
|
+
{
|
|
1368
|
+
d: cloudyPath.path,
|
|
1369
|
+
fill: "transparent",
|
|
1370
|
+
stroke: "transparent",
|
|
1371
|
+
strokeWidth: hitStrokeWidth,
|
|
1372
|
+
onPointerDown: onClick,
|
|
1373
|
+
style: {
|
|
1374
|
+
cursor: isSelected ? "move" : "pointer",
|
|
1375
|
+
pointerEvents: isSelected ? "none" : color === "transparent" ? "visibleStroke" : "visible"
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
) : /* @__PURE__ */ jsx(
|
|
1344
1379
|
"rect",
|
|
1345
1380
|
{
|
|
1346
1381
|
x,
|
|
@@ -1357,7 +1392,20 @@ function Square({
|
|
|
1357
1392
|
}
|
|
1358
1393
|
}
|
|
1359
1394
|
),
|
|
1360
|
-
!appearanceActive && /* @__PURE__ */ jsx(
|
|
1395
|
+
!appearanceActive && (isCloudy && cloudyPath ? /* @__PURE__ */ jsx(
|
|
1396
|
+
"path",
|
|
1397
|
+
{
|
|
1398
|
+
d: cloudyPath.path,
|
|
1399
|
+
fill: color,
|
|
1400
|
+
opacity,
|
|
1401
|
+
style: {
|
|
1402
|
+
pointerEvents: "none",
|
|
1403
|
+
stroke: strokeColor ?? color,
|
|
1404
|
+
strokeWidth,
|
|
1405
|
+
strokeLinejoin: "round"
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
) : /* @__PURE__ */ jsx(
|
|
1361
1409
|
"rect",
|
|
1362
1410
|
{
|
|
1363
1411
|
x,
|
|
@@ -1375,7 +1423,7 @@ function Square({
|
|
|
1375
1423
|
}
|
|
1376
1424
|
}
|
|
1377
1425
|
}
|
|
1378
|
-
)
|
|
1426
|
+
))
|
|
1379
1427
|
]
|
|
1380
1428
|
}
|
|
1381
1429
|
);
|
|
@@ -1392,8 +1440,11 @@ function Circle({
|
|
|
1392
1440
|
scale,
|
|
1393
1441
|
onClick,
|
|
1394
1442
|
isSelected,
|
|
1395
|
-
appearanceActive = false
|
|
1443
|
+
appearanceActive = false,
|
|
1444
|
+
cloudyBorderIntensity,
|
|
1445
|
+
rectangleDifferences
|
|
1396
1446
|
}) {
|
|
1447
|
+
const isCloudy = (cloudyBorderIntensity ?? 0) > 0;
|
|
1397
1448
|
const { width, height, cx, cy, rx, ry } = useMemo(() => {
|
|
1398
1449
|
const outerW = rect.size.width;
|
|
1399
1450
|
const outerH = rect.size.height;
|
|
@@ -1408,6 +1459,15 @@ function Circle({
|
|
|
1408
1459
|
ry: innerH / 2
|
|
1409
1460
|
};
|
|
1410
1461
|
}, [rect, strokeWidth]);
|
|
1462
|
+
const cloudyPath = useMemo(() => {
|
|
1463
|
+
if (!isCloudy) return null;
|
|
1464
|
+
return generateCloudyEllipsePath(
|
|
1465
|
+
{ x: 0, y: 0, width: rect.size.width, height: rect.size.height },
|
|
1466
|
+
rectangleDifferences,
|
|
1467
|
+
cloudyBorderIntensity,
|
|
1468
|
+
strokeWidth
|
|
1469
|
+
);
|
|
1470
|
+
}, [isCloudy, rect, rectangleDifferences, cloudyBorderIntensity, strokeWidth]);
|
|
1411
1471
|
const svgWidth = width * scale;
|
|
1412
1472
|
const svgHeight = height * scale;
|
|
1413
1473
|
const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$3 / scale);
|
|
@@ -1426,7 +1486,20 @@ function Circle({
|
|
|
1426
1486
|
viewBox: `0 0 ${width} ${height}`,
|
|
1427
1487
|
overflow: "visible",
|
|
1428
1488
|
children: [
|
|
1429
|
-
/* @__PURE__ */ jsx(
|
|
1489
|
+
isCloudy && cloudyPath ? /* @__PURE__ */ jsx(
|
|
1490
|
+
"path",
|
|
1491
|
+
{
|
|
1492
|
+
d: cloudyPath.path,
|
|
1493
|
+
fill: "transparent",
|
|
1494
|
+
stroke: "transparent",
|
|
1495
|
+
strokeWidth: hitStrokeWidth,
|
|
1496
|
+
onPointerDown: onClick,
|
|
1497
|
+
style: {
|
|
1498
|
+
cursor: isSelected ? "move" : "pointer",
|
|
1499
|
+
pointerEvents: isSelected ? "none" : color === "transparent" ? "visibleStroke" : "visible"
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
) : /* @__PURE__ */ jsx(
|
|
1430
1503
|
"ellipse",
|
|
1431
1504
|
{
|
|
1432
1505
|
cx,
|
|
@@ -1443,7 +1516,20 @@ function Circle({
|
|
|
1443
1516
|
}
|
|
1444
1517
|
}
|
|
1445
1518
|
),
|
|
1446
|
-
!appearanceActive && /* @__PURE__ */ jsx(
|
|
1519
|
+
!appearanceActive && (isCloudy && cloudyPath ? /* @__PURE__ */ jsx(
|
|
1520
|
+
"path",
|
|
1521
|
+
{
|
|
1522
|
+
d: cloudyPath.path,
|
|
1523
|
+
fill: color,
|
|
1524
|
+
opacity,
|
|
1525
|
+
style: {
|
|
1526
|
+
pointerEvents: "none",
|
|
1527
|
+
stroke: strokeColor ?? color,
|
|
1528
|
+
strokeWidth,
|
|
1529
|
+
strokeLinejoin: "round"
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
) : /* @__PURE__ */ jsx(
|
|
1447
1533
|
"ellipse",
|
|
1448
1534
|
{
|
|
1449
1535
|
cx,
|
|
@@ -1461,7 +1547,7 @@ function Circle({
|
|
|
1461
1547
|
}
|
|
1462
1548
|
}
|
|
1463
1549
|
}
|
|
1464
|
-
)
|
|
1550
|
+
))
|
|
1465
1551
|
]
|
|
1466
1552
|
}
|
|
1467
1553
|
);
|
|
@@ -1808,8 +1894,10 @@ function Polygon({
|
|
|
1808
1894
|
onClick,
|
|
1809
1895
|
currentVertex,
|
|
1810
1896
|
handleSize = 14,
|
|
1811
|
-
appearanceActive = false
|
|
1897
|
+
appearanceActive = false,
|
|
1898
|
+
cloudyBorderIntensity
|
|
1812
1899
|
}) {
|
|
1900
|
+
const isCloudy = (cloudyBorderIntensity ?? 0) > 0;
|
|
1813
1901
|
const allPoints = currentVertex ? [...vertices, currentVertex] : vertices;
|
|
1814
1902
|
const localPts = useMemo(
|
|
1815
1903
|
() => allPoints.map(({ x, y }) => ({ x: x - rect.origin.x, y: y - rect.origin.y })),
|
|
@@ -1821,6 +1909,10 @@ function Polygon({
|
|
|
1821
1909
|
const isPreview = !!currentVertex;
|
|
1822
1910
|
return (`M ${first.x} ${first.y} ` + rest.map((p) => `L ${p.x} ${p.y}`).join(" ") + (isPreview ? "" : " Z")).trim();
|
|
1823
1911
|
}, [localPts, currentVertex]);
|
|
1912
|
+
const cloudyPath = useMemo(() => {
|
|
1913
|
+
if (!isCloudy || allPoints.length < 3) return null;
|
|
1914
|
+
return generateCloudyPolygonPath(allPoints, rect.origin, cloudyBorderIntensity, strokeWidth);
|
|
1915
|
+
}, [isCloudy, allPoints, rect.origin, cloudyBorderIntensity, strokeWidth]);
|
|
1824
1916
|
const isPreviewing = currentVertex && vertices.length > 0;
|
|
1825
1917
|
const width = rect.size.width * scale;
|
|
1826
1918
|
const height = rect.size.height * scale;
|
|
@@ -1843,7 +1935,7 @@ function Polygon({
|
|
|
1843
1935
|
/* @__PURE__ */ jsx(
|
|
1844
1936
|
"path",
|
|
1845
1937
|
{
|
|
1846
|
-
d: pathData,
|
|
1938
|
+
d: isCloudy && cloudyPath ? cloudyPath.path : pathData,
|
|
1847
1939
|
fill: "transparent",
|
|
1848
1940
|
stroke: "transparent",
|
|
1849
1941
|
strokeWidth: hitStrokeWidth,
|
|
@@ -1856,7 +1948,20 @@ function Polygon({
|
|
|
1856
1948
|
}
|
|
1857
1949
|
}
|
|
1858
1950
|
),
|
|
1859
|
-
!appearanceActive && /* @__PURE__ */
|
|
1951
|
+
!appearanceActive && /* @__PURE__ */ jsx(Fragment, { children: isCloudy && cloudyPath ? /* @__PURE__ */ jsx(
|
|
1952
|
+
"path",
|
|
1953
|
+
{
|
|
1954
|
+
d: cloudyPath.path,
|
|
1955
|
+
opacity,
|
|
1956
|
+
style: {
|
|
1957
|
+
fill: color,
|
|
1958
|
+
stroke: strokeColor ?? color,
|
|
1959
|
+
strokeWidth,
|
|
1960
|
+
pointerEvents: "none",
|
|
1961
|
+
strokeLinejoin: "round"
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1860
1965
|
/* @__PURE__ */ jsx(
|
|
1861
1966
|
"path",
|
|
1862
1967
|
{
|
|
@@ -1903,7 +2008,7 @@ function Polygon({
|
|
|
1903
2008
|
style: { pointerEvents: "none" }
|
|
1904
2009
|
}
|
|
1905
2010
|
)
|
|
1906
|
-
] })
|
|
2011
|
+
] }) })
|
|
1907
2012
|
]
|
|
1908
2013
|
}
|
|
1909
2014
|
);
|
|
@@ -2634,9 +2739,7 @@ const builtInRenderers = [
|
|
|
2634
2739
|
),
|
|
2635
2740
|
zIndex: 0,
|
|
2636
2741
|
interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },
|
|
2637
|
-
|
|
2638
|
-
mixBlendMode: blendModeToCss(a.blendMode ?? PdfBlendMode.Multiply)
|
|
2639
|
-
})
|
|
2742
|
+
defaultBlendMode: PdfBlendMode.Multiply
|
|
2640
2743
|
}),
|
|
2641
2744
|
createRenderer({
|
|
2642
2745
|
id: "underline",
|
|
@@ -3029,9 +3132,10 @@ function Annotations(annotationsProps) {
|
|
|
3029
3132
|
renderer.onDoubleClick(annotation.object.id, setEditingId);
|
|
3030
3133
|
} : void 0,
|
|
3031
3134
|
zIndex: renderer.zIndex,
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3135
|
+
blendMode: blendModeToCss(
|
|
3136
|
+
annotation.object.blendMode ?? renderer.defaultBlendMode ?? PdfBlendMode.Normal
|
|
3137
|
+
),
|
|
3138
|
+
style: (_c = renderer.containerStyle) == null ? void 0 : _c.call(renderer, annotation.object),
|
|
3035
3139
|
appearance: useAP ? getAppearanceForAnnotation(annotation) : void 0,
|
|
3036
3140
|
...annotationsProps,
|
|
3037
3141
|
children: (currentObject, { appearanceActive }) => renderer.render({
|
|
@@ -3211,7 +3315,16 @@ function PreviewRenderer({ preview, scale }) {
|
|
|
3211
3315
|
return /* @__PURE__ */ jsx("div", { style, children: /* @__PURE__ */ jsx(Line, { isSelected: false, scale, ...preview.data }) });
|
|
3212
3316
|
}
|
|
3213
3317
|
if (preview.type === PdfAnnotationSubtype.INK) {
|
|
3214
|
-
return /* @__PURE__ */ jsx(
|
|
3318
|
+
return /* @__PURE__ */ jsx(
|
|
3319
|
+
"div",
|
|
3320
|
+
{
|
|
3321
|
+
style: {
|
|
3322
|
+
...style,
|
|
3323
|
+
mixBlendMode: blendModeToCss(preview.data.blendMode ?? PdfBlendMode.Normal)
|
|
3324
|
+
},
|
|
3325
|
+
children: /* @__PURE__ */ jsx(Ink, { isSelected: false, scale, ...preview.data })
|
|
3326
|
+
}
|
|
3327
|
+
);
|
|
3215
3328
|
}
|
|
3216
3329
|
if (preview.type === PdfAnnotationSubtype.FREETEXT) {
|
|
3217
3330
|
return /* @__PURE__ */ jsx("div", { style, children: /* @__PURE__ */ jsx(
|