mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Introduce variable iOSDevice
that disables 8c4fcc9
when running on an iOS device.
This commit is contained in:
parent
18c90ed2e0
commit
b3a10aca3b
@ -240,6 +240,10 @@
|
|||||||
* When zoomed in beyond this value alternative compositing will be used to
|
* When zoomed in beyond this value alternative compositing will be used to
|
||||||
* smooth out the edges between tiles. This will have a performance impact.
|
* smooth out the edges between tiles. This will have a performance impact.
|
||||||
*
|
*
|
||||||
|
* @property {Boolean} [iOSDevice=?]
|
||||||
|
* True if running on an iOS device, false otherwise.
|
||||||
|
* Used to disable certain features that behave differently on iOS devices.
|
||||||
|
*
|
||||||
* @property {Boolean} [autoResize=true]
|
* @property {Boolean} [autoResize=true]
|
||||||
* Set to false to prevent polling for viewer size changes. Useful for providing custom resize behavior.
|
* Set to false to prevent polling for viewer size changes. Useful for providing custom resize behavior.
|
||||||
*
|
*
|
||||||
@ -981,6 +985,18 @@ if (typeof define === 'function' && define.amd) {
|
|||||||
return target;
|
return target;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var isIOSDevice = function () {
|
||||||
|
if (typeof navigator !== 'object') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var userAgent = navigator.userAgent;
|
||||||
|
if (typeof userAgent !== 'string') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return userAgent.indexOf('iPhone') !== -1 ||
|
||||||
|
userAgent.indexOf('iPad') !== -1 ||
|
||||||
|
userAgent.indexOf('iPod') !== -1;
|
||||||
|
};
|
||||||
|
|
||||||
$.extend( $, /** @lends OpenSeadragon */{
|
$.extend( $, /** @lends OpenSeadragon */{
|
||||||
/**
|
/**
|
||||||
@ -1031,6 +1047,7 @@ if (typeof define === 'function' && define.amd) {
|
|||||||
minZoomImageRatio: 0.9, //-> closer to 0 allows zoom out to infinity
|
minZoomImageRatio: 0.9, //-> closer to 0 allows zoom out to infinity
|
||||||
maxZoomPixelRatio: 1.1, //-> higher allows 'over zoom' into pixels
|
maxZoomPixelRatio: 1.1, //-> higher allows 'over zoom' into pixels
|
||||||
smoothTileEdgesMinZoom: 1.1, //-> higher than maxZoomPixelRatio disables it
|
smoothTileEdgesMinZoom: 1.1, //-> higher than maxZoomPixelRatio disables it
|
||||||
|
iOSDevice: isIOSDevice(),
|
||||||
pixelsPerWheelLine: 40,
|
pixelsPerWheelLine: 40,
|
||||||
autoResize: true,
|
autoResize: true,
|
||||||
preserveImageSizeOnResize: false, // requires autoResize=true
|
preserveImageSizeOnResize: false, // requires autoResize=true
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
* @param {Boolean} [options.alwaysBlend] - See {@link OpenSeadragon.Options}.
|
* @param {Boolean} [options.alwaysBlend] - See {@link OpenSeadragon.Options}.
|
||||||
* @param {Number} [options.minPixelRatio] - See {@link OpenSeadragon.Options}.
|
* @param {Number} [options.minPixelRatio] - See {@link OpenSeadragon.Options}.
|
||||||
* @param {Number} [options.smoothTileEdgesMinZoom] - See {@link OpenSeadragon.Options}.
|
* @param {Number} [options.smoothTileEdgesMinZoom] - See {@link OpenSeadragon.Options}.
|
||||||
|
* @param {Boolean} [options.iOSDevice] - See {@link OpenSeadragon.Options}.
|
||||||
* @param {Number} [options.opacity=1] - Opacity the tiled image should be drawn at.
|
* @param {Number} [options.opacity=1] - Opacity the tiled image should be drawn at.
|
||||||
* @param {String} [options.compositeOperation] - How the image is composited onto other images; see compositeOperation in {@link OpenSeadragon.Options} for possible values.
|
* @param {String} [options.compositeOperation] - How the image is composited onto other images; see compositeOperation in {@link OpenSeadragon.Options} for possible values.
|
||||||
* @param {Boolean} [options.debugMode] - See {@link OpenSeadragon.Options}.
|
* @param {Boolean} [options.debugMode] - See {@link OpenSeadragon.Options}.
|
||||||
@ -153,6 +154,7 @@ $.TiledImage = function( options ) {
|
|||||||
alwaysBlend: $.DEFAULT_SETTINGS.alwaysBlend,
|
alwaysBlend: $.DEFAULT_SETTINGS.alwaysBlend,
|
||||||
minPixelRatio: $.DEFAULT_SETTINGS.minPixelRatio,
|
minPixelRatio: $.DEFAULT_SETTINGS.minPixelRatio,
|
||||||
smoothTileEdgesMinZoom: $.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,
|
smoothTileEdgesMinZoom: $.DEFAULT_SETTINGS.smoothTileEdgesMinZoom,
|
||||||
|
iOSDevice: $.DEFAULT_SETTINGS.iOSDevice,
|
||||||
debugMode: $.DEFAULT_SETTINGS.debugMode,
|
debugMode: $.DEFAULT_SETTINGS.debugMode,
|
||||||
crossOriginPolicy: $.DEFAULT_SETTINGS.crossOriginPolicy,
|
crossOriginPolicy: $.DEFAULT_SETTINGS.crossOriginPolicy,
|
||||||
placeholderFillStyle: $.DEFAULT_SETTINGS.placeholderFillStyle,
|
placeholderFillStyle: $.DEFAULT_SETTINGS.placeholderFillStyle,
|
||||||
@ -1434,9 +1436,10 @@ function drawTiles( tiledImage, lastDrawn ) {
|
|||||||
|
|
||||||
var zoom = tiledImage.viewport.getZoom(true);
|
var zoom = tiledImage.viewport.getZoom(true);
|
||||||
var imageZoom = tiledImage.viewportToImageZoom(zoom);
|
var imageZoom = tiledImage.viewportToImageZoom(zoom);
|
||||||
if (imageZoom > tiledImage.smoothTileEdgesMinZoom) {
|
if (imageZoom > tiledImage.smoothTileEdgesMinZoom && !tiledImage.iOSDevice) {
|
||||||
// When zoomed in a lot (>100%) the tile edges are visible.
|
// When zoomed in a lot (>100%) the tile edges are visible.
|
||||||
// So we have to composite them at ~100% and scale them up together.
|
// So we have to composite them at ~100% and scale them up together.
|
||||||
|
// Note: Disabled on iOS devices per default as it causes a native crash
|
||||||
useSketch = true;
|
useSketch = true;
|
||||||
sketchScale = tile.getScaleForEdgeSmoothing();
|
sketchScale = tile.getScaleForEdgeSmoothing();
|
||||||
sketchTranslate = tile.getTranslationForEdgeSmoothing(sketchScale,
|
sketchTranslate = tile.getTranslationForEdgeSmoothing(sketchScale,
|
||||||
|
@ -1375,6 +1375,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
alwaysBlend: _this.alwaysBlend,
|
alwaysBlend: _this.alwaysBlend,
|
||||||
minPixelRatio: _this.minPixelRatio,
|
minPixelRatio: _this.minPixelRatio,
|
||||||
smoothTileEdgesMinZoom: _this.smoothTileEdgesMinZoom,
|
smoothTileEdgesMinZoom: _this.smoothTileEdgesMinZoom,
|
||||||
|
iOSDevice: _this.iOSDevice,
|
||||||
crossOriginPolicy: _this.crossOriginPolicy,
|
crossOriginPolicy: _this.crossOriginPolicy,
|
||||||
debugMode: _this.debugMode
|
debugMode: _this.debugMode
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user