@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.
- package/dist/createReaderWithEnhancer.d.ts +1 -1
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +13 -13
- package/dist/index.umd.cjs.map +1 -1
- package/dist/navigation/Navigator.d.ts +1 -1
- package/dist/navigation/resolvers/NavigationResolver.d.ts +1 -1
- package/dist/navigation/resolvers/{wrapPositionWithSafeEdge.d.ts → getAdjustedPositionWithSafeEdge.d.ts} +2 -2
- package/dist/reader.d.ts +1 -1
- package/package.json +3 -3
|
@@ -63,7 +63,7 @@ export declare const createReaderWithEnhancers: (options: Partial<import('./sett
|
|
|
63
63
|
getNavigationForSpineIndexOrId: (indexOrId: number | string | import('./spineItem/createSpineItem').SpineItem) => import('./navigation/viewport/ViewportNavigator').ViewportPosition;
|
|
64
64
|
getNavigationForPosition: (viewportPosition: import('./navigation/viewport/ViewportNavigator').ViewportPosition) => import('./navigation/viewport/ViewportNavigator').ViewportPosition;
|
|
65
65
|
getMostPredominantNavigationForPosition: (viewportPosition: import('./navigation/viewport/ViewportNavigator').ViewportPosition) => import('./navigation/viewport/ViewportNavigator').ViewportPosition;
|
|
66
|
-
|
|
66
|
+
getAdjustedPositionWithSafeEdge: (position: import('./navigation/viewport/ViewportNavigator').ViewportPosition) => {
|
|
67
67
|
x: number;
|
|
68
68
|
y: number;
|
|
69
69
|
};
|
package/dist/index.js
CHANGED
|
@@ -704,7 +704,7 @@ const getNavigationForRightSinglePage = ({
|
|
|
704
704
|
spineItemPosition
|
|
705
705
|
);
|
|
706
706
|
if (!isNewNavigationInCurrentItem) {
|
|
707
|
-
return navigationResolver.
|
|
707
|
+
return navigationResolver.getAdjustedPositionWithSafeEdge(
|
|
708
708
|
pageTurnDirection === `horizontal` ? { x: position.x + context.getPageSize().width, y: 0 } : { y: position.y + context.getPageSize().height, x: 0 }
|
|
709
709
|
);
|
|
710
710
|
} else {
|
|
@@ -738,7 +738,7 @@ const getNavigationForRightPage = ({
|
|
|
738
738
|
if (context.state.isUsingSpreadMode) {
|
|
739
739
|
if ((spineItem == null ? void 0 : spineItem.isUsingVerticalWriting()) && position.x !== navigation.x) {
|
|
740
740
|
return navigationResolver.getAdjustedPositionForSpread(
|
|
741
|
-
navigationResolver.
|
|
741
|
+
navigationResolver.getAdjustedPositionWithSafeEdge(
|
|
742
742
|
context.isRTL() ? {
|
|
743
743
|
...navigation,
|
|
744
744
|
x: navigation.x - context.getPageSize().width
|
|
@@ -817,7 +817,7 @@ const getNavigationForLeftSinglePage = ({
|
|
|
817
817
|
spineItemPosition
|
|
818
818
|
);
|
|
819
819
|
if (!isNewNavigationInCurrentItem) {
|
|
820
|
-
return navigationResolver.
|
|
820
|
+
return navigationResolver.getAdjustedPositionWithSafeEdge(
|
|
821
821
|
pageTurnDirection === `horizontal` ? { x: position.x - context.getPageSize().width, y: 0 } : { y: position.y - context.getPageSize().height, x: 0 }
|
|
822
822
|
);
|
|
823
823
|
} else {
|
|
@@ -851,7 +851,7 @@ const getNavigationForLeftPage = ({
|
|
|
851
851
|
if (context.state.isUsingSpreadMode) {
|
|
852
852
|
if ((spineItem == null ? void 0 : spineItem.isUsingVerticalWriting()) && position.x !== navigation.x) {
|
|
853
853
|
return navigationResolver.getAdjustedPositionForSpread(
|
|
854
|
-
navigationResolver.
|
|
854
|
+
navigationResolver.getAdjustedPositionWithSafeEdge(
|
|
855
855
|
context.isRTL() ? { ...navigation, x: navigation.x + context.getPageSize().width } : {
|
|
856
856
|
...navigation,
|
|
857
857
|
x: navigation.x - context.getPageSize().width
|
|
@@ -2249,12 +2249,12 @@ const getAdjustedPositionForSpread = ({
|
|
|
2249
2249
|
const correctedX = isOffsetNotAtEdge ? x - pageSizeWidth : x;
|
|
2250
2250
|
return { x: correctedX, y };
|
|
2251
2251
|
};
|
|
2252
|
-
const
|
|
2252
|
+
const getAdjustedPositionWithSafeEdge = ({
|
|
2253
2253
|
position,
|
|
2254
2254
|
isRTL,
|
|
2255
|
-
pageSizeWidth,
|
|
2256
2255
|
pageSizeHeight,
|
|
2257
|
-
spineItemsManager
|
|
2256
|
+
spineItemsManager,
|
|
2257
|
+
visibleAreaRectWidth
|
|
2258
2258
|
}) => {
|
|
2259
2259
|
const lastSpineItem = spineItemsManager.get(spineItemsManager.getLength() - 1);
|
|
2260
2260
|
const distanceOfLastSpineItem = spineItemsManager.getAbsolutePositionOf(
|
|
@@ -2268,7 +2268,7 @@ const wrapPositionWithSafeEdge = ({
|
|
|
2268
2268
|
y
|
|
2269
2269
|
};
|
|
2270
2270
|
}
|
|
2271
|
-
const maximumXOffset = distanceOfLastSpineItem.right -
|
|
2271
|
+
const maximumXOffset = distanceOfLastSpineItem.right - visibleAreaRectWidth;
|
|
2272
2272
|
return {
|
|
2273
2273
|
x: Math.min(Math.max(0, position.x), maximumXOffset),
|
|
2274
2274
|
y
|
|
@@ -3399,14 +3399,14 @@ const createNavigationResolver = ({
|
|
|
3399
3399
|
const triggerPercentage = 0.5;
|
|
3400
3400
|
const triggerXPosition = pageTurnDirection === `horizontal` ? viewportPosition.x + context.state.visibleAreaRect.width * triggerPercentage : 0;
|
|
3401
3401
|
const triggerYPosition = pageTurnDirection === `horizontal` ? 0 : viewportPosition.y + context.state.visibleAreaRect.height * triggerPercentage;
|
|
3402
|
-
const midScreenPositionSafePosition =
|
|
3402
|
+
const midScreenPositionSafePosition = getAdjustedPositionWithSafeEdge({
|
|
3403
3403
|
position: {
|
|
3404
3404
|
x: triggerXPosition,
|
|
3405
3405
|
y: triggerYPosition
|
|
3406
3406
|
},
|
|
3407
3407
|
isRTL: context.isRTL(),
|
|
3408
3408
|
pageSizeHeight: context.getPageSize().height,
|
|
3409
|
-
|
|
3409
|
+
visibleAreaRectWidth: context.state.visibleAreaRect.width,
|
|
3410
3410
|
spineItemsManager
|
|
3411
3411
|
});
|
|
3412
3412
|
return getNavigationForPosition({
|
|
@@ -3455,11 +3455,11 @@ const createNavigationResolver = ({
|
|
|
3455
3455
|
spineLocator: locator
|
|
3456
3456
|
}),
|
|
3457
3457
|
getMostPredominantNavigationForPosition,
|
|
3458
|
-
|
|
3458
|
+
getAdjustedPositionWithSafeEdge: (position) => getAdjustedPositionWithSafeEdge({
|
|
3459
3459
|
position,
|
|
3460
3460
|
isRTL: context.isRTL(),
|
|
3461
3461
|
pageSizeHeight: context.getPageSize().height,
|
|
3462
|
-
|
|
3462
|
+
visibleAreaRectWidth: context.state.visibleAreaRect.width,
|
|
3463
3463
|
spineItemsManager
|
|
3464
3464
|
}),
|
|
3465
3465
|
isNavigationGoingForwardFrom,
|
|
@@ -4148,7 +4148,7 @@ const withFallbackPosition = ({
|
|
|
4148
4148
|
return {
|
|
4149
4149
|
navigation: {
|
|
4150
4150
|
...navigation,
|
|
4151
|
-
position: navigationResolver.
|
|
4151
|
+
position: navigationResolver.getAdjustedPositionWithSafeEdge(
|
|
4152
4152
|
navigation.position
|
|
4153
4153
|
)
|
|
4154
4154
|
},
|