Commit Graph

440 Commits

Author SHA1 Message Date
Chris Adams
baa3559df1 Graceful handling of cross-domain tilesource failures on IE<10
The TileSource error handling path used to raise non-obvious
"Unspecified error" exceptions on IE < 10 when configured with a URL
from a different origin (hostname or port) because the handler included
``xhr.status`` in the error message, triggering a security exception.

Now the second exception is caught and the log message will use the
original exception message instead to make the root cause more obvious.
2013-08-30 12:32:17 -04:00
Chris Adams
1b6cf93474 Graceful handling of IE cross-domain AJAX failures
Prior to IE 10, XmlHttpRequest cannot be used for requests to a
different origin even when the target URL's CORS headers would allow
access (see http://caniuse.com/#feat=cors).

This is easy to miss in testing if you use a single origin during
testing but have a CDN or domain-sharding for production and will break
the error handler function passed to makeAjaxRequest() if that code
assumes it can access properties on the request object.

This adds a more informative pointer to Microsoft's documentation when a
security exception is raised.
2013-08-29 16:13:18 -04:00
Mark Salsbery
c7f184f199 Reverted breaking change for issue #201
To be grouped with other breaking changes for major version release.
Also, minor formatting fix in src/eventhandler.js
2013-08-27 10:10:55 -07:00
Mark Salsbery
57ae0656c1 Fixes for issues #198, #201, #202, #203 2013-08-26 16:48:59 -07:00
Mark Salsbery
f8ab315795 Revert "Bad sync"
This reverts commit 70a7e8090e13cc35b93e652d2bcd7f418af26fc1.
2013-08-26 15:48:03 -07:00
Mark Salsbery
04a0197dc7 Fixes for issues #198, #201, #202, and #203 2013-08-26 15:25:57 -07:00
iangilman
aefe7f3610 Merge pull request #185 from robhobbes/master
Adding partial support for rotation.
2013-08-20 11:08:58 -07:00
Robert Hickman
d4467477ad More rotation documentation. 2013-08-19 16:29:22 -06:00
Ian Gilman
4b0450d271 Documented "current" param to a number of viewport functions 2013-08-19 10:14:04 -07:00
iangilman
d2353746c9 Merge pull request #179 from lukemurray/destroy
Add a destroy function on the viewer to clean up and remove elements
2013-08-19 10:03:12 -07:00
iangilman
dde052a22a Merge pull request #188 from iangilman/touch
Ignoring touchMove if we didn't get the touchStart
2013-08-19 09:57:36 -07:00
iangilman
e955c402ac Merge pull request #187 from iangilman/rtl
Drawer now works when the page is rtl
2013-08-19 09:55:04 -07:00
Robert Hickman
767c897e7f Revisions to rotate after second code review. 2013-08-16 11:32:21 -06:00
Ian Gilman
96c14f7617 Ignoring touchMove if we didn't get the touchStart 2013-08-16 10:09:49 -07:00
Robert Hickman
54e8d8c43f Fixes made after first code review of rotation. 2013-08-15 16:15:20 -06:00
Ian Gilman
6669589e5e Drawer now works when the page is rtl 2013-08-15 12:54:32 -07:00
Robert Hickman
6c63710131 Rotating overlays. 2013-08-14 13:43:49 -06:00
Ian Gilman
adbf35e002 Merge branch 'master' into form 2013-08-14 10:41:32 -07:00
Ian Gilman
3272572124 Clicking on a button control no longer refreshes page 2013-08-14 10:39:39 -07:00
Robert Hickman
b9583c43ac Working on rotating images.
So far only 90 degree rotation is supported.
Only the image is currently being rotated.
Overlays, debugger, and the navigator still need to be updated to support rotation.
2013-08-13 16:32:04 -06:00
Luke Murray
ab82783cf1 update the comments and unit test 2013-08-13 10:33:12 +10:00
Luke Murray
0c662b8a8d fix: comment updates and add a simple test for viewer.destroy 2013-08-12 16:38:37 +10:00
Luke Murray
68f9d675fc fix: calling viewer.destroy() multiple times throw an error. And a simple destroy to mousetracker 2013-08-08 17:49:24 +10:00
thatcher
88141c57f2 feature: navigatorPosition, option was available but not completely implemented 2013-08-08 00:12:44 -04:00
Luke Murray
4ccb141a42 Add a destroy function on the viewer to clean up and remove elements
created by open seadragon. Add removeAllHandlersForAllEvents to clean up all events on destroy. Clear
the onDraw callback on Overlay destroy.
2013-08-07 10:54:20 +10:00
Ian Gilman
967f2e4f32 Changelog for #177; minor doc tweaks 2013-08-02 09:40:55 -07:00
iangilman
51e37e3553 Merge pull request #177 from pnorcross/_getSafeElemSize
(hopefully) Final fix for issue #109, Viewport Broken on Hide.
2013-08-02 09:36:06 -07:00
pnorcrss
26938ed10e cleaned up docBlock and tabs in _getSafeElemWidth() 2013-08-01 12:11:33 -05:00
iangilman
f53ea2ddf1 Merge pull request #160 from lukemurray/custom_zoom_handler
Add the option for a zoom handler callback
2013-08-01 09:52:11 -07:00
Luke Murray
2717398181 Use the correct onDraw in drawer.js. Remove imageFullSize and fix up the comment for onDraw 2013-08-01 13:36:00 +10:00
pnorcrss
e47210d0bd refactored _getSafeElemSize() 2013-07-31 14:10:44 -05:00
pnorcrss
cb39fb7e32 fixed _getSafeElemSize() 2013-07-31 14:01:46 -05:00
pnorcrss
bf3dd7c031 fixed _getSafeElemSize() calls 2013-07-31 13:28:38 -05:00
pnorcrss
750eafcd2e added and implemented _getSafeElemSize() 2013-07-31 13:00:16 -05:00
iangilman
0aa0641cf4 Merge pull request #168 from ethanli83/fixtouch
canvas pans when tap on touch screen
2013-07-31 10:25:19 -07:00
Luke Murray
4239bb7adc fix: remove the useTransform/SVG stuff and move back to a simple onDraw callback only so people can handle their own custom drawing and sizing 2013-07-31 17:01:48 +10:00
Luke Murray
0a8d11875e Merge branch 'master' into custom_zoom_handler 2013-07-31 16:39:54 +10:00
ethan.li
0bb9c5be97 issue:
canvas pans when tap on touch screen

reason:
    onTouchStart calls onMouseDown which registers 'mousemove' event handler.
    when I tap on touch screen, even though browser did not dispatch 'touchmove' event, it dispatched 'mousemove' event.
    therefore, the 'mousemove' handler pans canvas.

fix:
    stop onTouchStart handler registering 'mousemove' handler as onMouseMove will be properly triggered by onTouchMove
2013-07-23 16:40:04 +10:00
Luke Murray
df877493a9 Rename drawHandler to onDraw. Also make it a notification style callback
(does not override the draw functionality).
Add an overlay option 'useTransform' that will transform the overlay
element instead of moving it's postion - useful for SVG elements
2013-07-16 12:04:37 +10:00
iangilman
77cf2a3b88 Merge pull request #159 from ethanli83/master
Fix for onTouchEnd
2013-07-12 09:01:31 -07:00
Luke Murray
233c3a357a Add the option for a zoom handler callback 2013-07-12 16:51:56 +10:00
ethan.li
0ef98be0b7 for fix I made to onTouchEnd:
1. remove IE8 related code as it does not support touch anyway
2. use event.changedTouches [ 0 ] rather than event
2013-07-12 10:29:44 +10:00
Ian Gilman
7391561dcd OpenSeadragon.now() returned undefined the first time; fixed 2013-07-10 09:31:22 -07:00
ethan.li
8108009ba7 fix issue:
onTouchEnd did not call the correct mouse up handler
2013-07-09 11:07:18 +10:00
iangilman
850aa14802 Merge pull request #151 from acdha/overhauled-ajax-error-reporting
Overhauled AJAX error reporting
2013-07-03 09:56:07 -07:00
radix-pro
004f13365d Update iiiftilesource.js 2013-07-02 13:41:37 -07:00
radix-pro
3c7e4b794a Update iiiftilesource.js 2013-07-02 00:41:22 -07:00
radix-pro
8f8e028015 Update iiiftilesource.js 2013-07-02 00:34:23 -07:00
radix-pro
acd55c709d Update iiiftilesource.js 2013-07-02 00:27:53 -07:00
radix-pro
040ff3a7ae Update iiiftilesource.js 2013-07-02 00:18:37 -07:00
radix-pro
a4303fb232 Update iiiftilesource.js 2013-07-02 00:02:48 -07:00
radix-pro
0441cfe4ec Update iiiftilesource.js 2013-07-01 23:55:07 -07:00
radix-pro
44a9d1b98b Update iiiftilesource.js 2013-07-01 23:49:25 -07:00
radix-pro
dde42b641d Update iiiftilesource.js
Fix Issue #55 "Tiles rendering issue..."
2013-07-01 22:38:37 -07:00
Chris Adams
0ed4703bd3 Viewport messages: add a class to the dialog for easy styling 2013-07-01 18:26:44 -04:00
Chris Adams
1ab6094420 Viewer: make viewport messages private, repeatable
* Marked _showMessage/_hideMessage as private
* Fix DOM manipulation bug: call standard removeNode() method rather
  than proprietary WebKit .remove()
* Change messageDiv to be the outer wrapper to simplify removing the
  entire message container
2013-07-01 13:43:48 -04:00
Chris Adams
b912896158 Viewer.showMessage() hides any previous message 2013-07-01 12:58:22 -04:00
Chris Adams
9de45ba281 Refactor OpenSeadragon.makeCenteredNode
* Use CSS display tables for vertical centering (tested back to IE8)
* Use the DOM instead of string concatenation
* Remove redundant styles ($.makeNeutralElement sets the same values
  for margin, padding & border)
* Return the outer wrapper element to ease DOM addition & removal
2013-06-28 15:52:48 -04:00
Chris Adams
1f345e4cc5 Viewer: refactor message code into showMessage/hideMessage methods
This avoids the need to deal with classes, and explicitly makes it
reusable for other needs
2013-06-28 15:46:31 -04:00
Chris Adams
7f42dfc032 code style 2013-06-28 15:01:56 -04:00
Chris Adams
fb7c91acd2 code style 2013-06-28 14:54:44 -04:00
Chris Adams
7dcf662fdd Viewer: add a basic error message display system
This might be something we want to make configurable for users who want
to completely control how errors are displayed.

This also adds the first use of OpenSeadragon.makeCenteredNode currently
so we might want to clean up that code as well.
2013-06-28 14:32:57 -04:00
Chris Adams
2bf6b13bfe User-visible warning when tile sources fail to load
This is currently using window.alert in lieu of something more sophisticated but it works for indicating 404s or invalid file
contents
2013-06-28 14:11:20 -04:00
Chris Adams
494bf7fe41 strings: add logging for untranslated source messages
This should probably be changed to be closer to the goal of being
like gettext but we can at least tell developers when we clobber the
string
2013-06-28 14:11:19 -04:00
Chris Adams
464428cef7 makeAjaxRequest: don't set request to null
Setting onreadystatechange can avoid the possibility of it somehow being
called twice but there's no point in nulling the request right before we
let the GC collect it.
2013-06-28 14:00:02 -04:00
Chris Adams
db38b71dd9 makeAjaxRequest: throw error for missing callback 2013-06-27 16:03:43 -04:00
Chris Adams
1c6a57c710 makeAjaxRequest: log all errors, test callback
* All AJAX errors will log to the console
* The onError callback will only be called if defined
2013-06-27 16:03:41 -04:00
Chris Adams
5eccdfee98 Better match project style 2013-06-27 15:58:09 -04:00
Chris Adams
496b7d757b Simplify OpenSeadragon.makeAjaxRequest
* Since async is always true – and browsers are starting to deprecate
  synchronous XHR – we were able to prune considerable amount of code
* Add an error callback to match the existing success callback
2013-06-27 15:58:09 -04:00
iangilman
8fe0ce26b8 Merge pull request #136 from acdha/jshint-cleanup
JSHint tidying
2013-06-26 09:37:08 -07:00
iangilman
f4139cef38 Merge pull request #144 from acdha/143-xhr-error-handling
Safe cleanup in makeAjaxRequest error handler
2013-06-26 09:23:04 -07:00
Ian Gilman
3f1072b321 Fixed typos in comments 2013-06-26 09:15:37 -07:00
Chris Adams
c648c1df8a drawer: don't leak drawLevel into global namespace
This code is still under-tested and documented but no longer relies on
`drawLevel` being leaked into the global namespace where `updateLevel`
to find it.

See #145
2013-06-25 14:26:09 -04:00
Chris Adams
f2cba16a8b Safe cleanup in makeAjaxRequest error handler
Previously `request.onreadystatechange` was assigned an empty function
on success but null on failures, which breaks in IE (see
http://jsbin.com/ezozax/6/).

This patch simply mimics the success behaviour in the cleanup function

Closes #143
2013-06-25 14:13:45 -04:00
Benjamin 'blindCoder' Schieder
0150622e78 fix error when recalculating overlay width and height 2013-06-25 18:01:38 +02:00
Chris Adams
c2107fcb22 Declare _processDZIError directly on OpenSeadragon 2013-06-21 16:37:31 -04:00
Kevin Ewing
8896c2278d Fixed mistake 2013-06-20 13:31:04 -07:00
Kevin Ewing
2ba3acda38 Removed extra parens 2013-06-20 13:23:16 -07:00
Kevin Ewing
248852c15f Implementing OpenSeadragon.now()
Replacing both `+new Date()` and `new Date().getTime()` with `$.now()`
2013-06-20 13:15:04 -07:00
Chris Adams
9ef6e085c8 viewer.js: update onfullscreenchange handler comment 2013-06-20 15:17:48 -04:00
Chris Adams
de29a34890 viewer.js: remove dead code 2013-06-20 15:12:55 -04:00
Chris Adams
adc4147304 Expose semi-private processDZIError for use by DziTileSource
This previously wasn't in scope outside of the main OpenSeadragon
closure. Now it's exposed with an underscore prefix to encourage people
not to think of it as a public interface.
2013-06-20 15:12:54 -04:00
Chris Adams
51bb8ca46e openseadragon.js: fix imageFormatSupported refs 2013-06-20 15:12:54 -04:00
Chris Adams
169244ed1a navigator.js: omit unused borderWidth from func args 2013-06-20 15:12:54 -04:00
Chris Adams
0d09183159 referencestrip.js: move variable declaration to the top of loadPanels 2013-06-20 15:12:54 -04:00
Chris Adams
eafc822aa8 openseadragon.js: remove unused builtin aliases 2013-06-20 15:12:54 -04:00
Chris Adams
8c433ba81c Declare assumed globals 2013-06-20 15:12:54 -04:00
Chris Adams
e2bea810e3 Replace gnarly ternary expression with if statement 2013-06-20 15:12:53 -04:00
Chris Adams
64d94ac2bd referencestrip.js: declare undeclared variable 2013-06-20 15:12:53 -04:00
Chris Adams
f8c77f65d7 viewer.js: fix typos in variable declarations 2013-06-20 15:12:53 -04:00
Chris Adams
d644acd50b Fix lack of braces on if statements
JavaScript's most popular rack in the grass for maintenance coders…
2013-06-20 15:12:53 -04:00
Chris Adams
643ee211ca Remove unused variables
Mostly unused function arguments but there were also a fair number
of legacy names which are now no longer used.

One question which comes up – mostly in tilesource.js – is whether
there is any value in leaving unused variables for functions which
are intended to be overridden anyway. I'm inclined to say that the
docs + tests need to be sufficient as there's no enforcement that
whatever is in the base implementation will actually be followed by
any of the real functions.
2013-06-20 15:12:53 -04:00
iangilman
6e9a300d1a Merge pull request #133 from iangilman/raf
Improved requestAnimationFrame polyfill; fixed timer leaks; added tests
2013-06-20 09:52:10 -07:00
Kevin Ewing
0984106983 Added missing semicolon 2013-06-20 09:08:21 -07:00
Kevin Ewing
2f8a26fda0 Responding to feedback
Function now re-assigns itself on the first go round to avoid doing the
check every time it is called
2013-06-19 15:13:56 -07:00
Ian Gilman
e0282a3c86 Stripped whitespace 2013-06-19 13:33:01 -07:00
Kevin Ewing
ebffea5a34 Merge branch 'master' into now 2013-06-19 11:23:42 -07:00
Ian Gilman
8e88f36098 Merge branch 'master' into raf
Fixed Conflicts:
	src/viewer.js
2013-06-19 11:19:54 -07:00
Kevin Ewing
e8408c1313 Moved to better location 2013-06-19 11:16:45 -07:00
Kevin Ewing
6a3b7cfb2f Added OpenSeadragon.now() 2013-06-19 10:57:09 -07:00