Skip to content

Commit 3bfe899

Browse files
authored
Fix overlapping FXL pages in landscape orientation (#637)
1 parent 4329388 commit 3bfe899

File tree

7 files changed

+19
-13
lines changed

7 files changed

+19
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file. Take a look
2424
* EPUB vertical text in scrolling mode:
2525
* [#556](https://github.com/readium/swift-toolkit/issues/556) Fixed reporting and restoring the reading progression.
2626
* Added support for decorations (highlights).
27+
* [#635](https://github.com/readium/swift-toolkit/issues/635) Fixed overlapping FXL pages in landscape orientation.
2728

2829

2930
## [3.3.0]

Sources/Navigator/EPUB/Assets/Static/scripts/readium-fixed-wrapper-one.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/Navigator/EPUB/Assets/Static/scripts/readium-fixed-wrapper-two.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/Navigator/EPUB/EPUBFixedSpreadView.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,18 @@ final class EPUBFixedSpreadView: EPUBSpreadView {
7777
guard isWrapperLoaded else {
7878
return
7979
}
80-
// Insets the bounds by the notch area (eg. iPhone X) to make sure that the content is not overlapped by the screen notch.
81-
let insets = notchAreaInsets
80+
81+
// Insets the bounds by the notch area (eg. iPhone X) to make sure that
82+
// the content is not overlapped by the screen notch.
83+
var insets = notchAreaInsets
84+
85+
// Use the same insets on the left and right side (the largest one) to
86+
// keep the pages centered on the screen even if the notches are not
87+
// symmetrical.
88+
let horizontalInsets = max(insets.left, insets.right)
89+
insets.left = horizontalInsets
90+
insets.right = horizontalInsets
91+
8292
let viewportSize = bounds.inset(by: insets).size
8393

8494
webView.evaluateJavaScript("""

Sources/Navigator/EPUB/Scripts/src/fixed-page.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ export function FixedPage(iframeId) {
5252
_iframe.style.height = _pageSize.height + "px";
5353
_iframe.style.marginTop =
5454
_safeAreaInsets.top - _safeAreaInsets.bottom + "px";
55-
_iframe.style.marginLeft =
56-
_safeAreaInsets.left - _safeAreaInsets.right + "px";
5755

5856
// Calculates the zoom scale required to fit the content to the viewport.
5957
var widthRatio = _viewportSize.width / _pageSize.width;

Support/Carthage/.xcodegen

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# XCODEGEN VERSION
2-
2.43.0
2+
2.44.1
33

44
# SPEC
55
{
@@ -408,11 +408,9 @@
408408
../../Sources/Navigator/EditingAction.swift
409409
../../Sources/Navigator/EPUB
410410
../../Sources/Navigator/EPUB/Assets
411-
../../Sources/Navigator/EPUB/Assets/.DS_Store
412411
../../Sources/Navigator/EPUB/Assets/fxl-spread-one.html
413412
../../Sources/Navigator/EPUB/Assets/fxl-spread-two.html
414413
../../Sources/Navigator/EPUB/Assets/Static
415-
../../Sources/Navigator/EPUB/Assets/Static/.DS_Store
416414
../../Sources/Navigator/EPUB/Assets/Static/fonts
417415
../../Sources/Navigator/EPUB/Assets/Static/fonts/OpenDyslexic-Bold.otf
418416
../../Sources/Navigator/EPUB/Assets/Static/fonts/OpenDyslexic-BoldItalic.otf
@@ -470,6 +468,7 @@
470468
../../Sources/Navigator/EPUB/Preferences/EPUBPreferencesEditor.swift
471469
../../Sources/Navigator/EPUB/Preferences/EPUBSettings.swift
472470
../../Sources/Navigator/EPUB/Scripts
471+
../../Sources/Navigator/EPUB/Scripts/.DS_Store
473472
../../Sources/Navigator/EPUB/Scripts/.eslintrc.json
474473
../../Sources/Navigator/EPUB/Scripts/.gitignore
475474
../../Sources/Navigator/EPUB/Scripts/.prettierignore

Support/Carthage/Readium.xcodeproj/project.pbxproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 54;
6+
objectVersion = 77;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -2289,8 +2289,6 @@
22892289
attributes = {
22902290
BuildIndependentTargetsInParallel = YES;
22912291
LastUpgradeCheck = 1250;
2292-
TargetAttributes = {
2293-
};
22942292
};
22952293
buildConfigurationList = 5A872BCD95ECE5673BC89051 /* Build configuration list for PBXProject "Readium" */;
22962294
compatibilityVersion = "Xcode 14.0";
@@ -2303,7 +2301,7 @@
23032301
);
23042302
mainGroup = 2C63ECC3CC1230CCA416F55F;
23052303
minimizedProjectReferenceProxies = 1;
2306-
preferredProjectObjectVersion = 54;
2304+
preferredProjectObjectVersion = 77;
23072305
projectDirPath = "";
23082306
projectRoot = "";
23092307
targets = (

0 commit comments

Comments
 (0)