@box/pdfjs-dist 6.4.299-box.2 → 6.4.299-box.4

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/build/pdf.mjs CHANGED
@@ -20,8 +20,8 @@
20
20
  */
21
21
 
22
22
  /**
23
- * pdfjsVersion = 6.4.299-box.2
24
- * pdfjsBuild = 9c8224a
23
+ * pdfjsVersion = 6.4.299-box.4
24
+ * pdfjsBuild = 38c965b
25
25
  */
26
26
 
27
27
  ;// ./src/shared/util.js
@@ -1759,6 +1759,16 @@ function renderRichText({
1759
1759
  fragment.firstElementChild.classList.add("richText", className);
1760
1760
  container.append(fragment);
1761
1761
  }
1762
+ let isBoxChangesSwitchOn = true;
1763
+ function setBoxChangesEnabled(enabled) {
1764
+ if (typeof enabled !== "boolean") {
1765
+ throw new Error("Invalid `enabled` type.");
1766
+ }
1767
+ isBoxChangesSwitchOn = enabled;
1768
+ }
1769
+ function areBoxChangesEnabled() {
1770
+ return isBoxChangesSwitchOn;
1771
+ }
1762
1772
  const axisAlignedClipPaths = new WeakMap();
1763
1773
  const NEAR_ZERO_TRANSFORM_RATIO = 1e-6;
1764
1774
  const MIN_SNAPPED_CLIP_SIZE = 2;
@@ -1874,6 +1884,9 @@ function recordClipPath(path, data) {
1874
1884
  }
1875
1885
  }
