Merge remote branch 'upstream/master' into getString-error

Conflicts:
	test/test.html
This commit is contained in:
Heath Nielson 2013-05-10 11:54:45 -06:00
commit eb14eae428
13 changed files with 150 additions and 48 deletions

2
.gitignore vendored
View File

@ -1,5 +1,3 @@
*.sublime-workspace
node_modules
build/
openseadragon.zip
openseadragon.tar

View File

@ -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,11 +52,12 @@ module.exports = function(grunt) {
// ----------
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
pkg: packageJson,
clean: {
build: ["build"],
package: [packageDir],
release: {
src: [releaseRoot],
src: [releaseRoot + '*', '!' + releaseRoot + 'releases'],
options: {
force: true
}
@ -84,18 +88,20 @@ module.exports = function(grunt) {
compress: {
zip: {
options: {
archive: "build/openseadragon.zip"
archive: "build/releases/" + packageDirName + ".zip",
level: 9
},
files: [
{ expand: true, cwd: "build/", src: ["openseadragon/**"] }
{ expand: true, cwd: "build/", src: [ packageDirName + "/**" ] }
]
},
tar: {
options: {
archive: "build/openseadragon.tar"
archive: "build/releases/" + packageDirName + ".tar.gz",
level: 9
},
files: [
{ expand: true, cwd: "build/", src: [ "openseadragon/**" ] }
{ expand: true, cwd: "build/", src: [ packageDirName + "/**" ] }
]
}
},
@ -150,6 +156,21 @@ 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);
});
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");
});
// ----------
// Copy:release task.
// Copies the contents of the build folder into the release folder.
@ -177,8 +198,8 @@ module.exports = function(grunt) {
// ----------
// Package task.
// Builds and creates the .zip and .tar files.
grunt.registerTask("package", ["build", "compress"]);
// Builds and creates the .zip and .tar.gz files.
grunt.registerTask("package", ["build", "copy:package", "compress", "clean:package"]);
// ----------
// Publish task.

View File

@ -1,10 +1,12 @@
# 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
See it in action at http://openseadragon.github.io/.
http://openseadragon.github.io/
## Stable Builds
See our [releases page](http://openseadragon.github.io/releases/).
## First Time Setup
@ -40,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
@ -60,6 +62,14 @@ 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
OpenSeadragon was initially released with a New BSD License ( preserved below ), while work done by Chris Thatcher is additionally licensed under the MIT License.

View File

@ -1,12 +1,22 @@
OPENSEADRAGON CHANGELOG
=======================
0.9.125: In Progress
0.9.127: (in progress)
0.9.126:
* DZI JSONp was broken; fixed.
0.9.125:
* Fully deprecated OpenSeadragon.createFromDZI, safely deprecated Viewer.openTileSource and
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:

View File

@ -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":

View File

@ -1,10 +1,10 @@
{
"name": "OpenSeadragon",
"version": "0.9.124",
"version": "0.9.126",
"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",

View File

@ -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;

View File

@ -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: {

View File

@ -24,10 +24,12 @@ 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.
*
**/
$.Viewer = function( options ) {
@ -115,8 +117,7 @@ $.Viewer = function( options ) {
THIS[ this.hash ] = {
"fsBoundsDelta": new $.Point( 1, 1 ),
"prevContainerSize": null,
"lastOpenStartTime": 0,
"lastOpenEndTime": 0,
"updateRequestId": null,
"animating": false,
"forceRedraw": false,
"mouseInside": false,
@ -355,6 +356,10 @@ $.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();
@ -956,16 +961,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 );
@ -1014,7 +1009,7 @@ function openTileSource( viewer, source ) {
});
}
if( _this.preserveVewport ){
if( _this.preserveViewport ){
_this.viewport.resetContentSize( _this.source.dimensions );
}
@ -1076,7 +1071,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
@ -1351,12 +1346,15 @@ function updateMulti( viewer ) {
var beginTime;
if ( !viewer.source ) {
THIS[ viewer.hash ].updateRequestId = null;
return;
}
beginTime = +new Date();
updateOnce( viewer );
scheduleUpdate( viewer, arguments.callee, beginTime );
THIS[ viewer.hash ].updateRequestId = scheduleUpdate( viewer,
arguments.callee, beginTime );
}
function updateOnce( viewer ) {

View File

@ -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();
};

12
test/data/testpattern.js Normal file
View File

@ -0,0 +1,12 @@
testpattern({
Image: {
xmlns: 'http://schemas.microsoft.com/deepzoom/2008',
Format: 'jpg',
Overlap: 1,
TileSize: 254,
Size:{
Height: 1000,
Width: 1000
}
}
});

51
test/dzi-jsonp.js Normal file
View File

@ -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();
// });
})();

View File

@ -17,5 +17,6 @@
<script src="/test/util.js"></script>
<script src="/test/basic.js"></script>
<script src="/test/strings.js"></script>
<!-- <script src="/test/dzi-jsonp.js"></script> -->
</body>
</html>