mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-16 14:53:14 +03:00
add type property to drawers. only add extra padding to tiles for drawers that need it.
This commit is contained in:
parent
048b43e196
commit
0a3aa6172d
@ -85,6 +85,10 @@ class CanvasDrawer extends $.DrawerBase{
|
|||||||
return $.supportsCanvas;
|
return $.supportsCanvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get type(){
|
||||||
|
return 'canvas';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create the HTML element (e.g. canvas, div) that the image will be drawn into
|
* create the HTML element (e.g. canvas, div) that the image will be drawn into
|
||||||
* @returns {Element} the canvas to draw into
|
* @returns {Element} the canvas to draw into
|
||||||
@ -129,6 +133,14 @@ class CanvasDrawer extends $.DrawerBase{
|
|||||||
this.sketchContext = null;
|
this.sketchContext = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Boolean} Whether this drawer requires enforcing minimum tile overlap to avoid showing seams.
|
||||||
|
*/
|
||||||
|
minimumOverlapRequired() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns image smoothing on or off for this viewer. Note: Ignored in some (especially older) browsers that do not support this property.
|
* Turns image smoothing on or off for this viewer. Note: Ignored in some (especially older) browsers that do not support this property.
|
||||||
*
|
*
|
||||||
|
@ -122,6 +122,13 @@ $.DrawerBase = class DrawerBase{
|
|||||||
return this.container;
|
return this.container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {String|undefined} type What type of drawer this is. Implementations should override this property.
|
||||||
|
*/
|
||||||
|
get type(){
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Boolean} whether the drawer implementation is supported by the browser
|
* @returns {Boolean} whether the drawer implementation is supported by the browser
|
||||||
*/
|
*/
|
||||||
@ -139,9 +146,9 @@ $.DrawerBase = class DrawerBase{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tiledImage the TiledImage that is ready to be drawn
|
* @param {Array} tiledImages - An array of TiledImages that are ready to be drawn
|
||||||
*/
|
*/
|
||||||
draw(tiledImage) {
|
draw(tiledImages) {
|
||||||
$.console.error('Drawer.draw must be implemented by child class');
|
$.console.error('Drawer.draw must be implemented by child class');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,6 +166,14 @@ $.DrawerBase = class DrawerBase{
|
|||||||
$.console.error('Drawer.destroy must be implemented by child class');
|
$.console.error('Drawer.destroy must be implemented by child class');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Boolean} Whether this drawer requires enforcing minimum tile overlap to avoid showing seams.
|
||||||
|
*/
|
||||||
|
minimumOverlapRequired() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns image smoothing on or off for this viewer. Note: Ignored in some (especially older) browsers that do not support this property.
|
* Turns image smoothing on or off for this viewer. Note: Ignored in some (especially older) browsers that do not support this property.
|
||||||
*
|
*
|
||||||
|
@ -65,6 +65,17 @@ class HTMLDrawer extends $.DrawerBase{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get type(){
|
||||||
|
return 'html';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Boolean} Whether this drawer requires enforcing minimum tile overlap to avoid showing seams.
|
||||||
|
*/
|
||||||
|
minimumOverlapRequired() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create the HTML element (e.g. canvas, div) that the image will be drawn into
|
* create the HTML element (e.g. canvas, div) that the image will be drawn into
|
||||||
* @returns {Element} the div to draw into
|
* @returns {Element} the div to draw into
|
||||||
|
@ -1657,16 +1657,18 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
tileCenter = positionT.plus( sizeT.divide( 2 ) ),
|
tileCenter = positionT.plus( sizeT.divide( 2 ) ),
|
||||||
tileSquaredDistance = viewportCenter.squaredDistanceTo( tileCenter );
|
tileSquaredDistance = viewportCenter.squaredDistanceTo( tileCenter );
|
||||||
|
|
||||||
if ( !overlap ) {
|
if(this.viewer.drawer.minimumOverlapRequired()){
|
||||||
sizeC = sizeC.plus( new $.Point( 1, 1 ) );
|
if ( !overlap ) {
|
||||||
}
|
sizeC = sizeC.plus( new $.Point(1, 1));
|
||||||
|
}
|
||||||
|
|
||||||
if (tile.isRightMost && this.wrapHorizontal) {
|
if (tile.isRightMost && this.wrapHorizontal) {
|
||||||
sizeC.x += 0.75; // Otherwise Firefox and Safari show seams
|
sizeC.x += 0.75; // Otherwise Firefox and Safari show seams
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tile.isBottomMost && this.wrapVertical) {
|
if (tile.isBottomMost && this.wrapVertical) {
|
||||||
sizeC.y += 0.75; // Otherwise Firefox and Safari show seams
|
sizeC.y += 0.75; // Otherwise Firefox and Safari show seams
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tile.position = positionC;
|
tile.position = positionC;
|
||||||
|
@ -248,6 +248,10 @@
|
|||||||
return !!( webglContext );
|
return !!( webglContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get type(){
|
||||||
|
return 'webgl';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create the HTML element (canvas in this case) that the image will be drawn into
|
* create the HTML element (canvas in this case) that the image will be drawn into
|
||||||
* @returns {Element} the canvas to draw into
|
* @returns {Element} the canvas to draw into
|
||||||
|
Loading…
x
Reference in New Issue
Block a user