@internetarchive/bookreader
Advanced tools
Comparing version 5.0.0-68 to 5.0.0-69
@@ -0,1 +1,4 @@ | ||
# 5.0.0-69 | ||
- Fix: Handle ppi incorrectly set to one @cdrini | ||
# 5.0.0-68 | ||
@@ -2,0 +5,0 @@ - Fix: 1up zoom wrong on start/entering full screen @cdrini |
{ | ||
"name": "@internetarchive/bookreader", | ||
"version": "5.0.0-68", | ||
"version": "5.0.0-69", | ||
"description": "The Internet Archive BookReader.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -355,4 +355,5 @@ // @ts-check | ||
constructor(book, index) { | ||
// TODO: Get default from config | ||
this.ppi = book._getDataProp(index, 'ppi', book.ppi); | ||
// Values less than 10 cause the UI to not work correctly | ||
const pagePPI = book._getDataProp(index, 'ppi', book.ppi); | ||
this.ppi = Math.max(pagePPI < 10 ? book.ppi : pagePPI, 10); | ||
this.book = book; | ||
@@ -359,0 +360,0 @@ this.index = index; |
@@ -27,4 +27,4 @@ import sinon from 'sinon'; | ||
test('handles single page data', () => { | ||
const bm = new BookModel({ data: SAMPLE_DATA.slice(0, 1), options: {ppi: 1} }); | ||
expect(bm.getMedianPageSizeInches()).toEqual({ width: 123, height: 123 }); | ||
const bm = new BookModel({ data: SAMPLE_DATA.slice(0, 1), options: {ppi: 10} }); | ||
expect(bm.getMedianPageSizeInches()).toEqual({ width: 12.3, height: 12.3 }); | ||
}); | ||
@@ -43,4 +43,4 @@ | ||
Object.assign(data[1][1], sizes[2]); | ||
const bm = new BookModel({ data, options: {ppi: 1} }); | ||
expect(bm.getMedianPageSizeInches()).toEqual({ width: 200, height: 2200 }); | ||
const bm = new BookModel({ data, options: {ppi: 10} }); | ||
expect(bm.getMedianPageSizeInches()).toEqual({ width: 20, height: 220 }); | ||
}); | ||
@@ -61,4 +61,4 @@ | ||
Object.assign(data[2][0], sizes[3]); | ||
const bm = new BookModel({ data, options: {ppi: 1} }); | ||
expect(bm.getMedianPageSizeInches()).toEqual({ width: 300, height: 2300 }); | ||
const bm = new BookModel({ data, options: {ppi: 10} }); | ||
expect(bm.getMedianPageSizeInches()).toEqual({ width: 30, height: 230 }); | ||
}); | ||
@@ -77,4 +77,4 @@ | ||
Object.assign(data[1][1], sizes[2]); | ||
const bm = new BookModel({ data, options: {ppi: 1} }); | ||
expect(bm.getMedianPageSizeInches()).toEqual({ width: 30, height: 30 }); | ||
const bm = new BookModel({ data, options: {ppi: 10} }); | ||
expect(bm.getMedianPageSizeInches()).toEqual({ width: 3, height: 3 }); | ||
}); | ||
@@ -81,0 +81,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
9475121
28522