@prose-reader/core 1.69.0 → 1.70.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.
@@ -705,7 +705,7 @@
705
705
  spineItemPosition
706
706
  );
707
707
  if (!isNewNavigationInCurrentItem) {
708
- return navigationResolver.wrapPositionWithSafeEdge(
708
+ return navigationResolver.getAdjustedPositionWithSafeEdge(
709
709
  pageTurnDirection === `horizontal` ? { x: position.x + context.getPageSize().width, y: 0 } : { y: position.y + context.getPageSize().height, x: 0 }
710
710
  );
711
711
  } else {
@@ -739,7 +739,7 @@
739
739
  if (context.state.isUsingSpreadMode) {
740
740
  if ((spineItem == null ? void 0 : spineItem.isUsingVerticalWriting()) && position.x !== navigation.x) {
741
741
  return navigationResolver.getAdjustedPositionForSpread(
742
- navigationResolver.wrapPositionWithSafeEdge(
742
+ navigationResolver.getAdjustedPositionWithSafeEdge(
743
743
  context.isRTL() ? {
744
744
  ...navigation,
745
745
  x: navigation.x - context.getPageSize().width
@@ -818,7 +818,7 @@
818
818
  spineItemPosition
819
819
  );
820
820
  if (!isNewNavigationInCurrentItem) {
821
- return navigationResolver.wrapPositionWithSafeEdge(
821
+ return navigationResolver.getAdjustedPositionWithSafeEdge(
822
822
  pageTurnDirection === `horizontal` ? { x: position.x - context.getPageSize().width, y: 0 } : { y: position.y - context.getPageSize().height, x: 0 }
823
823
  );
824
824
  } else {
@@ -852,7 +852,7 @@
852
852
  if (context.state.isUsingSpreadMode) {
853
853
  if ((spineItem == null ? void 0 : spineItem.isUsingVerticalWriting()) && position.x !== navigation.x) {
854
854
  return navigationResolver.getAdjustedPositionForSpread(
855
- navigationResolver.wrapPositionWithSafeEdge(
855
+ navigationResolver.getAdjustedPositionWithSafeEdge(
856
856
  context.isRTL() ? { ...navigation, x: navigation.x + context.getPageSize().width } : {
857
857
  ...navigation,
858
858
  x: navigation.x - context.getPageSize().width
@@ -2250,12 +2250,12 @@
2250
2250
  const correctedX = isOffsetNotAtEdge ? x - pageSizeWidth : x;
2251
2251
  return { x: correctedX, y };
2252
2252
  };
2253
- const wrapPositionWithSafeEdge = ({
2253
+ const getAdjustedPositionWithSafeEdge = ({
2254
2254
  position,
2255
2255
  isRTL,
2256
- pageSizeWidth,
2257
2256
  pageSizeHeight,
2258
- spineItemsManager
2257
+ spineItemsManager,
2258
+ visibleAreaRectWidth
2259
2259
  }) => {
2260
2260
  const lastSpineItem = spineItemsManager.get(spineItemsManager.getLength() - 1);
2261
2261
  const distanceOfLastSpineItem = spineItemsManager.getAbsolutePositionOf(
@@ -2269,7 +2269,7 @@
2269
2269
  y
2270
2270
  };
2271
2271
  }
2272
- const maximumXOffset = distanceOfLastSpineItem.right - pageSizeWidth;
2272
+ const maximumXOffset = distanceOfLastSpineItem.right - visibleAreaRectWidth;
2273
2273
  return {
2274
2274
  x: Math.min(Math.max(0, position.x), maximumXOffset),
2275
2275
  y
@@ -3400,14 +3400,14 @@
3400
3400
  const triggerPercentage = 0.5;
3401
3401
  const triggerXPosition = pageTurnDirection === `horizontal` ? viewportPosition.x + context.state.visibleAreaRect.width * triggerPercentage : 0;
3402
3402
  const triggerYPosition = pageTurnDirection === `horizontal` ? 0 : viewportPosition.y + context.state.visibleAreaRect.height * triggerPercentage;
3403
- const midScreenPositionSafePosition = wrapPositionWithSafeEdge({
3403
+ const midScreenPositionSafePosition = getAdjustedPositionWithSafeEdge({
3404
3404
  position: {
3405
3405
  x: triggerXPosition,
3406
3406
  y: triggerYPosition
3407
3407
  },
3408
3408
  isRTL: context.isRTL(),
3409
3409
  pageSizeHeight: context.getPageSize().height,
3410
- pageSizeWidth: context.getPageSize().width,
3410
+ visibleAreaRectWidth: context.state.visibleAreaRect.width,
3411
3411
  spineItemsManager
3412
3412
  });
3413
3413
  return getNavigationForPosition({
@@ -3456,11 +3456,11 @@
3456
3456
  spineLocator: locator
3457
3457
  }),
3458
3458
  getMostPredominantNavigationForPosition,
3459
- wrapPositionWithSafeEdge: (position) => wrapPositionWithSafeEdge({
3459
+ getAdjustedPositionWithSafeEdge: (position) => getAdjustedPositionWithSafeEdge({
3460
3460
  position,
3461
3461
  isRTL: context.isRTL(),
3462
3462
  pageSizeHeight: context.getPageSize().height,
3463
- pageSizeWidth: context.getPageSize().width,
3463
+ visibleAreaRectWidth: context.state.visibleAreaRect.width,
3464
3464
  spineItemsManager
3465
3465
  }),
3466
3466
  isNavigationGoingForwardFrom,
@@ -4149,7 +4149,7 @@
4149
4149
  return {
4150
4150
  navigation: {
4151
4151
  ...navigation,
4152
- position: navigationResolver.wrapPositionWithSafeEdge(
4152
+ position: navigationResolver.getAdjustedPositionWithSafeEdge(
4153
4153
  navigation.position
4154
4154
  )
4155
4155
  },