From 984fb8c531da4a4b0e9f1b2961ae2127a841f256 Mon Sep 17 00:00:00 2001 From: Rob Sanderson Date: Mon, 28 Jul 2014 11:53:06 -0700 Subject: [PATCH] Fixed drawer, renamed source, fixed tests --- Gruntfile.js | 2 +- src/drawer.js | 3 +-- src/{iiifmultitilesource.js => iiiftilesource.js} | 0 .../{iiif1_0.json => iiif_1_0_files/info.json} | 0 test/data/{iiif1_0.xml => iiif_1_0_files/info.xml} | 0 .../info.json} | 0 .../info.json} | 0 .../info.json} | 0 .../info.json} | 0 .../info.json} | 0 test/formats.js | 14 +++++++------- 11 files changed, 9 insertions(+), 10 deletions(-) rename src/{iiifmultitilesource.js => iiiftilesource.js} (100%) rename test/data/{iiif1_0.json => iiif_1_0_files/info.json} (100%) rename test/data/{iiif1_0.xml => iiif_1_0_files/info.xml} (100%) rename test/data/{iiif_1_1_no_tiles_1048.json => iiif_1_1_no_tiles_1048/info.json} (100%) rename test/data/{iiif_1_1_no_tiles_255.json => iiif_1_1_no_tiles_255/info.json} (100%) rename test/data/{iiif_1_1_no_tiles_384.json => iiif_1_1_no_tiles_384/info.json} (100%) rename test/data/{iiif_1_1_no_tiles_768.json => iiif_1_1_no_tiles_768/info.json} (100%) rename test/data/{iiif_1_1_tiled.json => iiif_1_1_tiled/info.json} (100%) diff --git a/Gruntfile.js b/Gruntfile.js index c1cdc909..96162044 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -33,7 +33,7 @@ module.exports = function(grunt) { //"src/profiler.js", "src/tilesource.js", "src/dzitilesource.js", - "src/iiifmultitilesource.js", + "src/iiiftilesource.js", "src/osmtilesource.js", "src/tmstilesource.js", "src/legacytilesource.js", diff --git a/src/drawer.js b/src/drawer.js index ebdf9c77..1f01c627 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -750,11 +750,10 @@ function onTileLoad( drawer, tile, time, image ) { tile.loaded = true; tile.image = image; - insertionIndex = drawer.tilesLoaded.length; if ( drawer.tilesLoaded.length >= drawer.maxImageCacheCount ) { - cutoff = Math.ceil( Math.log( drawer.source.tileSize ) / Math.log( 2 ) ); + cutoff = Math.ceil( Math.log( drawer.source.getTileSize(tile.level) ) / Math.log( 2 ) ); worstTile = null; worstTileIndex = -1; diff --git a/src/iiifmultitilesource.js b/src/iiiftilesource.js similarity index 100% rename from src/iiifmultitilesource.js rename to src/iiiftilesource.js diff --git a/test/data/iiif1_0.json b/test/data/iiif_1_0_files/info.json similarity index 100% rename from test/data/iiif1_0.json rename to test/data/iiif_1_0_files/info.json diff --git a/test/data/iiif1_0.xml b/test/data/iiif_1_0_files/info.xml similarity index 100% rename from test/data/iiif1_0.xml rename to test/data/iiif_1_0_files/info.xml diff --git a/test/data/iiif_1_1_no_tiles_1048.json b/test/data/iiif_1_1_no_tiles_1048/info.json similarity index 100% rename from test/data/iiif_1_1_no_tiles_1048.json rename to test/data/iiif_1_1_no_tiles_1048/info.json diff --git a/test/data/iiif_1_1_no_tiles_255.json b/test/data/iiif_1_1_no_tiles_255/info.json similarity index 100% rename from test/data/iiif_1_1_no_tiles_255.json rename to test/data/iiif_1_1_no_tiles_255/info.json diff --git a/test/data/iiif_1_1_no_tiles_384.json b/test/data/iiif_1_1_no_tiles_384/info.json similarity index 100% rename from test/data/iiif_1_1_no_tiles_384.json rename to test/data/iiif_1_1_no_tiles_384/info.json diff --git a/test/data/iiif_1_1_no_tiles_768.json b/test/data/iiif_1_1_no_tiles_768/info.json similarity index 100% rename from test/data/iiif_1_1_no_tiles_768.json rename to test/data/iiif_1_1_no_tiles_768/info.json diff --git a/test/data/iiif_1_1_tiled.json b/test/data/iiif_1_1_tiled/info.json similarity index 100% rename from test/data/iiif_1_1_tiled.json rename to test/data/iiif_1_1_tiled/info.json diff --git a/test/formats.js b/test/formats.js index c3653123..09add577 100644 --- a/test/formats.js +++ b/test/formats.js @@ -72,37 +72,37 @@ // ---------- asyncTest('IIIF 1.0 JSON', function() { - testOpen('iiif1_0.json'); + testOpen('iiif_1_0_files/info.json'); }); // ---------- asyncTest('IIIF 1.0 XML', function() { - testOpen('iiif1_0.xml'); + testOpen('iiif_1_0_files/info.xml'); }); // ---------- asyncTest('IIIF 1.1 JSON', function() { - testOpen('iiif_1_1_tiled.json'); + testOpen('iiif_1_1_tiled/info.json'); }); // ---------- asyncTest('IIIF No Tiles, Less than 256', function() { - testOpen('iiif_1_1_no_tiles_255.json'); + testOpen('iiif_1_1_no_tiles_255/info.json'); }); // ---------- asyncTest('IIIF No Tiles, Bet. 256 and 512', function() { - testOpen('iiif_1_1_no_tiles_384.json'); + testOpen('iiif_1_1_no_tiles_384/info.json'); }); // ---------- asyncTest('IIIF No Tiles, Bet. 512 and 1024', function() { - testOpen('iiif_1_1_no_tiles_768.json'); + testOpen('iiif_1_1_no_tiles_768/info.json'); }); // ---------- asyncTest('IIIF No Tiles, Larger than 1024', function() { - testOpen('iiif_1_1_no_tiles_1048.json'); + testOpen('iiif_1_1_no_tiles_1048/info.json'); }); })();