mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +03:00
Use canvas whenever possible (#191)
Drawer uses an HTML5 canvas element if it's available. Viewer.useCanvas can be used to override (default is true).
This commit is contained in:
parent
667204096a
commit
e209846ac1
@ -35,6 +35,7 @@ OPENSEADRAGON CHANGELOG
|
|||||||
* Button: 'enter', 'exit', 'press', 'release', 'focus', 'blur', 'click'
|
* Button: 'enter', 'exit', 'press', 'release', 'focus', 'blur', 'click'
|
||||||
* Fixed: IE 10 not reading DZI file correctly in certain circumstances (#218)
|
* Fixed: IE 10 not reading DZI file correctly in certain circumstances (#218)
|
||||||
* Fix for non-canvas tile rendering at large size (#264)
|
* Fix for non-canvas tile rendering at large size (#264)
|
||||||
|
* Drawer now uses an HTML5 canvas element if it's available. Can be overridden with Viewer.useCanvas option (#191)
|
||||||
|
|
||||||
0.9.131:
|
0.9.131:
|
||||||
|
|
||||||
|
@ -46,10 +46,7 @@ var DEVICE_SCREEN = $.getWindowSize(),
|
|||||||
( BROWSER == $.BROWSERS.IE && BROWSER_VERSION >= 9 )
|
( BROWSER == $.BROWSERS.IE && BROWSER_VERSION >= 9 )
|
||||||
),
|
),
|
||||||
|
|
||||||
USE_CANVAS = SUBPIXEL_RENDERING &&
|
USE_CANVAS = $.supportsCanvas;
|
||||||
!( DEVICE_SCREEN.x <= 400 || DEVICE_SCREEN.y <= 400 ) &&
|
|
||||||
!( navigator.appVersion.match( 'Mobile' ) ) &&
|
|
||||||
$.isFunction( document.createElement( "canvas" ).getContext );
|
|
||||||
|
|
||||||
//console.error( 'USE_CANVAS ' + USE_CANVAS );
|
//console.error( 'USE_CANVAS ' + USE_CANVAS );
|
||||||
|
|
||||||
@ -124,6 +121,10 @@ $.Drawer = function( options ) {
|
|||||||
|
|
||||||
}, options );
|
}, options );
|
||||||
|
|
||||||
|
if ( this.viewer ) {
|
||||||
|
USE_CANVAS = $.supportsCanvas && this.viewer.useCanvas;
|
||||||
|
}
|
||||||
|
|
||||||
this.container = $.getElement( this.element );
|
this.container = $.getElement( this.element );
|
||||||
this.canvas = $.makeNeutralElement( USE_CANVAS ? "canvas" : "div" );
|
this.canvas = $.makeNeutralElement( USE_CANVAS ? "canvas" : "div" );
|
||||||
this.context = USE_CANVAS ? this.canvas.getContext( "2d" ) : null;
|
this.context = USE_CANVAS ? this.canvas.getContext( "2d" ) : null;
|
||||||
|
@ -386,6 +386,19 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Detect canvas support
|
||||||
|
*/
|
||||||
|
var canvasElement = document.createElement( 'canvas' );
|
||||||
|
/**
|
||||||
|
* True if the browser supports the HTML5 canvas element
|
||||||
|
* @name $.supportsCanvas
|
||||||
|
* @property
|
||||||
|
*/
|
||||||
|
$.supportsCanvas = !!( $.isFunction( canvasElement.getContext ) &&
|
||||||
|
canvasElement.getContext( '2d' ) );
|
||||||
|
|
||||||
|
|
||||||
}( OpenSeadragon ));
|
}( OpenSeadragon ));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -559,6 +572,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
imageLoaderLimit: 0,
|
imageLoaderLimit: 0,
|
||||||
maxImageCacheCount: 200,
|
maxImageCacheCount: 200,
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
|
useCanvas: true, // Use canvas element for drawing if available
|
||||||
|
|
||||||
//INTERFACE RESOURCE SETTINGS
|
//INTERFACE RESOURCE SETTINGS
|
||||||
prefixUrl: "/images/",
|
prefixUrl: "/images/",
|
||||||
|
Loading…
Reference in New Issue
Block a user