@internetarchive/bookreader 5.0.0-68 → 5.0.0-69
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -352,8 +352,9 @@ export class PageModel {
|
|
|
352
352
|
* @param {PageIndex} index
|
|
353
353
|
*/
|
|
354
354
|
constructor(book, index) {
|
|
355
|
-
//
|
|
356
|
-
|
|
355
|
+
// Values less than 10 cause the UI to not work correctly
|
|
356
|
+
const pagePPI = book._getDataProp(index, 'ppi', book.ppi);
|
|
357
|
+
this.ppi = Math.max(pagePPI < 10 ? book.ppi : pagePPI, 10);
|
|
357
358
|
this.book = book;
|
|
358
359
|
this.index = index;
|
|
359
360
|
this.width = book.getPageWidth(index);
|
|
@@ -24,8 +24,8 @@ const SAMPLE_DATA = [
|
|
|
24
24
|
|
|
25
25
|
describe('getMedianPageSizeInches', () => {
|
|
26
26
|
test('handles single page data', () => {
|
|
27
|
-
const bm = new BookModel({ data: SAMPLE_DATA.slice(0, 1), options: {ppi:
|
|
28
|
-
expect(bm.getMedianPageSizeInches()).toEqual({ width:
|
|
27
|
+
const bm = new BookModel({ data: SAMPLE_DATA.slice(0, 1), options: {ppi: 10} });
|
|
28
|
+
expect(bm.getMedianPageSizeInches()).toEqual({ width: 12.3, height: 12.3 });
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
test('handles odd pages data', () => {
|
|
@@ -39,8 +39,8 @@ describe('getMedianPageSizeInches', () => {
|
|
|
39
39
|
Object.assign(data[0][0], sizes[0]);
|
|
40
40
|
Object.assign(data[1][0], sizes[1]);
|
|
41
41
|
Object.assign(data[1][1], sizes[2]);
|
|
42
|
-
const bm = new BookModel({ data, options: {ppi:
|
|
43
|
-
expect(bm.getMedianPageSizeInches()).toEqual({ width:
|
|
42
|
+
const bm = new BookModel({ data, options: {ppi: 10} });
|
|
43
|
+
expect(bm.getMedianPageSizeInches()).toEqual({ width: 20, height: 220 });
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
|
|
@@ -56,8 +56,8 @@ describe('getMedianPageSizeInches', () => {
|
|
|
56
56
|
Object.assign(data[1][0], sizes[1]);
|
|
57
57
|
Object.assign(data[1][1], sizes[2]);
|
|
58
58
|
Object.assign(data[2][0], sizes[3]);
|
|
59
|
-
const bm = new BookModel({ data, options: {ppi:
|
|
60
|
-
expect(bm.getMedianPageSizeInches()).toEqual({ width:
|
|
59
|
+
const bm = new BookModel({ data, options: {ppi: 10} });
|
|
60
|
+
expect(bm.getMedianPageSizeInches()).toEqual({ width: 30, height: 230 });
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
test('does not lexicographic sort for median', () => {
|
|
@@ -71,8 +71,8 @@ describe('getMedianPageSizeInches', () => {
|
|
|
71
71
|
Object.assign(data[0][0], sizes[0]);
|
|
72
72
|
Object.assign(data[1][0], sizes[1]);
|
|
73
73
|
Object.assign(data[1][1], sizes[2]);
|
|
74
|
-
const bm = new BookModel({ data, options: {ppi:
|
|
75
|
-
expect(bm.getMedianPageSizeInches()).toEqual({ width:
|
|
74
|
+
const bm = new BookModel({ data, options: {ppi: 10} });
|
|
75
|
+
expect(bm.getMedianPageSizeInches()).toEqual({ width: 3, height: 3 });
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
test('caches result', () => {
|