1876
1886
  function getPixelSnappedClipPath(path, transform) {
1887
+ if (!areBoxChangesEnabled()) {
1888
+ return path;
1889
+ }
1877
1890
  const axisAlignedPath = axisAlignedClipPaths.get(path);
1878
1891
  const snappedDrawOPS = axisAlignedPath && snapAxisAlignedPath(axisAlignedPath, transform);
1879
1892
  return snappedDrawOPS ? makePathFromDrawOPS(snappedDrawOPS) : path;
@@ -2213,7 +2226,7 @@ class FloatingToolbar {
2213
2226
  }
2214
2227
 
2215
2228
  ;// ./src/shared/internal_evt.js
2216
- const INTERNAL_EVT = "b73885cd-1954-4723-8cc0-0364b7abb527";
2229
+ const INTERNAL_EVT = "560872f8-101c-43ba-adde-6fe2cd9435d3";
2217
2230
  const internalOpt = Object.freeze({
2218
2231
  internal: INTERNAL_EVT
2219
2232
  });
@@ -10702,7 +10715,8 @@ function mirrorContextOperations(ctx, destCtx) {
10702
10715
  function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH) {
10703
10716
  const transform = getCurrentTransform(ctx);
10704
10717
  const [a, b, c, d, tx, ty] = transform;
10705
- if (isAxisAlignedScale(transform)) {
10718
+ const isRoundingTolerated = areBoxChangesEnabled();
10719
+ if (isRoundingTolerated ? isAxisAlignedScale(transform) : b === 0 && c === 0) {
10706
10720
  const tlX = destX * a + tx;
10707
10721
  const rTlX = Math.round(tlX);
10708
10722
  const tlY = destY * d + ty;
@@ -10716,7 +10730,7 @@ function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, de
10716
10730
  ctx.setTransform(a, b, c, d, tx, ty);
10717
10731
  return [rWidth, rHeight];
10718
10732
  }
10719
- if (isQuarterTurn(transform)) {
10733
+ if (isRoundingTolerated ? isQuarterTurn(transform) : a === 0 && d === 0) {
10720
10734
  const tlX = destY * c + tx;
10721
10735
  const rTlX = Math.round(tlX);
10722
10736
  const tlY = destX * b + ty;
@@ -15589,7 +15603,7 @@ function getDocument(src = {}) {
15589
15603
  }
15590
15604
  const docParams = {
15591
15605
  docId,
15592
- apiVersion: "6.4.299-box.2",
15606
+ apiVersion: "6.4.299-box.4",
15593
15607
  data,
15594
15608
  password,
15595
15609
  disableAutoFetch,
@@ -17290,8 +17304,8 @@ class InternalRenderTask {
17290
17304
  }
17291
17305
  }
17292
17306
  }
17293
- const version = "6.4.299-box.2";
17294
- const build = "9c8224a";
17307
+ const version = "6.4.299-box.4";
17308
+ const build = "38c965b";
17295
17309
 
17296
17310
  ;// ./src/display/editor/color_picker.js
17297
17311
 
@@ -21133,6 +21147,14 @@ class AnnotationLayer {
21133
21147
  await Promise.all(promises);
21134
21148
  if (this.#accessibilityManager) {
21135
21149
  const annotationIds = await this.#structTreeLayer?.getAnnotationIds();
21150
+ if (areBoxChangesEnabled()) {
21151
+ this.#accessibilityManager.addPointersInTextLayer(this.#elements.map(({
21152
+ contentElement
21153
+ }) => contentElement).filter(({
21154
+ id
21155
+ }) => !annotationIds?.has(id)), false);
21156
+ return;
21157
+ }
21136
21158
  for (const {
21137
21159
  contentElement
21138
21160
  } of this.#elements) {
@@ -28276,6 +28298,7 @@ globalThis.pdfjsLib = {
28276
28298
  AnnotationMode: AnnotationMode,
28277
28299
  AnnotationType: AnnotationType,
28278
28300
  applyOpacity: applyOpacity,
28301
+ areBoxChangesEnabled: areBoxChangesEnabled,
28279
28302
  build: build,
28280
28303
  ColorPicker: ColorPicker,
28281
28304
  createValidAbsoluteUrl: createValidAbsoluteUrl,
@@ -28316,6 +28339,7 @@ globalThis.pdfjsLib = {
28316
28339
  RenderingCancelledException: RenderingCancelledException,
28317
28340
  renderRichText: renderRichText,
28318
28341
  ResponseException: ResponseException,
28342
+ setBoxChangesEnabled: setBoxChangesEnabled,
28319
28343
  setLayerDimensions: setLayerDimensions,
28320
28344
  shadow: shadow,
28321
28345
  SignatureExtractor: SignatureExtractor,
@@ -28331,6 +28355,6 @@ globalThis.pdfjsLib = {
28331
28355
  XfaLayer: XfaLayer
28332
28356
  };
28333
28357
 
28334
- export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, CSSConstants, ColorPicker, DOMSVGFactory, DrawLayer, FeatureTest, GlobalWorkerOptions, ImageKind, InvalidPDFException, MathClamp, OPS, OutputScale, PDFDataRangeTransport, PDFDateString, PDFWorker, PasswordException, PasswordResponses, PermissionFlag, PixelsPerInch, RenderingCancelledException, ResponseException, SignatureExtractor, SupportedImageMimeTypes, TextLayer, TextLayerImages, TouchManager, Util, VerbosityLevel, XfaLayer, applyOpacity, build, createValidAbsoluteUrl, fetchData, findContrastColor, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getRGBA, getUuid, isDataScheme, isPdfFile, isValidExplicitDest, makeArr, makeMap, makeObj, makeSet, noContextMenu, normalizeUnicode, renderRichText, setLayerDimensions, shadow, stopEvent, updateUrlHash, version };
28358
+ export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, CSSConstants, ColorPicker, DOMSVGFactory, DrawLayer, FeatureTest, GlobalWorkerOptions, ImageKind, InvalidPDFException, MathClamp, OPS, OutputScale, PDFDataRangeTransport, PDFDateString, PDFWorker, PasswordException, PasswordResponses, PermissionFlag, PixelsPerInch, RenderingCancelledException, ResponseException, SignatureExtractor, SupportedImageMimeTypes, TextLayer, TextLayerImages, TouchManager, Util, VerbosityLevel, XfaLayer, applyOpacity, areBoxChangesEnabled, build, createValidAbsoluteUrl, fetchData, findContrastColor, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getRGBA, getUuid, isDataScheme, isPdfFile, isValidExplicitDest, makeArr, makeMap, makeObj, makeSet, noContextMenu, normalizeUnicode, renderRichText, setBoxChangesEnabled, setLayerDimensions, shadow, stopEvent, updateUrlHash, version };
28335
28359
 
28336
28360
  //# sourceMappingURL=pdf.mjs.map