From 5383ce7e61a784c006b2903709fa8d5c6087dc12 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Sat, 20 Apr 2013 03:38:10 -0400 Subject: [PATCH 01/33] Fix one more place where we define ourselves as a fork --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c3f66385..bd7557ab 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OpenSeadragon -This project is a fork of the OpenSeadragon project at http://openseadragon.codeplex.com/ +An open-source, web-based viewer for zoomable images, implemented in pure JavaScript. ## On the Web From 63c24aa56312c702f95fda26f6c5e859ba43944b Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 22 Apr 2013 10:32:23 -0700 Subject: [PATCH 02/33] Build info on readme --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bd7557ab..53d8f2e9 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,13 @@ An open-source, web-based viewer for zoomable images, implemented in pure JavaScript. -## On the Web +Find examples, documentation, and builds at http://openseadragon.github.io/. -http://openseadragon.github.io/ +## Stable Build + +[Zip](http://openseadragon.github.io/openseadragon.zip) + +[Tar](http://openseadragon.github.io/openseadragon.tar) ## First Time Setup From ee02dda56ed34ad1e4435cad8b27665cf07ad6e1 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 22 Apr 2013 10:34:26 -0700 Subject: [PATCH 03/33] Wording tweaks --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 53d8f2e9..2bffeb30 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,11 @@ An open-source, web-based viewer for zoomable images, implemented in pure JavaScript. -Find examples, documentation, and builds at http://openseadragon.github.io/. +See it in action at http://openseadragon.github.io/. ## Stable Build -[Zip](http://openseadragon.github.io/openseadragon.zip) - -[Tar](http://openseadragon.github.io/openseadragon.tar) +The latest stable builds are here: [Zip](http://openseadragon.github.io/openseadragon.zip) or [Tar](http://openseadragon.github.io/openseadragon.tar). ## First Time Setup From d7224f8206e5b08fc9f03c3599f2c9d4bd308a46 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Mon, 22 Apr 2013 20:13:42 -0400 Subject: [PATCH 04/33] Compress package tarballs with gzip Tar files are conventionally compressed, often with gzip. xz would be better but is not as universally supported; in particular, grunt-contrib-compress doesn't support it. --- Gruntfile.js | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index fda8fd6b..8746c0b6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -92,7 +92,7 @@ module.exports = function(grunt) { }, tar: { options: { - archive: "build/openseadragon.tar" + archive: "build/openseadragon.tar.gz" }, files: [ { expand: true, cwd: "build/", src: [ "openseadragon/**" ] } @@ -177,7 +177,7 @@ module.exports = function(grunt) { // ---------- // Package task. - // Builds and creates the .zip and .tar files. + // Builds and creates the .zip and .tar.gz files. grunt.registerTask("package", ["build", "compress"]); // ---------- diff --git a/README.md b/README.md index 2bffeb30..5ccbbae3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ See it in action at http://openseadragon.github.io/. ## Stable Build -The latest stable builds are here: [Zip](http://openseadragon.github.io/openseadragon.zip) or [Tar](http://openseadragon.github.io/openseadragon.tar). +The latest stable builds are here: [Zip](http://openseadragon.github.io/openseadragon.zip) or [Tar](http://openseadragon.github.io/openseadragon.tar.gz). ## First Time Setup @@ -42,7 +42,7 @@ You can also publish the built version to the site-build repository. This assume grunt publish -... which will delete the existing openseadragon folder, along with the .zip and .tar files, out of the site-build folder and replace them with newly built ones from the source in this repository; you'll then need to commit the changes to site-build. +... which will delete the existing openseadragon folder, along with the .zip and .tar.gz files, out of the site-build folder and replace them with newly built ones from the source in this repository; you'll then need to commit the changes to site-build. ## Testing From 551215404dc93df3e3b387681be705714582de97 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Fri, 19 Apr 2013 01:01:15 -0400 Subject: [PATCH 05/33] Use maximum compression when creating packages grunt-contrib-compress defaults to minimum compression. --- Gruntfile.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8746c0b6..25fcc3c3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -84,7 +84,8 @@ module.exports = function(grunt) { compress: { zip: { options: { - archive: "build/openseadragon.zip" + archive: "build/openseadragon.zip", + level: 9 }, files: [ { expand: true, cwd: "build/", src: ["openseadragon/**"] } @@ -92,7 +93,8 @@ module.exports = function(grunt) { }, tar: { options: { - archive: "build/openseadragon.tar.gz" + archive: "build/openseadragon.tar.gz", + level: 9 }, files: [ { expand: true, cwd: "build/", src: [ "openseadragon/**" ] } From 739ff2dbedc0a1f54b5a0322b07ac28bcd9a5c8d Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Mon, 22 Apr 2013 20:20:07 -0400 Subject: [PATCH 06/33] Rename {tar,zip}ball and packaged directory {Tar,zip}balls now have the form openseadragon-bin-0.9.125.{tar.gz,zip}, containing a directory openseadragon-bin-0.9.125. Including the project's version number makes it easy to determine the version of a random release sitting around a filesystem, and ensures that unpacking a tarball won't overwrite another unpacked tarball or write into a checked-out repo. Adding -bin distinguishes the packages from source tarballs, which are conventionally -.{tar.gz,zip}. --- Gruntfile.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 25fcc3c3..8db4a1e9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -12,8 +12,11 @@ module.exports = function(grunt) { grunt.loadNpmTasks("grunt-git-describe"); // ---------- - var distribution = "build/openseadragon/openseadragon.js", + var packageJson = grunt.file.readJSON("package.json"), + distribution = "build/openseadragon/openseadragon.js", minified = "build/openseadragon/openseadragon.min.js", + packageDirName = "openseadragon-bin-" + packageJson.version, + packageDir = "build/" + packageDirName + "/", releaseRoot = "../site-build/built-openseadragon/", sources = [ "src/openseadragon.js", @@ -49,9 +52,10 @@ module.exports = function(grunt) { // ---------- // Project configuration. grunt.initConfig({ - pkg: grunt.file.readJSON("package.json"), + pkg: packageJson, clean: { build: ["build"], + "package": [packageDir], release: { src: [releaseRoot], options: { @@ -84,20 +88,20 @@ module.exports = function(grunt) { compress: { zip: { options: { - archive: "build/openseadragon.zip", + archive: "build/" + packageDirName + ".zip", level: 9 }, files: [ - { expand: true, cwd: "build/", src: ["openseadragon/**"] } + { expand: true, cwd: "build/", src: [ packageDirName + "/**" ] } ] }, tar: { options: { - archive: "build/openseadragon.tar.gz", + archive: "build/" + packageDirName + ".tar.gz", level: 9 }, files: [ - { expand: true, cwd: "build/", src: [ "openseadragon/**" ] } + { expand: true, cwd: "build/", src: [ packageDirName + "/**" ] } ] } }, @@ -152,6 +156,18 @@ module.exports = function(grunt) { grunt.file.copy("changelog.txt", "build/changelog.txt"); }); + // ---------- + // Copy:package task. + // Creates a directory tree to be compressed into a package. + grunt.registerTask("copy:package", function() { + grunt.file.recurse("build/openseadragon", function(abspath, rootdir, subdir, filename) { + var dest = packageDir + + (subdir ? subdir + "/" : '/') + + filename; + grunt.file.copy(abspath, dest); + }); + }); + // ---------- // Copy:release task. // Copies the contents of the build folder into the release folder. @@ -180,7 +196,7 @@ module.exports = function(grunt) { // ---------- // Package task. // Builds and creates the .zip and .tar.gz files. - grunt.registerTask("package", ["build", "compress"]); + grunt.registerTask("package", ["build", "copy:package", "compress", "clean:package"]); // ---------- // Publish task. From 15994b688bcc98e8121ddd0e6f87a10fbd3c980d Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Fri, 19 Apr 2013 02:40:27 -0400 Subject: [PATCH 07/33] Include changelog and license files in packages A README would be good too, but right now README.md consists mostly of things that are only meaningful in a Git checkout. --- Gruntfile.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 8db4a1e9..9e6789bd 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -166,6 +166,9 @@ module.exports = function(grunt) { + filename; grunt.file.copy(abspath, dest); }); + grunt.file.copy("changelog.txt", packageDir + "changelog.txt"); + grunt.file.copy("licenses/mit.txt", packageDir + "licenses/mit.txt"); + grunt.file.copy("licenses/new-bsd.txt", packageDir + "licenses/new-bsd.txt"); }); // ---------- From c7c7b202ddb45560e295c964787326e5242a7910 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Mon, 22 Apr 2013 20:27:55 -0400 Subject: [PATCH 08/33] Don't delete old releases from the website It's convenient for old releases to be available indefinitely so that deployment scripts can retrieve a particular qualified version. This won't affect the disk space requirements of the repository, since the old packages will be in the Git history anyhow. Move packages to a subdirectory of the site root to avoid causing permanent clutter. --- Gruntfile.js | 6 +++--- README.md | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 9e6789bd..1d597da2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -57,7 +57,7 @@ module.exports = function(grunt) { build: ["build"], "package": [packageDir], release: { - src: [releaseRoot], + src: [releaseRoot + '*', '!' + releaseRoot + 'releases'], options: { force: true } @@ -88,7 +88,7 @@ module.exports = function(grunt) { compress: { zip: { options: { - archive: "build/" + packageDirName + ".zip", + archive: "build/releases/" + packageDirName + ".zip", level: 9 }, files: [ @@ -97,7 +97,7 @@ module.exports = function(grunt) { }, tar: { options: { - archive: "build/" + packageDirName + ".tar.gz", + archive: "build/releases/" + packageDirName + ".tar.gz", level: 9 }, files: [ diff --git a/README.md b/README.md index 5ccbbae3..db8de64e 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,10 @@ An open-source, web-based viewer for zoomable images, implemented in pure JavaSc See it in action at http://openseadragon.github.io/. -## Stable Build +## Stable Builds -The latest stable builds are here: [Zip](http://openseadragon.github.io/openseadragon.zip) or [Tar](http://openseadragon.github.io/openseadragon.tar.gz). +Stable builds of OpenSeadragon releases are available +[here](http://openseadragon.github.io/releases/). ## First Time Setup From 1430ac38fef03b50605b2209c35a743196aa7cfb Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Mon, 22 Apr 2013 20:28:13 -0400 Subject: [PATCH 09/33] Drop obsolete .gitignore entries --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index f562c278..4b26396b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ *.sublime-workspace node_modules build/ -openseadragon.zip -openseadragon.tar From eafd707d1a718efbe3dc4d5bca3088cbf949b0aa Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Tue, 23 Apr 2013 21:16:33 -0400 Subject: [PATCH 10/33] Drop unnecessary quotes --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 1d597da2..40af664e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -55,7 +55,7 @@ module.exports = function(grunt) { pkg: packageJson, clean: { build: ["build"], - "package": [packageDir], + package: [packageDir], release: { src: [releaseRoot + '*', '!' + releaseRoot + 'releases'], options: { From 0d6457027dea9821d7b38b3ffeba5c1880b7367c Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Tue, 23 Apr 2013 21:19:04 -0400 Subject: [PATCH 11/33] Stable Builds wording improvement --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index db8de64e..465e3aff 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ See it in action at http://openseadragon.github.io/. ## Stable Builds -Stable builds of OpenSeadragon releases are available -[here](http://openseadragon.github.io/releases/). +See our [releases page](http://openseadragon.github.io/releases/). ## First Time Setup From f958e66f05b1e50973d78ff8ee7f8e7bf9669844 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Tue, 23 Apr 2013 23:58:58 -0400 Subject: [PATCH 12/33] Fix typo in preserveViewport handling --- src/viewer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viewer.js b/src/viewer.js index a87c52e9..b6026148 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1014,7 +1014,7 @@ function openTileSource( viewer, source ) { }); } - if( _this.preserveVewport ){ + if( _this.preserveViewport ){ _this.viewport.resetContentSize( _this.source.dimensions ); } From b315b148c238a3a5944f5409ef351625dc56f578 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Wed, 24 Apr 2013 23:57:35 -0400 Subject: [PATCH 13/33] Drop remains of code to show "Loading..." message It calls a method that no longer exists, but only when an impossible condition is true. --- src/viewer.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index b6026148..f0b698b8 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -115,8 +115,6 @@ $.Viewer = function( options ) { THIS[ this.hash ] = { "fsBoundsDelta": new $.Point( 1, 1 ), "prevContainerSize": null, - "lastOpenStartTime": 0, - "lastOpenEndTime": 0, "animating": false, "forceRedraw": false, "mouseInside": false, @@ -956,16 +954,6 @@ function openTileSource( viewer, source ) { _this.close( ); } - // to ignore earlier opens - THIS[ _this.hash ].lastOpenStartTime = +new Date(); - - window.setTimeout( function () { - if ( THIS[ _this.hash ].lastOpenStartTime > THIS[ _this.hash ].lastOpenEndTime ) { - THIS[ _this.hash ].setMessage( $.getString( "Messages.Loading" ) ); - } - }, 2000); - - THIS[ _this.hash ].lastOpenEndTime = +new Date(); _this.canvas.innerHTML = ""; THIS[ _this.hash ].prevContainerSize = $.getElementSize( _this.container ); From 9eb19d6c9c7c1e4e037162db5332a8fc2acb2a18 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 25 Apr 2013 00:23:02 -0400 Subject: [PATCH 14/33] Garbage-collect strings --- src/strings.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/strings.js b/src/strings.js index 16f2df8a..4d98c1e2 100644 --- a/src/strings.js +++ b/src/strings.js @@ -6,21 +6,13 @@ // pythons gettext might be a reasonable approach. var I18N = { Errors: { - Failure: "Sorry, but Seadragon Ajax can't run on your browser!\n" + - "Please try using IE 7 or Firefox 3.\n", Dzc: "Sorry, we don't support Deep Zoom Collections!", Dzi: "Hmm, this doesn't appear to be a valid Deep Zoom Image.", Xml: "Hmm, this doesn't appear to be a valid Deep Zoom Image.", - Empty: "You asked us to open nothing, so we did just that.", ImageFormat: "Sorry, we don't support {0}-based Deep Zoom Images.", Security: "It looks like a security restriction stopped us from " + "loading this Deep Zoom Image.", - Status: "This space unintentionally left blank ({0} {1}).", - Unknown: "Whoops, something inexplicably went wrong. Sorry!" - }, - - Messages: { - Loading: "Loading..." + Status: "This space unintentionally left blank ({0} {1})." }, Tooltips: { From 47aba609403d090b04b144b1e0097e0ea969f7a8 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 25 Apr 2013 00:37:36 -0400 Subject: [PATCH 15/33] Fix timer leak after multiple Viewer.open() calls Keep a counter of Viewer.close() calls in private state and a copy in the timer's closure, and stop the timer when they no longer match. Fixes #76. --- src/viewer.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index f0b698b8..bd907f1b 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -115,6 +115,7 @@ $.Viewer = function( options ) { THIS[ this.hash ] = { "fsBoundsDelta": new $.Point( 1, 1 ), "prevContainerSize": null, + "closeCount": 0, "animating": false, "forceRedraw": false, "mouseInside": false, @@ -368,6 +369,8 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, VIEWERS[ this.hash ] = null; delete VIEWERS[ this.hash ]; + THIS[ this.hash ].closeCount++; + this.raiseEvent( 'close', { viewer: this } ); return this; @@ -948,6 +951,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, function openTileSource( viewer, source ) { var _this = viewer, overlay, + closeCount, i; if ( _this.source ) { @@ -1064,7 +1068,12 @@ function openTileSource( viewer, source ) { THIS[ _this.hash ].animating = false; THIS[ _this.hash ].forceRedraw = true; - scheduleUpdate( _this, updateMulti ); + + // Use local copy in closure + closeCount = THIS[ _this.hash ].closeCount; + scheduleUpdate( _this, function(){ + updateMulti( _this, closeCount ); + } ); //Assuming you had programatically created a bunch of overlays //and added them via configuration @@ -1121,9 +1130,7 @@ function scheduleUpdate( viewer, updateFunc, prevUpdateTime ){ deltaTime; if ( THIS[ viewer.hash ].animating ) { - return $.requestAnimationFrame( function(){ - updateFunc( viewer ); - } ); + return $.requestAnimationFrame( updateFunc ); } currentTime = +new Date(); @@ -1132,9 +1139,7 @@ function scheduleUpdate( viewer, updateFunc, prevUpdateTime ){ targetTime = prevUpdateTime + 1000 / 60; deltaTime = Math.max( 1, targetTime - currentTime ); - return $.requestAnimationFrame( function(){ - updateFunc( viewer ); - } ); + return $.requestAnimationFrame( updateFunc ); } @@ -1334,17 +1339,19 @@ function onContainerEnter( tracker, position, buttonDownElement, buttonDownAny ) // Page update routines ( aka Views - for future reference ) /////////////////////////////////////////////////////////////////////////////// -function updateMulti( viewer ) { +function updateMulti( viewer, closeCount ) { var beginTime; - if ( !viewer.source ) { + if ( closeCount !== THIS[ viewer.hash ].closeCount ) { return; } beginTime = +new Date(); updateOnce( viewer ); - scheduleUpdate( viewer, arguments.callee, beginTime ); + scheduleUpdate( viewer, function(){ + updateMulti( viewer, closeCount ); + }, beginTime ); } function updateOnce( viewer ) { From beba155ece87c82f7c72dd6e33c197e9a645cf72 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Fri, 26 Apr 2013 10:06:14 -0700 Subject: [PATCH 16/33] Sublime project now excludes node_modules --- openseadragon.sublime-project | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openseadragon.sublime-project b/openseadragon.sublime-project index b7e30c92..f8e2dd71 100644 --- a/openseadragon.sublime-project +++ b/openseadragon.sublime-project @@ -3,7 +3,13 @@ [ { "path": ".", - "file_exclude_patterns": ["*.sublime-project", "*.sublime-workspace"] + "file_exclude_patterns": [ + "*.sublime-project", + "*.sublime-workspace" + ], + "folder_exclude_patterns": [ + "node_modules" + ] } ], "settings": From 64a10f28df49f8daafbf967441d9607cb520b681 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Fri, 26 Apr 2013 10:06:31 -0700 Subject: [PATCH 17/33] Added note about "good first bug" issues --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 465e3aff..693c49a3 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,8 @@ OpenSeadragon is truly a community project; we welcome your involvement! When contributing, please attempt to match the code style already in the codebase. Note that we use four spaces per indentation stop. For more thoughts on code style, see https://github.com/rwldrn/idiomatic.js/. +If you're new to the project, check out our [good first bug](https://github.com/openseadragon/openseadragon/issues?labels=good+first+bug&page=1&state=open) issues for some places to dip your toe in the water. + ## Licenses OpenSeadragon was initially released with a New BSD License ( preserved below ), while work done by Chris Thatcher is additionally licensed under the MIT License. From 23c20e3d5aaa147bdb50b2a358f453d1e3496d27 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Fri, 26 Apr 2013 21:48:48 -0400 Subject: [PATCH 18/33] Revert "Fix timer leak after multiple Viewer.open() calls" This should be done with cancelAnimationFrame() instead. This reverts commit 47aba609403d090b04b144b1e0097e0ea969f7a8. --- src/viewer.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index bd907f1b..f0b698b8 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -115,7 +115,6 @@ $.Viewer = function( options ) { THIS[ this.hash ] = { "fsBoundsDelta": new $.Point( 1, 1 ), "prevContainerSize": null, - "closeCount": 0, "animating": false, "forceRedraw": false, "mouseInside": false, @@ -369,8 +368,6 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, VIEWERS[ this.hash ] = null; delete VIEWERS[ this.hash ]; - THIS[ this.hash ].closeCount++; - this.raiseEvent( 'close', { viewer: this } ); return this; @@ -951,7 +948,6 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, function openTileSource( viewer, source ) { var _this = viewer, overlay, - closeCount, i; if ( _this.source ) { @@ -1068,12 +1064,7 @@ function openTileSource( viewer, source ) { THIS[ _this.hash ].animating = false; THIS[ _this.hash ].forceRedraw = true; - - // Use local copy in closure - closeCount = THIS[ _this.hash ].closeCount; - scheduleUpdate( _this, function(){ - updateMulti( _this, closeCount ); - } ); + scheduleUpdate( _this, updateMulti ); //Assuming you had programatically created a bunch of overlays //and added them via configuration @@ -1130,7 +1121,9 @@ function scheduleUpdate( viewer, updateFunc, prevUpdateTime ){ deltaTime; if ( THIS[ viewer.hash ].animating ) { - return $.requestAnimationFrame( updateFunc ); + return $.requestAnimationFrame( function(){ + updateFunc( viewer ); + } ); } currentTime = +new Date(); @@ -1139,7 +1132,9 @@ function scheduleUpdate( viewer, updateFunc, prevUpdateTime ){ targetTime = prevUpdateTime + 1000 / 60; deltaTime = Math.max( 1, targetTime - currentTime ); - return $.requestAnimationFrame( updateFunc ); + return $.requestAnimationFrame( function(){ + updateFunc( viewer ); + } ); } @@ -1339,19 +1334,17 @@ function onContainerEnter( tracker, position, buttonDownElement, buttonDownAny ) // Page update routines ( aka Views - for future reference ) /////////////////////////////////////////////////////////////////////////////// -function updateMulti( viewer, closeCount ) { +function updateMulti( viewer ) { var beginTime; - if ( closeCount !== THIS[ viewer.hash ].closeCount ) { + if ( !viewer.source ) { return; } beginTime = +new Date(); updateOnce( viewer ); - scheduleUpdate( viewer, function(){ - updateMulti( viewer, closeCount ); - }, beginTime ); + scheduleUpdate( viewer, arguments.callee, beginTime ); } function updateOnce( viewer ) { From 8cb2714daea991c78823afc1bb1899e22f36c2b8 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Fri, 26 Apr 2013 22:32:51 -0400 Subject: [PATCH 19/33] Fix timer leak after multiple Viewer.open() calls, take 2 Track the request ID of the outstanding animation frame and cancel it on Viewer.close(). Fixes #76. --- src/viewer.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index f0b698b8..af4b1822 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -115,6 +115,7 @@ $.Viewer = function( options ) { THIS[ this.hash ] = { "fsBoundsDelta": new $.Point( 1, 1 ), "prevContainerSize": null, + "updateRequestId": null, "animating": false, "forceRedraw": false, "mouseInside": false, @@ -353,7 +354,11 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, * @return {OpenSeadragon.Viewer} Chainable. */ close: function ( ) { - + if ( THIS[ this.hash ].updateRequestId !== null ){ + $.cancelAnimationFrame( THIS[ this.hash ].updateRequestId ); + THIS[ this.hash ].updateRequestId = null; + } + if( this.drawer ){ this.drawer.clearOverlays(); } @@ -1064,7 +1069,7 @@ function openTileSource( viewer, source ) { THIS[ _this.hash ].animating = false; THIS[ _this.hash ].forceRedraw = true; - scheduleUpdate( _this, updateMulti ); + THIS[ _this.hash ].updateRequestId = scheduleUpdate( _this, updateMulti ); //Assuming you had programatically created a bunch of overlays //and added them via configuration @@ -1338,13 +1343,11 @@ function updateMulti( viewer ) { var beginTime; - if ( !viewer.source ) { - return; - } - beginTime = +new Date(); updateOnce( viewer ); - scheduleUpdate( viewer, arguments.callee, beginTime ); + + THIS[ viewer.hash ].updateRequestId = scheduleUpdate( viewer, + arguments.callee, beginTime ); } function updateOnce( viewer ) { From 3652c7066c5521aa1381f1982cbf3dacb0fb29aa Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Mon, 29 Apr 2013 13:17:37 -0400 Subject: [PATCH 20/33] Re-add viewer.source check in updateMulti() It should be redundant in normal operation, but may prevent a timer leak in case of a bug in the open/close path. --- src/viewer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/viewer.js b/src/viewer.js index af4b1822..a47d46d0 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1343,6 +1343,11 @@ function updateMulti( viewer ) { var beginTime; + if ( !viewer.source ) { + THIS[ viewer.hash ].updateRequestId = null; + return; + } + beginTime = +new Date(); updateOnce( viewer ); From 1c6deafe8bdccc0ce6c34f9286a041fdfe1872c7 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 2 May 2013 09:57:03 -0700 Subject: [PATCH 21/33] Added viewport property to Viewer documentation --- src/viewer.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/viewer.js b/src/viewer.js index a47d46d0..a2e36d6b 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -28,6 +28,8 @@ var THIS = {}, * @param {Seadragon.Overlays[]} options.overlays Array of Seadragon.Overlays, * @param {Seadragon.Controls[]} options.overlayControls An Array of ( TODO: * not sure! ) + * @property {OpenSeadragon.Viewport} viewport The viewer's viewport, where you + * can access zoom, pan, etc. * **/ $.Viewer = function( options ) { From bd0b0972b33969da601ca7194b0a56ad6fcb2509 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 2 May 2013 09:57:23 -0700 Subject: [PATCH 22/33] Fixed bad class names in docs --- src/viewer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index a2e36d6b..df8dce87 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -24,9 +24,9 @@ var THIS = {}, * @param {String} options.xmlPath Xpath ( TODO: not sure! ), * @param {String} options.prefixUrl Url used to prepend to paths, eg button * images, etc. - * @param {Seadragon.Controls[]} options.controls Array of Seadragon.Controls, - * @param {Seadragon.Overlays[]} options.overlays Array of Seadragon.Overlays, - * @param {Seadragon.Controls[]} options.overlayControls An Array of ( TODO: + * @param {OpenSeadragon.Control[]} options.controls Array of OpenSeadragon.Control, + * @param {OpenSeadragon.Overlay[]} options.overlays Array of OpenSeadragon.Overlay, + * @param {OpenSeadragon.Control[]} options.overlayControls An Array of ( TODO: * not sure! ) * @property {OpenSeadragon.Viewport} viewport The viewer's viewport, where you * can access zoom, pan, etc. From 8901ff8ea98059536bbcd083d9803fcd41f84be1 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 7 May 2013 09:27:37 -0700 Subject: [PATCH 23/33] Updated changelog --- README.md | 6 ++++++ changelog.txt | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 693c49a3..0fdad825 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,12 @@ OpenSeadragon is truly a community project; we welcome your involvement! When contributing, please attempt to match the code style already in the codebase. Note that we use four spaces per indentation stop. For more thoughts on code style, see https://github.com/rwldrn/idiomatic.js/. +When fixing bugs and adding features, when appropriate please also: + +* Update changelog.txt +* Add/update related unit tests +* Update related doc comments + If you're new to the project, check out our [good first bug](https://github.com/openseadragon/openseadragon/issues?labels=good+first+bug&page=1&state=open) issues for some places to dip your toe in the water. ## Licenses diff --git a/changelog.txt b/changelog.txt index 871d7f84..6e9007a0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,10 @@ OPENSEADRAGON CHANGELOG Viewer.openDZI to use Viewer.open internally. (#53 & #54). * Full page bug fix for when viewer is child of document body (#43). * Overlays for DZI bug fix (#45). +* DziTileSource: avoid changing relative paths (#56). +* Fix typo in preserveViewport handling (#77). +* Fix updateMulti timer leak after multiple Viewer.open() calls (#76). +* Minor documentation fixes. 0.9.124: From b5ba57fb6da4e0237e0aa5d0881390cd31bc757c Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 7 May 2013 09:42:51 -0700 Subject: [PATCH 24/33] Trying to trigger IRC commit hook --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0fdad825..5dbd048a 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ When fixing bugs and adding features, when appropriate please also: * Update changelog.txt * Add/update related unit tests -* Update related doc comments +* Update related doc comments If you're new to the project, check out our [good first bug](https://github.com/openseadragon/openseadragon/issues?labels=good+first+bug&page=1&state=open) issues for some places to dip your toe in the water. From 65274c0159b83c8d74107c54c42409c4d60a2b51 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 7 May 2013 09:50:20 -0700 Subject: [PATCH 25/33] Trying again to trigger IRC hook --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5dbd048a..0fdad825 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ When fixing bugs and adding features, when appropriate please also: * Update changelog.txt * Add/update related unit tests -* Update related doc comments +* Update related doc comments If you're new to the project, check out our [good first bug](https://github.com/openseadragon/openseadragon/issues?labels=good+first+bug&page=1&state=open) issues for some places to dip your toe in the water. From 1ef566607fbd42e21da2514a1e258d0de1761dc4 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 9 May 2013 09:34:11 -0700 Subject: [PATCH 26/33] Updated version number to 0.9.125 --- changelog.txt | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 6e9007a0..d52f5878 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,7 @@ OPENSEADRAGON CHANGELOG ======================= -0.9.125: In Progress +0.9.125: * Fully deprecated OpenSeadragon.createFromDZI, safely deprecated Viewer.openTileSource and Viewer.openDZI to use Viewer.open internally. (#53 & #54). diff --git a/package.json b/package.json index fe3dff04..b0e36c66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "OpenSeadragon", - "version": "0.9.124", + "version": "0.9.125", "description": "Provides a smooth, zoomable user interface for HTML/Javascript.", "devDependencies": { "grunt": "~0.4.0", From f817d4d4ac3412e7ccda6ddcaf52851e88d75c28 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 9 May 2013 09:36:26 -0700 Subject: [PATCH 27/33] Added 0.9.126 to changelog --- changelog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.txt b/changelog.txt index d52f5878..6e1e666b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,8 @@ OPENSEADRAGON CHANGELOG ======================= +0.9.126: (in progress) + 0.9.125: * Fully deprecated OpenSeadragon.createFromDZI, safely deprecated Viewer.openTileSource and From 8ded889af4d4d242914aa3c896698b5fbd22890a Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 9 May 2013 11:02:25 -0700 Subject: [PATCH 28/33] DZI JSONp was broken; fixed Also added support for DZI files with .xml extension --- src/dzitilesource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dzitilesource.js b/src/dzitilesource.js index 2a8150c4..6f148380 100644 --- a/src/dzitilesource.js +++ b/src/dzitilesource.js @@ -109,7 +109,7 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, { } if (url && !options.tilesUrl) { - options.tilesUrl = url.replace(/([^\/]+)\.dzi$/, '$1_files/'); + options.tilesUrl = url.replace(/([^\/]+)\.(dzi|xml|js)$/, '$1_files/'); } return options; From 4f1332860929fa15fd2af5de3fe64b897a25e30c Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 9 May 2013 11:02:51 -0700 Subject: [PATCH 29/33] Minor cleanups on basic test --- test/basic.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/basic.js b/test/basic.js index ca4556c8..ff302670 100644 --- a/test/basic.js +++ b/test/basic.js @@ -1,5 +1,7 @@ (function() { + module('Basic'); + // TODO: Tighten up springs and use "immediate" where possible, so tests run faster // TODO: Test drag @@ -104,6 +106,7 @@ asyncTest('Close', function() { var closeHandler = function() { viewer.removeHandler('close', closeHandler); + $('#example').empty(); ok(true, 'Close event was sent'); start(); }; From 05c25fddcf27e98815153a9e48539d89aabbe8c3 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 9 May 2013 11:03:31 -0700 Subject: [PATCH 30/33] Getting started on a DZI-JSONp test; currently disabled --- test/data/testpattern.js | 12 ++++++++++ test/dzi-jsonp.js | 51 ++++++++++++++++++++++++++++++++++++++++ test/test.html | 1 + 3 files changed, 64 insertions(+) create mode 100644 test/data/testpattern.js create mode 100644 test/dzi-jsonp.js diff --git a/test/data/testpattern.js b/test/data/testpattern.js new file mode 100644 index 00000000..8081b54b --- /dev/null +++ b/test/data/testpattern.js @@ -0,0 +1,12 @@ +testpattern({ + Image: { + xmlns: 'http://schemas.microsoft.com/deepzoom/2008', + Format: 'jpg', + Overlap: 1, + TileSize: 254, + Size:{ + Height: 1000, + Width: 1000 + } + } +}); diff --git a/test/dzi-jsonp.js b/test/dzi-jsonp.js new file mode 100644 index 00000000..138de35b --- /dev/null +++ b/test/dzi-jsonp.js @@ -0,0 +1,51 @@ +(function() { + + // TODO: How to know if a tile has been drawn? The tile-drawn event used below + // is defunct. + + module('DZI JSONp'); + + var viewer = null; + + // ---------- + asyncTest('Open', function() { + $(document).ready(function() { + viewer = OpenSeadragon({ + id: 'example', + prefixUrl: '/build/openseadragon/images/', + tileSources: '/test/data/testpattern.js' + }); + + ok(viewer, 'Viewer exists'); + + var openHandler = function(eventSender, eventData) { + viewer.removeHandler('open', openHandler); + ok(true, 'Open event was sent'); + viewer.drawer.viewer = viewer; + viewer.addHandler('tile-drawn', tileDrawnHandler); + }; + + var tileDrawnHandler = function(eventSender, eventData) { + viewer.removeHandler('tile-drawn', tileDrawnHandler); + ok(true, 'A tile has been drawn'); + start(); + }; + + viewer.addHandler('open', openHandler); + }); + }); + + // ---------- + // asyncTest('Close', function() { + // var closeHandler = function() { + // viewer.removeHandler('close', closeHandler); + // $('#example').empty(); + // ok(true, 'Close event was sent'); + // start(); + // }; + + // viewer.addHandler('close', closeHandler); + // viewer.close(); + // }); + +})(); diff --git a/test/test.html b/test/test.html index 37a9afe4..878547a8 100644 --- a/test/test.html +++ b/test/test.html @@ -16,5 +16,6 @@ + \ No newline at end of file From 8f20f3dae2e47b72e00f8187ba54646521a66c8b Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 9 May 2013 11:04:31 -0700 Subject: [PATCH 31/33] Upping version number to 0.9.126 --- changelog.txt | 4 +++- package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 6e1e666b..320970c0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,9 @@ OPENSEADRAGON CHANGELOG ======================= -0.9.126: (in progress) +0.9.126: + +* DZI JSONp was broken; fixed. 0.9.125: diff --git a/package.json b/package.json index b0e36c66..f6a24dc5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "OpenSeadragon", - "version": "0.9.125", + "version": "0.9.126", "description": "Provides a smooth, zoomable user interface for HTML/Javascript.", "devDependencies": { "grunt": "~0.4.0", From c7105695db432703e196bf29e134896f32407796 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 9 May 2013 11:07:17 -0700 Subject: [PATCH 32/33] Added in progress version --- changelog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.txt b/changelog.txt index 320970c0..eed40e53 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,8 @@ OPENSEADRAGON CHANGELOG ======================= +0.9.127: (in progress) + 0.9.126: * DZI JSONp was broken; fixed. From 9d763c0984aab9bd8748fbe967b76a61ddaac680 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 9 May 2013 21:05:38 -0400 Subject: [PATCH 33/33] Update to latest grunt-contrib-compress --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f6a24dc5..4450061b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Provides a smooth, zoomable user interface for HTML/Javascript.", "devDependencies": { "grunt": "~0.4.0", - "grunt-contrib-compress": "~0.4.0", + "grunt-contrib-compress": "~0.5.0", "grunt-contrib-concat": "~0.1.2", "grunt-contrib-jshint": "~0.1.1", "grunt-contrib-uglify": "~0.1.1",