Added ios detection (#591)
https://stackoverflow.com/questions/9038625/detect-if-device-is-ios/9039885#9039885 *Note* navigator.platform is deprecated but still seems to work for now.
This commit is contained in:
parent
5c5289d3db
commit
7414b8ae07
1 changed files with 10 additions and 1 deletions
|
|
@ -783,7 +783,16 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
if (this.ctx && this.canvas) {
|
if (this.ctx && this.canvas) {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && window['safari'].pushNotification));
|
const isSafari = [
|
||||||
|
'iPad Simulator',
|
||||||
|
'iPhone Simulator',
|
||||||
|
'iPod Simulator',
|
||||||
|
'iPad',
|
||||||
|
'iPhone',
|
||||||
|
'iPod'
|
||||||
|
].includes(navigator.platform)
|
||||||
|
// iPad on iOS 13 detection
|
||||||
|
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document);
|
||||||
const canvasLimit = isSafari ? 16_777_216 : 124_992_400;
|
const canvasLimit = isSafari ? 16_777_216 : 124_992_400;
|
||||||
const needsScaling = this.canvasImage.width * this.canvasImage.height > canvasLimit;
|
const needsScaling = this.canvasImage.width * this.canvasImage.height > canvasLimit;
|
||||||
if (needsScaling) {
|
if (needsScaling) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue