From 6b995c018b01a8ae06685e78b2761390851109e8 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 29 Nov 2023 17:35:49 -0500 Subject: [PATCH] re-enable html drawer in drawer comparison demo; deal with merge conflict resolution issues --- src/tiledimage.js | 26 +++++++++++++++++++++++++- test/demo/drawercomparison.js | 24 ++++++++++++------------ 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index dbcddd75..cb908cbd 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1404,7 +1404,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag this._loadTile(tile, currentTime); } }, this); - + this._needsDraw = true; return false; } else { @@ -2145,6 +2145,30 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag return previousBest; }, + /** + * @private + * @inner + * Sorts tiles in an array according to distance and visibility. + * + * @param {OpenSeadragon.Tile[]} tiles The tiles. + */ + _sortTiles: function( tiles ) { + tiles.sort(function (a, b) { + if (a === null) { + return 1; + } + if (b === null) { + return -1; + } + if (a.visibility === b.visibility) { + return (a.squaredDistance - b.squaredDistance); + } else { + return (a.visibility - b.visibility); + } + }); + }, + + /** * @private * @inner diff --git a/test/demo/drawercomparison.js b/test/demo/drawercomparison.js index 4b827118..96793915 100644 --- a/test/demo/drawercomparison.js +++ b/test/demo/drawercomparison.js @@ -58,18 +58,18 @@ let viewer2 = window.viewer2 = OpenSeadragon({ }); // // viewer3: html drawer, unused -// var viewer3 = window.viewer3 = OpenSeadragon({ -// id: "htmldrawer", -// drawer:'html', -// blendTime:2, -// prefixUrl: "../../build/openseadragon/images/", -// minZoomImageRatio:0.01, -// customDrawer: OpenSeadragon.HTMLDrawer, -// tileSources: [sources['leaves'], sources['rainbow'], sources['duomo']], -// sequenceMode: true, -// crossOriginPolicy: 'Anonymous', -// ajaxWithCredentials: false -// }); +var viewer3 = window.viewer3 = OpenSeadragon({ + id: "htmldrawer", + drawer:'html', + blendTime:2, + prefixUrl: "../../build/openseadragon/images/", + minZoomImageRatio:0.01, + customDrawer: OpenSeadragon.HTMLDrawer, + tileSources: [sources['leaves'], sources['rainbow'], sources['duomo']], + sequenceMode: true, + crossOriginPolicy: 'Anonymous', + ajaxWithCredentials: false +}); // Sync navigation of viewer1 and viewer 2