Compare commits

...

2051 commits

Author SHA1 Message Date
Ian Gilman
99fcb408fe Changelog for #2702 2025-04-02 09:36:33 -07:00
Ian Gilman
479ef0ec82
Merge pull request #2702 from achu1998/expose-nav-button
Exposed Zoom In and Out methods for end users
2025-04-02 09:33:44 -07:00
achu1998
9e01a1e18b Made changes according to review. 2025-04-01 11:04:04 +10:30
achu1998
2e3f0923f5 Explicitly bind 'this' to the Viewer instance 2025-03-29 14:17:54 +10:30
achu1998
3550dfafd3 Refactored code to minimise the changes required 2025-03-29 13:47:02 +10:30
achu1998
12de02938a Exposed Zoom In and Out methods for end users 2025-03-29 13:33:25 +10:30
Ian Gilman
8f093f54df Changelog and minor fixes for #2698 2025-03-26 09:44:50 -07:00
Ian Gilman
6bdd186219
Merge pull request #2698 from lokaesshwar/duplicate_ids_overlay_html_2682
Duplicate ids overlay html 2682
2025-03-26 09:36:17 -07:00
lokaesshwar
c54c292873 Fix #2682: Ensure unique ID for overlay wrapper to prevent duplicate IDs 2025-03-26 19:38:02 +05:30
lokaesshwar
4c7d9a2ffa Resolved Duplicate IDs in overlay HTML 2025-03-14 00:35:22 +05:30
Ian Gilman
595066abd1 Changelog for #2690 2025-03-12 09:32:08 -07:00
Ian Gilman
b4e14d4804
Merge pull request #2690 from MichaelWGibson/load-area-fixes
Make load code more robust to out of image panning
2025-03-12 09:31:08 -07:00
Michael Gibson
be87b47469 Make load code more robust to out of image panning 2025-03-10 11:19:44 -06:00
Ian Gilman
62fa378f51 Changelog for #2686 2025-03-10 10:04:26 -07:00
Ian Gilman
c386eca94d
Merge pull request #2686 from MichaelWGibson/animation-dest-tile-loading
During animations, load tiles in the destination region
2025-03-10 09:59:12 -07:00
Michael Gibson
8c6d1f4f88 Update documentation to match new flag behavior 2025-03-07 21:21:40 -07:00
Michael Gibson
3cb5152905 Change flag name 2025-03-07 21:18:42 -07:00
Michael Gibson
5cc76737b4 Fix flag type 2025-02-28 15:37:13 -07:00
Michael Gibson
f312bae614 Document flag 2025-02-28 15:35:25 -07:00
Michael Gibson
97d388be7d Add loadTilesOnAnimationPath flag 2025-02-28 11:30:30 -07:00
Michael Gibson
fd27327737 Factor out common traversal code 2025-02-28 11:10:29 -07:00
Michael Gibson
5c60f669ec Clean up 2025-02-28 09:33:49 -07:00
Michael Gibson
6ceac75b7a During animations, load tiles in the destination region 2025-02-28 09:17:41 -07:00
Ian Gilman
2387c3afd5 Stopped sponsor images from wrapping 2025-01-31 09:51:18 -08:00
Ian Gilman
5184ed6c9f Changelog for #2676 2025-01-31 09:40:00 -08:00
Ian Gilman
b22b689dae
Merge pull request #2676 from bennlich/patch-1
Update viewer.addOverlay doc
2025-01-31 09:38:38 -08:00
Benny Lichtner
138215e22f
delete trailing whitepsace 2025-01-30 20:12:05 +01:00
Ian Gilman
22e766bd1a Trimming sponsor logos 2025-01-30 09:37:34 -08:00
Benny Lichtner
337af91373
Update viewer.addOverlay doc
Mention the preserveOverlays option
2025-01-30 14:45:30 +01:00
Ian Gilman
ced1bde338 Changelog for #2643 2025-01-23 09:45:25 -08:00
Ian Gilman
dbc72d4d98
Merge pull request #2643 from RationAI/fix/fallback-canvas-drawer
Flexible support for drawers to modify cache
2025-01-23 09:37:52 -08:00
Aiosa
994f0e25a4 Fix renaming also in tests. 2025-01-14 12:26:28 +01:00
Aiosa
71c3c8437a Rename new drawer base api to reflect that it deals with internal cache. 2025-01-14 12:20:39 +01:00
Aiosa
6e81bedc39 Improve docs, change order of calls in prepareForRendering for better code stability. 2025-01-14 12:14:28 +01:00
Ian Gilman
a9562fbb64
Improved sponsor logo styling 2025-01-13 09:57:54 -08:00
Ian Gilman
b4c7e75109 Merge branch 'master' of github.com:openseadragon/openseadragon 2025-01-13 09:47:20 -08:00
Ian Gilman
301191a0b8 Actually adding the logos 2025-01-13 09:46:57 -08:00
Ian Gilman
edb422007c
Merge pull request #2661 from openseadragon/ian
Additional sponsor logos
2025-01-13 09:45:09 -08:00
Ian Gilman
f8aad5f237 Additional sponsor logos 2025-01-13 09:44:18 -08:00
Aiosa
1286fa4549 Test drawers collide with drawer render testing - remove after cache tests. 2025-01-10 22:13:16 +01:00
Aiosa
03b7c5b9a6 Update tests, fix async cache bug - first convert to supported format, then process. Record drawer ID in the internal cache type. 2025-01-10 22:05:16 +01:00
Ian Gilman
7dfde9da3a Changelog for #2644 2025-01-10 09:53:09 -08:00
Ian Gilman
ffe12888cf
Merge pull request #2644 from RationAI/feat/import
Import Openseadragon Dynamically
2025-01-10 09:51:54 -08:00
Ian Gilman
8b30e7a307 Changelog for #2657 2025-01-10 09:34:25 -08:00
Ian Gilman
306adb9b6a
Merge pull request #2657 from cff29546/master
use unique hash for MouseTracker
2025-01-10 09:32:12 -08:00
Aiosa
226a44c498 Fix docs. 2025-01-10 14:57:41 +01:00
Aiosa
b1feb367b8 Fix typo. 2025-01-10 14:49:59 +01:00
Aiosa
cb06a5c0fb Debug fallback to canvas drawer, small bugfixes, add support for drawer cleanup in cache. 2025-01-10 14:46:52 +01:00
Ian Gilman
9b8b4c2728 Changelog for #2652 2025-01-09 10:06:05 -08:00
Ian Gilman
d6740dab25 Merge branch 'master' of github.com:openseadragon/openseadragon 2025-01-09 10:04:58 -08:00
Ian Gilman
003dd3a9da
Merge pull request #2652 from pearcetm/fix-2651
Mark tiled image as needing update when opacity changes
2025-01-09 10:02:35 -08:00
Ian Gilman
a1fa790e19 Changelog for #2649 2025-01-09 09:45:33 -08:00
Ian Gilman
3aaa8fa721
Merge pull request #2649 from Seafret/master
Fixed issue with MouseTracker where hasGestureHandlers and hasScrollHandler values were not getting updated upon dynamically adding/removing handlers.
2025-01-09 09:42:51 -08:00
Min Xiang
39671f4d78 use unique hash for MouseTracker 2025-01-09 07:53:05 +08:00
Aiosa
426700b1c6 Temporarily disable tests - discussing design. 2025-01-07 19:57:37 +01:00
Aiosa
6315662078 DrawerBase API for internal cache. 2025-01-07 19:56:21 +01:00
Ian Gilman
e193557e56 Changelog for #2636 2025-01-06 09:45:36 -08:00
Ian Gilman
b8b6a9656a
Merge pull request #2636 from pcram-techcyte/v5.0.1-hasTransparency-fix
Typo in hasTransparency check in webgldrawer
2025-01-06 09:42:55 -08:00
Tom
f5f9eab200 mark tiled image as needing an update when opacity changes 2025-01-06 09:40:23 -05:00
Tom
3f22b6aa3a mark tiled image as needing an update when opacity changes 2025-01-06 09:39:28 -05:00
Jessica R.
641e085259
Updated MouseTracker's hasGestureHandlers and hasScrollHandler to be getters 2025-01-02 23:07:13 -07:00
Jessica R.
9527f15f52
Changed hasScrollHandler to be a function to better work with dynamically added handlers
Previously, we were setting hasScrollHandler once in the constructor and never re-assigning it after the initial creation. Changing hasScrollHandler to a function better accommodates dynamically added/removed handlers. See previous commit for change to hasGestureHandlers for further details and reasoning.
2025-01-01 22:45:12 -07:00
Jessica R.
865c3884b2
Changed hasGestureHandlers to be a function to better work with dynamically added handlers
Previously, we were setting hasGestureHandlers once in the constructor and never re-assigning it after the initial creation. This resulted in MouseTrackers created without gesture handlers never updating its hasGestureHandlers values, even when gesture handlers were dynamically added after creation. By changing this to a function, our MouseTrackers' hasGestureHandlers value should always be in the proper state, even if handlers are dynamically created or removed.
2025-01-01 22:38:48 -07:00
Ian Gilman
56d0d982da Changelog for #2640 2024-12-20 09:32:24 -08:00
Ian Gilman
58f4e6a36e
Merge pull request #2640 from harshkg23/master
Refactor assessNumericValue for improved clarity and debugging
2024-12-20 09:28:11 -08:00
Paul Cram
ef0f14a03d Revert "Add useTwoPassRendering as an option to the webgl drawer"
This reverts commit 55f53e8369.
2024-12-19 15:32:00 -05:00
Harsh Kumar Gupta
d31562e34f Fix the function arguments for the required file 2024-12-20 00:31:40 +05:30
Aiosa
ad943e5472 feat: ability to attach OSD to window reference if available 2024-12-19 16:22:50 +01:00
Aiosa
4c2b0715af fix: typo 2024-12-19 16:20:50 +01:00
Aiosa
a5c569ab5d fix: reference to the cpuData on webgldrawer 2024-12-19 16:11:53 +01:00
Harsh Kumar Gupta
8fdd639bf0 Rename parameters in helper functions for clarity and consistency 2024-12-19 16:30:04 +05:30
Harsh Kumar Gupta
a0fcfc20ad Correct function names in test helpers for consistency 2024-12-19 16:12:27 +05:30
Harsh Kumar Gupta
15627ee18e Bump version to 5.0.1 and update argument names for clarity in helper functions 2024-12-19 15:52:14 +05:30
Harsh Kumar Gupta
33c3d4b380 Corrected arguments name and fixed the identation issue 2024-12-19 15:24:34 +05:30
Harsh Kumar Gupta
74ffb66f40 Refactor test helper functions for improved readability and consistency 2024-12-18 00:53:44 +05:30
Paul Cram
55f53e8369 Add useTwoPassRendering as an option to the webgl drawer 2024-12-17 10:36:31 -05:00
pcram-techcyte
acb7563257
Merge branch 'openseadragon:master' into v5.0.1-hasTransparency-fix 2024-12-17 09:01:36 -05:00
Ian Gilman
c06e719198 Changelog for #2407 2024-12-16 09:30:47 -08:00
Ian Gilman
64bb7e25c7
Merge pull request #2407 from RationAI/cache-overhaul-reviewed
Cache Overhaul for OpenSeadragon (reviewed).
2024-12-16 09:26:13 -08:00
Aiosa
c392f2d205 Change location of logos, add link 2024-12-12 19:28:58 +01:00
pcram-techcyte
45bd3f48f9
Typo in hasTransparency check 2024-12-10 09:12:39 -05:00
Aiosa
bee3c243fb Delete demos with old plugins. 2024-12-10 14:38:34 +01:00
Aiosa
563c7674c7 Add sponsors section to README. 2024-12-10 14:37:30 +01:00
Aiosa
fec033f9d2 Clear up few todos, introduce tile processing promise to await single tiles. 2024-12-10 14:16:19 +01:00
Aiosa
e12a349f52 Merge branch 'temporary-merge' into cache-overhaul-reviewed 2024-12-10 13:51:56 +01:00
Aiosa
bee5cb2471 Merge conflicts from master. 2024-12-10 13:50:41 +01:00
Ian Gilman
c8c7b481b8 Started on version 6 2024-12-09 09:37:19 -08:00
Ian Gilman
480de92d0a Version 5.0.1 2024-12-09 09:31:27 -08:00
Ian Gilman
e9dd9e9dfc Changelog for #2627 2024-12-06 09:32:44 -08:00
Ian Gilman
07502e6d58
Merge pull request #2627 from pearcetm/pixel-density-change
Fix #2623
2024-12-06 09:30:41 -08:00
Tom
1843bbd89c update docs 2024-12-04 16:42:25 -05:00
Tom
a5987db8d5 fix #2623 2024-12-04 16:41:24 -05:00
Aiosa
039ffbd37a Fix typo 2024-12-04 09:16:04 +01:00
Aiosa
1a7a5ee1d6 Respect tainted() when uploading a texture. 2024-12-04 09:08:00 +01:00
Ian Gilman
9b96707dec Changelog for #2620 2024-12-02 09:51:24 -08:00
Ian Gilman
3ce307f309
Merge pull request #2620 from sbarex/master
Update webgldrawer.js
2024-12-02 09:48:24 -08:00
Aiosa
d6bb8d3bd1 Fix typo. Remove tileSource prototype extension - adds implementation for methods that throw exceptions. 2024-11-30 10:03:39 +01:00
Aiosa
271f437568 Force prototype extension on inlined tile source. Ensure zombies are processed with invalidation before restored in the system. WebGL drawer can use canvas drawer. Add changelog updates. 2024-11-30 09:52:27 +01:00
sbarex
5438fd65e1
Update webgldrawer.js
Fixed a bug that caused a completely white image to be rendered when two-pass rendering mode was requested (required when multiple images, using transparency, or in debug mode).
2024-11-26 23:38:13 +01:00
Aiosa
85e8b381b8 Add cache clear on viewer.clear(). Add tile and viewer state checks to invalidation. Fix IIF test (timer is now built-in). 2024-11-26 15:24:51 +01:00
Aiosa
ef7628f098 Fix bug: webgl 'manual instanced rendering' return -> continue, do not count as drawn index. 2024-11-26 14:08:32 +01:00
Aiosa
17f13885c7 Add back overlapFraction logic for webgl drawer. 2024-11-26 00:48:43 +01:00
Aiosa
6b4c0f873a Add maxTilesPerFrame degradation, fix tests. 2024-11-22 13:03:16 +01:00
Aiosa
8b16628950 Write documentation fo cache/data overhaul. Rename url type to be more explicit. 2024-11-22 12:43:14 +01:00
Ian Gilman
04211fbb27 Changelog for #2619 2024-11-21 09:58:12 -08:00
Ian Gilman
3885fa7bfc
Merge pull request #2619 from jbakarich/fix/2612/incorrect-display-region-rotation
Remove displayRegion transform
2024-11-21 09:53:08 -08:00
Aiosa
f03f2a5d31 Add fixes for working smoothing in the webgl renderer. 2024-11-21 16:51:38 +01:00
Aiosa
ce4b16616d Merge branch 'openseadragon-master' into cache-overhaul-reviewed 2024-11-21 16:13:36 +01:00
Aiosa
af9bf9e07f Resolve conflicts, implement setImageSmoothingEnabled on webgl drawer by invalidation routine. 2024-11-21 16:12:52 +01:00
Aiosa
1851405fcf Remove warning from cache attaching if the tile has already reference. 2024-11-21 15:48:11 +01:00
Aiosa
0bc7deccd7 Fixed tests & bugs for the new design of invalidation inside events. 2024-11-21 15:35:27 +01:00
Jacob Bakarich
2dc0e29647 Remove displayRegion transform
ref #2612

- Remove display region transform in `setFlip()` as it is not needed for flipping and was overriding existing rotation transforms.
2024-11-20 14:07:26 -07:00
Ian Gilman
0e3abe16f4 Changelog for #2615 2024-11-15 09:32:07 -08:00
Ian Gilman
cd9e4e8c4e
Merge pull request #2615 from pearcetm/webgl-glnearest
Add support for imageSmoothingEnabled to WebGLDrawer
2024-11-15 09:27:18 -08:00
Tom
02805226d4 only redraw after setImageSmoothingEnabled() when changed 2024-11-14 13:13:13 -05:00
Tom
4163a46a24 Update docs 2024-11-13 16:49:54 -05:00
Tom
16dbfc62be Add support for imageSmoothingEnabled to WebGLDrawer 2024-11-13 16:43:46 -05:00
Aiosa
e24f7d1358 Update demo plugins to the new api design 2024-11-13 15:04:09 +01:00
Aiosa
541fe2e4df Redesign working cache: it is now owned by the event, not a tile. Tests are not yet updated. 2024-11-13 14:35:50 +01:00
Aiosa
e059b8982e Add try-catch for a plugin 2024-11-07 12:22:18 +01:00
Aiosa
3b1b2d6d23 Fix: reference the correct drawer in invalidation routine. 2024-11-07 12:01:02 +01:00
Aiosa
535507568f Fix docs syntax. 2024-11-05 12:06:59 +01:00
Aiosa
cc7474ec9b
Merge branch 'openseadragon:master' into cache-overhaul-reviewed 2024-11-05 18:59:34 +09:00
Aiosa
9bfdd55b2e Make tile-invalidated event before tile-loaded. Try to fix behavior of maxTilesperFrame 2024-11-05 10:58:41 +01:00
Aiosa
5fdeb382ea Increase the test timeout: it seems that 5 seconds is not enough, maybe reason for tests failing. 2024-11-01 22:20:15 +01:00
Aiosa
cf65f1a4f4 Add ability to run only a specific module from CLI. 2024-11-01 22:06:18 +01:00
Aiosa
f127014f0f Design of separated events: drop update data support for tile-loaded, use only invalidated event. 2024-11-01 21:43:12 +01:00
Ian Gilman
e1e0ec6b24 Changelog for #2606 2024-10-28 09:17:59 -07:00
Ian Gilman
faf6d19db5
Merge pull request #2606 from pearcetm/viewerMargins
Fix problem with asymmetric viewport margins in webgl drawer
2024-10-28 09:14:09 -07:00
Tom
fab607584c fix problem with asymmetric viewport margins 2024-10-25 11:15:52 -06:00
Aiosa
cd60aff5dc Fix demo further: clear tile processing logics, perform locking on tile level, delete tile if drawn process encountered _destroyed state. 2024-10-23 15:54:31 +02:00
Aiosa
207bc88aab Fix demo further: _queuedInvalidateTiles was not being used, simplify how tile cache updates are being called (but without priorities). 2024-10-23 14:37:43 +02:00
Aiosa
6cbe359398 Fix demo filtering plugin: certain guards made rendering not being properly updated. 2024-10-23 10:07:16 +02:00
Ian Gilman
82314dd4bf Changelog for #2600 2024-10-22 09:43:43 -07:00
Ian Gilman
12e4607a30
Merge pull request #2600 from pearcetm/viewerMargins
Make webgl drawer account for viewport margins
2024-10-22 09:41:40 -07:00
Aiosa
20177116e7 Integration tests: bugfixing of manipulation of tiles that share data: when tiles are loaded, when tiles are processed, also await async data preparation befre finishing the invalidation event. 2024-10-22 17:25:02 +02:00
Aiosa
e403e29312 Fix tests: bug in type equality checking 2024-10-21 12:59:21 +02:00
Aiosa
82e1160508 Clean up outdated TODO comments. 2024-10-21 11:00:23 +02:00
Aiosa
d5cdf59993 Fix styling on the plugin demo. 2024-10-21 10:00:53 +02:00
Aiosa
3c6c7e0ab7 Add plugin interaction demo. 2024-10-21 09:55:23 +02:00
Aiosa
68f0ed8901 Do not spit out warns on invalid tile unload (preemtive working cache deletion), do not ignore working cache even if __restore=true. 2024-10-21 09:00:24 +02:00
Aiosa
b3cdeabf02 Flexible timeout for tests. 2024-10-18 14:56:05 +02:00
Aiosa
0cd17abafd Clean up old comments in a test. 2024-10-18 14:40:54 +02:00
Aiosa
1e47bd6add Add cache tests, add more robust CacheRecord creation/deletion logics. Zombies now do not replace data, prevents also potential memory leak. 2024-10-18 14:38:04 +02:00
Tom
6c20101c8b make webgl drawer account for viewport margins 2024-10-17 15:06:04 -04:00
Aiosa
bf25e2f069 Minor documentation and test cleanup. 2024-10-17 13:24:11 +02:00
Aiosa
06ac68d00e Html drawer add canvas to supported formats 2024-10-17 12:17:49 +02:00
Aiosa
1b6fea72d8 Add assets for fallback compatibility filtering plugin demo. 2024-10-17 12:17:24 +02:00
Aiosa
0b63a943b6 Tests & Bugfixes: new cache tests, working cache preemptively deleted when restore() called, zombie cache had bug (restored cache had no attached tile reference and restoration failed since we relied on any existing tile on the cache to inherit state), deprecated old HTMLDrawer props on tile, rewritten HTMLDrawer to work also with cache API. 2024-10-17 12:10:04 +02:00
Aiosa
f8e5cff117 Feature/Optimization: cache can be created by a callback (async or sync), to avoid premature data creation 2024-10-16 16:31:08 +02:00
Aiosa
b6693ee50d Fixed outdated demo pages. 2024-10-16 11:12:20 +02:00
Ian Gilman
8bdc0a4146 Changelog for #2590 2024-10-08 09:26:56 -07:00
Ian Gilman
3e0e39900e
Merge pull request #2590 from pearcetm/fix-setClip
Bug fix in TiledImage.setClip
2024-10-08 09:24:41 -07:00
Tom
263a664e58 add _needsUpdate during tiledImage.setClip() 2024-10-07 18:19:38 -04:00
Aiosa
3d21ec897b Set fully loaded for reset() call on tiled image to false. Add old plugins demo to see how they behave. Remove basic2 demo as it was added by accident. 2024-10-07 11:18:36 +02:00
Aiosa
2033814227 Update documentation and minor cleanup. 2024-10-05 11:50:21 +02:00
Ian Gilman
17c34a7985 Changelog for #2582 2024-09-24 09:50:10 -07:00
Ian Gilman
53e56932bd
Merge pull request #2582 from BeebBenjamin/2576-overlay-wrapping
Fixed: removeChild on Node
2024-09-24 09:43:56 -07:00
Richard Benjamin Allen
2b010a9a59 Fixed: JQuery cannot be used to get position with wrapper 2024-09-19 21:13:28 +01:00
Richard Benjamin Allen
4d4ccb99ba Fixed: Removed unused style attributes 2024-09-18 00:16:41 +01:00
Richard Benjamin Allen
c0eae951c6 Fixed: Removed unnecessary complexity 2024-09-17 23:38:48 +01:00
Richard Benjamin Allen
b28b77fdbd FIxed: Removed unnecessary references in selectors
We can test the overlay dimensions still
2024-09-17 23:30:06 +01:00
Richard Benjamin Allen
3b99665b32 Fixed: removeChild on Node
The overlay.js code has been changed to apply a div wrapper to the overlay element as opposed to its innerHTML.
2024-09-17 12:16:00 +01:00
Ian Gilman
50d7db595b
Merge pull request #2581 from openseadragon/dependabot/npm_and_yarn/serve-static-1.16.2
Bump serve-static from 1.14.2 to 1.16.2
2024-09-16 09:47:18 -07:00
dependabot[bot]
fe7e9a3315
Bump serve-static from 1.14.2 to 1.16.2
Bumps [serve-static](https://github.com/expressjs/serve-static) from 1.14.2 to 1.16.2.
- [Release notes](https://github.com/expressjs/serve-static/releases)
- [Changelog](https://github.com/expressjs/serve-static/blob/v1.16.2/HISTORY.md)
- [Commits](https://github.com/expressjs/serve-static/compare/v1.14.2...v1.16.2)

---
updated-dependencies:
- dependency-name: serve-static
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 13:29:14 +00:00
Aiosa
e3af370832 Merge branch 'cache-overhaul-reviewed' of github.com:RationAI/openseadragon into cache-overhaul-reviewed 2024-08-24 10:00:09 +02:00
Aiosa
63180a1589 Simplify filtering plugin demo. 2024-08-24 09:59:18 +02:00
Aiosa
c04b6af937
Merge branch 'master' into cache-overhaul-reviewed 2024-08-24 09:53:23 +02:00
Aiosa
29b01cf1bd First visually correct design: tile invalidation event manages three caches that are shared among equal tiles (based on cache key). Works with both latest drawers and shared caches. 2024-08-24 09:49:16 +02:00
Ian Gilman
a10b9086ab Changelog for #2570 2024-08-16 09:39:04 -07:00
Ian Gilman
a9f81190dd
Merge pull request #2570 from pearcetm/resize-after-drawer-swap
Remove resize handler from viewer when webgl drawer is destroyed
2024-08-16 09:36:49 -07:00
Tom
f3b92e0562 remove resize handler when webgl drawer is destroyed 2024-08-15 17:51:06 -04:00
Aiosa
cba40f4db8 Merge branch 'cache-overhaul-reviewed' of github.com:RationAI/openseadragon into cache-overhaul-reviewed 2024-08-15 12:58:07 +02:00
Aiosa
1b6f79661b Commit before merging master v5.0 2024-08-15 12:58:01 +02:00
Aiosa
999ff30e74
Merge branch 'master' into cache-overhaul-reviewed 2024-08-15 11:53:50 +01:00
Ian Gilman
d97ba581b0 Started 5.0.1 2024-08-14 09:37:49 -07:00
Ian Gilman
f28b7fc116 Version 5.0.0 2024-08-14 09:31:15 -07:00
Ian Gilman
a803e826a3 Changelog for #2563 2024-08-05 09:28:19 -07:00
Ian Gilman
8d2fd759cc Merge branch 'master' of github.com:openseadragon/openseadragon 2024-08-05 09:26:42 -07:00
Ian Gilman
d4c9b601c8
Merge pull request #2563 from openseadragon/ms-pixelDensityRatio-docs
JSDoc comments for OpenSeadragon.getCurrentPixelDensityRatio
2024-08-05 09:26:18 -07:00
Mark Salsbery
7740accfaf Update openseadragon.js
Fix jsdoc comments for OpenSeadragon.getCurrentPixelDensityRatio
2024-08-04 15:29:12 -07:00
Ian Gilman
8f6771ba91 Changelog for #2557 and #2558 2024-07-17 09:19:32 -07:00
Ian Gilman
980deca107
Merge pull request #2558 from pearcetm/webgl-update
Mark image-unloaded and tile-ready events as private
2024-07-17 09:17:54 -07:00
Ian Gilman
2db1c2f1da
Merge pull request #2557 from pearcetm/acceleration-test
add check for missing webgl context in WebGLDrawer.isSupported()
2024-07-17 09:16:58 -07:00
Tom
b87eaf3040 mark image-unloaded and tile-ready events as private 2024-07-16 14:17:29 -04:00
Tom
37ce7cc256 add check for missing webgl context in WebGLDrawer.isSupported() 2024-07-16 14:07:27 -04:00
Ian Gilman
74b69d99de Changelog for #2546 2024-07-16 09:36:24 -07:00
Ian Gilman
819d4cb20c
Merge pull request #2546 from BeebBenjamin/flip-overlay
Fixed: Invert overlay scale and rotate on flip
2024-07-16 09:30:02 -07:00
Richard Benjamin Allen
c1c1d480dd Fixed: Try renaming to something more descriptive 2024-07-16 08:38:39 +01:00
Richard Benjamin Allen
2c5d2eb7c6 Fixed: More meaning full variable and help text, innerStyle not outer 2024-07-12 20:36:11 +01:00
Richard Benjamin Allen
396fcb33a5 Fixed: Outer div added to element to allow independent flipping
An outer div has been added to the internal HTML of the overlay element to allow for independent flipping of the content.  Flipping will invert the `scaleX` value of the transform property for the style of the element.  By setting the value `overlayContentFlipped: true` in the OSD config we can flip the content in the opposite direction to the overlay, but by setting this to false we can flip the content along with the overlay.  This allows for some people who are using images in their overlay to flip the images along with the overlay.
2024-07-11 22:08:37 +01:00
Richard Benjamin Allen
176fae11e5 Fixed: Add inner div if text and invert x 2024-07-09 14:08:58 +01:00
Richard Benjamin Allen
fd9b701272 Fixed: Position.x not working on Scaled overlay 2024-07-09 10:37:51 +01:00
Ian Gilman
c0655ba370
Merge pull request #2553 from openseadragon/ms-IE11
More dropped support for IE11
2024-06-24 09:51:15 -07:00
Mark Salsbery
c08ef0ee36 Merge branch 'master' into ms-IE11 2024-06-23 16:36:59 -07:00
Mark Salsbery
fc7b942bc2 Update changelog.txt 2024-06-23 16:35:22 -07:00
Mark Salsbery
2290e5d08d More dropped support for IE11 2024-06-23 16:32:00 -07:00
Ian Gilman
ee6751e02f
Merge pull request #2548 from openseadragon/dependabot/npm_and_yarn/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3
2024-06-20 09:24:13 -07:00
dependabot[bot]
3ed100d218
Bump braces from 3.0.2 to 3.0.3
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-18 23:24:55 +00:00
Richard Benjamin Allen
2c6b970f29 Fixed: Remove trailing space 2024-06-18 11:28:29 +01:00
Richard Benjamin Allen
263dc85fbd Fixed: Remove trailing spaces 2024-06-18 11:22:23 +01:00
Richard Benjamin Allen
79eecdcc76 Fixed: Remove duplicate line 2024-06-18 11:10:11 +01:00
Richard Benjamin Allen
44347fb2d0 Fixed: Invert overlay scale and rotate on flip 2024-06-18 10:57:55 +01:00
Ian Gilman
72d7c5353e
Merge pull request #2544 from openseadragon/ms-avif
Added avif to supported image formats
2024-06-17 09:35:06 -07:00
Mark Salsbery
88d7eb8c60 Update changelog.txt 2024-06-14 14:51:31 -07:00
Mark Salsbery
db0ab10428 Added avif to supported image formats (#2439) 2024-06-14 14:49:42 -07:00
Ian Gilman
fd74ea3dca Changelog for #2539 2024-06-10 09:27:44 -07:00
Ian Gilman
a96d186650
Merge pull request #2539 from eug-L/master
Fix Ajax headers not propagated to navigator
2024-06-10 09:24:05 -07:00
eug-L
35d468c4db propagate ajaxWithCredentials to navigator 2024-06-09 20:52:37 +08:00
Eugene Lu
65c727079c
Merge branch 'openseadragon:master' into master 2024-06-09 20:32:23 +08:00
Ian Gilman
feb5e13c32 Changelog for #2537 2024-06-04 09:29:40 -07:00
Ian Gilman
94954a699c Merge branch 'master' of github.com:openseadragon/openseadragon 2024-06-04 09:27:39 -07:00
Ian Gilman
3f5735be67
Merge pull request #2537 from pearcetm/fix-tile-loading
Fix sorting logic for best tiles to load
2024-06-04 09:25:12 -07:00
eug-L
834ed6ede5 fix ajax headers not propagated to navigator 2024-06-04 15:24:56 +08:00
Aiosa
0a035afc2d Merge master 2024-06-01 16:37:12 +02:00
Aiosa
cdb89ff5ad Add job queue full event. 2024-06-01 15:02:31 +02:00
Tom
65d30e7ce1 add minPixelRatio guard back in; fix tabs and spaces in comments' 2024-05-31 16:24:04 -04:00
Tom
f7c12a716b undo extra tabs before ach line introduced automatically by copy-and-pasting code 2024-05-22 18:59:19 -04:00
Tom
be30b429f8 remove unused code paths 2024-05-22 18:54:29 -04:00
Tom
3f03bd6e20 swap logic of haveDrawn and drawLevel within _updateTile 2024-05-22 17:36:16 -04:00
Tom
9ef1c5952e revert swapping order of arguments in _updateTile call to fix behavior of canvas drawer 2024-05-21 16:33:48 -04:00
Tom
5be44521b5 Fix sorting logic for best tiles to load 2024-05-21 04:30:17 -04:00
Ian Gilman
8d66acde53 Changelog for #2521 2024-04-29 10:50:35 -07:00
Ian Gilman
f3a942c522
Merge pull request #2521 from pearcetm/fix-2519
Fix #2519
2024-04-29 10:47:42 -07:00
Ian Gilman
3d54f8f686 Changelog for #2518 2024-04-29 10:41:38 -07:00
Ian Gilman
441ea71f40 Merge branch 'master' of github.com:openseadragon/openseadragon 2024-04-29 10:40:40 -07:00
Ian Gilman
d68a4024f8
Merge pull request #2518 from pearcetm/fix-canvas
Fix #2517
2024-04-29 10:38:44 -07:00
Tom
8b401e65e3 fix #2519 by checking minimumOverlapRequired on a per-tiled image basis 2024-04-28 08:38:03 -04:00
Tom
9d6a785aac add comment; clean up console.log messages from testing 2024-04-27 16:41:18 -04:00
Tom
f2c8db5db0 fix #2517 2024-04-27 16:38:30 -04:00
Ian Gilman
f8ef6818de Changelog for #2511 2024-04-12 09:24:16 -07:00
Ian Gilman
4f2bcbb1e3
Merge pull request #2511 from pearcetm/fix-canvas
Fix CanvasDrawer when viewport is flipped and a TiledImage is rotated
2024-04-12 09:19:39 -07:00
Tom
7ce5499868 fix comments 2024-04-11 12:45:11 -04:00
Ian Gilman
e809c9f198
Merge pull request #2512 from gaiborjosue/master
fix(citation): Fixed style issues for citation.cff
2024-04-11 09:32:43 -07:00
Tom
f7c8e4cf33 fix canvas drawer when viewport is flipped and tiled image is rotated. fix webgl drawer debug info when viewport is flipped. 2024-04-10 16:42:15 -04:00
Edward Gaibor
41c3abb12a
Update CITATION.cff 2024-04-10 12:35:30 -04:00
Edward Gaibor
3d97ac8ae7
Update CITATION.cff 2024-04-10 12:33:29 -04:00
Edward Gaibor
86395dfc78
Update CITATION.cff 2024-04-10 12:33:01 -04:00
Ian Gilman
49e2d7a987
Merge pull request #2509 from openseadragon/citation
Added citation file
2024-04-10 09:27:12 -07:00
Ian Gilman
5fefb8f976 Added Aseem and changed authors to chronological 2024-04-09 09:33:03 -07:00
Ian Gilman
6a4c3838c8 Added citation file 2024-04-08 09:43:16 -07:00
Ian Gilman
9f7b18adb6 Changelog for #2507 2024-04-08 09:36:39 -07:00
Ian Gilman
6ea7779318
Merge pull request #2507 from frameflare/master
chore: fix some comments
2024-04-08 09:35:11 -07:00
frameflare
0ba2f75213 Signed-off-by: frameflare <yangzenghua@outlook.com>
chore: fix some comments

Signed-off-by: frameflare <yangzenghua@outlook.com>
2024-04-07 10:50:24 +08:00
Ian Gilman
31c2c85c4f Changelog for #2506 2024-04-05 09:20:02 -07:00
Ian Gilman
0621958ca2
Merge pull request #2506 from eug-L/master
Getter & setter for Viewport.maxZoomPixelRatio
2024-04-05 09:18:22 -07:00
eug-L
4451131999 update flags for setMaxZoomPixelRatio 2024-04-05 12:47:15 +08:00
eug-L
b0926b3e69 Getter & setter for Viewport.maxZoomPixelRatio 2024-04-04 16:02:09 +08:00
Ian Gilman
63d8d63c1f Changelog for #2505 2024-04-03 09:28:56 -07:00
Ian Gilman
a2f6da52c0
Merge pull request #2505 from eug-L/imageToViewportZoom
update error message for Viewport.imageToViewportZoom
2024-04-03 09:26:24 -07:00
eug-L
5990e5649b update error message for Viewport.imageToViewportZoom 2024-04-03 23:06:42 +08:00
Ian Gilman
6a47104b4f Updated for version 4.1.1 2024-04-01 10:12:04 -07:00
Ian Gilman
9b7fc464ca Changelog for #2492 2024-03-07 09:30:00 -08:00
Ian Gilman
262d04c6c6
Merge pull request #2492 from pearcetm/fix-webgl-tilepadding
Make WebGLDrawer deal with tiles with padding
2024-03-07 09:29:19 -08:00
Ian Gilman
9a92d9e9ad Changelog for #2491 2024-03-07 09:24:47 -08:00
Ian Gilman
553795e8fa Merge branch 'master' of github.com:openseadragon/openseadragon 2024-03-07 09:23:24 -08:00
Ian Gilman
afeea19403
Merge pull request #2491 from pearcetm/fix-2490
Fix #2490
2024-03-07 09:21:59 -08:00
Tom
029a40aa21 deal with tiles that have padding 2024-03-05 15:39:54 -05:00
Tom
3e04c8854e make navigator.update's parameter optional, default to navigator.viewer.viewport 2024-03-05 13:01:42 -05:00
Aiosa
e0f442209b Fix black viewport with testing filtering demo on webgl renderer. Introduce managed mock getters for tests. 2024-03-05 10:48:07 +01:00
Tom
2cb1835533 fix docs 2024-03-04 21:32:14 -05:00
Tom
c177246675 fix #2490 2024-03-04 21:28:12 -05:00
Aiosa
e2c633a23b Small bugfixes, rename some properties. Add more redraw calls. 2024-03-04 19:23:47 +01:00
Aiosa
47419a090a Fix circular references in JSON test log serialization. 2024-03-04 10:49:05 +01:00
Aiosa
52ef8156c0 Fixed: internal cache not allways calling destructor, refresh handler was not called on internal cache. Polish code. Improve filtering demo. 2024-03-03 17:59:39 +01:00
Aiosa
a9b50a8fdb Test fixes (except gl null reference error - test fails sometimes). 2024-03-03 16:39:15 +01:00
Aiosa
135fa76fde Merge webgl PR - problems with tained canvas and texture upload. 2024-03-03 15:17:54 +01:00
Aiosa
360f0d6796 Fix docs, commit before upstream merge. 2024-03-03 14:50:01 +01:00
Ian Gilman
4d26c800ba Changelog for #2488 2024-03-01 09:25:16 -08:00
Ian Gilman
a42a0d1822
Merge pull request #2488 from pearcetm/setPosition-fix
Mark TiledImage as needing an update when position, scale, or rotation are set immediately
2024-03-01 09:18:33 -08:00
Tom
e4fd005fb0 Mark TiledImage as needing an update when position, scale, or rotation are set with immediately=true 2024-02-29 16:44:09 -05:00
Ian Gilman
1c0797e800 Changelog for #2472 2024-02-27 09:35:01 -08:00
Ian Gilman
01e70ab7d8
Merge pull request #2472 from pearcetm/canvas-fallback
In webgl drawer, fall back to canvas drawer for tiled images with tainted data
2024-02-27 09:33:06 -08:00
Tom
b6501a3786 fix typo in docs. change to options object for requestDrawer API 2024-02-22 13:30:05 -05:00
Ian Gilman
7dfc60a97f Changelog for #2478 2024-02-22 09:31:32 -08:00
Ian Gilman
da5abc1b39
Merge pull request #2478 from pearcetm/webgl-clipping
fix clip behavior with webgl drawer
2024-02-22 09:30:01 -08:00
Tom
5df791fc82 support viewport flipping for clip and cropping polygons in webglviewer 2024-02-21 18:12:22 -05:00
Tom
ae5f08b9bd call _setClip for test spyOnce 2024-02-21 17:53:23 -05:00
Tom
a0bcbc4d21 fix clip behavior with webgl drawer 2024-02-21 17:49:46 -05:00
Tom
c6e3e06194 Merge branch 'master' into canvas-fallback 2024-02-21 16:13:36 -05:00
Tom
1442e5d4e4 revert change in drawercomparison.js used for testing 2024-02-21 16:02:29 -05:00
Tom
99c35aa3cb consolidate drawer creation into viewer api. add drawer-error event 2024-02-21 16:01:18 -05:00
Tom
02898cfc17 clean up bound event handlers in webgldrawer.destroy 2024-02-12 18:05:33 -05:00
Ian Gilman
59645e3a0d Changelog for #2468 2024-02-12 09:53:00 -08:00
Ian Gilman
4c331a2000
Merge pull request #2468 from thec0keman/fix-this-scoping
Fix `this` scoping
2024-02-12 09:52:01 -08:00
Ian Gilman
b62fba80d6 Changelog for #2469 2024-02-12 09:32:37 -08:00
Ian Gilman
1c60e45a7f
Merge pull request #2469 from pearcetm/placeholder-for-webgl
Support placeholderFillStyle in WebGLDrawer, and other fixes
2024-02-12 09:29:20 -08:00
Tom
6e4914ada3 better cleanup for html drawer in destroy 2024-02-12 09:32:17 -05:00
Tom
8967e2bb03 support hot-swapping drawers with viewer.setDrawer() 2024-02-12 09:30:26 -05:00
Tom
0a154a3b21 In webgl drawer, fall back to canvas drawer for tiled images with tainted data 2024-02-11 11:51:38 -05:00
Aiosa
63f0adbc15 Fix issues with tile reference in cache: keep the 'most fresh' ref. 2024-02-11 17:18:03 +01:00
Aiosa
d91df0126b Add base drawer options and fix docs. Implement 'simple internal cache' for drawer data, optional to use. 2024-02-11 11:27:02 +01:00
Tom
3f21f84df4 clean up code added for testing 2024-02-09 18:16:30 -05:00
Tom
c734de531f fix placeholder positioning for canvas drawer 2024-02-09 17:18:54 -05:00
Tom
d4e82d374e account for viewport rotation in addition to tiledImage rotation 2024-02-09 15:19:40 -05:00
Tom
5b2c6d7ed9 add support for placeholderFillStyle to webgl drawer. fix spring logic to avoid getting stuck updating due to floating point math. update tilesource-swap demo. 2024-02-09 15:06:52 -05:00
John Ratcliff
8f483a3ba0 Fix this scoping 2024-02-09 11:23:38 -08:00
Aiosa
cae6ec6bee Revert weird tiledImage check - tests worked now also without. Add generic drawerswitcher utility for demos. 2024-02-08 13:11:10 +01:00
Aiosa
a97fe34d74 Remove merge marks. 2024-02-05 09:47:10 +01:00
Aiosa
9ef2d46e75 Fix tests: always fetch up-to-date pixel values, prevent adding loaded tile to the 'bestTiles' array. Enforce _needsDraw check to be based on lastDrawn - we are async now. 2024-02-05 09:42:26 +01:00
Aiosa
fcf20be8ea Drawers now use new cache API to draw onto a canvas. The type conversion now requires also the tile argument so that conversion can rely on the tile metadata. 2024-02-04 18:48:25 +01:00
Aiosa
3fa13570ef Resolve Merge with First WebGL PR: code is merged, but not operable [drawer refactoring needs interaction implemented with cache system]. 2024-02-04 15:41:05 +01:00
Ian Gilman
f7d86ac244 Changelog for #2466 2024-02-02 09:29:54 -08:00
Ian Gilman
e3c3634266
Merge pull request #2466 from pearcetm/fix-docs
fix jsdoc formatting for drawer classes
2024-02-02 09:26:43 -08:00
Tom
3ced918fb4 fix jsdoc formatting for drawer classes 2024-02-01 14:29:10 -05:00
Tom
23e50b6038 fix jsdoc formatting for drawer classes 2024-02-01 14:24:25 -05:00
Ian Gilman
fdaa3e2f16 Changelog for #2464, #2462 2024-02-01 09:43:51 -08:00
Ian Gilman
2e0868023a
Merge pull request #2464 from jonasengelmann/fix/touch-gesture-dragToPan
Fix dragToPan when flickEnabled is activated
2024-02-01 09:38:28 -08:00
Ian Gilman
98769af678
Merge pull request #2462 from pearcetm/fix-zero-opacity-case
Fix zero opacity case
2024-02-01 09:33:04 -08:00
jonasengelmann
e08274e2b0 fix dragToPan when flickEnabled is activated #2463 2024-02-01 18:01:21 +01:00
Tom
68623ace26 skip drawing zero-opacity images for webgl drawer. remove checks for preload in html and canvas drawers since that is done in tiledimage. 2024-02-01 10:46:45 -05:00
Tom
921171ed2b move logic about zero opacity case into getDrawArea 2024-02-01 08:47:03 -05:00
Tom
84a55968ee Allow preloading of tiles for zero opacity tiled images 2024-01-31 15:40:47 -05:00
Tom
1b44de3b68 Stop tiles from loading if opacity of tiled image is 0 2024-01-31 15:37:09 -05:00
Ian Gilman
f9a8b97cf9 Changelog for #2310 2024-01-31 09:47:49 -08:00
Ian Gilman
52fc10ffa2
Merge pull request #2310 from pearcetm/rotation-seams
Refactor drawing code, add WebGL drawer, and enable plugin renderers
2024-01-31 09:38:56 -08:00
Tom
59519e0e96 fix docs 2024-01-30 13:14:54 -05:00
Tom
d490592b99 expand event validation logic 2024-01-29 13:12:01 -05:00
Tom
024cee42f5 make event handler validation private 2024-01-29 13:01:44 -05:00
Tom
a55071f67b fix documentation for rejectEventHandler 2024-01-29 11:25:36 -05:00
Tom
2add108539 reject adding handlers for certain event names 2024-01-29 10:39:55 -05:00
Tom
c0104c7480 add validation at time of binding event handlers 2024-01-26 12:23:02 -05:00
Ian Gilman
5be1ab6f7d Changelog for #2455 2024-01-25 11:26:33 -08:00
Ian Gilman
4811dd0320
Merge pull request #2455 from BeebBenjamin/webp-support
Fix #2454, add webp to supported image formats
2024-01-25 11:23:25 -08:00
Richard Benjamin Allen
362a060512 Fix, change set supported format example 2024-01-25 16:47:51 +00:00
Tom
d2376b571f clean up comments and error logging 2024-01-24 13:02:50 -05:00
Richard Benjamin Allen
4e9134f66a Fix #2454, add webp to supported image formats 2024-01-22 09:43:02 +00:00
Tom
dc03989bbe throw error if MAX_TEXTURE_IMAGE_UNITS is a bad value 2024-01-19 14:42:34 -05:00
Tom
3cdd5fd711 throw error if MAX_TEXTURE_IMAGE_UNITS is a bad value 2024-01-19 13:19:43 -05:00
Tom
f6c35b44ed move qunit.starTest log message to test.js 2024-01-19 12:54:24 -05:00
Tom
43de595c24 clean up code from testing the MAX_TEXTURE_IMAGE_UNITS error issue 2024-01-18 16:20:28 -05:00
Tom
a2d31e9610 cleaned up additional viewers in tests 2024-01-18 16:06:49 -05:00
Tom
8271b6d8b2 more test details logged 2024-01-18 15:44:29 -05:00
Tom
aae82ab16a more test details logged 2024-01-18 15:34:14 -05:00
Tom
525d9b52fe more test details logged 2024-01-18 13:47:14 -05:00
Tom
bb676a8699 add test info to console.log 2024-01-18 13:32:30 -05:00
Tom
fd648c26e9 add logging directly to webgl drawer 2024-01-18 13:17:35 -05:00
Tom
f6c67b2159 remove additional test logging for testing travis ci 2024-01-18 12:56:03 -05:00
Tom
0a2657cb5b additional test logging for testing travis ci 2024-01-18 12:45:27 -05:00
Tom
44b66be0a9 update tests 2024-01-17 17:07:25 -05:00
Tom
db11611d7d add logging of gl max_texture_image_units errors to multi-image test 2024-01-17 16:13:34 -05:00
Tom
b902256a59 clean up comments. modify tests. add check for max textures in webgldrawer 2024-01-15 14:39:15 -05:00
Tom
f563600635 test canvas and webgl drawers in multi-image 2024-01-11 14:42:11 -05:00
Tom
e0fd78344b add description of WebGLDrawer drawing pipeline 2024-01-11 13:54:01 -05:00
Tom
3bab3c2190 small cleanups 2024-01-11 13:29:59 -05:00
Tom
500c22feb1 consolidate tiled-image-drawn event description and firing code 2024-01-10 18:00:01 -05:00
Tom
8be2ca2dfb test drawers separately 2024-01-10 17:46:17 -05:00
Tom
834795b4b8 fix basic demo 2024-01-10 14:48:48 -05:00
Tom
9725ac0398 update tiled-image-drawn event description 2024-01-10 12:21:05 -05:00
Tom
58f918aaa1 clean up tests 2024-01-10 12:13:00 -05:00
Tom
f3a90159c1 cleaning up webgldrawer 2024-01-08 19:18:58 -05:00
Tom
1239b22c30 updates to viewer 2023-12-22 13:46:36 -05:00
Tom
1a1e2c20c0 fix viewport.update so tests don't stall 2023-12-21 16:31:23 -05:00
Tom
22ecdfd75d fix documentation for viewport.update 2023-12-21 16:12:19 -05:00
Tom
bbee6e9605 update animating logic 2023-12-21 16:09:45 -05:00
Tom
40a4e42835 make reference strip always use the canvas drawer 2023-12-21 15:29:25 -05:00
Tom
1588f6b715 add documentation; rename parameters for clarity 2023-12-21 15:10:23 -05:00
Tom
55882b9215 fix docs. rename matrix.js to matrix3.js 2023-12-19 15:57:15 -05:00
Tom
d5a3cabf13 fixing jsdocs 2023-12-18 17:01:17 -05:00
Tom
9616e26dd2 updates in drawers and tiled image 2023-12-15 13:13:40 -05:00
Tom
074b65bfcd clean up comments and small fixes 2023-12-14 20:59:55 -05:00
Tom
3f7e7141b9 fixes from review of drawerbase.js 2023-12-14 19:14:05 -05:00
Tom
2d8c6fe4c3 cleaning up docs 2023-12-13 18:11:09 -05:00
Tom
a364c3f168 responding to review 2023-12-12 21:45:24 -05:00
Aiosa
3d6eb1b91c Fix broken tests (bad logics in event handling). 2023-12-10 17:58:50 +01:00
Aiosa
cf2413e0c9 Fix test for the preload hack (and fix the parentheses to always call updateMulti). 2023-12-10 16:49:56 +01:00
Aiosa
a690b50eee Add external execution pipeline (proof of concept implementation, needs polishing). Add filtering plugin live demo for testing. Fix issues with tile cache access outside its lifespan. Add custom css for the static page renderer and differentiate folder icons. Remove some old deprecations. 2023-12-10 16:34:42 +01:00
Tom
e50d3639ce bugfix in canvasdrawer tiled-image-drawn event 2023-12-02 15:47:01 -05:00
Tom
1200f0b081 clean up outdated code; add tiled-image-drawn event to canvasdrawer so tests work with this viewer 2023-12-02 15:40:47 -05:00
Tom
32f12b3ba5 check for valid ASSERT in tilesource-dynamic-url test 2023-11-29 19:34:41 -05:00
Tom
9dc96390fc update tests to skip fullscreen and certain drawer-related events 2023-11-29 19:04:27 -05:00
Tom
6b995c018b re-enable html drawer in drawer comparison demo; deal with merge conflict resolution issues 2023-11-29 17:35:49 -05:00
pearcetm
36d8b3d9ad
Merge branch 'master' into rotation-seams 2023-11-29 17:28:42 -05:00
Tom
c86158f0ca cleaning up changes 2023-11-29 16:46:14 -05:00
Aiosa
90ce0669c5 Add auto recognition of the need for tiledImage draw call. Fix ajax-headers test: did not finish because we don't call tile-loaded on cached tiles by default. 2023-11-27 12:12:54 +01:00
Aiosa
2c67860c61 Implement cache manipulation strategy: default copy on access if tile in the rendering process, remove 'canvas' type support, many bugfixes and new tests. 2023-11-26 21:32:26 +01:00
pearcetm
a578b97d96
Merge pull request #5 from Aiosa/rotation-seams
Small rendering bugfixes, URL params in demo pages.
2023-11-24 09:41:30 -05:00
Aiosa
191ba39cbb Remove demo references to the modular renderer. 2023-11-21 20:53:06 +01:00
Aiosa
23496cb049 Remove also file references. 2023-11-21 12:56:19 +01:00
Aiosa
f4efe2970a Remove modular implementation -> will be introduced in subsequent PR. 2023-11-21 12:54:09 +01:00
Aiosa
2a1090ffa8 Fix wrong test comparison. Add equality comparator to TileSource API. Return
deprecated support for getCompletionCallback. Turn on zombie cache if sources replaced & equal.
2023-11-19 16:14:28 +01:00
Aiosa
219049976c Add tests for zombie and data type conversion, ensure destructors are called.
Fix bugs (zombie was disabled on item replace, fix zombie cache system by separating to its own cache array). Fix CacheRecord destructor & dijkstra. Deduce cache only from originalCacheKey. Force explicit type declaration with types on users.
2023-11-18 20:16:35 +01:00
Aiosa
c3ab9a08e7 Merge branch 'cache-overhaul-reviewed' of github.com:RationAI/openseadragon into cache-overhaul-reviewed 2023-11-17 20:22:13 +01:00
Aiosa
023a864a36
Merge branch 'openseadragon:master' into cache-overhaul-reviewed 2023-11-17 20:21:24 +01:00
Ian Gilman
6abcc76a93 Changelog for #2431 2023-11-13 09:57:19 -08:00
Ian Gilman
c92f8ad65d
Merge pull request #2431 from cavenel/master
Fix zoom out when wheel event.deltaY is zero
2023-11-13 09:53:42 -08:00
Christophe Avenel
c1038af37d
Revert "Add debounce of pan events"
This reverts commit e836ffcc61.
2023-11-08 18:52:05 +01:00
Ian Gilman
89ae9c1376 Changelog for #2416 2023-11-06 09:32:00 -08:00
Ian Gilman
a8d37d892e
Merge pull request #2416 from lutzhelm/2415-iiif-tiling-error-for-descending-sizes
Fix #2415, order IIIF sizes on tile source init
2023-11-06 09:27:08 -08:00
Christophe Avenel
e836ffcc61 Add debounce of pan events
Group pan events together if needed, in order to avoid lag if drawing of layers takes more time than it should.
2023-10-31 15:38:38 +01:00
Christophe Avenel
810987210c
Fix zoom out when wheel event.deltaY is zero
Don't apply zoom in or zoom out when deltaY is zero on wheel events.
Should fix https://github.com/openseadragon/openseadragon/issues/947 and not make OpenSeadragon zoom out when scrolling horizontally on a touchpad
2023-10-25 09:26:48 +02:00
Aiosa
6447009c18 Remove blend time from comparison demo (not functional). 2023-10-23 16:05:18 +02:00
Aiosa
cd9d340038 Removed date loader (will be handled by future OSD cache system). Attempt to use instanced rendering. Refactoring of the module. 2023-10-23 16:03:47 +02:00
Lutz Helm
5272cf092c Ensure descending size order also works for level 0 2023-10-10 14:04:31 +02:00
Lutz Helm
b92a428e88 Sort levelSizes instead of sizes 2023-10-10 14:02:44 +02:00
Aiosa
31f9a71109 Working tiledimage-level transparency in a single pass. 2023-09-27 15:16:23 +02:00
Aiosa
174c4c709a Remove logs from debugging. 2023-09-26 15:47:50 +02:00
Aiosa
e3024deb46 Modular webgl2 drawer: fix small bugs. Add drawer IDs to demo page urls to allow refreshing/direct running 2023-09-26 15:31:43 +02:00
Aiosa
f796925ae5 Remove irrelevant code and comments. 2023-09-25 08:52:45 +02:00
Aiosa
750d45be81 Implement asynchronous tile processing logic wrt. tile cache conversion. 2023-09-24 22:30:28 +02:00
Lutz Helm
5542ead48b Fix #2415, order IIIF sizes on tile source init 2023-09-19 09:55:53 +02:00
Aiosa
f01a7a4b3c Cache Overhaul for OpenSeadragon (areas to discuss marked with FIXME). 2023-09-08 08:47:43 +02:00
Ian Gilman
640526b444 Changelog for #2393 2023-08-22 10:21:35 -07:00
Ian Gilman
8d2f8449ba
Merge pull request #2393 from VIRAT9358/fix496
fixed position issue
2023-08-22 10:16:17 -07:00
ViratSr
ed49d46237 syntax fixed and if statement amended 2023-08-17 10:39:45 +05:30
ViratSr
9b051f55de #fix496 2023-08-16 00:10:55 +05:30
ViratSr
b15ba75551 fixed position issue 2023-08-15 16:46:10 +05:30
Ian Gilman
17cd6b51ce Changelog for #2387 and tweaks to its demo page 2023-08-08 09:39:45 -07:00
Ian Gilman
cca81a37d5
Merge pull request #2387 from schuefflerlab/BestTiles
Introduced option maxTilesPerFrame
2023-08-08 09:25:17 -07:00
Peter
0bdd807d9d Cleaned code according to comments in PR 2023-08-08 11:05:33 +02:00
Peter
f8ad0acfa4 Sort the N tiles only once instead of when adding new indiviual tiles 2023-08-02 21:04:43 +02:00
Peter
55a05963a2 Sort N tiles always for a better look and feel. 2023-08-02 20:30:30 +02:00
pearcetm
e07745d790
Merge pull request #4 from Aiosa/rotation-seams
First modular webgl drawer implementation by @Aiosa

Thanks for putting this together @Aiosa! I'm going to merge it into the large refactor PR. It'd be great to have a demo page that includes all these features, for testing/debugging and to show off the capabilities.
2023-08-01 17:18:32 -04:00
Ian Gilman
4a3fc5b325
Merge pull request #2389 from openseadragon/ms-mousetracker-docs
MouseTracker options docs fixes
2023-08-01 09:33:12 -07:00
Tom
2fcdcc3f6a add attribution for rStats code 2023-08-01 12:20:13 -04:00
Mark Salsbery
fa8196ef4f changelog update 2023-07-31 13:16:36 -07:00
Mark Salsbery
1f47f5def1 MouseTracker options docs fixes 2023-07-31 13:08:07 -07:00
Tom
77b5766fa2 update drawerperformance demo 2023-07-31 15:48:29 -04:00
Peter
13955b0bf6 added demo with maxTilesPerFrame = 3 2023-07-31 10:14:27 +02:00
Tom
c77a7e7386 enhance performance demo. rename variables for clarity. 2023-07-28 17:49:24 -04:00
Peter
17873001b8 outsourced tile sorting from tile comparing. 2023-07-28 13:15:47 +02:00
Aiosa
054ad0d53b
Merge branch 'pearcetm:rotation-seams' into rotation-seams 2023-07-28 12:25:58 +02:00
Aiosa
a907aaa160 Merge remote-tracking branch 'origin/rotation-seams' into rotation-seams 2023-07-28 12:24:15 +02:00
Aiosa
b6273b95b8 First modular webgl drawer implementation. 2023-07-28 12:23:59 +02:00
pearcetm
d912ff3196
Merge pull request #3 from Aiosa/rotation-seams
Exposing matrix implementation, automatic drawer recognition

Thanks, @Aiosa!
2023-07-26 19:28:29 -04:00
Aiosa
ca45e96142
Merge branch 'rotation-seams' into rotation-seams 2023-07-26 23:58:07 +02:00
Aiosa
046612f8da Better drawer resolution, also supporting inline class spec. Fix minor review stuff. 2023-07-26 23:55:46 +02:00
Tom
1e37745764 sync webgldemodrawer with webgldrawer 2023-07-26 15:44:38 -04:00
Tom
f4ded1630f code cleanup 2023-07-26 15:42:18 -04:00
Aiosa
3c3842bdce Change comments TO DO -> TODO. Add automatic recognition of drawers. Matrix as an exposed class. 2023-07-26 20:01:26 +02:00
Peter
ccb4ae9f86 Fixed _updateViewport to come to a fullyLoaded state with n tiles.
Improved _compareTiles
2023-07-20 17:27:49 +02:00
Peter
9684a83b8c Updated Comment 2023-07-20 15:17:02 +02:00
P. Schueffler
7ad748799e
Pr for upstream (#3)
Added maxTilesPerFrame
2023-07-20 14:45:15 +02:00
Tom
f510301922 add performance test demo page. reduce number of drawing calls drawing pipeline of webgl drawer. 2023-07-19 18:18:56 -04:00
Ian Gilman
f50df84287
Merge pull request #2386 from openseadragon/dependabot/npm_and_yarn/word-wrap-1.2.4
Bump word-wrap from 1.2.3 to 1.2.4
2023-07-18 14:00:49 -07:00
dependabot[bot]
9f31919dc1
Bump word-wrap from 1.2.3 to 1.2.4
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-18 20:28:16 +00:00
Ian Gilman
e51053a6a3 Changelog for #2382 2023-07-17 14:03:59 -07:00
Ian Gilman
eec052f054
Merge pull request #2382 from AndrewADev/update-grunt-contrib-qunit
Update grunt-contrib-qunit and extend FullScreen test
2023-07-17 14:02:02 -07:00
Andrew Armbruster
be4d5ad7f7 Update grunt-contrib-qunit and extend FullScreen test
Update the package responsible for running tests, grunt-contrib-qunit.

The package change includes a significant bump to the puppeteer version used to run the tests (from v9 -> v19: https://github.com/gruntjs/grunt-contrib-qunit#release-history).

Running the tests with the newer puppeteer version leads to issues running the FullScreen test when run in the 'old'/current default headless mode (the test fails with a timeout).

Updating to the 'new' headless mode (eventually to be the default anyway), seems to allow the fullscreen request to succeed.

Thus, go ahead and extend the FullScreen test to verify the correct values for a successful request, as well as an additional step to exit fullscreen mode.
2023-07-16 13:10:56 +02:00
Tom
01a4ea6f2c Update documentation and remove commented code. Change from get type to getType(). 2023-07-09 14:10:20 -04:00
Tom
6feed0a68e Add clipping to demo. Update documentation and remove commented code. Change from get type to getType(). 2023-07-09 12:05:17 -04:00
Tom
0a3aa6172d add type property to drawers. only add extra padding to tiles for drawers that need it. 2023-06-30 16:38:07 -04:00
Tom
048b43e196 remove forced transparency from images in drawercomparison demo. change from context2d naming to canvas. 2023-06-30 16:06:17 -04:00
Tom
cc412f0a20 add documentation; remove unnecessary deprecated code 2023-06-29 21:55:59 -04:00
Tom
3a5a738508 remove viewer.destroy() from some tests 2023-06-29 17:06:45 -04:00
Tom
83ec2bb1f0 tiled image opacity works now with no overlapping regions at tile borders 2023-06-29 16:41:45 -04:00
Tom
24c4d2d2bc Remove tile-drawn event and replace with tiled-image-drawn for webgl drawer, and update related tests. 2023-06-27 13:57:02 -04:00
Tom
2ec2c0f2c7 remove three.js and associated plugin renderer; fix demo 2023-06-26 21:44:03 -04:00
Tom
386ca85db8 implement native webgl renderer, and many associated changes related to drawing pipeline and testing 2023-06-26 21:29:08 -04:00
Ian Gilman
ffbd8f985a Changelog for #2367 2023-06-21 14:19:06 -07:00
Ian Gilman
88f419330e Merge branch 'master' of github.com:openseadragon/openseadragon 2023-06-21 14:17:06 -07:00
Ian Gilman
3386a73e44
Merge pull request #2367 from akansjain/master
Removed createCallback function
2023-06-21 14:10:28 -07:00
akansjain
eaa41f7f05 Replaced the comment with Deprecated 2023-06-21 13:34:58 +05:30
Tom
128975ea0f only calculate tile positions when necessary 2023-06-18 19:28:48 -04:00
Tom
0584ca7be9 add to-do comments 2023-06-18 19:09:22 -04:00
Tom
37b8ef9519 deprecate useCanvas option; add option for drawer and drawerOptions 2023-06-18 19:08:33 -04:00
Tom
7bb02d51d0 reverted change to argument order in _updateTile call 2023-06-14 07:51:50 -07:00
akansjain
7dec7b9aba Added console.error() in createCallback() function 2023-06-09 17:58:22 +05:30
Tom
2e248baf91 additional fixes to get tests to pass 2023-06-08 12:10:55 -07:00
Tom
354590a17a convert DrawerBase and drawer implementations to classes; add html drawer to the demo page 2023-06-07 12:42:16 -07:00
Tom
8fda8ceae7 re-enable sequence mode demo viewer 2023-06-07 10:16:21 -04:00
Tom
8fe6a5f6e6 merging remote 2023-06-07 10:14:58 -04:00
Tom
1bc93be3f2 update tile drawing logic 2023-06-06 19:37:24 -04:00
Tom
36084703f0 conditional usage of draw() vs event handlers depending on initialization context 2023-06-06 18:08:53 -04:00
Tom
1089f79a5b remove drawer class 2023-06-06 18:08:50 -04:00
Tom
2a0af48bc1 updates to threejsdrawer, bugxfixes/improvements 2023-06-06 18:08:30 -04:00
Tom
dab8a9a3cd move tile update logic back to TiledImage to keep drawing logic cleaner 2023-06-06 18:08:30 -04:00
Tom
2f3bef0865 split canvas from html rendering 2023-06-06 18:08:30 -04:00
Tom
467597e2c2 cleaning up drawer APIs 2023-06-06 18:08:30 -04:00
Tom
5eece7d73a fix cropping when viewer is rotated 2023-06-06 18:08:30 -04:00
Tom
69c4ccf33e revert debugging changes in overlay demo 2023-06-06 18:08:30 -04:00
Tom
5328761877 finished many implementation details and demo 2023-06-06 18:08:01 -04:00
Tom
f9ab63944b ThreeJSRenderer nearly complete, starting refactor of core to support plugin drawers. 2023-06-06 18:05:17 -04:00
akansjain
3fc156d513 Removed createCallback function 2023-06-06 23:04:04 +05:30
Ian Gilman
c9cd7352c4 Changelog for #2364 2023-06-02 14:23:11 -07:00
Ian Gilman
ebab356c20
Merge pull request #2364 from SebDelile/master
workaround tile edge smoothing maxZoom + flip
2023-06-02 14:18:54 -07:00
Delile Sebastien
f96db3cf0f complete comment 2023-06-02 18:59:22 +02:00
Delile Sebastien
f004ecf323 fix comment 2023-06-01 10:20:14 +02:00
Delile Sebastien
2c03c1bbe9 workaround tile edge smoothing maxZoom + flip 2023-05-31 16:11:42 +02:00
Ian Gilman
b405a904a6
Merge pull request #2362 from AndrewADev/update-qunit
Update to most recent QUnit
2023-05-30 14:31:02 -07:00
Ian Gilman
c2a1df9ae0 Changelog for #2361 2023-05-30 14:25:44 -07:00
Ian Gilman
c69950c6e4
Merge pull request #2361 from AndrewADev/allow-es6-syntax
Allow Using ES6 Syntax
2023-05-30 14:24:34 -07:00
Andrew Armbruster
c7df7be7f1 Catch rejected Promise on failed fullscreen request
Add a `catch()` rejection of request for fullscreen (standard Fullscreen API implementation), as well as fullscreen exit. For now there is no actual handling, but we send a message to the internal error channel.

Motivation: The fullscreen request was causing certain tests to fail when run with newer versions of QUnit (starting in 2.5.0), which now fails tests that have unhandled Promise rejections (as we did here).

The exit case is not currently covered by tests, but works the same way (also returns a promise).

See: https://fullscreen.spec.whatwg.org/#ref-for-dom-element-requestfullscreen%E2%91%A0
2023-05-28 14:15:55 +02:00
Andrew Armbruster
ff67cf1cae Support ES6 Syntax
Bump ESLint's parser options to support ES6 syntax, which allows developers to start using a number of features associated with modern JavaScript.

Doing this now that #2286 has been marked as resolved, since IE 11 support was the last known blocker for such changes.
2023-05-28 12:41:30 +02:00
Andrew A
ad1179b9db Update to most recent QUnit
Update to most recent version of QUnit, which has been published under a new name for a while now.

Accordingly, replace the old package with the new one in both dependencies, as well as update references in test HTML files.
2023-05-27 13:16:28 +02:00
Ian Gilman
ea54427f42
Merge pull request #2359 from openseadragon/ian
Updated copyright to 2023
2023-05-25 14:53:05 -07:00
Ian Gilman
b9cb52a184 Updated copyright to 2023 2023-05-25 14:52:20 -07:00
Ian Gilman
3d57722b9f Changelog for #2300 2023-05-25 14:37:50 -07:00
Ian Gilman
ae9ad111c4
Merge pull request #2300 from AndrewADev/add-es-api-linting
Add ESLint plugin for linting browser compatibility
2023-05-25 14:35:47 -07:00
Ian Gilman
160cae7a4a Starting version 5.0.0 2023-05-25 13:58:21 -07:00
Ian Gilman
884968139d Version 4.1.0 2023-05-25 13:53:17 -07:00
Ian Gilman
324dc4ed30 Changelog for #2356 2023-05-24 14:03:14 -07:00
Ian Gilman
dedd85e184
Merge pull request #2356 from lcl45/rotating-navigator-region
Added navigator's region rotation
2023-05-24 13:59:23 -07:00
lcl45
7fb5744495 Resolved suggestions
- Avoid useless parameters _navigatorRotate since it already exists within the navigator;
- Automatically rotate the image in the demo page.
2023-05-24 08:45:15 +02:00
oro.niccolo
d897e5454f Added navigator's region rotation
When the "navigatorRotate" option is set to false, rotate the navigator's region accordigly to the image rotation.
2023-05-23 09:27:32 +02:00
Ian Gilman
01d940b938 Changelog for #2346 2023-05-19 15:04:46 -07:00
Ian Gilman
e6f2d3e07b
Merge pull request #2346 from uschmidt83/ajax-headers
Add `setAjaxHeaders` method to Viewer and TiledImage
2023-05-19 15:01:54 -07:00
Uwe Schmidt
4060dee4f9 Make updateAjaxHeaders private 2023-05-19 22:22:10 +02:00
Uwe Schmidt
e983bd8108 Add docs for updating ajax headers 2023-05-12 23:48:31 +02:00
Uwe Schmidt
857a825ed8 Fix some jsdoc typos 2023-05-12 23:37:34 +02:00
Uwe Schmidt
6fd828974d Update navigator ajax headers 2023-05-12 21:46:16 +02:00
Uwe Schmidt
e51aa4a9c5 Refine setAjaxHeaders
- Allow null to clear headers (same as empty object)
- Add TiledImage._updateAjaxHeaders
- Add error message in case of invalid headers
2023-05-05 01:13:44 +02:00
Uwe Schmidt
182c11481e Add tests for setAjaxHeaders 2023-05-05 00:03:22 +02:00
Ian Gilman
6981cfed01 Changelog for #2347 2023-05-04 13:45:06 -07:00
Ian Gilman
d4057aca12
Merge pull request #2347 from pearcetm/navigator-fix
update navigator size when calling setHeight or setWidth
2023-05-04 13:42:17 -07:00
Tom
528df37335 update navigator size when calling setHeight or setWidth 2023-05-03 22:38:49 -04:00
Uwe Schmidt
b23e8295d3 Propagate updated ajax headers by default 2023-05-03 23:51:07 +02:00
Uwe Schmidt
13603dd5f4 Update reference strip ajax headers 2023-05-03 19:33:50 +02:00
Uwe Schmidt
fe7a5eb01b Make ES5-compatible 2023-05-03 18:46:18 +02:00
Uwe Schmidt
3c2628f182 Add setAjaxHeaders method to Viewer and TiledImage
- First draft, not tested at all
- See openseadragon/openseadragon#1748
2023-05-03 16:05:58 +02:00
Ian Gilman
b1274515aa Tiny basic.html tweak 2023-04-27 14:27:40 -07:00
Ian Gilman
b088fc0da3 Changelog for #2337 2023-04-27 14:27:09 -07:00
Ian Gilman
d36c76127c
Merge pull request #2337 from ruven/master
Use resolution level dimensions provided in the info.json "sizes" field
2023-04-27 14:24:23 -07:00
Ruven
c5404006b2
Further optimization: code moved into constructor thereby eliminating need for getLevelSize() function. 2023-04-25 12:06:27 +02:00
Ruven
5fd125dc92
Added implementation of getTileAtPoint() function. This eliminates flickering at level transitions caused by mis-match in resolution size calculation between the getTileAtPoint() and getNumTiles() functions. 2023-04-24 22:44:46 +02:00
Ruven
877c3b68ed
Refactored code to take into account optimization suggestions (https://github.com/openseadragon/openseadragon/pull/2337#discussion_r1170931340) 2023-04-24 17:24:18 +02:00
Ruven
0c358c140d
Use resolution level dimensions provided in the info.json "sizes" field to determine tile sizes as well as the number of tiles that exist at a particular resolution. Fall back to calculation using ceil() if no resolution sizes provided. Avoids rounding errors for edge tiles and fixes https://github.com/openseadragon/openseadragon/issues/2321 2023-04-17 21:08:18 +02:00
Ian Gilman
60a6a610e0 Changelog for #2334 2023-04-10 14:23:31 -07:00
Ian Gilman
f91dbdd2c7
Merge pull request #2334 from Ughuuu/Fix-TileLoader-re-trying-even-if-successful
Fix TileLoader re-trying even if successful #2
2023-04-10 14:18:58 -07:00
Dragos Daian
d18a4c3fd7 mark tile.exists so that the retired tiles appear. 2023-04-08 16:48:04 +02:00
Ian Gilman
ebda5a909b Changelog for #2333 2023-04-07 13:49:12 -07:00
Ian Gilman
4f737f1714
Merge pull request #2333 from robertjcolley/master
Fixes navigator rotation not honoring immediately parameter
2023-04-07 13:47:35 -07:00
Robert Colley
e6b9c79bc1
Fixes #2332
Mirror the main viewer's rotation and account for immediately. Without 
this, viewer.setRotation(90, true) would rotate the main viewer without 
animation and the navigator with animation.
2023-04-06 18:10:38 -04:00
Ian Gilman
8b305546ed Changelog for #2324 2023-04-06 14:26:15 -07:00
Ian Gilman
5b56d6fa16
Merge pull request #2324 from rsimon/master
Applied touch rotate fix suggested in #2319
2023-04-06 14:22:54 -07:00
Ian Gilman
2e99e48603 Fixed changelog for #2136 2023-04-06 14:12:30 -07:00
Ian Gilman
b45d500f1e Changelog for #2328 2023-04-04 14:51:05 -07:00
Ian Gilman
cec0acafe1
Merge pull request #2328 from craigberry/master
Handle XML embedded in tilesource JSON
2023-04-04 14:48:52 -07:00
Ian Gilman
073b2e0b1f Changelog for #2318 2023-03-31 15:30:19 -07:00
Ian Gilman
3488d18e4c
Merge pull request #2318 from donotloveshampo/patch-1
Fixed #2314
2023-03-31 15:27:43 -07:00
Craig A. Berry
bff93af17e Handle XML embedded in tilesource JSON
The existing check for whether the tilesource data is XML or JSON
looks for a tag anywhere in the response content, which incorrectly
flags the content as XML in the case where it is really JSON with
XML embedded in it.

This commit corrects that problem by requiring the tag to occur as
the first non-whitespace part of the content. This is basically a
poor person's well-formedness check since well-formed XML cannot
have non-whitespace content outside of the root node.

N.B. While malformed XML content with non-whitespace characters
before the first element has been getting identified as XML, it
has not been getting parsed correctly.  With current parsing
infrastructure, the content has been getting replaced by a parsing
error message.  With more up-to-date parsing infrastructure, it
will throw an error.  Either way we're not losing anything by failing
to identify malformed XML as XML.

Addresses issue #2325.
2023-03-30 16:38:35 -05:00
Rainer Simon
84d2dcf11d Applied touch rotate fix suggested in #2319 2023-03-25 18:38:58 +01:00
donotloveshampo
244e54da69
Fixed #2314 2023-03-17 16:27:12 +08:00
Ian Gilman
292b62ba21 Change log for #2317 2023-03-16 13:26:59 -07:00
Ian Gilman
dec2afabb2 Merge branch 'master' of github.com:openseadragon/openseadragon 2023-03-16 13:23:40 -07:00
Ian Gilman
2ae9fb0e13
Merge pull request #2317 from pearcetm/after-resize-event
Add after-resize event
2023-03-16 13:22:50 -07:00
Ian Gilman
56ae09fc8a Changelog for #2316 2023-03-14 14:02:07 -07:00
Ian Gilman
5f816246e4
Merge pull request #2316 from pearcetm/scaled-crop-bugfix
partial bugfix for #2312
2023-03-14 13:57:35 -07:00
Tom
fb32cc7198 add after-resize event 2023-03-13 22:19:06 -04:00
Tom
a01c230b6e partial bugfix for #2312 2023-03-13 21:56:06 -04:00
Tom
8a4c95ef4b conditional usage of draw() vs event handlers depending on initialization context 2023-03-13 21:39:54 -04:00
Tom
9821b4589d remove drawer class 2023-03-13 17:56:53 -04:00
Tom
6d1895364f updates to threejsdrawer, bugxfixes/improvements 2023-03-13 17:43:35 -04:00
Tom
ade59513df move tile update logic back to TiledImage to keep drawing logic cleaner 2023-03-13 15:56:04 -04:00
Tom
641951aaed split canvas from html rendering 2023-03-12 11:42:03 -04:00
Tom
6159ca7c7c cleaning up drawer APIs 2023-03-11 11:38:21 -05:00
Ian Gilman
bf06f271c6 Changelog for #2293 2023-03-10 13:52:32 -08:00
Ian Gilman
cbb0a009e7
Merge pull request #2293 from pearcetm/zoom-constraints-fix
Take zoom constraint into account within _fitBounds
2023-03-10 13:49:41 -08:00
Ian Gilman
25b4d7a3ca
Merge pull request #2308 from AndrewADev/set-node-lts-in-ci
Update Travis to use latest Node LTS
2023-03-07 14:27:02 -08:00
Ian Gilman
624609d800 Changelog for #2306 2023-03-06 14:25:38 -08:00
Ian Gilman
afae0ec5ec
Merge pull request #2306 from MohitBansal321/addButton
add custom button for this viewer
2023-03-06 14:22:34 -08:00
Tom
a6e621b562 fix cropping when viewer is rotated 2023-03-06 14:29:39 -05:00
Tom
7c81d068e6 revert debugging changes in overlay demo 2023-03-05 16:12:30 -05:00
Tom
d1b8001adc finished many implementation details and demo 2023-03-05 16:08:32 -05:00
Andrew Armbruster
2764e3ad9a Try an even newer build env
This would buy even more time to find an alternative to pinning the runner version.
2023-02-28 21:16:41 +01:00
Andrew Armbruster
5c12e1ce1c Use newer runner version
Request a newer runner version from Travis CI due to a glibc version bump in newer versions of Node.
2023-02-28 21:04:22 +01:00
Andrew Armbruster
7d2ceac61a Travis uses latest Node LTS
Update CI config to use the most recent LTS.

For some other possible values, see: https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#specifying-nodejs-versions
2023-02-28 20:21:10 +01:00
Mohit Bansal
8a201c12b4 add given button function to buttongroup 2023-02-28 01:05:22 +05:30
Mohit Bansal
f393547d9e add custom button 2023-02-27 23:52:29 +05:30
Andrew A
b0233f6a24 Drop non-standard lint command
Stick to existing approach leveraging grunt for dev tasks.
2023-02-24 19:51:42 +01:00
Andrew A
2932b0a800 Exclude IE 11 from query
We are ready to drop IE 11, so no need for it to be included in the browserslist

See: https://github.com/openseadragon/openseadragon/pull/2300#pullrequestreview-1308240522
2023-02-24 19:50:38 +01:00
Ian Gilman
59083b7669 Changelog for #2301 2023-02-23 15:07:09 -08:00
Ian Gilman
f0d15e3e79
Merge pull request #2301 from MohitBansal321/focusEvent
add canvas-focus and canvas-blur events to Viewer
2023-02-23 15:04:11 -08:00
Mohit Bansal
795e85bebb update doc comments 2023-02-22 10:21:51 +05:30
Tom
376ee38d3c ThreeJSRenderer nearly complete, starting refactor of core to support plugin drawers. 2023-02-21 18:59:40 -05:00
Mohit Bansal
c05af1d38b add focus and blur event 2023-02-19 15:49:43 +05:30
Andrew A
ab0ddcae3d Add a lint script
Make it easy to lint in stand-alone fashion.

Note that I'm going with a direct call to ESLint, as using `grunt eslint` leads to warnings about a circular dependency (per trace it seems to originate in istanbul?)
2023-02-18 15:55:03 +01:00
Andrew A
09a119afe3 Add ESLint plugin for ES API linting
Adding [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat) to check for usage of incompatible APIs.

For a list of browsers, we start out using both the 'defaults' query along with IE 11, which is still expressly supported in OSD v4 (current).
2023-02-18 15:50:21 +01:00
Ian Gilman
25aabbe766
Merge pull request #2298 from MohitBansal321/npmOutdated
some npm packages outdated
2023-02-17 14:16:07 -08:00
Ian Gilman
f2fa9dbb41 Changelog for #2297 2023-02-17 14:01:56 -08:00
Ian Gilman
9026c3a71d
Merge pull request #2297 from KevinBritten/docs/button-type-fix
2087 add type Element to documentation for custom ui buttons
2023-02-17 13:57:33 -08:00
Mohit Bansal
e765860aeb Merge branch 'master' of https://github.com/openseadragon/openseadragon into npmOutdated 2023-02-17 15:26:10 +05:30
Kevin Britten
8ec6e55304
Merge branch 'openseadragon:master' into docs/button-type-fix 2023-02-16 17:21:44 -05:00
Ian Gilman
5a5420972c Changelog for #2291 2023-02-16 14:16:56 -08:00
Ian Gilman
c7992411a5
Merge pull request #2291 from MohitBansal321/keyboardHandling
Consolidate viewer keyboard handling into keydown handler
2023-02-16 14:13:45 -08:00
Kevin Britten
cf3bf91b8d add type Element to documentation for custom ui buttons 2023-02-16 14:51:30 -05:00
Mohit Bansal
8442cc2b2b update npm packages 2023-02-15 19:15:22 +05:30
Mohit Bansal
0ab81df9b8 remove unwanted property 2023-02-15 09:37:03 +05:30
Mohit Bansal
6be459e451 formatting 2023-02-13 23:13:08 +05:30
Mohit Bansal
78928e3510 add comment 2023-02-13 23:01:19 +05:30
Mohit Bansal
4909320089 correction of keyCode 2023-02-12 13:30:41 +05:30
Mohit Bansal
3a8738fd43 spacing && documentation 2023-02-12 12:43:41 +05:30
Mohit Bansal
dac697c74e formatting 2023-02-10 16:44:55 +05:30
Mohit Bansal
4bc9ea4573 add keypress handler's event 2023-02-09 12:55:44 +05:30
Mohit Bansal
cfa88b701f replace canvasKeyPressEventArgs to canvasKeyDownEventArgs 2023-02-08 19:22:27 +05:30
Tom
16fc72d8fb Take zoom constraint into account within _fitBounds when constraints = true and immediately = false 2023-02-07 18:12:26 -05:00
Mohit Bansal
f36d44dc67 Consolidate viewer keyboard handling into keydown handler 2023-02-07 03:31:57 +05:30
Ian Gilman
ead728dc35 Changelog for #2282 2023-02-03 14:07:08 -08:00
Ian Gilman
3cf3fb50b2
Merge pull request #2282 from RationAI/master
Ensure tile-loaded event completionCallback is called only once.
2023-02-03 14:03:39 -08:00
Aiosa
37d4f62ce9 Remove discouraging note on getCompletionCallback use docs. 2023-02-02 17:18:12 +01:00
Aiosa
57486732b1 Prevent early tile completion with call order instead of guard flag. Improve getCompletionCallback docs. 2023-02-01 10:25:10 +01:00
Aiosa
55e7d2439a Change completionCallback with 'tile-loaded' event to support original scenario of async completion notification with additional guarding flags. 2023-01-31 08:05:02 +01:00
Aiosa
81d86570da Typo in the stopping comparison condition. 2023-01-28 14:08:00 +01:00
Aiosa
947109718c Ensure tile-loaded event completionCallback is called only once. Check when context2D used after cache creation. 2023-01-28 08:42:07 +01:00
Ian Gilman
ca5cc84988 Changelog for #2280 and #2238 2023-01-26 14:13:52 -08:00
Ian Gilman
dbb60cf026
Merge pull request #2280 from damonsson/patch-1
fix problem with click precision on ReferenceStrip
2023-01-26 14:11:16 -08:00
Damian Murawski
2484de5010
remove trailing space 2023-01-26 11:44:39 +01:00
Damian Murawski
8550b4fea5
fix problem with click precision on ReferenceStrip
temporary fix for #1992 . Just adding 4px which works in all use cases.
2023-01-25 23:15:12 +01:00
Ian Gilman
6f7e8c7a49
Merge pull request #2238 from Ughuuu/pr-1386-3
add loop for re-trying failed tiles [Take 3]
2023-01-24 15:15:58 -08:00
Ian Gilman
e6f7c78626 Changelog for #2273 2023-01-24 14:58:13 -08:00
Ian Gilman
d22eceed66
Merge pull request #2273 from RationAI/master
EventSource: promises, priorities and execution breaks
2023-01-24 14:53:07 -08:00
Dragos Daian
b4700d28bd Also add documentation for tileRetryDelay 2023-01-23 22:16:05 +01:00
Dragos Daian
f0f12c459e try fix with check for null and undefined 2023-01-23 22:10:23 +01:00
Dragos Daian
5d70a807da fix build error 2023-01-23 19:54:51 +01:00
Dragos Daian
77bc130636 Add tileRetryMax documentation. 2023-01-23 19:49:43 +01:00
Aiosa
377f2bd04f Merge branch 'master' of github.com:RationAI/openseadragon 2023-01-21 09:00:58 +01:00
Aiosa
7a7acdbe57
Merge branch 'openseadragon:master' into master 2023-01-21 08:00:29 +00:00
Aiosa
de00939d8d Revert async support and event breaking support in EventSource. 2023-01-21 09:00:24 +01:00
Ian Gilman
a1004bac86 Changelog for #2276 2023-01-20 13:53:46 -08:00
Ian Gilman
5a8e7ddcf8
Merge pull request #2276 from ambujsahu81/patch-1
Fix #2264: Navigator display rectangle is off when the page has box-sizing: border-box
2023-01-20 13:51:52 -08:00
ambujsahu81
f3a76a267c add box-sizing property to the navigator display region 2023-01-20 18:26:54 +05:30
Aiosa
c8dbb2c757 Implement support for async function and promise type recognition with $.type. Add $.Promise proxy. Implement support for promises in EventSource. Implement ability to abort events as well as prioritize events. 2023-01-17 11:13:48 +01:00
Ian Gilman
d80b6ad4ce Changelog for #2270 2023-01-12 13:57:44 -08:00
Ian Gilman
3d9ae49948
Merge pull request #2270 from hrghauri/issue-2192
issues/2192 fix - Introduced canvas-key-press for keypress.
2023-01-12 13:54:50 -08:00
Haris Ghauri
a9f0523b62 issues/2192 fix. 2023-01-11 23:15:24 -05:00
Ian Gilman
a111d0f616 Starting 4.0.1 2022-12-16 14:22:50 -08:00
Ian Gilman
8e6196a3f3 Version 4.0.0 2022-12-16 14:17:28 -08:00
Ian Gilman
c93df98363 JSDoc fixes 2022-12-16 14:14:40 -08:00
Ian Gilman
574f375467 Changelog for #2256 2022-12-16 13:57:02 -08:00
Ian Gilman
1351ac018a
Merge pull request #2256 from pearcetm/resize-listener
work in progress about viewer resize behavior
2022-12-16 13:48:45 -08:00
Ian Gilman
c5588a2313 Changelog for #2249 2022-12-15 14:03:46 -08:00
Ian Gilman
3342b7880d
Merge pull request #2249 from pearcetm/rotated-constraints-fix
fixed viewport constraint behavior when viewer is rotated
2022-12-15 13:57:44 -08:00
Tom
564121428c removed polling vs resizeviewer option from demo 2022-12-14 11:31:12 -05:00
Tom
67fc9eafe8 disabled autoResize for navigator 2022-12-14 10:53:40 -05:00
Tom
9ccf93d767 cleaning up changes 2022-12-14 09:25:23 -05:00
Tom
9daa8feec1 cleaning up changes; modified demo 2022-12-14 09:21:52 -05:00
Tom
9048abb05e Merge branch 'master' into resize-listener 2022-12-13 18:31:42 -05:00
Tom
69297c0181 Updated resize behavior 2022-12-13 16:49:23 -05:00
Ian Gilman
ae70c88e52
Merge pull request #2259 from openseadragon/ig-test
Fixed fullyLoaded test when run in browser
2022-12-12 15:26:44 -08:00
Ian Gilman
e6341ac1e0 Fixed fullyLoaded test when run in browser 2022-12-12 15:21:56 -08:00
Ian Gilman
2d713783ba
Merge pull request #2257 from pearcetm/fix-navigator-tests
Fix navigator tests
2022-12-12 14:44:03 -08:00
Tom
e122f372ba enable all tests 2022-12-11 15:07:43 -05:00
Tom
48bcd75f1a fixed logic of dragNavigatorBackToCenter method 2022-12-11 14:47:52 -05:00
Tom
37a024f023 bugfix in getCenter during zoom animation 2022-12-10 07:02:16 -05:00
Tom
86c105beaa bugfix in getCenter during zoom animation 2022-12-10 06:57:53 -05:00
Tom
2afd61b05d updates to work in progress 2022-12-08 23:12:28 -05:00
Tom
7e1b5c5665 fixed typo in documentation 2022-12-07 18:03:59 -05:00
Tom
54af53cf4e work in progress about viewer resize behavior 2022-12-07 17:46:25 -05:00
Ian Gilman
dd2f132577 Changelog for #2206 2022-12-07 14:27:43 -08:00
Ian Gilman
de4eac5a06
Merge pull request #2206 from filak/master
Update iiiftilesource.js
2022-12-07 14:21:47 -08:00
Ian Gilman
15b3e10727
Merge pull request #2254 from openseadragon/dependabot/npm_and_yarn/qs-6.11.0
Bump qs from 6.9.4 to 6.11.0
2022-12-07 13:59:18 -08:00
Tom
524b42c778 demo update 2022-12-06 17:21:03 -05:00
dependabot[bot]
44431beb13
Bump qs from 6.9.4 to 6.11.0
Bumps [qs](https://github.com/ljharb/qs) from 6.9.4 to 6.11.0.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.9.4...v6.11.0)

---
updated-dependencies:
- dependency-name: qs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-06 21:57:23 +00:00
Ian Gilman
c5c1fd156f Changelog for #2253 2022-12-06 13:54:38 -08:00
Tom
66b4b29424 small cleanup 2022-12-06 16:53:19 -05:00
Tom
256514bca6 small cleanup 2022-12-06 16:52:48 -05:00
Ian Gilman
4f990c74b7
Merge pull request #2253 from pearcetm/rotation-api-reconciliation
Rotation api reconciliation
2022-12-06 13:52:40 -08:00
Tom
757bf8690e fix Viewport._fixBounds to work with boundary constraints, and updated the demo page to show the behavior. 2022-12-06 16:42:13 -05:00
Tom
845cbced69 reverted Viewport.setRotation, created Viewport.setRotationWithPivot 2022-12-05 19:40:30 -05:00
Tom
05997d359c reverted Viewport.setRotation, created Viewport.setRotationWithPivot 2022-12-05 19:38:46 -05:00
Ian Gilman
f85c8ca4e9
Merge pull request #2251 from openseadragon/dependabot/npm_and_yarn/decode-uri-component-0.2.2
Bump decode-uri-component from 0.2.0 to 0.2.2
2022-12-05 13:51:19 -08:00
dependabot[bot]
5a11784173
Bump decode-uri-component from 0.2.0 to 0.2.2
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-04 03:42:28 +00:00
Tom
78c6295acf update unit tests 2022-12-02 22:08:15 -05:00
Tom
5aca85fe21 Merge branch 'master' of https://github.com/openseadragon/openseadragon into rotated-constraints-fix 2022-12-02 19:36:39 -05:00
Ian Gilman
1fe1630ab9
Merge pull request #2250 from openseadragon/ig-test
Fix unit tests
2022-12-02 16:33:24 -08:00
Ian Gilman
dfcfa4c02b Temporarily disabling navigator tests 2022-12-02 16:27:43 -08:00
Ian Gilman
77030096e4 Fixing test failures 2022-12-02 15:52:53 -08:00
Tom
8744a429f1 added documentation to _raiseConstraintsEvent 2022-12-02 18:48:28 -05:00
Tom
aede32c335 added documentation to getConstrainedBounds 2022-12-02 18:46:57 -05:00
Ian Gilman
9c42062efb Changelog for #2247 2022-12-02 14:18:22 -08:00
Ian Gilman
eb85b4498f
Merge pull request #2247 from JohnReagan/1970/support-tile-source-url-getter
Add support for dynamic urls from tile source. Fixes #1970
2022-12-02 14:16:40 -08:00
Tom
ac18d5629d fixed viewport constraint behavior when viewer is rotated 2022-12-02 16:43:39 -05:00
John Reagan
8ef5270d7f #1970: Update unit test to check for changed url behavior 2022-12-02 10:32:11 -05:00
Ian Gilman
09544f795f Changelog for #2246 2022-11-30 14:14:21 -08:00
Ian Gilman
c92fe116c5
Merge pull request #2246 from pearcetm/boundary-constraints-fix
boundary constraint logic fix
2022-11-30 14:12:16 -08:00
Tom
bd8e8a9e7f add line spacing 2022-11-30 16:48:04 -05:00
John Reagan
601160e9fb Add support for dynamic urls from tile source. Fixes #1970 2022-11-30 15:38:57 -05:00
Tom
5aa5d7ad56 removed extra space 2022-11-29 17:43:14 -05:00
Ian Gilman
11f70d54e8 Changelog for #2239 2022-11-29 13:53:35 -08:00
Ian Gilman
b8cc7e171e
Merge pull request #2239 from pearcetm/viewer-destroy-event
Viewer destroy event
2022-11-29 13:51:48 -08:00
Tom
554149cf4f merged .gitignore changes 2022-11-28 17:56:05 -05:00
Tom
968cb96bc4 added before-destroy event; reverted viewport boundary constraint changes 2022-11-28 17:54:23 -05:00
Tom
6d35f6df2c boundary constraint logic fix 2022-11-28 17:45:21 -05:00
Ian Gilman
c5639e32b5
Merge pull request #2244 from openseadragon/ig-test
Temporary fix to Travis builds: Pin the node version to one that works
2022-11-28 14:37:56 -08:00
Ian Gilman
da314c067c Travis debugging 2022-11-28 14:32:24 -08:00
Ian Gilman
11b7205ea4
Merge pull request #2243 from openseadragon/ig-test
Updating qunit test library
2022-11-28 14:28:10 -08:00
Ian Gilman
87f90c05b4 Merge branch 'master' into ig-test 2022-11-28 14:26:56 -08:00
Ian Gilman
9150af8592 Changelog for #2233 2022-11-28 13:50:22 -08:00
Ian Gilman
c25d15419c
Merge pull request #2233 from pearcetm/define-setRotation-axis
implemented rotation about a pivot point in viewport coordinates
2022-11-28 13:47:10 -08:00
Ian Gilman
7670892ae7 Just a tiny change to trigger Travis... 2022-11-26 18:01:44 -08:00
Tom
6fa8e6695d viewport _applyBoundaryConstraints fix 2022-11-26 12:04:05 -05:00
Tom
27399beffe banish .DS_Store 2022-11-23 15:33:09 -05:00
Tom
29384cd5ff Added event for viewer destroy 2022-11-23 15:28:40 -05:00
Tom
d55ccdf557 resolved package-lock.json conflict 2022-11-22 13:01:00 -05:00
Ian Gilman
22d4e62198 Updated package lock 2022-11-21 17:19:23 -08:00
Ian Gilman
cdfd5a454b Merge branch 'master' into ig-test 2022-11-21 17:16:45 -08:00
Dragos Daian
c3dec09d9c add loop for re-trying failed tiles [Take 3] 2022-11-20 12:27:51 +01:00
Ian Gilman
d7cd12679c
Merge pull request #2235 from openseadragon/dependabot/npm_and_yarn/minimatch-3.0.8
Bump minimatch from 3.0.4 to 3.0.8
2022-11-18 13:48:17 -08:00
Tom
7454d4323d updated setRotation param order to match rotateBy/rotateTo, deprecation warning for setting degrees, and private API 2022-11-16 18:07:56 -05:00
Ian Gilman
69c4b31853 Changelog tweak 2022-11-16 14:26:18 -08:00
Ian Gilman
89a69ee1e0 Changelog for #2225 2022-11-16 14:21:51 -08:00
dependabot[bot]
733f501a94
Bump minimatch from 3.0.4 to 3.0.8
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.0.8.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.0.8)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-16 22:20:58 +00:00
Ian Gilman
5bba14a763
Merge pull request #2225 from HamzaTatheer/master
One touch zoom in & out function #2077
2022-11-16 14:16:13 -08:00
Hamza Tatheer
7c44dc64bc Update viewer.js 2022-11-16 15:48:45 +05:00
Tom
2f174ad552 updated rotateBy 2022-11-15 23:51:44 -05:00
Tom
7f2725ba49 Slight API tweaks; added checks to rotationPivot 2022-11-15 19:01:19 -05:00
Tom
aea62de752 .DS_Store banished! 2022-11-15 17:50:56 -05:00
Tom
84bbc27a17 Add rotateBy and rotateTo to the API 2022-11-12 18:20:26 -05:00
Tom
bfddf7355b Add rotateBy and rotateTo to the API 2022-11-12 18:18:25 -05:00
Hamza Tatheer
6540a57aa9 pr changes 2022-11-12 16:32:45 +05:00
Tom
51807a77f0 implemented rotation about a pivot point in viewport coordinates 2022-11-11 22:15:52 -05:00
Hamza Tatheer
cb2fbe9b50 pr changes latest 2022-11-06 18:23:12 +05:00
Hamza Tatheer
fccab2da56 pr fixes 2022-11-03 23:55:35 +05:00
Hamza Tatheer
e4d9dcdd03 Triple Click Bug Fix 2022-10-30 01:27:56 +05:00
Hamza Tatheer
3ebc03ab3a demo page fix 2022-10-29 21:59:29 +05:00
Hamza Tatheer
05b596ce32 space removed 2022-10-29 21:47:37 +05:00
Hamza Tatheer
ca88de8e7f double click drag same position constraint removed 2022-10-29 21:46:12 +05:00
Hamza Tatheer
d44fc85582 pr changes 2022-10-29 21:22:25 +05:00
Hamza Tatheer
a0ac8666e0 Merge branch 'master' of https://github.com/HamzaTatheer/openseadragon 2022-10-29 20:18:23 +05:00
Hamza Tatheer
af3801367a
Merge branch 'openseadragon:master' into master 2022-10-26 11:03:28 +05:00
Ian Gilman
ed66c2d151 Changelog for #2212 2022-10-24 14:17:51 -07:00
Ian Gilman
af564547f0
Merge pull request #2212 from joedf/regression-fix-2201
Undefined check for object descriptor
2022-10-24 14:16:21 -07:00
Hamza Tatheer
89ab847ef6 bug fix 2022-10-24 23:17:03 +05:00
Hamza Tatheer
2f28970e32 zoom infinite 2022-10-24 11:08:37 +05:00
Hamza Tatheer
e12a626efb hide toolbar 2022-10-23 23:51:27 +05:00
Hamza Tatheer
2f2285711d Update viewer.js 2022-10-23 01:30:16 +05:00
Hamza Tatheer
9a4b802286 Update index.html 2022-10-22 21:10:01 +05:00
Hamza Tatheer
8336e8336b test 2022-10-22 21:04:58 +05:00
Hamza Tatheer
3a0bb0cd58 orignal Config 2022-10-22 15:50:18 +05:00
Hamza Tatheer
41a07b2250 zoom equation updated 2022-10-22 15:47:12 +05:00
Hamza Tatheer
cd9c5032f8 functionality test 2022-10-22 12:15:28 +05:00
Ian Gilman
c470e7effd Changelog for #2219 2022-10-20 14:29:06 -07:00
Ian Gilman
d5bcbcec3a
Merge pull request #2220 from jssullivan/master
Fixes #2219 TypeError: Cannot set property buttons of [object Object] which has only a getter when initializing OpenSeaDragon
2022-10-20 14:27:29 -07:00
Ian Gilman
38027e7588 Changelog for #2211 2022-10-20 14:23:27 -07:00
Ian Gilman
bbac0f0355
Merge pull request #2211 from openseaforce/docss
docs: change `@return` -> `@returns`
2022-10-20 14:21:42 -07:00
Joe DF
aec24d6dd7 add continue, update warning msg 2022-10-19 16:07:35 -04:00
Jimmy Sullivan
13330c4ede
Update viewer.js
Remove erroneous whitespace
2022-10-19 11:35:49 -04:00
Jimmy Sullivan
8bb600f6ae
Update viewer.js
Change removing buttons, to renaming it buttonGroup
2022-10-19 11:35:08 -04:00
Shyamkumar Yadav
98972d22d1
docs: fix a jsdoc 2022-10-19 10:25:37 +05:30
james.sullivan
333be9d6ca Remove version bump 2022-10-14 10:51:56 -04:00
james.sullivan
f87310c082 Fix initilization crash caused by Extend and buttons getter 2022-10-14 10:47:48 -04:00
james.sullivan
1a1b8e4510 v3.2.0-pre 2022-10-13 17:36:50 -04:00
Joe DF
476657ecad undefined check for obj. descriptor 2022-10-10 15:12:30 -04:00
Shyamkumar Yadav
5baa8d3252
docs: change @return -> @returns 2022-10-10 01:12:18 +05:30
Ian Gilman
39625aacaa
Merge pull request #2208 from openseaforce/readme
fix: links in README
2022-10-05 13:44:26 -07:00
Shyamkumar Yadav
f787d941e8
Remove Gitter and Build tags 2022-10-05 11:45:52 +05:30
Shyamkumar Yadav
2a90a2cdf4
Merge branch 'openseadragon:master' into readme 2022-10-05 11:42:38 +05:30
Ian Gilman
e212edae54
Merge pull request #2207 from openseaforce/contributing-links
fix: links in CONTRIBUTING
2022-10-04 13:53:46 -07:00
Shyamkumar Yadav
6b92904178
fix: links
- update `http` to `https`
- move all links at bottom
2022-10-01 14:16:27 +05:30
Shyamkumar Yadav
c48d143fe8
fix: links
- update JSDoc link
- update all links to https
- update `good first bug` to `good first issue`
2022-10-01 13:04:28 +05:30
Ian Gilman
0474d64ba1 Changelog for #2201 2022-09-28 14:00:46 -07:00
Ian Gilman
38bc89f455 Merge branch 'master' of github.com:openseadragon/openseadragon 2022-09-28 13:57:06 -07:00
Ian Gilman
d504a7ac83 Updating qunit to latest 2022-09-28 13:56:14 -07:00
Ian Gilman
9ec91891e6
Merge pull request #2201 from joedf/fix-2193
Fix "Viewer.buttons is deprecated" warning issue
2022-09-28 13:54:41 -07:00
filak
ce45e34265 Update iiiftilesource.js 2022-09-26 17:26:43 +02:00
Joe DF
6d74b684ec implement @iangilman 's fix 2022-09-17 17:10:03 +02:00
Joe DF
7497b83525 based on @pearcetm 's fix 2022-09-10 21:31:15 -04:00
Ian Gilman
f88a1f0603 Changelog for #2136 2022-08-23 14:17:39 -07:00
Ian Gilman
d3ef767487
Merge pull request #2136 from jonasengelmann/master
Viewport rotation animation
2022-08-23 14:13:22 -07:00
Ian Gilman
8e55dc7217 Changelog for #2190 2022-08-23 14:03:59 -07:00
Ian Gilman
5e7ce1afa5
Merge pull request #2190 from Aiosa/master
Provide deafult getTileHashKey implementation for "TileSource" object if missing
2022-08-23 14:01:45 -07:00
jonasengelmann
5f50d9e59e reworked setRotation to allow all degree values 2022-08-22 15:34:29 +02:00
jonasengelmann
9bce0e696c removed redundant EuclideanModulo function 2022-08-22 15:31:35 +02:00
Aiosa
61c77a3440 Fix hash tile generation by checking the validity of URL input parameter and fallback to level, x, y variables. 2022-08-21 10:09:36 +02:00
Aiosa
298f069c7e Change missing cacheKey in Tilesource constructor to warning. Provide default implementation of getTileHashKey for tileSource if the tileSource does not inherit from OpenSeadragon.TileSource 2022-08-09 10:40:57 +01:00
Ian Gilman
12402f2f0f Changelog for #2187 2022-08-01 14:19:22 -07:00
Ian Gilman
dafcf7bc14
Merge pull request #2187 from pearcetm/button-bugfix
Button bugfix
2022-08-01 14:15:55 -07:00
pearcetm
45643b94e3
Update button.js 2022-07-28 17:55:21 -04:00
pearcetm
6d5a75bcf7
Bugfix for enable/disable methods for Buttons
Fixes https://github.com/openseadragon/openseadragon/issues/2185
2022-07-28 17:53:49 -04:00
Ian Gilman
bdb44d84fb Changelog for #2183 2022-07-26 14:58:07 -07:00
Ian Gilman
c449a8353d
Merge pull request #2183 from altert/master
Fix closure for croppingPolygons in _drawTiles function
2022-07-26 14:55:09 -07:00
altert
5829a9e892 fix closure for croppingPolygons in drawTile 2022-07-26 13:12:48 +05:30
jonasengelmann
ddd4a05e5e Revert "always return Euclidean modulo of current rotation"
This reverts commit 32af983910.
2022-07-07 16:31:35 +02:00
jonasengelmann
32af983910 always return Euclidean modulo of current rotation 2022-06-29 20:32:47 +02:00
jonasengelmann
3cdd94e465 constrained rotation to shortest path 2022-06-29 19:47:26 +02:00
jonasengelmann
1b27e59be8 added Euclidean modulo helper function 2022-06-29 19:47:03 +02:00
Ian Gilman
0335f3f4ab Changelog for #2148 2022-06-28 14:15:35 -07:00
Ian Gilman
d1f46148a7 Merge branch 'master' of github.com:openseadragon/openseadragon 2022-06-28 14:13:21 -07:00
Ian Gilman
1d327d673e
Merge pull request #2148 from Aiosa/master
Delegate tile fetching and caching to the TileSource
2022-06-28 14:12:44 -07:00
Aiosa
2fbaf71448
Merge branch 'master' into master 2022-06-28 14:14:05 +02:00
Aiosa
0aadc23fcb Merge branch 'openseadragon-master' 2022-06-28 14:11:30 +02:00
Aiosa
bb1755613e Merge branch 'master' of https://github.com/openseadragon/openseadragon into openseadragon-master
# Conflicts:
#	src/tiledimage.js
2022-06-28 14:11:02 +02:00
Ian Gilman
71e9d5775c Changelog for #2173 2022-06-20 13:59:58 -07:00
Ian Gilman
6494b49d67
Merge pull request #2173 from ahankinson/fix-iiif-id-field
Fixed: ID field parsing on IIIF tile sources
2022-06-20 13:58:14 -07:00
Andrew Hankinson
ddd375b378 Merge branch 'master' into fix-iiif-id-field 2022-06-18 15:17:20 +02:00
Andrew Hankinson
1b777c9e62 Fixed: remove redundant checks
Also fixes a JSDoc error for annotating optional parameters.
2022-06-18 15:16:48 +02:00
Andrew Hankinson
d35c0a6385 Fixed: Updated configure comment
Updated comment to make it clear that it's a static method. Also updated the example
to IIIF v2, since that's more widely used than v1.1.
2022-06-17 10:34:31 +02:00
Andrew Hankinson
86dabe624b Revert changes to ID field in configure 2022-06-17 10:23:13 +02:00
Andrew Hankinson
7a97d524f8 Improved testing data for IIIFv3
This commit adds a new set of tests for IIIFv3 Image API info
to the `formats` tests. These tests mirror the tests done for the v2
handler, but with updated 'info.json' files.

Image directories also needed to be changed to include the full width/height
parameters.

Also changed was moving the `iiif` test block up below formats, and adding a QUnit
module name. This allowed the tests to show up in the QUnit browser test.

All of the new tests were checked and pass.
2022-06-16 12:58:41 +02:00
Andrew Hankinson
820564dd3e Fixed: normalize ID property for IIIF tile source
This commit attempts to normalize all possible values of the "id" property for IIIF tile sources
into a single internal _id property.
2022-06-16 12:55:21 +02:00
Ian Gilman
9988fcebc1 Changelog for #2175 2022-06-14 14:29:14 -07:00
Ian Gilman
0114381ebe
Merge pull request #2175 from joedf/patch-2174
added navigatorElement, fix bug id-overwrite on element
2022-06-14 14:25:05 -07:00
Joe DF
650b899de3 added navigatorElement, fix bug id-overwrite on element 2022-06-14 12:56:34 -04:00
Andrew Hankinson
6eeccb530b Fixed: ID field parsing on IIIF tile sources
The IIIF specification allows for the ID field to be either with or without
an "@" prefix for IIIFv3. (See: https://iiif.io/api/image/3.0/) Currently OSD
will fail to parse an image block that uses the non-prefixed form.

This PR changes the IIIF tile source parsing to allow for both forms of the
`id` key.
2022-06-14 08:57:00 +02:00
Ian Gilman
bf395c1633 Changelog for #2166 2022-06-13 14:17:20 -07:00
Ian Gilman
d956b2ae9d
Merge pull request #2166 from joedf/patch-for-PR-1303
Patch for #1303
2022-06-13 13:49:17 -07:00
Ian Gilman
c20b2bbab9 Changelog for #2160 2022-06-09 15:44:03 -07:00
Ian Gilman
71a1f06e35
Merge pull request #2160 from joedf/patch-2
apply only zoom constraint by default for scroll events
2022-06-09 15:41:17 -07:00
Joachim de fourestier
3ca17c1508 missing period 2022-06-08 20:15:21 -04:00
Joachim de fourestier
ff4f88dc64 add some documentation 2022-06-08 20:05:43 -04:00
Ian Gilman
e8adefbe6e Minor fix to previous PR 2022-06-08 15:06:58 -07:00
Ian Gilman
4ce2bdcdd1
Merge pull request #2172 from openseadragon/copyright
Updated copyright to 2022
2022-06-08 15:03:15 -07:00
Ian Gilman
f31179c9ce Updated copyright to 2022 2022-06-08 15:02:29 -07:00
Ian Gilman
c1c380fa8f Started version 3.2.0 2022-06-07 14:06:11 -07:00
Ian Gilman
ee3fc2bd79 Version 3.1.0 2022-06-07 14:00:35 -07:00
Ian Gilman
2afc028ab2 JSDoc fixes 2022-06-07 13:56:58 -07:00
Ian Gilman
db9dcdb2cc Package-lock 2022-06-07 13:42:55 -07:00
Jirka
7b759558b1 Add tile reference to imagejob options. 2022-06-07 14:53:18 +02:00
Aiosa
1d99a2d6be
Merge branch 'openseadragon:master' into master 2022-06-07 14:48:33 +02:00
Ian Gilman
2007ba7ea5
Merge pull request #2165 from openseadragon/dependabot/npm_and_yarn/grunt-1.5.3
Bump grunt from 1.5.2 to 1.5.3
2022-05-31 13:58:07 -07:00
Joe DF
df0e598e38 fix typo 2022-05-29 21:38:38 -04:00
Joe DF
3661d6cae5 remove auto code 2022-05-29 21:31:29 -04:00
Joe DF
9772901d71 Don't overwrite the element's id if it has one already 2022-05-29 21:30:48 -04:00
Joe DF
4a877d60f7 remove unneeded code, not sure how it got there 2022-05-29 21:23:22 -04:00
Joe DF
ca368797b0 restructure again to make less confusing, less duplicate code 2022-05-29 21:18:28 -04:00
Joe DF
d4dfcd2288 fix inconsistent open-close braces, add warn when using element even when id provided 2022-05-29 20:53:11 -04:00
Joe DF
21146b6b2c Merge remote-tracking branch 'cameronbaney/add-element-option-navigator' into patch-for-PR-1303 2022-05-29 20:33:23 -04:00
dependabot[bot]
e15c65ac09
Bump grunt from 1.5.2 to 1.5.3
Bumps [grunt](https://github.com/gruntjs/grunt) from 1.5.2 to 1.5.3.
- [Release notes](https://github.com/gruntjs/grunt/releases)
- [Changelog](https://github.com/gruntjs/grunt/blob/main/CHANGELOG)
- [Commits](https://github.com/gruntjs/grunt/compare/v1.5.2...v1.5.3)

---
updated-dependencies:
- dependency-name: grunt
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-26 00:12:47 +00:00
Joe DF
5b7be6be05 implement fixes from iangilman 2022-05-19 16:52:56 -04:00
Ian Gilman
995be3c37c Changelog for #2162 2022-05-18 15:39:02 -07:00
Ian Gilman
15ef58a8f5
Merge pull request #2162 from pearcetm/imagetilesource-bugfix
Bugfix for imagetilesource _freeupCanvasMemory
2022-05-18 15:33:47 -07:00
pearcetm
af26fdbff1
Bugfix for imagetilesource _freeupCanvasMemory 2022-05-18 12:26:19 -04:00
Joe DF
325f65fe5c attempt no.2 to fix #2160 2022-05-18 11:16:28 -04:00
Joe DF
7d6437b2cd Revert "apply only zoom constraint by default for scroll events"
This reverts commit a6d1472134.
2022-05-18 10:48:58 -04:00
Ian Gilman
a27b511ad3 Changelog for #2158 2022-05-12 13:55:42 -07:00
Ian Gilman
f3f20fd30d
Merge pull request #2158 from cavenel/master
Fix wrong center point on pinch zoom
2022-05-12 13:54:26 -07:00
Joe DF
a6d1472134 apply only zoom constraint by default for scroll events 2022-05-12 15:31:51 -04:00
Christophe Avenel
f1865c3878
Fix wrong center point on touch zoom
When doing pinch to zoom, we need to do pan first and then zoom, so that the center point is correct.
Otherwise, the pan will computed on the unzoomed coordinates, giving an impression of zooming toward the center
2022-05-12 10:45:47 +02:00
Ian Gilman
165aaebd4c Changelog for #2155 2022-05-10 13:51:58 -07:00
Ian Gilman
bfc4bc553a
Merge pull request #2155 from samwilson/typos
Fix duplicated word: "the the"
2022-05-10 13:51:05 -07:00
Aiosa
6e80e2d184
Merge branch 'openseadragon:master' into master 2022-05-06 16:52:24 +02:00
Ian Gilman
fe3b1c5a0d Changelog for #2153 2022-05-05 14:04:34 -07:00
Ian Gilman
ad7f3449bb
Merge pull request #2153 from devbyjonah/deprecated_Alias
added warning for deprecated method buttons()
2022-05-05 14:02:06 -07:00
Sam Wilson
1700e2f060 Fix duplicated word: "the the"
From https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ProofreadPage/+/789330
2022-05-05 20:43:38 +08:00
Jirka
8a2c998cb9 Finish on image job now accepts request argument. Further comments cleanup. Deprecation message for image property in tile loaded event. Removal of downloadTileFinish(). More robust aborting that cleans up an image properties when aborted (not done until now). 2022-05-04 15:16:13 +02:00
Aiosa
150e750ece
Merge branch 'openseadragon:master' into master 2022-05-04 13:40:06 +02:00
Ian Gilman
2b13120fcc Changelog for #2152 2022-05-03 14:41:56 -07:00
Ian Gilman
c0674b2924
Merge pull request #2152 from joedf/patch-1
fix typos for dragToPan in OpenSeadragon.Options
2022-05-03 14:40:48 -07:00
Ian Gilman
569b2fdf41
Merge pull request #2150 from openseadragon/dependabot/npm_and_yarn/grunt-1.5.2
Bump grunt from 1.4.1 to 1.5.2
2022-05-03 14:35:54 -07:00
devbyjonah
5ed4d5f630 added warning for deprecated method buttons() 2022-05-02 19:14:39 -07:00
Ian Gilman
449c709dcc Changelog for #2145 2022-05-02 14:35:30 -07:00
Ian Gilman
3aca527360
Merge pull request #2145 from tdiprima/patch-1
updated conditional expression
2022-05-02 14:33:57 -07:00
Jirka
d82fd35323 Fix comments on #2148: part 2. Better commens on the new TileSource API. Deprecation if 'tile-loaded' image event parameter. Unwrap ImageJob and add userData property. 2022-04-29 23:45:01 +02:00
Joe DF
eaa1a93755
fix typos for dragToPan in OpenSeadragon.Options
I noticed "`gestureSettings`[Mouse]" was 3 more times, where I believe they should be `Touch`, `Pen`, and `Unknown`?
2022-04-29 14:05:24 -04:00
Jirka
45a7a4aaf3 Fix comments on #2148: hasTransparency as a property. Move '.image' tile property to be a getter instead. Rename 'ImageJob' data property from 'image' to 'data'. Repair comments related to #2148. 2022-04-29 18:41:43 +02:00
Aiosa
92ad2c5552
Merge branch 'openseadragon:master' into master 2022-04-29 17:40:14 +02:00
dependabot[bot]
9c6d22aa50
Bump grunt from 1.4.1 to 1.5.2
Bumps [grunt](https://github.com/gruntjs/grunt) from 1.4.1 to 1.5.2.
- [Release notes](https://github.com/gruntjs/grunt/releases)
- [Changelog](https://github.com/gruntjs/grunt/blob/main/CHANGELOG)
- [Commits](https://github.com/gruntjs/grunt/compare/v1.4.1...v1.5.2)

---
updated-dependencies:
- dependency-name: grunt
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-27 05:26:49 +00:00
Ian Gilman
229bfe7946 Changelog for #2147 2022-04-19 13:46:08 -07:00
Ian Gilman
a8233ca6e1
Merge pull request #2147 from Aiosa/mousetracker
Release handler and undefined releasePoint instance
2022-04-19 13:44:14 -07:00
jonasengelmann
62e24ac1ab ensure constructor backward compatibility 2022-04-19 16:43:00 +02:00
Jirka
4f79f29238 Move cache creation, image downloading process and transparency deduction to the TileSource instance to allow custom data fetching, caching, processing. 2022-04-16 21:19:54 +02:00
Jirka
b2eda881e8 Another problem with release handler: a point instace could be undefined. 2022-04-16 16:53:30 +02:00
Ian Gilman
3dc1fc87b1 Changelog for #2142 2022-04-15 14:16:06 -07:00
Ian Gilman
334e8fbc67
Merge pull request #2142 from Aiosa/master
Delegate error printing to the ajax caller.
2022-04-15 14:12:39 -07:00
Jirka
ec430779f4 Move open-failed error message to the handler, adjust test for the new message style. Add 'numberOfHandlers()' method for events. 2022-04-15 10:32:08 +02:00
Ian Gilman
3b2d456a25 Changelog for #2138 2022-04-14 15:03:24 -07:00
Ian Gilman
d8a8eff21a
Merge pull request #2138 from Aiosa/cache-key
Change Tile.cacheKey strategy
2022-04-14 15:00:35 -07:00
Ian Gilman
f70106e41b
Merge pull request #2144 from openseadragon/dependabot/npm_and_yarn/node-fetch-2.6.7
Bump node-fetch from 2.6.6 to 2.6.7
2022-04-13 13:50:14 -07:00
Ian Gilman
0976c67a29 Changelog for #2100 2022-04-13 13:49:06 -07:00
Tammy DiPrima
e1b651b66c
update expression
Code fails if element.style is undefined.
2022-04-13 13:33:44 -04:00
Jirka
3a84b9369b Clarify documentation on cache-key creation. 2022-04-13 10:47:48 +02:00
dependabot[bot]
e722c960bc
Bump node-fetch from 2.6.6 to 2.6.7
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.6 to 2.6.7.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.6...v2.6.7)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-12 23:12:41 +00:00
Ian Gilman
2d7be96bdf
Merge pull request #2143 from openseadragon/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-04-12 16:11:47 -07:00
Ian Gilman
2d890fb7a1
Merge pull request #2100 from TanukiSharp/master
Changed full page sizing to 100% instead of compute fixed size (issue #2099)
2022-04-12 15:53:16 -07:00
dependabot[bot]
4679455720
Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-09 08:55:12 +00:00
Sebastien ROBERT
99f73c548c Changed full page sizing to 100vw/100vh instead of compute fixed size (issue 2099) 2022-04-08 08:23:25 +09:00
Jirka
1ec4d71db0 makeAjaxRequest(): delegate error message responsibility to the handler if any. 2022-04-07 17:56:14 +02:00
Jirka
a2b915cc6d Merge remote-tracking branch 'origin/cache-key' into cache-key 2022-04-07 14:53:20 +02:00
Jirka
ee2404afe3 Update Tile.prototype.getTileHashKey() documentation. Provide deprecation warning for cacheKey property - now it must be passed through Tile constructor. 2022-04-07 14:48:26 +02:00
Aiosa
29d16bd535
Merge branch 'openseadragon:master' into cache-key 2022-04-02 15:23:37 +02:00
jonasengelmann
eca51850e2 Merge branch 'master' of https://github.com/openseadragon/openseadragon 2022-04-01 11:14:55 +02:00
jonasengelmann
c16d1e3dff ensure backward compatibility 2022-04-01 10:06:18 +02:00
jonasengelmann
d62538f42e fixed white space 2022-03-31 23:50:38 +02:00
jonasengelmann
c2821b1775 set initial navigator animation time to viewport's 2022-03-31 23:45:46 +02:00
Ian Gilman
2c9d244023 Changelog for #2134 2022-03-31 13:55:53 -07:00
Ian Gilman
8e6369969b
Merge pull request #2134 from Aiosa/master
Docs clarification and solve #2094. Unwrap TiledImage closure.
2022-03-31 13:48:53 -07:00
jonasengelmann
ef8e7ad9c5 fixed typo 2022-03-30 23:41:43 +02:00
jonasengelmann
fb8bafc6a0 updated tests 2022-03-30 23:05:14 +02:00
jonasengelmann
dc2a1534d3 removed modulo for degrees to avoid spining 2022-03-30 22:59:29 +02:00
jonasengelmann
8746e8b243 fixed wrong getHomeBounds 2022-03-30 22:37:14 +02:00
Jirka
38e91f1fa5 Change coverage methods on TiledImage to be member methods. 2022-03-30 13:27:23 +02:00
jonasengelmann
1cbc2d96c1 fixed initial degree option 2022-03-29 19:18:25 +02:00
jonasengelmann
65957efe72 updated docs 2022-03-29 16:55:47 +02:00
jonasengelmann
8519e30a3a added viewport rotation animation 2022-03-29 16:50:18 +02:00
Jirka
2750100d24 Move cache-key generation to TileSource: user might need to override default behaviour in case of non-unique URL's (post data used). 2022-03-29 09:30:25 +02:00
Jirka
7f784835a7 Revert 'spacing change' for licence disclaimer (TiledImage), fix tests on drag-end event no longer firing when mouse does not move (PR #2064) 2022-03-25 12:30:18 +01:00
Jirka
20594e5a51 Stupid typo, added 'static' methods to a wrong class... 2022-03-23 14:25:36 +01:00
Jirka
aa0119be45 Rewrite TiledImage closure functions to be private class members. Fix tests that expect error message to appear in 'log' instead of 'error'. 2022-03-23 14:05:58 +01:00
Jirka
68126a82dc Update docs on POST data to reflect more accurately the behaviour.
Fix bug & implement propositions ~ issue #2094.
2022-03-23 10:22:13 +01:00
Ian Gilman
8506b8a486 Changelog for #2121 (for real) 2022-03-15 14:54:08 -07:00
Ian Gilman
fd8405dd6b Changelog for #2021 2022-03-15 14:52:17 -07:00
Ian Gilman
7e64d28197
Merge pull request #2121 from ronnymikalsen/fix/2117-contacts-points-in-mousetracker
fix: contacts points on touch devices
2022-03-15 14:49:51 -07:00
Ian Gilman
cf709b1c5c
Merge pull request #2132 from ronnymikalsen/fix/demo-iiif-tilesources
fix: change tileSources in demo for iiif
2022-03-15 14:46:47 -07:00
Ronny Mikalsen
576a0f9c33 fix: setting contacts to 0 if below 0 2022-03-14 14:26:11 +01:00
Ronny Mikalsen
01a9e3b168 fix: change tileSources in demo for iiif
Tile sources on wellcomelibrary.org is no longer available
2022-03-14 14:12:21 +01:00
Ian Gilman
116d0a7001 Changelog for #2120 2022-03-04 14:17:02 -08:00
Ian Gilman
7ee059d276 Merge branch 'master' of github.com:openseadragon/openseadragon 2022-03-04 14:14:50 -08:00
Ian Gilman
d175de1496
Merge pull request #2120 from claycoleman/allow-silencing-multi-image-warnings
Allow silencing multi-image warnings
2022-03-04 14:13:51 -08:00
Ronny Mikalsen
eeeccff1ba chore: revert code that should be in another PR 2022-03-02 10:12:06 +01:00
Ronny Mikalsen
0f984bd3b3 refactor: removed unnecessary code 2022-03-02 10:10:30 +01:00
Ian Gilman
5b87f9387e Changelog for #2116 2022-03-01 14:07:01 -08:00
Ian Gilman
3e5e12722a
Merge pull request #2116 from rvv-bouvet/fix/draw-tiles-without-canvas
fix: avoid crash when setting useCanvas to false
2022-03-01 14:03:49 -08:00
Clay Coleman
322a22cb68 Allow silencing multi-image warnings 2022-02-25 12:11:06 -06:00
Ronny Mikalsen
47cc04ff53 fix: contacts points on touch devices
Swiping fast multiple times makes contacts points in mousetracker to be out of sync for touch event

Fixes #2117
2022-02-22 14:24:10 +01:00
Ronny Valentin Vindenes
34fd856b4f fix: avoid crash when setting useCanvas to false 2022-02-22 12:31:32 +01:00
Ian Gilman
2b6c8dd622 Changelog for #2112 2022-02-18 14:23:03 -08:00
Ian Gilman
d4e03836dd
Merge pull request #2112 from shyamkumaryadav/doc-typo
Doc: small documentation fix
2022-02-18 14:19:02 -08:00
Shyamkumar Yadav
7532075aab
Doc: small documentation fix openseadragon#2111
line change from click to double-click
2022-02-18 09:49:24 +05:30
Shyamkumar Yadav
84257e3202 Doc: small documentation fix #2111 2022-02-12 23:34:40 +05:30
Ian Gilman
51e3ea7fa0 Changelog for #2072 and minor comment style change 2022-01-21 11:57:14 -08:00
Ian Gilman
b1ec71e91c
Merge pull request #2072 from Aiosa/master
Ajax POST data in the OpenSeadragon.
2022-01-21 11:53:07 -08:00
Jirka
63ecaafa51 Update documentation to be more explicit about post data string parameter format. 2022-01-20 18:03:08 +01:00
Jirka
bd6ec09458 Remove warning because loadTilesWithAjax flag is not passed to the TileSource 2022-01-13 10:05:37 +01:00
Jirka
e236ff0ea8 Forgot one 'allowPost' rename 2022-01-12 22:37:59 +01:00
Jirka
aacae1ca3f Reverted .json configuration changes made by npm. Added tests for PUSH functionality, new flag 'allowPost' to explicitly enable POST data, remove (-1) in the URL splitting. 2022-01-12 22:31:13 +01:00
Aiosa
745a788d84
Merge branch 'openseadragon:master' into master 2022-01-06 10:56:43 +01:00
Ian Gilman
055699a00a Changelog for #2075 2021-12-23 11:47:41 -08:00
Ian Gilman
fab395dc02
Merge pull request #2075 from TanukiSharp/master
Extends the fix for seams in transparent images to any browsers
2021-12-23 11:43:11 -08:00
Sebastien ROBERT
12939d5bb9 Removed the animation state and isSubPixelRoundingRule* functions (except isSubPixelRoundingRuleUnknown), changed timing when animating is set to false 2021-12-23 12:15:09 +09:00
Sebastien ROBERT
458a16ce1f Introduced animation state and testing it to determine rendering when at rest 2021-12-22 15:44:32 +09:00
Sebastien ROBERT
bfc0c4608e Fixed copy/paste mistake 2021-12-22 15:42:43 +09:00
Sebastien ROBERT
3fa67c317b Moved _shouldRoundPositionAndSize Drawer class member to drawTile() function argument 2021-12-22 14:16:11 +09:00
Sebastien ROBERT
2aebdbd066 Renamed subPixelRounding to subPixelRoundingForTransparency, changed fallback to '*', introduced SUBPIXEL_ROUNDING_OCCURRENCES numbers, added support for simple mode 2021-12-22 14:16:11 +09:00
Ian Gilman
5835b85d3f Merge branch 'master' of github.com:openseadragon/openseadragon 2021-12-17 15:09:04 -08:00
Ian Gilman
9ab6a5ac69 Fix after NPM package update 2021-12-17 15:03:56 -08:00
Ian Gilman
bdcd078b46 Updated NPM packages 2021-12-17 15:02:14 -08:00
Ian Gilman
24b3d1caef Changelogs for #2067, #2069, #2073 2021-12-17 14:56:50 -08:00
Ian Gilman
b1cf63eaff
Merge pull request #2073 from Abhishek-90/master
Changed Console.log in SRC
2021-12-17 14:51:40 -08:00
Ian Gilman
d9494c6d7f
Merge pull request #2069 from JachiOnuoha/JachiOnuoha-ArrowKeysBug
Fixed Arrow keys by pass panVertical/panHorizontal bug
2021-12-17 14:49:12 -08:00
Ian Gilman
c40a77f2de
Merge pull request #2067 from JachiOnuoha/JachiOnuoha
Fixed jsdocs issue and detecting when viewer is Fullscreen
2021-12-17 14:45:45 -08:00
Ian Gilman
9da3fb8da9 Started 3.0.1 changelog 2021-12-15 11:38:29 -08:00
Ian Gilman
3eded36fed Version 3.0.0 2021-12-15 11:33:54 -08:00
Abhishek-90
77c47cdd09 Made changes in ReferenceStrip.js 2021-12-15 11:54:11 +05:30
Sebastien ROBERT
e5b608d86a Extends the fix for seams in transparent images to any browsers, making it configurable 2021-12-13 14:20:11 +09:00
Abhishek-90
200bd607d8 Changed Console.log in SRC 2021-12-10 19:12:14 +05:30
Aiosa
3782ea2284
Merge branch 'openseadragon:master' into master 2021-12-08 09:59:05 +01:00
Aiosa
a11b5ce602 Support for POST data in the ajax requests. 2021-12-08 09:54:14 +01:00
Jachimike Onuoha
46099f3dfb
Merge branch 'openseadragon:master' into JachiOnuoha 2021-12-07 13:27:42 -05:00
Jachimike Onuoha
0a06c5b6a4 Updated boolean logic for preventVerticalPan and preventHorizontalPan 2021-12-06 23:33:58 -05:00
Jachimike Onuoha
a42e08c1ed Minor documentation updates 2021-12-06 23:19:12 -05:00
Jachimike Onuoha
5b8a22e848
Merge branch 'openseadragon:master' into JachiOnuoha-ArrowKeysBug 2021-12-02 16:56:18 -05:00
Jachimike Onuoha
f84d241367 Corrected documentation and isFullScreen function 2021-12-02 16:55:07 -05:00
Jachimike Onuoha
1fde705785 Fixed Arrowkey panning bug 2021-12-02 14:45:55 -05:00
Ian Gilman
c8f4934c8a Changelog for #2066 2021-12-01 11:31:49 -08:00
Ian Gilman
d302daae48
Merge pull request #2066 from kim-sanghoon/feature/setMaxLevel
Fix #2065 and add setMaxLevel for #2059
2021-12-01 11:29:33 -08:00
Sanghoon Kim
3bde256d62 Modify the unit test for changing maxLevel 2021-12-01 10:17:10 +09:00
Sanghoon Kim
7686812336 Fix maxLevel typo 2021-12-01 10:01:18 +09:00
Jachimike Onuoha
2edf48e880 Temporary fix for arrow key panVertical bug 2021-11-30 17:43:11 -05:00
Sanghoon Kim
24d5d98548 Add the description of setMaxLevel 2021-11-30 13:23:30 +09:00
Sanghoon Kim
f8c97143e8 Modify the TileSource constructor and _memoizeLevelScale 2021-11-30 11:40:06 +09:00
Jachimike Onuoha
0f1de455e2 Recreated panHorizontal & panVertical bug 2021-11-29 16:40:26 -05:00
Jachimike Onuoha
664b707e5f Added isFullscreen function to viewer.js 2021-11-29 15:33:37 -05:00
Jachimike Onuoha
45ee4cd7a9 Added jsdocs fixes as discussed in the issue 2021-11-28 19:46:45 -05:00
Sanghoon Kim
de39597c14 Add setMaxLevel to initialize getLevelScale memoization 2021-11-23 16:58:00 +09:00
Sanghoon Kim
91793ce752 Revert "Merge pull request #2059 from kim-sanghoon/fix/getLevelScale"
This reverts commit 1454ac791a, reversing
changes made to fcca75c57e.
2021-11-23 16:22:41 +09:00
Ian Gilman
b3196a9756
Merge pull request #2064 from openseadragon/ig-drag
No longer firing canvas-drag-end if there is no canvas-drag preceding
2021-11-22 11:35:01 -08:00
Ian Gilman
c4904fb460 No longer firing canvas-drag-end if there is no canvas-drag preceding 2021-11-18 13:45:50 -08:00
Ian Gilman
f15d5a2bff Changelog for #2059 2021-11-17 15:10:23 -08:00
Ian Gilman
1454ac791a
Merge pull request #2059 from kim-sanghoon/fix/getLevelScale
Fix getLevelScale to use image dimensions
2021-11-17 15:05:34 -08:00
Sanghoon Kim
63a4f87716 Fix getLevelScale to use image dimensions 2021-11-09 21:56:01 +09:00
Ian Gilman
fcca75c57e Changelog for #2049 2021-11-05 11:52:48 -07:00
Ian Gilman
f0d5d4bedd
Merge pull request #2049 from superbland/get_relative_image_size
Add method for getting the relative size of an image
2021-11-05 11:50:50 -07:00
superbland
446382f5a1 Use correct method for imageToWindowCoordinates 2021-11-04 19:43:59 +00:00
superbland
57e97019d9 Update tests 2021-11-04 19:35:57 +00:00
superbland
92bcfa5416 Rename method, update logic 2021-11-04 19:35:46 +00:00
superbland
45bdd87224 Tests for getRelativeSize 2021-10-09 16:30:13 +01:00
superbland
11ef3fcfbb Add utility method for getting relative size 2021-10-09 16:25:53 +01:00
Ian Gilman
d1a5e926c6
Merge pull request #2043 from openseadragon/ms-passivewheel
Explicitly set passive:false for wheel event handlers to supress console warnings
2021-09-27 11:38:54 -07:00
Ian Gilman
267c8c65cd Merge branch 'master' into ms-passivewheel 2021-09-27 11:38:31 -07:00
Ian Gilman
ea7057b601 Removed changelog for #2042 and added one for #2037 2021-09-27 11:34:15 -07:00
Ian Gilman
0d1956de05
Merge pull request #2042 from openseadragon/ms-pointerevents
Removed unnecessary touch-action:none and pointer-events:none settings on overlay container DIV
2021-09-27 11:29:28 -07:00
Ian Gilman
8e20ac8fb9
Merge pull request #2037 from openseadragon/ig-event
Attempting to get the original target for click events
2021-09-27 11:26:48 -07:00
Mark Salsbery
2353f96d2c changelog update 2021-09-24 16:23:19 -07:00
Mark Salsbery
9c2f46cb19 Explicitly set passive:false for wheel event handlers to supress console warnings 2021-09-24 16:20:04 -07:00
Mark Salsbery
803ade38d8 Removed touch-action:none setting 2021-09-23 14:35:09 -07:00
Mark Salsbery
8c16ba50b5 changelog update 2021-09-23 14:19:29 -07:00
Mark Salsbery
ca736de339 Removed unnecessary pointer-events:none setting on overlay container DIV 2021-09-23 14:16:39 -07:00
Ian Gilman
ecfe380b17 Fixed spelling of isStoppable 2021-09-22 11:41:17 -07:00
Ian Gilman
6761bd9375 Added documentation for originalTarget 2021-09-22 11:37:55 -07:00
Ian Gilman
f097808c95 Added "funding" to package.json 2021-09-20 11:58:45 -07:00
Ian Gilman
533a8ba532 Attempting to get the original target for click events 2021-09-20 11:41:23 -07:00
Ian Gilman
2398369883 Changelog for #2018 2021-08-12 11:21:58 -07:00
Ian Gilman
3c3b5e8150
Merge pull request #2018 from crydell/updated-match
Navigator is matched to viewer when it succeeds
2021-08-12 11:18:02 -07:00
Ian Gilman
2198dea47d
Merge pull request #2017 from openseadragon/dependabot/npm_and_yarn/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7
2021-08-11 11:35:29 -07:00
crydell
9724174a5b
Navigator is matched to viewer when it succeeds 2021-08-11 12:59:14 +02:00
dependabot[bot]
db64c20837
Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-10 17:47:56 +00:00
Ian Gilman
6cb2c9e7bc Changelog for #2007 2021-07-13 11:16:35 -07:00
Ian Gilman
fc7a4b93f4
Merge pull request #2007 from RammasEchor/master
Add keys to change image source in sequence mode
2021-07-13 11:11:17 -07:00
Luis Nieto
22bb516bc0 Change the way we access some viewer methods 2021-07-12 13:42:31 -05:00
Luis Nieto
1f73dde983 Move change image source's methods inside viewer
Added the methods inside the extend function, so that they appear
as properties. Since we cannot reference properties of an object inside
said object, we extract them as properties when needed.
2021-07-09 16:09:46 -05:00
Luis Nieto
5889f34695 Add keys to change image source in sequence mode
Add the keys 'j' and 'k' to change the image source in the viewer.
- 'j': previous source
- 'k': next source
2021-07-08 23:43:38 -05:00
Ian Gilman
eff2ef6f1b Changelog for #2005 2021-07-08 11:11:58 -07:00
Ian Gilman
4ce125993a
Merge pull request #2005 from RammasEchor/master
Flip the order in which view and navigator add a new item
2021-07-08 11:06:48 -07:00
Luis Nieto
932b826c4d Flip the order in which view and navigator add a new item
This change ensures that the added items are updated first in the
navigator's world. If the viewer's world is updated first, it fires
an add-item event, which in turn it may encounter a setItemIndex call;
since the navigator's world does not have the item yet, an error
occurs.
2021-07-05 15:17:30 -05:00
Ian Gilman
577622a210 Changelog for #2000 2021-07-05 11:48:04 -07:00
Ian Gilman
97b08645f6
Merge pull request #2000 from HerCerM/get-viewer-attached-to-an-element
Provide a static method in OpenSeadragon to get an existing viewer
2021-07-05 11:45:55 -07:00
Hernán Cervera
b0fb8e836d Add tests for OpenSeadragon.getViewer 2021-07-02 12:25:02 -05:00
Hernán Cervera
69aba71f79 Cleanup on viewer destroy and register on Viewer()
Other changes:

- ESLint comment about undeclared variable Map removed, since Map
  is now registered as a global in .eslintrc.*
  // eslint-disable-next-line no-undef
- Mark as private the property _viewers of OpenSeadragon
2021-07-02 07:46:55 -05:00
Hernán Cervera
94f269d6d0 Update globals in .eslintrc files
1. Add Map as a global
2. Use readonly/writable over false/true

Change 2 was done to use non-deprecated values (last paragraph of the section):
https://eslint.org/docs/user-guide/configuring/language-options#using-configuration-files-1
2021-07-02 07:33:55 -05:00
Hernán Cervera
c639dd15e3 Provide a static method in OpenSeadragon to get an existing viewer
From limited testing, this method allows retrieval even when the viewer
was instantiated in a different file.

OpenSeadragon keeps internal private state in _viewers, following the
convention of the underscore prefix for private members.
2021-06-29 19:14:46 -05:00
Ian Gilman
fd85d5e22f Changelog for #1996 2021-06-23 11:54:13 -07:00
Ian Gilman
f6d3676ed6
Merge pull request #1996 from tdiprima/patch-1
Reference globalCompositeOperation doc
2021-06-23 11:51:05 -07:00
Tammy DiPrima
1ca9b16158
correction
difference; not destination
2021-06-22 14:52:06 -04:00
Tammy DiPrima
ef297a2c2c
Reference globalCompositeOperation doc
Fixes openseadragon/openseadragon#1994
2021-06-22 12:32:59 -04:00
Ian Gilman
cac0e5c9bd Changelog for #1995 2021-06-21 11:44:01 -07:00
Ian Gilman
2d3c50065d
Merge pull request #1995 from thewilkybarkid/fullscreen-display
Force the display of body to be block when fullscreen
2021-06-21 11:40:41 -07:00
Chris Wilkinson
e78e6646e6
Force the display of body to be block when fullscreen 2021-06-18 16:24:38 +01:00
Ian Gilman
d04ccddebe
Update FUNDING.yml 2021-05-11 20:58:53 -07:00
Ian Gilman
3265792c3b
Update FUNDING.yml 2021-05-11 20:57:19 -07:00
Ian Gilman
683749f5e6
Merge pull request #1976 from openseadragon/dependabot/npm_and_yarn/lodash-4.17.21
Bump lodash from 4.17.19 to 4.17.21
2021-05-10 11:23:42 -07:00
dependabot[bot]
b95da6801a
Bump lodash from 4.17.19 to 4.17.21
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-07 18:29:49 +00:00
Ian Gilman
5e079ee18b
Merge pull request #1975 from openseadragon/dependabot/npm_and_yarn/grunt-1.3.0
Bump grunt from 1.1.0 to 1.3.0
2021-05-07 11:29:02 -07:00
Ian Gilman
2d7b06fd4a
Merge pull request #1973 from openseadragon/dependabot/npm_and_yarn/handlebars-4.7.7
Bump handlebars from 4.7.6 to 4.7.7
2021-05-07 11:21:35 -07:00
dependabot[bot]
39dfbcc735
Bump grunt from 1.1.0 to 1.3.0
Bumps [grunt](https://github.com/gruntjs/grunt) from 1.1.0 to 1.3.0.
- [Release notes](https://github.com/gruntjs/grunt/releases)
- [Changelog](https://github.com/gruntjs/grunt/blob/main/CHANGELOG)
- [Commits](https://github.com/gruntjs/grunt/compare/v1.1.0...v1.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-07 02:32:45 +00:00
Ian Gilman
2b70908dcb
Merge pull request #1974 from openseadragon/ms-vscode-tasks
Visual Studio Code tasks.json update to version 2.0.0
2021-05-06 14:30:03 -07:00
Mark Salsbery
b1845f9f6d Visual Studio Code tasks.json update to version 2.0.0 2021-05-06 11:53:48 -07:00
Ian Gilman
f775526d81
Merge pull request #1972 from openseadragon/ms-webkit-bug
Workaround for WebKit Pointer Event Implicit Capture Bug
2021-05-06 11:22:42 -07:00
dependabot[bot]
dde7bbf1c6
Bump handlebars from 4.7.6 to 4.7.7
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.7.6 to 4.7.7.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.7.6...v4.7.7)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-06 18:15:33 +00:00
Mark Salsbery
40623f1e99 Re-added the OpenSeadragon.setElementPointerEventsNone() function 2021-05-05 12:43:53 -07:00
Mark Salsbery
72fc528b3c removeContact only on existing tracked pointer 2021-05-04 16:55:37 -07:00
Mark Salsbery
7fbff2cc27 cleanup debug code 2021-05-03 14:02:29 -07:00
Mark Salsbery
a53550ea0e Removed test for move-leave (fly-over, no enter event) 2021-05-03 13:57:14 -07:00
Mark Salsbery
0f1432ce82 changelog update 2021-05-03 13:48:33 -07:00
Mark Salsbery
4b4da7c4a1 Workaround for WebKit Pointer Event Implicit Capture Bug #1962 2021-05-03 13:43:47 -07:00
Mark Salsbery
00187cb5a1 Fixed legacy mouse and touch event handling 2021-05-03 11:38:20 -07:00
Ian Gilman
dba9bcd76c Changelog for #1968 2021-04-19 11:30:13 -07:00
Ian Gilman
16a255ae33
Merge pull request #1968 from maxshuty/master
Fixing issue where the `ajaxHeaders` are not being set for image requests
2021-04-19 11:28:22 -07:00
Max Poshusta
60010628b4 Fixing issue where the ajaxHeaders were not being set for image requests 2021-04-16 06:06:27 -05:00
Ian Gilman
a679213881 Changelog for #1865 2021-04-08 11:34:14 -07:00
Ian Gilman
ed7da66b69
Merge pull request #1865 from gunmiosb/fix774_1861
Fix overlays disappearing in SequentialMode
2021-04-08 11:30:39 -07:00
Ian Gilman
15f8e4c186 Changelog for #1937 2021-03-26 13:47:06 -07:00
Ian Gilman
0a78916ff7
Merge pull request #1937 from ronnymikalsen/1763-a11y-browser-zoom
fix(a11y): draw the level based on pixel density ratio
2021-03-26 13:44:24 -07:00
Ian Gilman
63f8f2e2a9 Changelog for #1903 2021-03-26 13:43:29 -07:00
Ian Gilman
e7d4f87ca9
Merge pull request #1903 from ali1234/flipmode
Implement per-image flipping
2021-03-26 13:40:20 -07:00
ronnymikalsen
3fcd4aeee3 refactor: moved methods that belongs together closer 2021-03-26 12:38:58 +01:00
Alistair Buxton
e6725871b8 Make setFlip() update the navigator
Makes setFlip() raise a bounds change, and makes the navigator copy
the image flip in addition to the other properties, when receiving
the bounds signal.
2021-03-26 11:18:21 +00:00
ronnymikalsen
47802c0bd7 refactor: use pixelDensityRatio in getPixelRatio() 2021-03-26 12:08:50 +01:00
ronnymikalsen
f0cf90df76 fix: removes resize event on destroy 2021-03-26 09:43:30 +01:00
ronnymikalsen
99f87c0bc7 docs: fixed typo and corrected the comment 2021-03-25 14:54:42 +01:00
ronnymikalsen
7ab493d18b fix: made updatePixelDensityRatio private
Prefixed it with a underscore and added @private annotation
2021-03-25 14:41:11 +01:00
Alistair Buxton
eebfdc1391 Improve the flipping example
Adds tiled images to the viewer at creation so that they are properly
centred.

This also checks the current state of the test checkboxes on loading.
Some browsers, notably Firefox, will remember the value of checkboxes
across reloads. This can lead to the checkboxes being out of sync with
with viewer after a reload.

An alternative is to set autocomplete="off" on each checkbox element.
This will force the browser to reset the field to the default specified
in the HTML. However I think checking the actual value is preferable
as it means the defaults are only specified in one place.
2021-03-23 03:22:13 +00:00
Alistair Buxton
409620fa38 Tidy up the tile/image flip check
Don't need double negation and brackets here.
2021-03-23 02:26:06 +00:00
Alistair Buxton
7552806a47 Force reload tiles when the tile's flip doesn't match the image
Flipping an image changes the bounds of each tile. The existing
code assumes that cannot happen. getTile() calculates the tile
bounds the first time it is asked for a particular tile. It then
caches and returns the same time on every subsequent call.

getTile() has a check to test if a tile exists in the cache. If
it does not, the tile is created and inserted. In order to make
tiles be rebuilt after a flip, we only need to check if the tile's
flip matches the image's flip. If not, we can recreate the tile
as if it did not exist.

To make this a bit clearer, the tile's flipped flag is now set
in getTile() rather than positionTile().

This makes setFlip() work.
2021-03-22 06:45:26 +00:00
Alistair Buxton
3161808a9d Add a basic setFlip method to TiledImage
This doesn't fully work - even raising a bounds-change doesn't seem
to be enough.
2021-03-19 17:16:25 +00:00
Alistair Buxton
53052c8c08 Add flipping example
This isn't complete - the flip toggles do not work as setFlip() is
not implemented. The second image is currently always flipped.
2021-03-19 15:45:21 +00:00
Alistair Buxton
b2b95e8556 Correctly set the rightmost tile property when flipped
This ensures that seams are not visible in Firefox and Safari when
the image is wrapped horizontally and also flipped.
2021-03-19 14:49:07 +00:00
Alistair Buxton
3c57063632 Render the flipped columns in reverse order
This completes the per-image flip implementation. Tile bounds are
re-positioned within the image. When rendering, the x ordinals are
remapped to the flipped ones.

To use, set "flipped" on the image instead of the viewer. The code
is compatible with rotations and wrapping.

Implements #1553
2021-03-19 14:49:07 +00:00
Alistair Buxton
afa8c2d1bd Store the flipped state in each tile and render it as such
This will flip each individual tile on a per image bases. However
the tiles are now drawn in the wrong locations. Clipping etc works.
this is implemented for Canvas and HTML renderers.
2021-03-19 14:49:07 +00:00
Alistair Buxton
4b13cf32fd Introduce getTileBounds method for tiledImage
This wraps the implementation in tileSource but provides support for
wrapping. It does not support getting the source bounds.

Using this function instead of the tileSource version allows the
viewport clipping optimization to work with wrapping.
2021-03-19 14:49:07 +00:00
Ian Gilman
58a90f7c39
Merge pull request #1960 from openseadragon/ms-firefox-test
Fixed test "Events: Viewer: preventDefaultAction in dblClickHandler".…
2021-03-18 11:21:15 -07:00
Ian Gilman
7a9e496c64
Merge branch 'master' into ms-firefox-test 2021-03-18 11:20:51 -07:00
Ian Gilman
34aa187e65
Merge pull request #1958 from openseadragon/ms-referencestrip
ReferenceStrip: Fixed destroy() exception and made element focusable
2021-03-18 11:17:58 -07:00
Mark Salsbery
a0ff35a153 more code cleanup 2021-03-17 16:18:49 -07:00
Mark Salsbery
baeb70fdcc code cleanup 2021-03-17 16:15:22 -07:00
Mark Salsbery
6b846249e4 changelog update 2021-03-17 15:24:18 -07:00
Mark Salsbery
b0447979f3 Fixed test "Events: Viewer: preventDefaultAction in dblClickHandler". Fixes #1372 2021-03-17 15:15:36 -07:00
Mark Salsbery
f73420af9b changelog update 2021-03-17 13:06:41 -07:00
Mark Salsbery
e8accfdfaf ReferenceStrip: Fixed destroy() exception and made element focusable 2021-03-17 13:04:13 -07:00
Ian Gilman
16ab337146
Merge pull request #1957 from openseadragon/ms-preventDefault
Added preventDefault option to MouseTracker handlers: ...
2021-03-17 11:30:17 -07:00
Mark Salsbery
8c29f705e6 changelog update 2021-03-16 19:48:08 -07:00
Mark Salsbery
870d9df779 Code cleanup, better scrollHandler handling in Viewer 2021-03-16 19:47:08 -07:00
Mark Salsbery
23d00c92c1 Added preventDefault option to MouseTracker handlers: scrollHandler, keyDownHandler, keyUpHandler, keyHandler 2021-03-16 19:35:22 -07:00
Ian Gilman
733f851ad3
Merge pull request #1956 from openseadragon/ms-gesturesettings
Added dragToPan to the GestureSettings class
2021-03-16 13:40:26 -07:00
Mark Salsbery
f99c9a8a4f Merge branch 'master' into ms-gesturesettings
* master:
  Added changelog for #1954 and bumped upcoming version to 3.0.0
  Update jsdoc, replace Object.assign with $.extend
  Create setImageFormatsSupported function

# Conflicts:
#	changelog.txt
2021-03-16 12:04:58 -07:00
Ian Gilman
3caf4a0da4 Added changelog for #1954 and bumped upcoming version to 3.0.0 2021-03-16 11:53:13 -07:00
Ian Gilman
dfd4ea3b04
Merge pull request #1954 from pandaxtc/set_formats_supported
Create setImageFormatsSupported function
2021-03-16 11:50:57 -07:00
Mark Salsbery
38a6189c20 code cleanup 2021-03-16 11:37:32 -07:00
Mark Salsbery
033c16ca85 Remember to initialize new properties! Code cleanup... 2021-03-16 11:27:48 -07:00
Mark Salsbery
84c23c3729 changelog update 2021-03-16 10:42:54 -07:00
Mark Salsbery
3947c81726 Added dragToPan to the GestureSettings class, implemented in Viewer 2021-03-16 10:40:36 -07:00
Waylon Peng
1ccefd9f6a Update jsdoc, replace Object.assign with $.extend 2021-03-15 16:20:26 -07:00
Ian Gilman
118f4cfed6
Merge pull request #1857 from openseadragon/dependabot/npm_and_yarn/lodash-4.17.19
Bump lodash from 4.17.15 to 4.17.19
2021-03-15 11:20:25 -07:00
Waylon Peng
54721608a4 Create setImageFormatsSupported function 2021-03-12 23:03:18 -08:00
Ian Gilman
96ce058d13
Merge pull request #1953 from openseadragon/ms-preventDefaultAction
Fixed preventDefaultAction Functionality in Viewer Events
2021-03-12 11:44:33 -08:00
Ian Gilman
84b0aea54b Merge branch 'master' into ms-preventDefaultAction 2021-03-12 11:44:10 -08:00
Ian Gilman
dc753985b3
Merge pull request #1951 from openseadragon/ms-mousetracker
MouseTracker preProcessEvent on keydown, keyup, keypress, focus, blur Events
2021-03-12 11:38:57 -08:00
Ian Gilman
bbdcd0579b Merge branch 'master' into ms-mousetracker 2021-03-12 11:37:36 -08:00
Ian Gilman
d4eaefbae1 Changelog refinement 2021-03-12 11:19:29 -08:00
ronnymikalsen
89d4499c2f Merge branch 'master' into 1763-a11y-browser-zoom 2021-03-12 10:21:42 +01:00
Mark Salsbery
d6cec05dee Removed code formatting changes to reduce noise in PR 2021-03-11 21:04:42 -08:00
Mark Salsbery
aa6cc3f5c2 changelog update 2021-03-11 20:34:24 -08:00
Mark Salsbery
57a98c5ec2 Fixed preventDefaultAction functionality tests, removed unused preventDefaultAction instances from MouseTracker 2021-03-11 20:30:50 -08:00
Mark Salsbery
0195c5a5ec preventDefaultAction - removed from MouseTracker, implemented for canvas-pinch and canvas-scroll events 2021-03-11 16:09:57 -08:00
Mark Salsbery
83788cbb75 key down/up event disposition defaults 2021-03-11 16:07:24 -08:00
Mark Salsbery
bed6cfa853 Removed a bit more IE<11 code 2021-03-10 17:18:17 -08:00
Mark Salsbery
802c3c23f7 Merge branch 'master' into ms-mousetracker
* master:
  Changelog update
  Remove support for IE < 11
2021-03-10 16:17:44 -08:00
Mark Salsbery
145d742760
Merge pull request #1950 from rmontroy/ms-IE
Remove support for IE < 11 (#1863)
2021-03-10 16:15:44 -08:00
Mark Salsbery
3b2d5e640c removed some redundant code 2021-03-10 16:10:28 -08:00
Rob Montroy
a96e369c0f Changelog update 2021-03-10 19:07:51 -05:00
Mark Salsbery
f16a7308b4 changelog update 2021-03-10 16:05:22 -08:00
Mark Salsbery
d7d7fda4af Fixed bug preventing keypress events from firing on MouseTrackers with onKeyDown handlers 2021-03-10 15:58:27 -08:00
Mark Salsbery
2bbfa97063 MouseTracker preProcessEvent on key, focus, blur events 2021-03-10 14:53:33 -08:00
Mark Salsbery
c38188927e Added preventDefault option to MouseTracker.contextMenuHandler and Viewer 'canvas-contextmenu' event args 2021-03-10 13:45:15 -08:00
rmontroy
515a155cf6 Remove support for IE < 11 2021-03-10 13:48:09 -05:00
Ian Gilman
ab3f49abe3
Merge pull request #1949 from openseadragon/ms-IE
Remove support for IE < 11 (fixes #1863)
2021-03-10 09:39:08 -08:00
Mark Salsbery
bf0b7842ca Sane pointer coords for navigator tests drag simulations 2021-03-09 11:22:34 -08:00
Mark Salsbery
4f94de0ef6 Changelog update 2021-03-08 16:10:15 -08:00
Mark Salsbery
5eea11e2a5 Fixed simulated drag events in navigator tests 2021-03-08 15:42:12 -08:00
Mark Salsbery
a520da0d55 Changelog update 2021-03-08 13:35:27 -08:00
Mark Salsbery
6fa083d2e0 Remove support for IE < 11 (#1863) 2021-03-08 13:33:05 -08:00
Ian Gilman
7ddc5c93e3
Merge pull request #1872 from openseadragon/ms-mousetracker
MouseTracker Overhaul 2020
2021-03-08 09:56:48 -08:00
Mark Salsbery
459fcb9a4e Merge branch 'master' into ms-mousetracker
* master:
  Changleg for #1878
  Separate properties for buttonGroup and customButtons
  Better handle destruction when navigator in custom location

# Conflicts:
#	src/viewer.js
2021-03-08 09:42:32 -08:00
Mark Salsbery
1c6d67d2d7
Merge pull request #1884 from woodchuck/pr-1878
Better handle destruction when navigator in custom location
2021-03-08 09:35:13 -08:00
Steve Halasz
6c317d0807 Changleg for #1878 2021-03-08 08:18:40 -05:00
Mark Salsbery
ac97d5ff3c MouseTracker minor code formatting fixes 2021-03-07 14:24:32 -08:00
Mark Salsbery
a94841cf97 MouseTracker documentation update 2021-03-05 18:50:40 -08:00
Mark Salsbery
631881cb8a Mousetracker documentation update 2021-03-05 18:39:31 -08:00
Mark Salsbery
6b7fcbdc07 MouseTracker isEmulated documentation update 2021-03-05 18:06:26 -08:00
Mark Salsbery
5674cf47ad Per #1863, dropped support for Internet Explorer < 11 2021-03-04 15:48:13 -08:00
Mark Salsbery
6a1a6275ed MouseTracker: Allow pre-processing of click and dblclick events 2021-03-02 10:29:44 -08:00
Mark Salsbery
ce098f889c Added additional documentation for the zoomPerSecond viewer option 2021-02-10 08:51:17 -08:00
Mark Salsbery
72fe7a9025 Show deprecation warning in console for MouseTracker.exitHandler 2021-02-10 08:32:00 -08:00
Mark Salsbery
4b40400cd3 MouseTracker contextmenu enabled by default 2021-02-10 07:29:36 -08:00
Mark Salsbery
73dc6895f1 Removed commented legacy fix code (#1872) 2021-02-09 16:28:42 -08:00
Mark Salsbery
6f5eddc686 Merge branch 'master' into ms-mousetracker
* master:
  Bump bl from 1.2.2 to 1.2.3
2021-02-09 10:51:42 -08:00
Mark Salsbery
9742c4880d Merge branch 'master' into ms-mousetracker
* master:
  Create FUNDING.yml
  Bump ini from 1.3.5 to 1.3.7
  change log for #1889
  fileFormat is no longer hard coded in Zoomify Tile Source

# Conflicts:
#	changelog.txt
2021-02-09 10:47:48 -08:00
dependabot[bot]
323f653d2a
Bump bl from 1.2.2 to 1.2.3
Bumps [bl](https://github.com/rvagg/bl) from 1.2.2 to 1.2.3.
- [Release notes](https://github.com/rvagg/bl/releases)
- [Commits](https://github.com/rvagg/bl/compare/v1.2.2...v1.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-09 18:46:21 +00:00
Mark Salsbery
8800c96cdc Merge branch 'dependabot/npm_and_yarn/ini-1.3.7' of https://github.com/openseadragon/openseadragon 2021-02-09 10:42:53 -08:00
ronnymikalsen
38435faade revert: url 2021-02-05 12:39:58 +01:00
ronnymikalsen
4a51a4e47c refactor: removed empty line 2021-02-05 12:39:10 +01:00
ronnymikalsen
e7497272fa fix: comment 2021-02-05 12:32:13 +01:00
ronnymikalsen
eb113662e8 refactor: cleanup code 2021-02-05 11:48:08 +01:00
ronnymikalsen
c410b82e65 fix: refresh $.pixelDensityRatio 2021-02-04 13:39:26 +01:00
ronnymikalsen
39811d9300 fix: draw the level based on pixel density ratio 2021-02-04 12:24:01 +01:00
Steve Halasz
0ede8992de Separate properties for buttonGroup and customButtons
This makes it more clear what we're testing for or calling methods on, vs. assigning to this.buttons in both the
useGroup true and false cases.
2020-12-18 13:25:29 -05:00
Ian Gilman
a3d91fe237
Create FUNDING.yml 2020-12-12 17:15:29 -08:00
dependabot[bot]
066de5f13f
Bump ini from 1.3.5 to 1.3.7
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-10 20:04:36 +00:00
Ian Gilman
9510312f5a change log for #1889 2020-11-20 15:22:52 -08:00
Ian Gilman
6648e8fe88
Merge pull request #1889 from abrlam/master
fileFormat is no longer hard coded in Zoomify Tile Source
2020-11-20 15:10:32 -08:00
abraham lam
c6f812bf8c fileFormat is no longer hard coded in Zoomify Tile Source 2020-09-23 21:45:20 -04:00
Steve Halasz
8178687298 Better handle destruction when navigator in custom location 2020-09-10 17:40:30 -04:00
Mark Salsbery
c969f85239 contextmenu 2020-08-25 11:46:35 -07:00
Mark Salsbery
f7cd901672 Merge branch 'master' into ms-mousetracker
# Conflicts:
#	changelog.txt
2020-08-25 09:13:23 -07:00
Mark Salsbery
35b1dcf362 Better setPointerCapture/releasePointerCapture exception handling 2020-08-25 09:11:00 -07:00
Mark Salsbery
5360e65ee9 setPointerCapture/releasePointerCapture exception handling 2020-08-25 08:51:00 -07:00
Ian Gilman
4ab8cc7481 Change log for #1871 2020-08-24 17:39:45 -07:00
Ian Gilman
1772cab251
Merge pull request #1871 from MImranAsghar/change-v2-iiifsize
Replace v2 iiifSize max with full
2020-08-24 17:08:15 -07:00
Mark Salsbery
c22e624a3d isPrimary handling 2020-08-20 16:56:57 -07:00
Mark Salsbery
e7bc65c0af Remove stopImmediatePropagation stub for implementation in future release 2020-08-18 20:03:38 -07:00
Mark Salsbery
f38e0c7967 diff review cleanup 2020-08-14 22:03:23 -07:00
Mark Salsbery
11f4f31ba3 changelog - deprecation to top 2020-08-14 21:37:26 -07:00
Mark Salsbery
dc80264074 changelog update 2020-08-14 20:50:37 -07:00
Mark Salsbery
3630b4d365 Merge branch 'master' into ms-mousetracker
# Conflicts:
#	changelog.txt
2020-08-14 16:47:17 -07:00
Mark Salsbery
b07d47011f preventDefaultAction docs 2020-08-14 16:42:06 -07:00
Ian Gilman
899cd5fba7 Change log update for #1868 2020-08-14 10:25:14 -07:00
Ian Gilman
6357aab370
Merge pull request #1868 from abrlam/master
tileSize is no longer hard corded in Zoomify Tile Source
2020-08-14 10:17:12 -07:00
Mark Salsbery
3769af532b Fixed tests to account for #1459 fix (fire drag-end event even if pointer didn't move) 2020-08-13 19:56:22 -07:00
Mark Salsbery
6b500f1ff2 docs update 2020-08-13 17:21:32 -07:00
Mark Salsbery
8fc83c696a Improved releasing of tracked pointers on destroy()/stopTracking() (#1346) 2020-08-13 16:43:49 -07:00
Mark Salsbery
5a9874e4fa changelog update 2020-08-13 10:09:17 -07:00
Imran Asghar
f567fbfeaf Replace v2 iiifSize max with full
Size parameter is set to max when the tile width and image width are same. But, in version 2, max is not required to be supported by IIIF v2 services on any compliance level.
2020-08-13 12:00:16 -04:00
Mark Salsbery
e74d83f104 New preProcessEvent event 2020-08-12 21:22:48 -07:00
abraham lam
5ea41bd346 Change log for #1704 2020-08-11 18:12:54 -04:00
abraham lam
47463161b4 revised tileSize check as suggested by @msalsbery 2020-08-10 11:22:19 -04:00
abraham lam
820cdb90f8 tileSize is no longer hard corded in Zoomify Tile Source 2020-08-09 21:33:17 -04:00
Mark Salsbery
e7a62c2717 Enhanced pointer capture implementation, IE bug workarounds 2020-07-30 21:08:02 -07:00
gunmiosb
f9fea572a5 Removed unnecessary (style.display !== 'none') check
Fixes issues 774 and 1861
2020-07-29 11:02:25 +02:00
Mark Salsbery
e47f629a9e Undo unnecessary event property changes from previous commit 2020-07-28 20:20:09 -07:00
Mark Salsbery
ef45f1df1d Fixed/enhanced Viewer event object properties 2020-07-25 20:08:52 -07:00
Mark Salsbery
2d4a723854 MouseTracker enhancements, improved IE <=10 support 2020-07-25 18:30:06 -07:00
Mark Salsbery
d2bb480363 Browser sniffing and pointer events fixes and enhancements 2020-07-24 20:05:39 -07:00
dependabot[bot]
47e2dde3a1
Bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-16 04:32:57 +00:00
Ian Gilman
84dd5cd6a7 Change log for #1840 2020-06-30 10:52:38 -07:00
Ian Gilman
94cce30cda
Merge pull request #1840 from openseadragon/ms-grunt-build
Slightly Stricter Linting
2020-06-30 10:49:31 -07:00
Mark Salsbery
f20b7e738c Stricter linting fixes part 1 2020-06-30 10:25:38 -07:00
Mark Salsbery
4492bdd6d8 package-lock 2020-06-25 16:14:57 -07:00
Mark Salsbery
c4351f64e8 stricter linting 2020-06-25 16:01:14 -07:00
Ian Gilman
48a18a6a7d Updated change log for #1832 2020-06-10 10:07:41 -07:00
Ian Gilman
df850c62e8
Merge pull request #1832 from JoFrMueller/pr-1721
Clear viewer and navigator listeners and nodes to avoid memory leaks
2020-06-10 09:41:43 -07:00
Ian Gilman
6b92e92e32
Merge pull request #1835 from openseadragon/dependabot/npm_and_yarn/websocket-extensions-0.1.4
Bump websocket-extensions from 0.1.3 to 0.1.4
2020-06-10 09:36:15 -07:00
dependabot[bot]
947afbb0af
Bump websocket-extensions from 0.1.3 to 0.1.4
Bumps [websocket-extensions](https://github.com/faye/websocket-extensions-node) from 0.1.3 to 0.1.4.
- [Release notes](https://github.com/faye/websocket-extensions-node/releases)
- [Changelog](https://github.com/faye/websocket-extensions-node/blob/master/CHANGELOG.md)
- [Commits](https://github.com/faye/websocket-extensions-node/compare/0.1.3...0.1.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-06 11:46:41 +00:00
Johannes Mueller
5f933b12bb Clear listeners and nodes to avoid memory leaks 2020-06-05 12:27:00 +02:00
Ian Gilman
2ed99077eb Change log for #1814 2020-05-25 13:12:17 -07:00
Ian Gilman
560b8f76ff
Merge pull request #1814 from kenanchristian/master
small doc fix
2020-05-25 13:07:44 -07:00
Kenan Christian Dimas
c20f95ba94
small doc fix 2020-05-12 23:37:37 +07:00
Ian Gilman
0383f8fbeb Change log for #1789 2020-04-30 10:10:38 -07:00
Ian Gilman
db85f77c88
Merge pull request #1789 from TakumaKira/master
Add freeupCanvasMemory method on Viewer.destroy method.
2020-04-30 09:33:56 -07:00
Takuma Kira
9998edb255 Move TileSource.destroy to the right place. 2020-04-17 14:29:19 +09:00
Takuma Kira
c2ed66415f Revert "- Undo removing prefixUrl option in memorycheck-with-simple-image demo."
This reverts commit 344ddb924f.
2020-04-17 13:48:53 +09:00
Takuma Kira
344ddb924f - Undo removing prefixUrl option in memorycheck-with-simple-image demo.
- Define destroy method in TileSource class, call ImageTileSource.freeupCanvasMemory method as optional from TileSource.destroy method and remove TODO.
2020-03-23 11:29:07 +09:00
Takuma Kira
6cb57aa66c - Make ImageTileSource.freeupCanvasMemory method private and call it from ImageTileSource.destroy for consistency.
- Add comment to memorycheck-with-simple-image demo how to reproduce the problem.
- Simplify memorycheck-with-simple-image demo.
2020-03-19 12:02:50 +09:00
Takuma Kira
798e49e4b2 - Add freeupCanvasMemory method on Viewer.destroy method. 2020-03-18 14:37:45 +09:00
Takuma Kira
abc11e3eb6 - Add memorycheck-with-simple-image demo to reproduce "Total canvas memory use exceeds the maximum limit" warning and then "null is not an object (evaluating 'smallContext.drawImage')" error.
(To get them, click Create button 12 times on "iPad Air (3rd generation) -- 13.3" Simulator on Mac with Web Inspector by Safari.)
2020-03-18 14:36:56 +09:00
Ian Gilman
519cbaccde
Merge pull request #1788 from openseadragon/dependabot/npm_and_yarn/acorn-7.1.1
Bump acorn from 7.1.0 to 7.1.1
2020-03-16 11:14:14 -07:00
dependabot[bot]
1dc6720d0d
Bump acorn from 7.1.0 to 7.1.1
Bumps [acorn](https://github.com/acornjs/acorn) from 7.1.0 to 7.1.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/7.1.0...7.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-13 21:45:14 +00:00
Ian Gilman
a700581493
Merge pull request #1785 from openseadragon/dependabot/npm_and_yarn/js-yaml-3.13.1
Bump js-yaml from 3.7.0 to 3.13.1
2020-03-06 11:06:23 -08:00
Ian Gilman
2b6fec38c0
Merge pull request #1784 from openseadragon/dependabot/npm_and_yarn/handlebars-4.7.3
Bump handlebars from 4.0.11 to 4.7.3
2020-03-06 11:06:06 -08:00
Ian Gilman
4c64042bac JSDoc fixes 2020-03-05 10:29:08 -08:00
Ian Gilman
b8c5c42920 Starting on 2.4.3 2020-03-05 10:20:37 -08:00
dependabot[bot]
73e1bbf179
Bump js-yaml from 3.7.0 to 3.13.1
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.7.0 to 3.13.1.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.7.0...3.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-05 18:16:59 +00:00
dependabot[bot]
16706765a2
Bump handlebars from 4.0.11 to 4.7.3
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.11 to 4.7.3.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.0.11...v4.7.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-05 18:16:59 +00:00
Ian Gilman
c4507497f2 Version 2.4.2 2020-03-05 10:15:28 -08:00
Ian Gilman
eff33b64f7 Changelog for #1779 2020-02-24 15:09:33 -08:00
Ian Gilman
4a6226361f
Merge pull request #1779 from jstaab/master
apply pixelDensityRatio after flip
2020-02-24 15:06:40 -08:00
Jasper Staab
0c2c506d88 apply pixelDensityRatio after flip 2020-02-19 18:35:23 -10:00
Ian Gilman
3adb001b9f Changelog for #1772 2020-02-14 10:33:52 -08:00
Ian Gilman
17cabdb923
Merge pull request #1772 from zero41120/feature/1540-cropping-with-multiple-polygons
Feature/1540 cropping with multiple polygons
2020-02-14 10:30:31 -08:00
YSH
4627d59609
Update tiledimage.js 2020-02-13 14:49:14 -08:00
zero41120
3ec9b66bc9 1540 Use OSD defined isArray 2020-02-11 11:34:53 -08:00
YSH
d8651bd268
1540 Update documentation with correct terminology 2020-02-11 11:30:37 -08:00
zero41120
a885c33433 1540 Remove support for array in the demo UI 2020-02-10 16:19:36 -08:00
zero41120
ff70878bb9 1540 Update documentation for setCroppingPolygons 2020-02-10 16:19:09 -08:00
zero41120
9d0c7bd9c9 1540 Remove support for array for cropping 2020-02-10 16:16:19 -08:00
Yansong Hong
956c830f3e 1540 Add point support on the demo page 2020-02-07 16:04:16 -08:00
Yansong Hong
7193f5b445 1540 Add support for xy point object and mixed array 2020-02-07 16:03:40 -08:00
Yansong Hong
b4bf21cda8 1540 Use strict equality instead of loose equality 2020-02-07 13:16:09 -08:00
Yansong Hong
dadef91ce0 1540 Address reviewer comment to better document viewportCoordToDrawerCoord function 2020-02-07 13:15:03 -08:00
zero41120
94183f7f18 1540 Change innerHTML to value to sync user input 2020-02-06 13:50:15 -08:00
zero41120
2d971af445 1540 Add feature to crop tiledImage with multiple polygons 2020-02-06 13:46:14 -08:00
Ian Gilman
d97fe5b1eb Changelog for #1764 2020-01-16 10:26:18 -08:00
Ian Gilman
898b8456d1
Merge pull request #1764 from lutzhelm/iiif-v3beta
Add support for IIIF Image API 3.0 beta
2020-01-16 10:22:50 -08:00
Lutz Helm
8afdce3e00 Add error message if IIIF data @context property contains no IIIF context URI 2020-01-15 09:56:45 +01:00
Lutz Helm
996cf610c3 Add iiif.js tests to coverage.html 2020-01-15 09:50:31 +01:00
Lutz Helm
d5d0b4ce6e Add tests for IIIF, fix error in OpenSedragonIIIFTileSource.canBeTiled 2020-01-07 16:10:14 +01:00
Lutz Helm
11719baaaf Expose private functions in IIIFTileSource for testing purposes 2020-01-06 16:16:05 +01:00
Lutz Helm
456567af59 Fix error in IIIF version detection 2020-01-06 13:42:32 +01:00
Lutz Helm
e851620df4 Add some unit tests for the handling of different IIIF versions 2020-01-06 13:42:32 +01:00
Lutz Helm
ddf42bf224 Improve clarity and remove error in IIIF size param determination 2020-01-06 13:42:32 +01:00
Lutz Helm
07cb95e99b Improve code readability 2020-01-06 13:42:32 +01:00
Lutz Helm
8ae1edfd48 Add support for IIIF Image API 3.0 beta 2020-01-06 13:42:32 +01:00
Ian Gilman
ae4f586714
Merge pull request #1761 from openseadragon/ig-update
Updated NPM packages
2020-01-02 09:58:20 -08:00
Ian Gilman
9c561cc866 audit fix 2019-12-30 10:52:39 -08:00
Ian Gilman
89268e1e57 package lock 2019-12-30 10:51:58 -08:00
Ian Gilman
c01887f3e3 Updated NPM packages 2019-12-30 10:46:44 -08:00
Ian Gilman
cef269d323 Changelog for #1758 2019-12-30 10:07:07 -08:00
Ian Gilman
e732b6b3aa
Merge pull request #1758 from AaronPlave/safely-decodeURIComponent
Safely decode uri component (#1757)
2019-12-30 10:05:58 -08:00
aplave
0953bb4be8 Move $.console declaration up so $.Browser can make use of it 2019-12-22 10:33:15 -08:00
aplave
f7f2f501f5 Wrap URL parameter decoding in try-catch for safety 2019-12-22 10:32:17 -08:00
Ian Gilman
e46d7c64ae Changelog for #1756 2019-12-19 09:53:16 -08:00
Ian Gilman
889bbce108
Merge pull request #1756 from lunit-io/fix-multitouch
prevents multi-touch issue on ipad
2019-12-19 09:51:34 -08:00
SangYeob Yu
4a3f79e305
prevent multi-points errors on ipad 2019-12-18 16:48:15 +09:00
Ian Gilman
e79e132cd9 Changelog for #1754 2019-12-13 11:26:28 -08:00
Ian Gilman
72585d9f43
Merge pull request #1754 from lunit-io/master
fix iPadOS 13 multi-touch issue (#1724)
2019-12-13 11:25:27 -08:00
SangYeob Yu
831c06c499
fix iPadOS 13 multi-touch issue 2019-12-10 16:29:20 +09:00
Ian Gilman
c962613afc Changelog for #1742 2019-11-20 14:18:40 -08:00
Ian Gilman
9767c027ba
Merge pull request #1742 from greggarson/respect-use-canvas-in-thumbnail-viewers
Pass useCanvas value down to reference strip viewers.
2019-11-20 14:16:49 -08:00
Greg Garson
8f0e876d4f Pass useCanvas value down to reference strip viewers. 2019-11-20 10:36:54 -08:00
Ian Gilman
ce75ea9770 Changelog for #1740 2019-11-19 11:47:43 -08:00
Ian Gilman
45a3980a79
Merge pull request #1740 from btzr-io/patch-1
Remove deprecated imageSmoothingEnabled prefixes
2019-11-19 11:46:19 -08:00
Baltazar Gomez
70b2834839
remove deprecated imageSmoothingEnabled prefixes 2019-11-18 16:21:07 -07:00
Ian Gilman
68e9efebe6 gitignore update 2019-10-30 13:49:44 -07:00
Ian Gilman
3bbfbcbc0e Changelog for #1719 2019-10-09 13:37:26 -07:00
Ian Gilman
c732ccd0e4
Merge pull request #1719 from alvaromartmart/master
fix wrong documentation description of `Viewer.world`
2019-10-09 13:36:38 -07:00
alvaromartmart
df45b0fd8c fix wrong documentation description of Viewer.world 2019-10-09 15:13:52 +02:00
Ian Gilman
92904b7ac9 Merge branch 'master' of github.com:openseadragon/openseadragon 2019-10-03 10:14:11 -07:00
Ian Gilman
e0135d5b1d Changelog for #1716 2019-10-03 10:13:50 -07:00
Ian Gilman
dffec1ff5c
Merge pull request #1716 from jayrsmith/patch-1
Correct gestureSettingsPan typo in docs
2019-10-03 10:12:09 -07:00
Jay Smith
d9271a69a4
Correct gestureSettingsPan typo in docs
gestureSettingsPan.zoomToRefPoint
to
gestureSettingsPen.zoomToRefPoint
2019-10-03 14:47:16 +10:00
Ian Gilman
f803fb9ad4 Changelog for #1701 2019-08-23 10:07:07 -07:00
Ian Gilman
0c4a22d301
Merge pull request #1701 from ithaka/master
Pass down ajax configs to reference strip thumbnail viewers
2019-08-23 10:04:47 -07:00
Evan Slawski
a39d20bd70
Merge pull request #1 from ithaka/PLATO-130
PLATO-130: Pass along ajax headers when loading thumbnails in reference strip
2019-08-22 08:25:05 -04:00
Evan Slawski
d970be5f8e PLATO-130: Pass along ajax headers when loading thumbnails in reference strip 2019-08-21 14:07:25 -04:00
Ian Gilman
19d66892ed Updated packages 2019-08-19 10:46:12 -07:00
Ian Gilman
860d2f6ea4 Changelog for #1698 2019-08-19 10:42:18 -07:00
Ian Gilman
bb559d064d
Merge pull request #1698 from alvaromartmart/master
Added missing Rect.degrees and Viewport.setRotation(degrees) documentation
2019-08-19 10:36:30 -07:00
Álvaro Martínez
cc28a0589f added missing Rect.degrees member to deocumentation 2019-08-19 08:19:28 +02:00
Álvaro Martínez
98d5e11fc7 added missing 'degrees' argument to viewport.setRotation() documentation 2019-08-19 08:18:43 +02:00
Ian Gilman
c9b8f52e96 Merge branch 'master' of github.com:openseadragon/openseadragon 2019-08-16 13:26:56 -07:00
Ian Gilman
c5f7b07cb0 Changelog for #1696 2019-08-16 13:26:32 -07:00
Ian Gilman
d1ad926d38
Merge pull request #1696 from alvaromartmart/master
updated viewer.addOverlay and viewer.updateOverlay documentation (#1694)
2019-08-16 11:53:24 -07:00
Álvaro Martínez
5a55ce4583 updated viewer.addOverlay and viewer.updateOverlay documentation (#1694) 2019-08-14 23:50:29 +02:00
Ian Gilman
1b418be606 Changelog for #1686 2019-08-07 10:47:05 -07:00
Ian Gilman
35a48acbcb
Merge pull request #1686 from openseadragon/ig-navigator
Making it possible to manually set the width and height of the navigator
2019-08-07 10:44:14 -07:00
Ian Gilman
3fa1068275 Making it possible to manually set the width and height of the navigator 2019-07-26 11:34:33 -07:00
Ian Gilman
9506d6e539 Changelog for #1676 2019-07-22 15:24:20 -07:00
Ian Gilman
704ac9bae4
Merge pull request #1676 from dmcalpin/master
allow reference strip to work in a web component
2019-07-22 14:48:52 -07:00
David McAlpine
ab33cd502e only run shadow dom test if brower supports shadow dom 2019-07-19 16:29:19 -04:00
David McAlpine
daa387f4b7 allow reference strip to work in a web component 2019-07-18 21:14:49 -04:00
Ian Gilman
ae3b049bb5 Package-lock 2019-07-18 16:29:19 -07:00
Ian Gilman
3f0f167fac
Merge pull request #1678 from dmcalpin/qunit-upgrade
Upgraded grunt-contrib-qunit to ^3.1.0
2019-07-18 14:30:57 -07:00
David McAlpine
998439f29c Upgraded grunt-contrib-qunit to ^3.1.0 which utilizes pupetter instead of phantomjs 2019-07-17 20:02:40 -04:00
Ian Gilman
c7aa6eda84 Starting 2.4.2 2019-07-03 15:01:49 -07:00
Ian Gilman
244790e2a7 Version 2.4.1 2019-07-03 14:56:51 -07:00
Ian Gilman
eafdc452c9 Changelog for #1656 2019-06-24 09:55:27 -07:00
Ian Gilman
079ae0fdcb
Merge pull request #1656 from buda-base/fix-1655
add support for iiif preferredFormats
2019-06-24 09:53:24 -07:00
berger-n
0436795c3b add support for iiif preferredFormats 2019-05-22 11:44:52 +02:00
Ian Gilman
e7108f2360 Changelog for #1648 2019-04-19 10:11:47 -07:00
Ian Gilman
d23ee3479b
Merge pull request #1648 from bandicoot-imaging-sciences/nn-interp2
Fixed: window resize was resetting image smoothing.
2019-04-19 10:11:05 -07:00
yellowtailfan
378c2a160c Fixed: window resize was resetting image smoothing. 2019-04-19 16:26:41 +10:00
Ian Gilman
90f416f1b9 Changelog for #1647 2019-04-18 10:58:00 -07:00
Ian Gilman
229515554c
Merge pull request #1647 from bandicoot-imaging-sciences/nn-interp
Set image smoothing options on sketch canvas.
2019-04-18 10:54:33 -07:00
yellowtailfan
1d3a1e0ccf Set image smoothing options on sketch canvas. 2019-04-18 13:08:05 +10:00
Ian Gilman
517be7db49 Changelog part 2 for #1625. 2019-03-21 09:45:02 -07:00
Ian Gilman
f4c31690da Changelog for #1625 2019-03-19 10:49:52 -07:00
Ian Gilman
fe3e7e5534
Merge pull request #1625 from buda-base/fix-1617-2
fix for #1617 and #1343
2019-03-19 10:45:49 -07:00
Elie Roux
427ac45a8a better description 2019-03-19 18:23:27 +01:00
Elie Roux
db86ae28c8 address PR comments 2019-03-19 18:22:09 +01:00
Elie Roux
3f91bafcf8 rename usedFormat to tileFormat 2019-03-19 08:47:40 +01:00
Elie Roux
0810d97b69 no direct support for formatHints 2019-03-19 08:39:01 +01:00
Elie Roux
81e030e653 add formatHints options 2019-03-14 21:03:28 +01:00
Elie Roux
f8022385f7 fix qunit error 2019-03-14 19:58:38 +01:00
Elie Roux
b38f5d609b use === and !== 2019-03-14 19:10:40 +01:00
Elie Roux
e4987f9701 fix too agressive canonicalization 2019-03-14 16:10:28 +01:00
Elie Roux
661fef19b5 fix for #1617 and #1343 2019-03-14 14:04:12 +01:00
Ian Gilman
6426f6fc21 Updated #1595 changelog 2019-02-13 09:28:44 -08:00
Ian Gilman
71e3c08116 Changelog for #1595 2019-02-13 09:26:08 -08:00
Ian Gilman
d003aab06f
Merge pull request #1595 from doutsh/pr/imagesmoothing
[WIP] Fixing "imageSmoothingEnabled" resetting to 'True' (should fix #1593)
2019-02-13 09:17:45 -08:00
Yochay Doutsh
712e3d8dd1 Moved property from prototype to constructor and renamed private function 2019-02-10 14:57:35 +02:00
Yochay Doutsh
ef068e9229 split setImageSmoothingEnabled into private and public parts, change floor to round 2019-02-07 11:40:34 +02:00
Yochay Doutsh
1e538e665d imageSmoothingEnabled is being set to correct value after resize 2019-02-06 17:47:07 +02:00
Yochay Doutsh
578ff36a06 WIP: _calculateCanvasSize outputs are floored, but imageSmoothingEnabled is still initalized on resize 2019-02-06 16:04:33 +02:00
Ian Gilman
869a3f6a13
Merge pull request #1577 from openseadragon/update
Updating to latest NPM dependencies.
2018-12-11 13:26:38 -08:00
Ian Gilman
f805974a04 Updating to latest NPM dependencies. 2018-12-11 12:02:24 -08:00
Ian Gilman
81a634a618 Changelog for #1562. 2018-11-01 09:13:15 -07:00
Ian Gilman
a6e10e4ac4
Merge pull request #1562 from 96dpi/master
Fixed issue #1557: Typo in viewer.js
2018-11-01 09:09:43 -07:00
Andreas Levers
21cfb0acf4
Fixed issue #1557: Typo in viewer.js
Fixed a typo in areControlsEnabled
2018-10-31 18:15:48 +01:00
Ian Gilman
7abb2211eb Changelog for #1560 2018-10-31 09:47:42 -07:00
Ian Gilman
6f54c67bae
Merge pull request #1560 from superbland/disable_empty_label
Don't insert label element until this feature is fully implemented.
2018-10-31 09:45:27 -07:00
superbland
3049a81c94 Don't insert label element until this feature is fully implemented. 2018-10-31 15:37:57 +00:00
Ian Gilman
f6559e6c17
Merge pull request #1556 from stweil/lgtm
Add missing space between sentences in error message
2018-10-29 09:44:47 -07:00
Stefan Weil
3227a152eb Add missing space between sentences in error message
This fixes an issue reported by LGTM:

    This string appears to be missing a space after 'deprecated.'.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-28 22:02:45 +01:00
Ian Gilman
0948a8b376 Changelog for #1549 2018-10-22 11:20:15 -07:00
Ian Gilman
65c8ff71a2
Merge pull request #1549 from nelsonn3c/fix-flip-slides-when-using-opacity-and-multiple-slides
Fix flip slides when using opacity and multiple slides
2018-10-22 11:18:39 -07:00
Nelson Campos
dc8331e641 Clean unnecessary code.
Clean tiled image's flip property and methods.
2018-10-19 15:49:27 +01:00
Nelson Campos
546efcc1db Fix undefined return from getFlip
Navigator setFlip was looking for tiledImage flip state using the getFlip method.
The item this.viewer.world._items[0] can be undefined and trying to use its methods would fail.
2018-10-19 10:58:47 +01:00
Nelson Campos
4fe5a84170 Fix flipped debug drawing context 2018-10-18 15:29:08 +01:00
Nelson Campos
2670f62892 Fix navigator flip transformation
Flip transformation wasn't correctly applied on navigator for all images when its tileSource is flipped by default.
2018-10-18 12:04:52 +01:00
Nelson Campos
132c68c8bb Create getFlip function to retrieve tiledImage flipped state 2018-10-17 12:45:10 +01:00
Nelson Campos
bfd170689d Fix navigator flipped drag and click handlers 2018-10-17 11:10:37 +01:00
Nelson Campos
cf20d9fb43 Fix drawer clearance bounds 2018-10-16 17:29:44 +01:00
Nelson Campos
7a7ba07902 Moved flip call to the end of drawTiles method. Just code backup 2018-10-02 16:57:31 +01:00
Nelson Campos
49e3ef6885 Code backup. Bug Semi-fix. 2018-10-01 17:03:34 +01:00
Nelson Campos
ab98173a13
Merge pull request #1 from openseadragon/master
Update Master
2018-09-20 14:06:53 +01:00
Ian Gilman
defc2ccded
Merge pull request #1535 from UCLALibrary/timeout-configuration
ImageJob timeout configuration debugging help
2018-09-11 09:08:43 -07:00
Mark Allen Matney, Jr
f94aa78cc6 Improved ImageJob timeout error logging 2018-09-10 00:59:25 -07:00
Mark Allen Matney, Jr
42060a49b5 Added HTML tests for ImageJob timeout 2018-09-10 00:58:24 -07:00
Ian Gilman
e72a60e5bc
Merge pull request #1529 from stweil/typos
Fix some typos in comments (found by codespell)
2018-09-04 11:10:07 -07:00
Stefan Weil
6ea7ec261d Fix more similar typos in comments
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-01 14:36:31 +02:00
Stefan Weil
e3775acbe0 Fix typo in comment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-01 14:34:14 +02:00
Stefan Weil
0e2f5d49ef Fix some typos in comments (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-01 10:59:20 +02:00
Ian Gilman
00551e6c2b Changelog for #1524 2018-08-22 09:26:12 -07:00
Ian Gilman
144befb44c
Merge pull request #1524 from jil24/master
Adds option to set rotation increment for nav buttons and keyboard
2018-08-22 09:24:25 -07:00
Jonathan Lake
2dd8a65e63 Adds option to set rotation increment for nav buttons and keyboard; Issue 1518 2018-08-21 17:39:46 -04:00
Ian Gilman
105801b6fa Changelog for #1515. 2018-08-10 09:51:15 -07:00
Ian Gilman
746d6f4906 Merge branch 'master' of github.com:openseadragon/openseadragon 2018-08-10 09:49:45 -07:00
Ian Gilman
8eee617ed4
Merge pull request #1515 from Fabroh/master
Fix issue #1504
2018-08-10 09:48:55 -07:00
Ian Gilman
3bc3be5c19 Changelog for #1507 2018-08-10 09:40:07 -07:00
Ian Gilman
959f8e739a
Merge pull request #1507 from jetic83/master
Enable to switch off smoothed rendering of images on canvas
2018-08-10 09:31:26 -07:00
Fabien Rohman
b055f6fe54 Fix issue #1504 2018-08-10 10:23:33 +02:00
Peter
9511cf2d00 Removed save/restore for canvas 2018-08-10 03:46:25 -04:00
Peter
d892dcfbc7 Repaired Minor issues 2018-08-08 20:05:46 -04:00
Peter
9968025782 Simplified imageSmoothingEnabled Option. The option can be set during viewer creation and also later with the function viewer.drawer.setImageSmoothingEnabled(). 2018-08-03 18:47:16 -04:00
Peter
17e25c0428 Revert "Added switch to smoothly or unsmoothly render images on the canvas: imageSmoothingEnabled (true (default), false). Medical images can thus be displayed in more pixelated, unsmoothed manner."
This reverts commit 19f7b80dca.
2018-08-03 17:29:48 -04:00
Peter
19f7b80dca Added switch to smoothly or unsmoothly render images on the canvas: imageSmoothingEnabled (true (default), false). Medical images can thus be displayed in more pixelated, unsmoothed manner. 2018-07-30 20:00:58 -04:00
Peter
d353580471 Merge branch 'master' of https://github.com/openseadragon/openseadragon 2018-07-23 13:58:23 -04:00
Ian Gilman
1cdda569d5 Started 2.4.1 2018-07-20 09:47:45 -07:00
Ian Gilman
446af4dc94 Version 2.4.0 2018-07-20 09:43:13 -07:00
Ian Gilman
2bc102de33
Merge pull request #1492 from openseadragon/dzi
Making the DziTileSource honor minLevel.
2018-07-06 15:43:03 -07:00
Ian Gilman
071b865765 Tweaks to minLevel DZI patch 2018-07-06 13:17:46 -07:00
Ian Gilman
452e50c8d8 Making the DziTileSource honor minLevel. 2018-07-03 09:40:10 -07:00
Ian Gilman
68d08d8748 Merge branch 'master' of github.com:openseadragon/openseadragon 2018-06-29 10:37:40 -07:00
Ian Gilman
890d9bc599 Changelog for #1416. 2018-06-29 10:37:27 -07:00
Ian Gilman
47e95b4d26
Merge pull request #1416 from francescocretti/hotfix/minimapClick
Navigator minimap onClick vertical/horizontal pan fix
2018-06-29 10:35:41 -07:00
Ian Gilman
e1bb9814a2 Changelog for #1484. 2018-06-29 10:29:08 -07:00
Ian Gilman
7b73768b3b
Merge pull request #1484 from francescocretti/hotfix/minimapDrag
preventDefaultAction in canvas-drag on minimap
2018-06-29 10:26:45 -07:00
Francesco Cretti
9c2211f93c
Merge branch 'master' into hotfix/minimapClick 2018-06-26 14:25:02 +02:00
Francesco Cretti
ed169086e7 Doc minor fix and trailing space removed 2018-06-26 14:07:52 +02:00
Francesco Cretti
0bdc2df8ff Documentations corrected 2018-06-26 13:51:33 +02:00
Peter
7108f40cce Merge branch 'master' of https://github.com/openseadragon/openseadragon 2018-06-21 09:46:46 -04:00
Francesco Cretti
02ddb7a2f7 preventDefaultAction in canvas-drag on minimap 2018-06-20 18:45:38 +02:00
Francesco Cretti
2eb6eaf52f preventDefaultAction support 2018-06-20 18:07:43 +02:00
Ian Gilman
0043956e2a
Merge pull request #1479 from alanaberdeen/master
Documentation addition for viewer.world
2018-06-15 13:26:04 -07:00
Ian Gilman
c5085f92f5 Changelog for #1480 2018-06-15 13:17:35 -07:00
Ian Gilman
beecde11d9
Merge pull request #1480 from mauguedes/customize-navigator-background-and-border-colors
Add CSS configuration options for the navigator minimap
2018-06-15 13:16:16 -07:00
Alan Aberdeen
a691fbb37e Add note that source in viewer.js is depreciated
source is in viewer.js for backwards compatibility. It is not an official part of the API and should not be relied upon.
2018-06-14 21:50:45 +01:00
evilricio
6c2c5ba498 Add CSS configuration options for the navigator minimap
This patch adds CSS configuration options for the navigator minimap, namely:
- background color
- opacity
- outside border color
- display region border color

If unspecified, the previous default values are kept as default as not to break previous implementations.
2018-06-14 17:38:30 +01:00
Alan Aberdeen
2a67484358 Add *correct* documentation for source on Viewer 2018-06-13 20:27:57 +01:00
Alan Aberdeen
0c4eafb669 Revert "Add documentation for source on Viewer"
This reverts commit 99b7c3d2e5.
2018-06-13 20:25:00 +01:00
Alan Aberdeen
99b7c3d2e5 Add documentation for source on Viewer 2018-06-13 20:15:51 +01:00
Alan Aberdeen
002c1fcc65 Add documentation for .source on TiledImage 2018-06-13 20:11:26 +01:00
Alan Aberdeen
1024a2e1d8 Documentation addition for viewer.world 2018-06-13 12:32:10 +01:00
Ian Gilman
cd0a4aee16 Changelog for #1441 2018-06-07 09:50:52 -07:00
Ian Gilman
e01e36794d
Merge pull request #1441 from nelsonn3c/feature/flip
Adds flip/mirror slides feature.
2018-06-07 09:48:59 -07:00
Nelson Campos
0023ae9801 Put flip tests out from the original tests in their own test cases 2018-06-07 11:41:45 +01:00
Peter
532b0b95af Merge branch 'master' of https://github.com/openseadragon/openseadragon 2018-06-06 15:19:12 -04:00
Ian Gilman
8f0711e26e Changelog #1470 2018-06-06 11:51:18 -07:00
Nelson Campos
6a2cd1ff84 Adds some more tests 2018-06-06 17:56:37 +01:00
Nelson Campos
3615ad412f Adds some more tests and tries to solve some code bugs.
A new variance parameter was added to assertPointsEquals function.

Variance value was set on loopingTestHelper function (1e-15).

The following tests were modified to execute tests on flipped viewport:
* 'panBy'
* 'panTo'
* 'zoomBy with ref point'
2018-06-06 17:03:40 +01:00
Ian Gilman
c3b9293036
Merge pull request #1470 from Dvidan/bug/overlap_transparent
Transparent image overlap when using Overlap=0 in dzi
2018-06-04 16:01:57 -07:00
Torbjörn Kvist
bbe34e0816 Remove offset for transparent tile. 2018-06-04 11:16:23 +02:00
Peter
e2d2215374 Merge branch 'master' of https://github.com/openseadragon/openseadragon 2018-06-01 08:51:10 -04:00
Torbjörn Kvist
f509f43472 Change offset of clearRect. 2018-05-18 07:42:24 +02:00
Ian Gilman
541c7c5fe5
Merge pull request #1466 from openseadragon/update
Updated to latest packages (and fixed lint errors)
2018-05-15 10:10:28 -07:00
Ian Gilman
ee1ed31d8c Security audit 2018-05-14 11:59:20 -07:00
Ian Gilman
24be785bbd Updated to latest packages (and fixed lint errors) 2018-05-11 10:53:16 -07:00
Peter
4ca7a94daa Merge branch 'master' of https://github.com/openseadragon/openseadragon 2018-04-29 13:34:49 -04:00
Ian Gilman
ceb828dd06
Merge pull request #1429 from openseadragon/ig-square
Fixed issue with square tile code on IE
2018-04-25 09:35:11 -07:00
Nelson Campos
a31587df2f Adds tests about flip methods 2018-04-17 16:23:21 +01:00
Nelson Campos
43d3949dd1 Refactored 90 degrees rotation button's actions. 2018-04-17 11:19:15 +01:00
Peter
576d0eb317 Merge branch 'master' of https://github.com/openseadragon/openseadragon 2018-04-16 19:10:05 -04:00
Ian Gilman
26ec933d7d Changelog for #1370 2018-04-16 09:47:15 -07:00
Ian Gilman
b63c77fdb9
Merge pull request #1370 from avandecreme/tile_at_point
Fix getTileAtPoint epsilon precision
2018-04-16 09:44:25 -07:00
Nelson Campos
ec0f55098a Simplifies viewport setFlip function. 2018-04-13 17:51:43 +01:00
Nelson Campos
c2fd5322e2 Code cleaning and function calls reorganization 2018-04-12 18:24:11 +01:00
Nelson Campos
b7badc7d32 Documentation comments fix 2018-04-12 10:39:37 +01:00
Nelson Campos
194d1c0606 Documentation comments 2018-04-12 10:36:34 +01:00
Nelson Campos
84dc60632c code simplification and impro^Cments on toggleFlip function 2018-04-11 18:24:01 +01:00
Nelson Campos
b8a4f7e7a0 Reorganizes code to match standard calls of viewport object methods.
A new viewport function was created (toggleFlip()) to change viewport's flip state and demand new viewers drawing.

The onFlip function exists on openseadragon to handle flip control button press and demand viewport toggle flip.
2018-04-11 11:25:46 +01:00
Nelson Campos
6e2c1258df Comments on functions 2018-04-10 12:04:58 +01:00
Nelson Campos
7e5c9e1897 Changes flip store object from viewer to viewport.
More than changing the store object of flip state, the code was simplified and the onFlip function from openseadragon was changed to receive a viewer argument.
TiledImage had a flipped variable wrongly stored.

From now on, flipped state must be read from the viewport object.
2018-04-10 11:51:06 +01:00
Nelson Campos
7c7d714839 Changes back default state values 2018-04-09 15:09:29 +01:00
Nelson Campos
f65dbd3a39 Changes back showFlipControl and showNavigator variables to false default state 2018-04-09 15:06:29 +01:00
Nelson Campos
6e4012976b Adds two helpers for style formating and updates onCanvasKeyPress method.
There were created a new helper method "setDisplayTransform" to change navigator styling.
Also, a new general function "setElementTransform" was created to help on element styling.

For this commit, I also made some changes on viewer onCanvasKeyPress method:
- r is rotating the image clockwise;
- R is rotating the image counter clockwise;
- Freed "F" keycode to other purposes (like filters or others).
2018-04-06 11:52:10 +01:00
Ian Gilman
4b36e27875 Added demo/temp folder to gitignore 2018-04-04 10:13:37 -07:00
Nelson Campos
71fd747051 Adds flip/mirror slides feature.
This commit adds full support for a new OpenSeaDragon(OSD) feature - Mirror/Flip.
In order to fully support this new feature, the following OSD objects had to be modified:
        - drawer.js:
        - navigator
        - openseadragon
        - strings
        - tiledImage
	- viewer

Additionally, a new flip button was created (similar to the existing ones).

Flip Logic
        Whenever the state is flip button is pressed, flip state is toogled, inverting all the controls and displays (the rotation direction is inverted as well).
        This means that all viewer coordinates (including user inputs) must me inverted too.

Summary of modifications
        - drawer.js: modified _offsetForRotation to invert rotation angle on flipped state. Added a _flip method to scale/mirror canvas context.
        - navigator.js: adds full flip support and inverts nagivator inputs.
        - openseadragon.js: new buttons, flip state variable and showFlipControl variable.
        - strings.js: flip tool help tips.
        - tiledImage.js: flips the actual drawing canvas.
	- viewer.js: Added keyboardshortcuts to rotate 90degrees (r/R) and flip image (f/F). flip button state is stored here and flip order is set.

The flipped state is stored on viewer object.
2018-04-04 16:08:13 +01:00
Ian Gilman
02a397638c Fixed test errors 2018-04-02 11:09:23 -07:00
Ian Gilman
7ba516b30a Fixed issue with square tile code on IE 2018-03-27 09:48:18 -07:00
Ian Gilman
e5355abafe Changelog for #1426 2018-03-23 09:22:45 -07:00
Ian Gilman
49fe216447
Merge pull request #1426 from openseadragon/ig-square
Now supporting square edge tiles that are padded rather than cropped
2018-03-23 09:20:15 -07:00
Ian Gilman
075a37ce8c Now supporting square edge tiles with padding 2018-03-21 14:07:00 -07:00
Peter
00f9acf5e4 Merge remote-tracking branch 'refs/remotes/openseadragon/master' 2018-03-20 06:58:12 -04:00
Ian Gilman
dccd038f6c Changelog for #1423 2018-03-19 10:21:19 -07:00
Ian Gilman
053332e282
Merge pull request #1423 from jetic83/master
Added optional zoom in the middle of the image instead of pointer position.
2018-03-19 10:19:27 -07:00
schueffp@mskcc.org
4889d63534 removed trailing spaces error 2018-03-16 11:44:42 +01:00
schueffp@mskcc.org
85d8d9ee32 Added option zoomToRefPoint for all gestureSettings
This is an option for different applications or user preferences:
If zoomToRefPoint in a gesture setting is true (default), the zoom is
centered at the pointer position. Otherwise, the zoom is centered at the
canvas center.
2018-03-16 11:29:16 +01:00
schueffp@mskcc.org
251ab23cc0 Merge remote-tracking branch 'refs/remotes/openseadragon/master' 2018-03-16 08:37:23 +01:00
Francesco Cretti
57654cf1cf raise event for navigator click 2018-03-11 13:24:29 +01:00
Francesco Cretti
12be95c8c3 getCenter fixed when clicking on minimap 2018-03-11 13:05:19 +01:00
Ian Gilman
c915a5966f Changelog for #1414 plus documentation tweak 2018-03-07 09:28:20 -08:00
Ian Gilman
6c7fcb1063
Merge pull request #1414 from francescocretti/hotfix/keyboardPatch
keyboard handlers patch
2018-03-07 09:23:45 -08:00
Francesco Cretti
027dac0d8e navigato minimap onClick vertical/horizontal pan fix 2018-03-07 11:25:33 +01:00
Francesco Cretti
44ca4a79b8 trailing spaces removed 2018-03-07 11:07:29 +01:00
Francesco Cretti
34f691df28 Event name and documentation 2018-03-07 10:32:31 +01:00
Francesco Cretti
2b878cbdbf keyboard handlers patch 2018-03-06 15:51:22 +01:00
Ian Gilman
784f470744 Changelog for #1401 2018-02-26 13:37:08 -08:00
Ian Gilman
23ec3284b9
Merge pull request #1401 from hyperknot/master
Fixed IIIF options.maxLevel calculation
2018-02-26 11:59:18 -08:00
Zsolt Ero
59f15508b9 removed old files from test 2018-02-16 21:17:52 +01:00
Zsolt Ero
d44e907910 added tests for scaleFactors [1] 2018-02-16 21:14:28 +01:00
Zsolt Ero
8e06e5eb39 fixed IIIF options.maxLevel 2018-02-16 21:09:56 +01:00
Ian Gilman
01408a4744
Merge pull request #1374 from nein09/bug-1331
Bug 1331
2018-01-23 09:23:46 -08:00
nein09
3a0e01479f Call equalsWithVariance correctly 2018-01-19 14:39:17 -08:00
nein09
fd81da2f7d Adjust timeout downward 2018-01-19 14:38:56 -08:00
nein09
c53bd18290 Revert timeout changes 2018-01-18 10:45:56 -08:00
nein09
ac013513a2 Comment out failing tests (opened a bug) 2018-01-04 08:35:40 -08:00
nein09
aaec7c9526 Implement code coverage without grunt-qunit-istanbul 2018-01-02 08:32:45 -08:00
nein09
80e8065e2f More work on navigator tests 2018-01-02 08:32:45 -08:00
nein09
b8a28ce838 Navigator tests 2018-01-02 08:32:45 -08:00
nein09
6f789e7e88 Everything but the navigator tests 2018-01-02 08:32:45 -08:00
nein09
b096e369d0 Controls and viewport 2018-01-02 08:32:45 -08:00
nein09
52a275808f Multi-image and overlays tests 2018-01-02 08:32:45 -08:00
nein09
76669f8a65 Update units 2018-01-02 08:32:45 -08:00
nein09
9f39f7bf03 Convert events tests 2018-01-02 08:32:45 -08:00
nein09
b4b1ec8825 Make timeWatcher args make more sense, add utils tests 2018-01-02 08:32:45 -08:00
nein09
73be93b995 Formats tests 2018-01-02 08:32:45 -08:00
nein09
c29715cbe8 Update QUnit syntax in strings tests 2018-01-02 08:32:45 -08:00
nein09
2af7db43a4 Update test helpers, basic tests, and polyfill tests 2018-01-02 08:32:45 -08:00
nein09
bfb00656cc Fix up QUnit syntax for ajax-tiles 2018-01-02 08:32:45 -08:00
nein09
343e990738 Replace grunt-qunit-istanbul with grunt-contrib-qunit 2018-01-02 08:32:45 -08:00
nein09
6dfeddb4b7 Update grunt packages and remove istanbul. 2018-01-02 08:32:45 -08:00
Antoine Vandecreme
517e1feae8 Fix getTileAtPoint epsilon precision
Fix #1362
2017-12-24 10:57:57 +01:00
Ian Gilman
2155a0d157 Changelog for #1364 2017-12-15 10:08:34 -08:00
Ian Gilman
c1edcac2a3
Merge pull request #1364 from j-hudecek/master
Added option pixelsPerArrowPress that sets the speed of arrow keys
2017-12-15 10:06:47 -08:00
Jan Hudecek
5ddcfa438e Added option pixelsPerArrowPress that sets the speed of movement by arrow keys 2017-12-14 17:10:10 +01:00
Ian Gilman
b0f6b5d049 changelog for #1330 2017-10-30 09:22:59 -07:00
Ian Gilman
854086a62f
Merge pull request #1330 from ncmikkelsen/master
Fix for #1085 - goToPage : event sent before updating the index
2017-10-30 09:17:42 -07:00
Ian Gilman
324ed1f045
Merge pull request #1332 from robhicks/master
Doc clarification for getting instance of TitledImage
2017-10-30 09:13:47 -07:00
Nikolaj Mikkelsen
a7cc7bbfba Refactor: move the documentation comment down with the event 2017-10-26 22:36:19 +02:00
Rob Hicks
2db5cfeebd move TiledImage instance instructions to function description 2017-10-26 12:36:30 -06:00
Rob Hicks
d59e237dda more doc tweaks 2017-10-25 14:55:28 -06:00
Rob Hicks
12e1869f99 add clarifications to api docs for TiledImage 2017-10-25 14:51:17 -06:00
Nikolaj Mikkelsen
1a6aac578b Fix for #1085 - goToPage : event sent before updating the index 2017-10-24 16:14:20 +02:00
Ian Gilman
557ff005a2 Changelog for #1319 2017-10-06 10:04:15 -07:00
Ian Gilman
a0beedc860 Merge pull request #1319 from jetic83/master
Solves issue #1318 for transparent TiledImages
2017-10-06 10:02:23 -07:00
Peter
44b108f00e changed conditional if to else in draw function 2017-10-05 14:44:56 -04:00
Peter
f64388b038 Solves issue #1318 : transparent tiledImages get _needsDraw = false in the draw function. 2017-10-04 16:11:08 -04:00
Peter
628cfad52a Merge remote-tracking branch 'refs/remotes/openseadragon/master' 2017-10-04 15:41:20 -04:00
Ian Gilman
f471040ddf Changelog for #1288 2017-09-19 10:13:21 -07:00
Ian Gilman
ed42a7feee Merge pull request #1288 from ooystein/dblClick
Manage preventDefaultAction flag inside canvas-double-click viewer event
2017-09-19 10:11:14 -07:00
Ian Gilman
365b3ee8ba In progress for 2.4.0 2017-09-19 09:58:14 -07:00
Ian Gilman
08414cdada Version 2.3.1 2017-09-19 09:54:38 -07:00
Ian Gilman
d13781baf9 Changelog for #1305 2017-09-19 09:52:09 -07:00
Ian Gilman
1cb557b2cb Merge pull request #1305 from openseadragon/seams
Addressing seams that appear in wrap mode on Safari and Firefox
2017-09-14 21:19:52 -07:00
Ian Gilman
a49bbbcb06 Addressing seams that appear in wrap mode on Safari and Firefox 2017-09-08 14:03:40 -07:00
Cameron Baney
4301254fa0 Allow user to add element option for navigator 2017-09-05 14:05:36 -04:00
Oeystein Lygre
d1ea179296 manage preventDefaultAction flag in canvas-double-click viewer event
Trigger the canvas-double-click event before default double tap to zoom happens on the viewer
2017-08-22 23:11:12 +02:00
Ian Gilman
36dd37b931 Changelog for #1286 2017-08-10 10:39:02 -07:00
Ian Gilman
a1b27bcb33 Merge pull request #1286 from mkoesem/master
Fix placeholderFillStyle on tiledImage has no effect #1283
2017-08-10 10:37:09 -07:00
Mutlu Koesem
8a4ef0cc2e Fix placeholderFillStyle on tiledImage has no effect 2017-08-09 11:39:17 +02:00
Ian Gilman
7f5a18e46a Changelog for #1280 2017-08-07 10:54:02 -07:00
Ian Gilman
e4a3e0e5ef Merge branch 'master' into prevent 2017-08-07 10:51:53 -07:00
Ian Gilman
248a001bb6 Merge pull request #1280 from avandecreme/fix_tile_at_point
Fix getTileAtPoint floating point computation error
2017-08-07 10:50:50 -07:00
Antoine Vandecreme
cd4c4d38ed Fix getTileAtPoint floating point computation error 2017-08-06 15:00:50 +02:00
Ian Gilman
5196dc0450 Merge pull request #1278 from openseadragon/prevent
Fixed a problem with preventDefaultAction for the canvas-drag event
2017-08-04 10:06:09 -07:00
Ian Gilman
db79a6af1e Changelog for #1278 2017-08-03 10:49:52 -07:00
Ian Gilman
49ee98bbb0 Fixed a problem with preventDefaultAction for the canvas-drag event 2017-08-03 10:47:35 -07:00
Ian Gilman
a77ffd1133 Changelog for #1271 2017-08-01 13:11:09 -07:00
Ian Gilman
8d2d0552a2 Merge pull request #1271 from jetic83/master
different colors for different tiled images in debug mode.
2017-08-01 13:07:22 -07:00
Peter
910eaf6da6 changed indexOfImage to colorIndex 2017-07-31 17:43:10 -04:00
Peter
f268607b54 more colors for the default case and added documentation. 2017-07-31 17:36:25 -04:00
Peter
6265d389b9 remove BOM 2017-07-31 17:05:18 -04:00
Peter
175463a0f6 different colors for different tiled images in debug mode.
If there are multiple tiled images as overlay, it might be important to
see how they are loaded. Different colors in the debug mode for the
different tiledImages visualize that. DebugGridColors have to be given
as a sting array with a color for each tiledImage. However, shorter
arrays will be recycled without error. Also, single strings are treated
as single entry arrays, for backwards compatibility.
2017-07-26 10:57:17 -04:00
Peter
d8f761f509 Merge remote-tracking branch 'refs/remotes/openseadragon/master' 2017-07-26 10:39:20 -04:00
Ian Gilman
3d8a03c177 Merge pull request #1258 from dlong500/installfromgithub
Compatibility with direct npm/yarn installation from Github forks/branches
2017-07-20 10:19:09 -07:00
Ian Gilman
bb8631bbe8 Merge pull request #1259 from openseadragon/ian
Fixed doc comments for 2.3.0
2017-07-18 16:58:27 -07:00
Ian Gilman
b0ed8444c1 Removed Doc comment for OpenSeadragon function 2017-07-18 16:39:43 -07:00
Ian Gilman
ca4550d76e Doc comment fixes 2017-07-18 16:22:26 -07:00
Davison Long
1d70f86ca1 add documentation for installing from Github forks/branches 2017-07-17 20:23:53 -04:00
Davison Long
3dec5bb98a make project compatible with direct npm/yarn installation from github repo 2017-07-17 19:38:18 -04:00
Ian Gilman
b49fef332c Next version number 2017-07-14 16:48:16 -07:00
Ian Gilman
e4fd781199 Updated grunt compress so it would make tars properly 2017-07-14 16:46:55 -07:00
Ian Gilman
bc6e20e62f Version 2.3.0 2017-07-14 16:15:54 -07:00
Ian Gilman
285f22d84c Merge branch 'master' of github.com:openseadragon/openseadragon 2017-07-14 16:04:43 -07:00
Ian Gilman
8195b3835c Updated changelog for release 2017-07-14 16:04:23 -07:00
Ian Gilman
e37a73824d Merge pull request #1249 from openseadragon/ian
More forgiving check for DZI schema
2017-07-13 17:21:19 -07:00
Ian Gilman
65b41c3f6e Looser check for DZI schema 2017-07-13 17:16:13 -07:00
Ian Gilman
356ea78b26 Changelog for #1071 2017-07-13 17:05:47 -07:00
Ian Gilman
62bc9e7958 Merge branch 'thejohnhoffer-master' 2017-07-13 17:00:28 -07:00
Ian Gilman
d2c58c43aa Removed Boolean constructor from pre-load patch 2017-07-13 16:56:09 -07:00
Ian Gilman
e8971b2940 Merge branch 'master' of https://github.com/thejohnhoffer/openseadragon into thejohnhoffer-master 2017-07-13 16:53:43 -07:00
Ian Gilman
1f85a811e9 Changelog for #1244 2017-07-12 16:04:37 -07:00
Ian Gilman
28f9e9e35e Merge pull request #1244 from LarissaSmith/master
Fix more issues with tracking multiple pointers.
2017-07-12 16:00:38 -07:00
Ian Gilman
0bbb7c336d Merge pull request #1246 from openseadragon/ig-constraints
Updated viewport.getConstrainedBounds so it takes in `current`
2017-07-12 15:59:57 -07:00
Ian Gilman
969faaab23 Merge pull request #1193 from openseadragon/ig-loading
No longer loading too many tiles
2017-07-12 15:59:15 -07:00
Ian Gilman
6282a9b717 Changelog for #1245 2017-07-12 15:36:44 -07:00
Ian Gilman
d8b0aae823 Merge pull request #1245 from gehan/master
Fix for #1232 - constrainDuringPan causes jitter on mobile
2017-07-12 15:35:22 -07:00
larissasmith
0bded9f8e1 Correct docs and add check for contact count. 2017-07-12 11:21:52 -06:00
larissasmith
21f103e95d Revert "Update event assertions."
This reverts commit fd15789f6f.
2017-07-12 11:13:10 -06:00
Gehan Gonsalkorale
76f5a0ed33 Fix for #1232 - constrainDuringPan causes jitter on mobile 2017-07-11 22:39:01 +01:00
Ian Gilman
6600aca3e4 Removing debug code 2017-07-11 13:41:40 -07:00
Ian Gilman
4320f2d6c8 Merge branch 'master' into ig-loading 2017-07-11 13:40:51 -07:00
Ian Gilman
97c839b9f3 Updated viewport.getConstrainedBounds so it takes in current instead of immediately 2017-07-11 13:25:58 -07:00
Ian Gilman
4e060d6ca2 Changelog for #1133 2017-07-11 13:11:15 -07:00
Ian Gilman
41b9cc647b Merge pull request #1133 from josmilmed/master
Patch to fix issue #697
2017-07-11 13:08:35 -07:00
Ian Gilman
fd502dbdab Changelog for #1241 2017-07-11 11:53:41 -07:00
Ian Gilman
31bee4028f Merge pull request #1241 from VipSaran/master
fix for #1209 (Reference strip using "thumbs")
2017-07-11 11:50:47 -07:00
Jose
aabfa32595 Merge conflict resolved 2017-07-10 23:01:04 +02:00
larissasmith
c3a65bab38 Replace filter with a for loop. 2017-07-10 13:54:20 -06:00
Robert Saric
57103a5dd4 fix for #1209 (Reference strip using "thumbs") additional changes 2017-07-10 20:19:13 +02:00
larissasmith
fd15789f6f Update event assertions. 2017-07-07 17:21:01 -06:00
larissasmith
d9bda20e59 Fix more issues with tracking multiple pointers. 2017-07-07 16:50:03 -06:00
Robert Saric
413e40a64c fix for #1209 (Reference strip using "thumbs") 2017-07-06 21:59:26 +02:00
Ian Gilman
2419a0111a Merge branch 'master' into ig-loading 2017-07-06 10:06:07 -07:00
Ian Gilman
f0a943281b Changelog for #1213 2017-07-05 09:42:10 -07:00
Ian Gilman
818d445ec9 Merge pull request #1213 from VipSaran/master
fix for #1210 (Dinamically show ReferenceStrip)
2017-07-05 09:38:29 -07:00
Robert Saric
51cf6201cf fix for #1210 (Dinamically show ReferenceStrip) yet additional changes 2017-07-01 09:57:36 +02:00
Jose
0fe5dad769 zoom methods calls removed 2017-07-01 00:12:41 +02:00
Ian Gilman
f42322503d Changelog for #1229 2017-06-30 11:14:30 -07:00
Ian Gilman
d6bf2db5d8 Merge pull request #1229 from imagolive/1218-process-ready-items-in-queue
process ready items always even if others fail
2017-06-30 11:09:32 -07:00
Robert Saric
ec7e5e5419 fix for #1210 (Dinamically show ReferenceStrip) additional changes 2017-06-24 17:58:19 +02:00
endevea
4cb9dead89 Reverted eslintrc rule to unix cflf 2017-06-24 16:58:33 +08:00
Ian Gilman
e6438abe8d Changelog for #1214 2017-06-23 11:18:42 -07:00
Ian Gilman
0f6fedb057 Merge pull request #1214 from seanich/cache-cutoff
Use TileSource.getClosestLevel to set TileCache release cutoff
2017-06-23 11:17:40 -07:00
Ian Gilman
433752273d Changelog for #1222 2017-06-23 10:42:11 -07:00
Ian Gilman
928404c520 Merge pull request #1222 from openseadragon/ig-safari
Fixed issue with transparent images disappearing on Safari
2017-06-23 10:40:30 -07:00
Ian Gilman
74149a97b1 Changelog for #1223 2017-06-22 13:50:59 -07:00
Ian Gilman
c7e3d9fc0e Merge pull request #1223 from LarissaSmith/master
Fix image stuck to mouse when right-clicking and left-clicking simult…
2017-06-22 13:49:12 -07:00
Ian Gilman
3ce663fe54 Merge pull request #1227 from jp887/fix/coverageTests
Skip version tests when running coverage. Fixes #1226
2017-06-22 13:39:24 -07:00
endevea
101a734aaf process ready items always even if others fail 2017-06-22 13:43:34 +08:00
larissasmith
ad206a7738 Add reference to github discussion on mouse tracking bug fix. 2017-06-20 16:35:00 -06:00
John Perdue
191cf81d6b Skip version tests when running coverage. 2017-06-20 22:30:58 +01:00
Ian Gilman
4808d7f54d Changelog for #1224 2017-06-20 10:15:02 -07:00
Ian Gilman
f04631e47e Merge pull request #1224 from jp887/feature/setDebugMode
Add support for setting debug mode after the Viewer object has been constructed. #1221
2017-06-20 10:13:54 -07:00
John Perdue
bfa0ac0137 Added setDebugMode function to Viewer.
Added SetDebugMode tests.


Update in respose to PR review.
2017-06-19 21:29:41 +01:00
larissasmith
319d27f0c0 Fix image stuck to mouse when right-clicking and left-clicking simultaneously.
Mouseup and mousedown events are lost when two buttons are pressed at the same time. Pressing buttons in the order left-button down, right-button down (ignored), left-button up (ignored), right-button up was leaving drag state active.
2017-06-16 14:05:35 -06:00
Ian Gilman
d71ceebd72 Fixed issue with transparent images disappearing on Safari 2017-06-15 17:28:04 -07:00
Sean Nichols
e4393cc4dc Use TileSource.getClosestLevel to set TileCache release cutoff 2017-06-06 15:30:14 -04:00
Robert Saric
a783edc76f fix for #1210 (Dinamically show ReferenceStrip) 2017-06-06 18:21:14 +02:00
Ian Gilman
265625df75 Changelog for #1208 2017-06-05 16:37:02 -07:00
Ian Gilman
e81e30c81c Merge pull request #1208 from VipSaran/master
fix for #1165 (Reference strip not updated for initially set page)
2017-06-05 16:33:57 -07:00
Robert Saric
6f3b0a6d75 fix for #1165 (Reference strip not updated for initially set page) 2017-06-03 16:10:57 +02:00
Ian Gilman
8d782e1003 Merge branch 'master' into ig-loading 2017-05-31 10:00:46 -07:00
Ian Gilman
8c21844352 Changelog for #1203 2017-05-31 09:54:56 -07:00
Ian Gilman
eb26eabb46 Merge pull request #1203 from seanich/navigator-sync
Synchronize opacity and compositeOperation of TiledImages in navigator
2017-05-31 09:52:46 -07:00
Sean Nichols
1fb25f3e41 Add documentation for opacity-change and composite-operation-change
- Add early exit to setOpacity/setCompositeOperation when new value is
   the same as current
2017-05-30 14:52:45 -04:00
John Hoffer
1ae3a9b961 Merge branch 'master' into master 2017-05-30 12:58:05 -04:00
thejohnhoffer
7a4fda37b5 setPreload correctly treats both Primatives and Objects as Boolean Primatives 2017-05-30 12:00:43 -05:00
Sean Nichols
035f35a26a Synchronize opacity and composite operation of TiledImages in navigator 2017-05-25 12:26:30 -04:00
Ian Gilman
7d3a32d372 Reverting accidental change to basic.html 2017-05-24 09:40:45 -07:00
Ian Gilman
5dc6700f0c Changelog for #1201 2017-05-23 10:02:19 -07:00
Ian Gilman
d815b5da64 Merge pull request #1201 from vin-dev/master
Add timeout for navigator item index change handler. Fix for issue# 1126
2017-05-23 09:59:29 -07:00
Ian Gilman
326e7f3e36 Merge branch 'master' into ig-loading 2017-05-22 10:19:57 -07:00
Ian Gilman
5290d02d9a Changelog for #1198 2017-05-22 10:19:30 -07:00
Ian Gilman
e4771234a2 Merge pull request #1198 from openseadragon/ig-closest
Improved best first level calculation
2017-05-22 10:17:19 -07:00
vin
6e66c2ace0 Merge branch 'master' of https://github.com/vin-dev/openseadragon 2017-05-22 17:23:03 +05:30
vin
4eca8aca98 Add timeout for navigator item index change handler. Fix for issue# 1130 2017-05-22 17:20:41 +05:30
vin
867837bfef Add timeout for navigator item index change handler. Fix for issue# 1130 2017-05-22 17:14:10 +05:30
Ian Gilman
82b1b3e599 getClosestLevel refinement 2017-05-19 11:12:01 -07:00
Ian Gilman
52525f6697 Changelog for #1200 and comment tweak 2017-05-19 10:06:48 -07:00
Ian Gilman
d84102be24 Merge branch 'master' of github.com:openseadragon/openseadragon 2017-05-19 10:03:29 -07:00
Ian Gilman
8fe682f966 Merge pull request #1200 from LarissaSmith/master
Clamp device pixel ratio to a minimum of 1 for calculating pixelDensi…
2017-05-19 10:02:50 -07:00
Ian Gilman
aaff33e267 Changelog for #1199 2017-05-19 09:56:55 -07:00
Ian Gilman
063b05bd3d Merge pull request #1199 from altert/master
additional change to tilesUrl regex
2017-05-19 09:51:56 -07:00
larissasmith
23cba35ea0 Clamp device pixel ratio to a minimum of 1 for calculating pixelDensityRatio.
A lower value can cause tile drawing issues.
2017-05-18 15:17:02 -06:00
Ian Gilman
283b2974dd Debugging code 2017-05-18 11:19:06 -07:00
Alexey Tikhonov
ed93a32912 change regex determining tilesUrl to accept file as iipserver parameter without slash in front 2017-05-17 22:58:50 +03:00
Ian Gilman
1a60238c61 Improved best first level calculation 2017-05-16 13:49:59 -07:00
Ian Gilman
03e43998eb Fixed problem with subsequent zooms not loading tiles 2017-05-15 10:51:17 -07:00
Ian Gilman
bb0846f1a5 Merge branch 'master' into ig-loading 2017-05-15 10:14:01 -07:00
Ian Gilman
29f973029f Changelog for #1196 and doc tweaks 2017-05-15 10:13:34 -07:00
Ian Gilman
bf1b5fd793 Merge pull request #1196 from VipSaran/master
fix for #1191 (extension of Viewer.open() function with initialPage argument)
2017-05-15 10:07:58 -07:00
Robert Saric
bb68755699 fix for #1191 (extension of Viewer.open() function with initialPage argument) 2017-05-14 15:56:21 +02:00
Ian Gilman
85c204dece Changelog for #1192 2017-05-12 10:30:43 -07:00
Ian Gilman
dc70acec55 Merge pull request #1192 from UCLALibrary/timeout-configuration
Enable configuration of ImageJob timeout
2017-05-12 10:28:39 -07:00
Mark Allen Matney, Jr
77da306397 Enable configuration of ImageJob timeout 2017-05-11 21:36:27 -07:00
Ian Gilman
300ebbfe82 Tracking tile loading separately from tile drawing 2017-05-11 11:49:18 -07:00
Ian Gilman
de2fcb1b74 Changelog for #1184 2017-05-11 10:19:43 -07:00
Ian Gilman
fc254c1c6f Merge pull request #1184 from avandecreme/zoomtowithref
Fix zoomTo/zoomBy with ref point and immediately to true. Fix #800
2017-05-11 10:16:02 -07:00
Ian Gilman
f1e324a4a7 Changelog for #1189 2017-05-11 10:02:49 -07:00
Ian Gilman
e55c5beb1c Merge pull request #1189 from lastlegion/master
[FIX #1188] added fix for supporting weird filenames that look like JSONs
2017-05-11 10:01:07 -07:00
Ganesh Iyer
ce1360f5cb using try/catch $.parseJSON to check for JSONs 2017-05-10 17:51:59 -04:00
Ian Gilman
b08efcf169 Changelog for #1055 2017-05-10 10:11:06 -07:00
Ian Gilman
9fa1ac2bf9 Merge pull request #1055 from seanich/ajax-tile-loading
Add options for loading tiles via AJAX and custom AJAX request headers. (resolves #1032)
2017-05-10 10:08:59 -07:00
Ganesh Iyer
2a251b219a added fix for supporting weird filenames that look like JSONs 2017-05-09 14:55:23 -04:00
Sean Nichols
e2585bd66e Add more tests for AJAX tile loading 2017-05-08 16:21:35 -04:00
Sean Nichols
2ed09bade2 Add fallback to BlobBuilder API when Blob constructor is missing 2017-05-08 15:34:46 -04:00
Sean Nichols
4e6badc548 Fix format of Range headers 2017-05-08 15:24:55 -04:00
Sean Nichols
b909caaf45 Add some tests for AJAX tile loading 2017-05-08 11:14:26 -04:00
Antoine Vandecreme
8e755c389a Fix zoomTo/zoomBy with ref point and immediately to true. Fix #800 2017-05-07 17:22:44 +02:00
Sean Nichols
11157999eb Remove use of Object.keys and Array.prototype.forEach for IE8 compatibility 2017-05-05 15:37:33 -04:00
Sean Nichols
6fdf81f266 Ignore falsy header values and improve ajaxHeaders documentation 2017-05-05 15:37:33 -04:00
Sean Nichols
15fe35a589 Improve documentation and option/argument names 2017-05-05 15:37:33 -04:00
Sean Nichols
ddab768696 Add options for loading tiles via AJAX and custom AJAX request headers. 2017-05-05 15:37:33 -04:00
Ian Gilman
b941864ac5 Changelog for #1175 2017-04-26 09:40:15 -07:00
Ian Gilman
6ae0ad887c Merge pull request #1175 from VipSaran/master
fix for #1172 (ReferenceStrip not freeing resources)
2017-04-26 09:38:03 -07:00
Robert Saric
85e60b759b fix for #1172 (ReferenceStrip not freeing resources) 2017-04-25 21:07:37 +02:00
Ian Gilman
80611e999a Merge pull request #1171 from superbland/canvas-drag-optimisation
prevent unnecessary panBy on canvas-drag in viewer
2017-04-25 09:38:13 -07:00
superbland
bb229c24d3 Only apply constraints during an actual drag 2017-04-24 22:47:40 +01:00
jonw-cogapp
ab6cdf102e prevent unnecessary panBy on canvas-drag in viewer 2017-04-21 18:19:11 +01:00
Ian Gilman
be382a47b6 Changelog for #1149 2017-04-21 09:55:23 -07:00
Ian Gilman
2f7ebc2d67 Merge pull request #1149 from sickrandir/preventDefault-canvas-drag
Manage preventDefaultAction flag inside the canvas-drag viewer event
2017-04-21 09:51:24 -07:00
Ian Gilman
e771911058 Merge pull request #1162 from acorncom/patch-1
Documents the return type for imageToViewportRectangle
2017-04-14 10:05:45 -07:00
David Baker
a8dba2a494 Documents the return type for imageToViewportRectangle 2017-04-12 16:12:47 -06:00
Ian Gilman
f86848f965 Merge pull request #1150 from Daniel-KM/feature/zoomify
Feature/zoomify
2017-03-17 11:00:19 -07:00
Ian Gilman
c6add463d7 Changelog for #1148 2017-03-15 09:34:44 -07:00
Ian Gilman
7f2a6eb74b Merge pull request #1148 from sickrandir/preventDefault-canvas-click
Manage preventDefaultAction inside canvas-click event
2017-03-15 09:30:16 -07:00
kinto
741745433d manage preventDefaultAction flag inside the canvas-drag viewer event. Trigger the canvas-drag event before default drag happens on the viewer 2017-03-15 09:51:44 +01:00
kinto
bc5e235822 Add comment instructions for using preventDefaultAction parameter in canvas-click event 2017-03-14 19:23:07 +01:00
kinto
d5031835da manage preventDefaultAction flag inside the canvas-click viewer event. Trigger the canvas-click event before default click zoom happens on the viewer 2017-03-14 16:08:52 +01:00
Daniel Berthereau
f3198929b0 Added a demo file for the Zoomify format. 2017-03-13 00:00:00 +01:00
Daniel Berthereau
e6ae1ac4e1 Typo. 2017-03-13 00:00:00 +01:00
Daniel Berthereau
2515efa414 Typo. 2017-03-13 00:00:00 +01:00
Jose
fba70355cd In-iframe check added before resetting all active mousetrackers 2017-02-23 19:15:29 +01:00
Ian Gilman
199e960d22 Merge pull request #1135 from hendriklammers/buttons
Iconless buttons and psd
2017-02-21 09:52:05 -08:00
Hendrik Lammers
68f1efb7d2 Add psd with button source
Can be used to create new buttons in the original design, for example
for custom plugins that need a button.
2017-02-20 20:41:14 +01:00
Hendrik Lammers
726bb62a2c Add buttons without icons 2017-02-20 20:38:00 +01:00
Jose
70bdc8839e Some issues solved 2017-02-20 20:23:25 +01:00
Ian Gilman
82dad491e9 Merge branch 'master' of github.com:openseadragon/openseadragon 2017-02-20 10:48:21 -08:00
Ian Gilman
3c9ce999a0 Changelog for #1134 2017-02-20 10:48:11 -08:00
Ian Gilman
c2414da0a3 Merge pull request #1134 from IllyaMoskvin/image-compression
Compress images. Close #342, #50
2017-02-20 10:46:47 -08:00
Illya Moskvin
251f79b231 Compress images. Close #342, #50
- Used FileOptimizer 9.60.1708
- 64,065 bytes saved (47%)
2017-02-20 00:45:47 -05:00
Jose
d5b62aabcd Patch to fix issue #697, also contains improvements when panning under certain constrains 2017-02-19 17:36:53 +01:00
Ian Gilman
06f9804497 Changelog for #1129 2017-02-13 09:58:33 -08:00
Ian Gilman
2bde6a2ec4 Merge pull request #1129 from jetic83/master
Update strings.js solves issue #1124
2017-02-13 09:54:49 -08:00
Peter
c81e10ba57 updated test for console.log instead of console.debug 2017-02-10 15:20:05 -05:00
Peter
219e4a14c6 Update strings.js 2017-02-09 17:29:13 -05:00
Ian Gilman
e888ddf109 Merge branch 'master' of github.com:openseadragon/openseadragon 2017-02-08 10:07:43 -08:00
Ian Gilman
ac12a3eed2 Changelog for #1123 2017-02-08 10:07:29 -08:00
Ian Gilman
da2068a334 Merge pull request #1123 from avandecreme/simple_image_fix
Fix simple image being drawn twice. Fix #1113
2017-02-08 09:58:14 -08:00
Antoine Vandecreme
e65de72e3a Fix simple image being drawn twice. Fix #1113 2017-02-04 15:37:50 +01:00
Ian Gilman
7b7672ef96 Merge pull request #1120 from leesei/issue-1080
update doc for `$.Button`
2017-02-02 14:27:10 -08:00
Ian Gilman
8f2bb593c8 Changelog for #1119 2017-02-02 14:24:42 -08:00
Ian Gilman
8103cc54d1 Merge pull request #1119 from leesei/master
fix: overlay size calculation
2017-02-02 14:21:21 -08:00
leesei
9d96c58eaf update doc for $.Button
relates to #1080

 On branch issue-1080
 Changes to be committed:
	modified:   src/button.js
2017-02-02 14:24:16 +08:00
leesei
cce1e9ac37 fix: overlay size calculation
fix #1116
2017-02-01 12:06:14 +08:00
Ian Gilman
8df10f2177 Merge pull request #1100 from avandecreme/animate_rotation
Animate rotation
2017-01-23 10:09:35 -08:00
Antoine Vandecreme
63a8a2ffa6 Allow tiled image rotation outside the 0 to 360 range 2017-01-21 20:13:32 +01:00
Antoine Vandecreme
b62d4a7bc1 Fix navigator with rotation and clip 2017-01-21 19:40:21 +01:00
Antoine Vandecreme
fc69c6568d Animate rotation 2017-01-21 19:40:21 +01:00
Ian Gilman
cfc339edea Merge pull request #1103 from avandecreme/eslint
Add eslint and hound
2017-01-19 09:24:58 -08:00
Antoine Vandecreme
30a6c4494b Remove jshint 2017-01-16 21:44:36 +01:00
Antoine Vandecreme
de25b68b43 Add eslint and hound 2017-01-16 21:41:07 +01:00
Ian Gilman
537c3d04c1 Merge branch 'master' of github.com:openseadragon/openseadragon 2017-01-16 11:48:18 -08:00
Ian Gilman
8beac359a7 Changelog for #1104 2017-01-16 11:48:05 -08:00
Ian Gilman
525232c873 Merge pull request #1104 from dieend/navigator_constrainDuringPan
Navigator can pan outside boundary
2017-01-16 11:45:59 -08:00
Ian Gilman
08f299e9bf Merge branch 'master' of github.com:openseadragon/openseadragon 2017-01-16 11:22:02 -08:00
Ian Gilman
97a63db40c Changelog updates 2017-01-16 11:21:34 -08:00
Ian Gilman
855bfbe168 Merge pull request #1102 from avandecreme/sketch_canvas_size
Fix sketch canvas not resizing properly. Fix #973
2017-01-16 11:04:07 -08:00
Ian Gilman
86783a50b9 Merge pull request #1101 from avandecreme/optimize_tile_smoothing
Disable tile edge smoothing when only one tile is drawn. Fix #956
2017-01-16 10:57:31 -08:00
Ian Gilman
e0b4547143 Merge pull request #1099 from avandecreme/fix-version-object
Fix version object not filled. Fix #1024
2017-01-16 10:43:52 -08:00
Ian Gilman
8a2e9e8070 Merge pull request #1098 from leesei/master
update doc for Overlay
2017-01-16 10:12:30 -08:00
Adinata Thayib
4eb3864639 Fix navigator doesn't get constrained although viewer have constrainDuringPan options on 2017-01-11 20:11:43 -08:00
Antoine Vandecreme
43bd0e972f Fix sketch canvas not resizing properly. Fix #973 2017-01-08 11:13:32 +01:00
Antoine Vandecreme
a23a709fb1 Disable tile edge smoothing when only one tile is drawn. Fix #956 2017-01-07 19:56:37 +01:00
Antoine Vandecreme
41b8956df6 Fix version object not filled. Fix #1024 2017-01-07 17:38:38 +01:00
leesei
286ba36bf3 fix param for update()
Changes to be committed:
	modified:   src/overlay.js
2017-01-06 11:30:09 +08:00
Ian Gilman
18454ff3de Changelog for #1074 2016-12-22 10:01:52 -08:00
Ian Gilman
6a3b2d52c5 Merge pull request #1074 from altert/smallfix
See #832, further fix for dzitilesource guessing of tilesUrl, for iii…
2016-12-22 09:59:09 -08:00
Ian Gilman
ae3309fa8f Merge pull request #1026 from rdlester/comments
Comments for some private functions in TiledImage.
2016-11-14 10:32:54 -08:00
Ryan Lester
b4d0104206 Comments for some private functions in TiledImage. 2016-11-13 23:03:43 -05:00
Ian Gilman
36aa63361d Merge pull request #1076 from seanich/gtap-fix
Fix incorrect call to getTileWidth and getTileHeight in getTileAtPoint
2016-11-09 10:39:27 -08:00
Sean Nichols
e2c43d64db Fix incorrect call to getTileWidth and getTileHeight in getTileAtPoint 2016-11-08 16:20:12 -05:00
Ian Gilman
c59a2be322 Merge branch 'master' of github.com:openseadragon/openseadragon 2016-11-08 09:52:09 -08:00
Ian Gilman
c27d424281 Changelog updates for #1073 and #1066 2016-11-08 09:51:40 -08:00
Alexey Tikhonov
63e4daab50 fixed type im test case 2016-11-08 02:02:59 +03:00
Ian Gilman
ec46f85024 Merge pull request #1066 from avandecreme/wrapping
Remove reliance on getTileAtPoint for wrapping
2016-11-07 13:38:58 -08:00
Ian Gilman
a74c9052bc Merge pull request #1073 from thejohnhoffer/fullyLoaded
count tiledImage._tilesLoading
2016-11-07 13:36:21 -08:00
Alexey Tikhonov
870bb2a99a See #832, further fix for dzitilesource guessing of tilesUrl, for iiipserver configurations like /iiipsrv?DeepZoom=/path/my.dzi 2016-11-07 11:42:37 +03:00
Antoine Vandecreme
4a1ae35631 Add TiledImage._getCornerTiles unit tests 2016-11-06 15:31:36 +01:00
Antoine Vandecreme
b162f197ea Add TileSource.getTileAtPoint test 2016-11-05 17:34:36 +01:00
Antoine Vandecreme
6370a6bafa Fix tests 2016-11-05 16:41:09 +01:00
thejohnhoffer
3eee34a0f2 count tiledImage._tilesLoading 2016-11-04 17:37:48 -04:00
thejohnhoffer
cf5825d1fa better underscores in preload term handling 2016-11-04 10:03:41 -04:00
thejohnhoffer
2915ee09c5 correct logic for call to _updateViewport 2016-11-04 09:26:34 -04:00
thejohnhoffer
9548ad6a27 using the strict === comparison 2016-11-04 09:24:08 -04:00
thejohnhoffer
171591a7a3 new opacity flag 2016-11-04 09:21:04 -04:00
thejohnhoffer
c402a7bfdd underscores to preload 2016-11-04 09:11:46 -04:00
thejohnhoffer
0a44585457 documentation of opacity and preload relations 2016-11-03 22:39:00 -04:00
thejohnhoffer
3fc1948a44 setting booleans the shortest way 2016-11-03 17:12:44 -04:00
thejohnhoffer
1baf086e1b setting booleans the easy way 2016-11-03 17:11:22 -04:00
thejohnhoffer
bac2cab8e9 document tiledImage.preload 2016-11-02 20:45:33 -04:00
thejohnhoffer
c5d4e9f049 Merge remote-tracking branch 'upstream/master' 2016-11-02 19:00:57 -04:00
Antoine Vandecreme
10dd723637 Remove reliance on getTileAtPoint for wrapping 2016-11-01 21:43:50 +01:00
Ian Gilman
e910e93dbf Merge branch 'master' of github.com:openseadragon/openseadragon 2016-10-31 09:57:58 -07:00
Ian Gilman
0a292491cc Changelog for #1064 2016-10-31 09:57:44 -07:00
Ian Gilman
3321fda1b9 Merge pull request #1064 from Riksarkivet/edgeSmoothingIE8
Edge smoothing and IE8 #1063
2016-10-31 09:56:27 -07:00
Edminsson
04eafa9275 Edge smoothing and IE8 #1063 2016-10-31 09:25:13 +01:00
Ian Gilman
21884afff7 Merge branch 'master' of github.com:openseadragon/openseadragon 2016-10-26 09:59:35 -07:00
Ian Gilman
8240db3546 changelog for #1006 2016-10-26 09:59:20 -07:00
Ian Gilman
eb8b9ccd50 Merge pull request #1006 from avandecreme/master
Tiled image rotation
2016-10-26 09:58:12 -07:00
Antoine Vandecreme
4b48717010 Rollback sketchCanvas scaling when tiled image rotated 2016-10-25 21:41:42 +02:00
Antoine Vandecreme
5ac1502ccd Take pixelDensityRatio into account when rotating 2016-10-24 22:03:31 +02:00
Antoine Vandecreme
b992d54572 Fix jshint error 2016-10-24 21:34:29 +02:00
Ian Gilman
824c9ab211 Changelog for #1056 2016-10-24 10:13:52 -07:00
Ian Gilman
73bea928c5 Merge pull request #1056 from awagner-mainz/awagner-mainz-no_prior_filetype_check
Update legacytilesource.js
2016-10-24 10:07:51 -07:00
Antoine Vandecreme
a9b60057ea Fix wrapping. 2016-10-23 22:25:16 +02:00
Antoine Vandecreme
77310b0229 Remove TODO 2016-10-23 18:25:14 +02:00
Antoine Vandecreme
5bfccec7a3 Disable tile edge smoothing with tiled image rotation 2016-10-23 17:45:39 +02:00
Ian Gilman
9e39ab7f5d Changelog for #1041 2016-10-21 09:36:59 -07:00
Ian Gilman
6878bc8771 Merge pull request #1041 from zakharov-aa/master
IE8 fix for tileSources type: 'image'
2016-10-21 09:34:56 -07:00
thejohnhoffer
b04717ae4b Merge branch 'master' of https://github.com/avandecreme/openseadragon 2016-10-20 11:02:05 -04:00
Andreas Wagner
e50beb435b Update legacytilesource.js
Remove check for filetype based on uri or mimetype strings (maybe the filetype is not known before actually downloading the resource).
2016-10-20 11:32:13 +02:00
Ian Gilman
bcd093e3e6 Merge branch 'master' of github.com:openseadragon/openseadragon 2016-10-10 17:09:28 -07:00
Ian Gilman
f7d660945c Changelog for #1035 2016-10-10 17:09:12 -07:00
Ian Gilman
5c538c0967 Merge pull request #1035 from adgoncal/patch-2
Fix IndexSizeError on IE and Edge #1033
2016-10-10 17:07:18 -07:00
Ian Gilman
3cc4ffd21b Changelog for #1027 2016-10-10 15:37:47 -07:00
Ian Gilman
77ff2bfd05 Merge pull request #1027 from rdlester/square
Use the squared distance when comparing tiles.
2016-10-10 15:34:17 -07:00
Antoine Vandecreme
cca6b47fc0 Fix TileSource.getTileAtPoint 2016-10-09 14:05:22 +02:00
Antoine Vandecreme
2821c8f67b Partialy fix edge smoothing. 2016-10-06 22:18:32 +02:00
zakharov-aa
ffa4bbc8df IE8 naturalWidth and naturalHeight more clear fix 2016-09-28 10:39:20 +03:00
zakharov-aa
c5ad9b25bf IE8 fix for tileSources type: 'image' 2016-09-28 09:40:28 +03:00
A
e38c53ff31 Use canvas instead of sketchCanvas 2016-09-23 16:19:08 -04:00
A
c24e8ceedf Fix IndexSizeError on IE and Edge #1033
Internet Explorer and Microsoft Edge throw IndexSizeError when you call context.drawImage with negative x or y or width or height greater than the canvas width or height respectively.
2016-09-23 15:57:35 -04:00
Ryan Lester
861f4bdcd1 Comment fixes 2016-09-22 23:01:33 -04:00
Antoine Vandecreme
254b426b2b Merge pull request #1031 from kant/patch-1
Fix link to GitHub's intro to open source page.
2016-09-18 10:11:23 +02:00
Darío Hereñú
63430ecf6f Minor fix (proposal) 2016-09-17 18:57:15 -03:00
Ryan Lester
0d4e17b627 Use the squared distance when comparing tiles.
This drops a Math.sqrt calculation from every tile iterated over while
drawing, improving performance.
2016-09-05 19:09:44 -04:00
Ian Gilman
52fd82d4be Changelog and tweak for #995 2016-09-01 10:02:42 -07:00
Ian Gilman
bde239d389 Merge pull request #995 from chrishonselaar/patch-1
this.tileSize undefined in this scope
2016-09-01 09:56:09 -07:00
Ian Gilman
192c0e5c36 Changelog and tweak for #863 2016-08-29 10:45:28 -07:00
Ian Gilman
1f75fb8d0a Merge pull request #863 from foobarable/master
Added first version of zoomifytilesource.js
2016-08-29 10:42:32 -07:00
Ian Gilman
a228126ddb Merge pull request #1019 from msalsbery/ms-vscode
Added Visual Studio Code workspace configuration
2016-08-29 09:59:42 -07:00
Antoine Vandecreme
fbcf78c894 Fix tests. 2016-08-28 19:59:36 +02:00
Antoine Vandecreme
62c96ebad7 Add clip-change event. 2016-08-28 14:39:14 +02:00
Antoine Vandecreme
33332bf774 Set rotation around center and fix typo. 2016-08-28 13:39:26 +02:00
Antoine Vandecreme
eaddc1c33b Merge branch 'master' of https://github.com/openseadragon/openseadragon 2016-08-28 12:14:49 +02:00
Antoine Vandecreme
2e3f57401f Fix tiles missing with rotation + rotate around center 2016-08-28 12:10:35 +02:00
Mark Salsbery
ff7dfac544 newline at end 2016-08-27 11:27:04 -07:00
Ian Gilman
e8324627e1 Changelog for #1014 2016-08-26 10:00:35 -07:00
Ian Gilman
7088dbf3c1 Merge pull request #1014 from CaptainCodeman/issue-1013
Fix #1013
2016-08-26 09:58:52 -07:00
Mark Salsbery
8e2358288b Merge remote-tracking branch 'origin/master' into ms-vscode
* origin/master: (249 commits)
  Fixed test issues
  Changelog for #837
  Changelog for #1004
  Use control anchor configuration for custom toolbar also
  changelog for #999
  Fix tests on Firefox.
  Make tileSources option smarter about detecting when a json string or xml string has been passed in
  Updated with improved API
  Changelog for #987
  [-] remove ref to getTileAtPoint - becasue this are subclass of TileSource
  [=] fix for image source type image and in legacytilesource
  [=] Dropped useless calculations
  [=] Wrap fix for #555
  Changelog for #981
  Passed options.crossOriginPolicy into getTileSource. Also changed checks on crossOriginPolicy to compare to undefined, and added tests for the addTiledImage crossOriginPolicy api.
  Changelog for #984
  Add support for commonjs.
  Added an option to addTiledImage to change the crossOriginPolicy. addTiledImage will also check the tileSource for crossOriginPolicy.
  Changelog for #967
  Moved setting of withCredentials to after the request is opened to fix IE 10 bug.
  ...
2016-08-25 18:27:07 -07:00
Mark Salsbery
b506281a49 Added Visual Studio Code workspace configuration 2016-08-25 18:15:28 -07:00
Simon Green
198e5b3461 Fix #1013
tiledImage. _needsDraw flag was only being set to true once the tile had been loaded which effectively made the initial tile loading sequential
2016-08-25 13:44:12 -06:00
Antoine Vandecreme
f0cb707ff2 Improve code readability 2016-08-21 19:24:40 +02:00
Antoine Vandecreme
9e69462405 Merge branch 'master' of https://github.com/openseadragon/openseadragon 2016-08-21 13:16:38 +02:00
Antoine Vandecreme
a9f5e7ec73 Add unit test and fix code review comments. 2016-08-21 12:54:33 +02:00
Ian Gilman
23f3a9fb0d Merge pull request #1005 from openseadragon/loaded
Fixed test issues
2016-08-17 10:50:48 -07:00
Antoine Vandecreme
65b59c08d6 First draft of tiled image rotation. 2016-08-17 15:43:08 +02:00
Ian Gilman
168bbfea29 Fixed test issues 2016-08-16 10:18:39 -07:00
Ian Gilman
ae1e2757ba Changelog for #837 2016-08-16 09:48:29 -07:00
Ian Gilman
e7da167c4e Merge pull request #837 from openseadragon/loaded
Added "fully-loaded" event to TiledImage
2016-08-16 09:44:46 -07:00
Ian Gilman
f887b4fefc Changelog for #1004 2016-08-15 14:37:06 -07:00
Ian Gilman
e80c05183b Merge pull request #1004 from Riksarkivet/navigationControlAnchorFix
Use control anchor configuration for custom toolbar also
2016-08-15 14:35:08 -07:00
Sebastian Öberg
77726a684f Use control anchor configuration for custom toolbar also 2016-08-15 13:54:10 +02:00
Ian Gilman
03cc8ffa12 Merge branch 'master' of github.com:openseadragon/openseadragon 2016-08-11 09:51:26 -07:00
Ian Gilman
429a27960f Merge pull request #1001 from avandecreme/master
Fix tests on Firefox.
2016-08-11 09:50:56 -07:00
Ian Gilman
d03b6a7569 changelog for #999 2016-08-11 09:48:23 -07:00
Ian Gilman
b481a17298 Merge pull request #999 from rburgstaler/rpb/make-tilsources-option-smarter-with-json-xml-string
Make tileSources option smarter about detecting when a json string or…
2016-08-11 09:46:07 -07:00
Antoine Vandecreme
bbf354b6b6 Fix tests on Firefox. 2016-08-11 14:45:21 +02:00
Rick Burgstaler
dde379ba12 Make tileSources option smarter about detecting when a json string or xml string has been passed in
The tileSources option was only using a test looking for the presence of a "{", "[", or "<" character to determine if a json string or xml string was passed in.  It is possible for a url to contain one of these characters as well which would break using the url as a tileSources parameter.  The following is an example of a breaking url:
http://myurl.org/{25fb14f0-a839-4c4d-8c97-dd1d67b2cb35}/MyImage.xml

This patch resolves this issue.
2016-08-10 14:30:10 -05:00
Ian Gilman
23b955c6b4 Updated with improved API 2016-08-10 10:35:08 -07:00
Ian Gilman
03b2a86a9d Merge branch 'master' into loaded 2016-08-10 09:49:59 -07:00
Chris Honselaar
0b28b5f152 this.tileSize undefined in this scope 2016-08-04 16:02:48 +02:00
Ralph Krimmel
0d9e2e8b96 Adding a comment describing the format 2016-08-01 09:39:54 +02:00
Ian Gilman
0c43d76ed0 Changelog for #987 2016-07-29 13:24:12 -07:00
Ian Gilman
6f6207412c Merge pull request #987 from VoidVolker/master
[=] Wrap fix for #555
2016-07-29 13:21:24 -07:00
VoidVolker
41c82c88a9 [-] remove ref to getTileAtPoint - becasue this are subclass of TileSource 2016-07-29 20:45:57 +03:00
VoidVolker
eb799bdc70 [=] fix for image source type image and in legacytilesource 2016-07-29 20:36:05 +03:00
VoidVolker
ecebc3305f [=] Dropped useless calculations 2016-07-29 12:41:25 +03:00
VoidVolker
2bcc1aa0f4 [=] Wrap fix for #555
1. Fix for horizontal and vertical wrap. Problem was in
`getTileAtPoint`: it was working only for points inside viewer - thanks
to @avandecreme for finding this.
2. Was small bug in not rendering top row and left column - after scroll
there are empty space and need some time for rendering.
2016-07-29 01:33:48 +03:00
Ian Gilman
a4d97e1929 Changelog for #981 2016-07-28 10:16:46 -07:00
Ian Gilman
469341094d Merge pull request #981 from LarissaSmith/master
Added an option to addTiledImage to change the crossOriginPolicy.
2016-07-28 10:15:25 -07:00
Larissa Smith
4ccabe78de Passed options.crossOriginPolicy into getTileSource. Also changed checks on crossOriginPolicy to compare to undefined, and added tests for the addTiledImage crossOriginPolicy api. 2016-07-28 09:35:43 -06:00
Ian Gilman
922d247c7b Changelog for #984 2016-07-27 09:56:41 -07:00
Ian Gilman
0b8aca750f Merge pull request #984 from aindlq/common-js
Add support for commonjs.
2016-07-27 09:53:43 -07:00
Artem Kozlov
9ef153ca53 Add support for commonjs. 2016-07-25 20:35:49 +02:00
Larissa Smith
1e0ddcedc1 Added an option to addTiledImage to change the crossOriginPolicy. addTiledImage will also check the tileSource for crossOriginPolicy. 2016-07-21 10:26:02 -06:00
Ian Gilman
edd2464a88 Changelog for #967 2016-06-27 16:24:15 -07:00
Ian Gilman
eead018195 Merge pull request #967 from Riksarkivet/moveWithCredentials
Fixed CORS bug in IE 10
2016-06-22 11:06:31 -07:00
Sebastian Öberg
fb5e628add Moved setting of withCredentials to after the request is opened to fix IE 10 bug. 2016-06-22 14:34:21 +02:00
Ian Gilman
42c9cbaa06 2.2.2 started 2016-06-21 10:09:19 -07:00
Ian Gilman
babdefd100 Version 2.2.1 2016-06-21 10:06:25 -07:00
Ian Gilman
35d9350e48 Changelog for #966 2016-06-20 09:18:27 -07:00
Ian Gilman
e3edf20e22 Merge pull request #966 from plougsgaard/fix-ios-zoom-bug
Disable part of `8c4fcc9` when running on an iOS device
2016-06-20 09:15:12 -07:00
plougsgaard
e9a0bbc8d9 Document effect on smoothTileEdgesMinZoom referencing #952. 2016-06-17 19:16:08 +02:00
plougsgaard
b3a10aca3b Introduce variable iOSDevice that disables 8c4fcc9 when running on an iOS device. 2016-06-17 16:37:30 +02:00
Ralph Krimmel
7bf79eac77 Merge branch 'master' of https://github.com/openseadragon/openseadragon 2016-06-17 08:26:34 +02:00
Ian Gilman
18c90ed2e0 Changelog for #965 2016-06-15 09:50:17 -07:00
Ian Gilman
6f4235c7f3 Merge pull request #965 from MrP/master
Fix issue #890 in applyConstraints
2016-06-15 09:40:09 -07:00
Victor Rodriguez Gil
36264c44ef simplified constraint code 2016-06-14 17:31:21 +00:00
Victor Rodriguez Gil
c91039b545 Code that fixes #890, new test passes. Events.js test needed fixing with good value, unrelated to actual test. 2016-06-13 23:07:17 +00:00
Victor Rodriguez Gil
0035b3f36f Test that shows the bug #890, fails 2016-06-13 23:04:55 +00:00
Ian Gilman
755d8f01d0 Attempting to fix Gitter badge for npm 2016-05-26 16:00:04 -07:00
Ian Gilman
a81f3a9b31 Started 2.2.1 "in progress" for changelog 2016-05-26 15:19:14 -07:00
Ian Gilman
373e61e0df Version bump to 2.2.0 2016-05-26 15:14:19 -07:00
Ian Gilman
0043c8a6ce Changelog for #948 2016-05-26 11:54:50 -07:00
Ian Gilman
d52d19cb7f Merge pull request #948 from adgoncal/patch-1
Fix #946
2016-05-26 11:52:38 -07:00
A
033b650c29 Fix #946
Fix for https://github.com/openseadragon/openseadragon/issues/946
2016-05-26 13:24:03 -04:00
Ralph Krimmel
96a4de7b87 Merge remote-tracking branch 'upstream/master' 2016-05-24 08:59:28 +02:00
Ian Gilman
5071540af4 Changelog for #939 2016-05-19 09:50:10 -07:00
Ian Gilman
bd743d688a Merge pull request #939 from avandecreme/perf
Avoid loading clipped out tiles. Fix #889.
2016-05-19 09:46:33 -07:00
Antoine Vandecreme
8951ac3f5b Fix fitBounds with extreme zoom values. 2016-05-17 14:27:28 -04:00
Ian Gilman
12f9aa46b5 Changelog for #930 2016-05-17 10:46:11 -07:00
Ian Gilman
436ff0d086 Merge pull request #930 from dlukez/master
Handle simultaneous touch events
2016-05-17 10:44:46 -07:00
Ian Gilman
af21d7b4cd Changelog for #940 2016-05-17 09:54:03 -07:00
Ian Gilman
ebf7cbf918 Merge pull request #940 from avandecreme/fullpage
Enforce html element width and height to 100% when going full page.
2016-05-17 09:51:08 -07:00
Daniel Zimmermann
7935ab82d4 Add unit tests for multi-touch 2016-05-17 11:29:42 +10:00
Antoine Vandecreme
32f993f862 Enforce html element width and height to 100% when going full page. 2016-05-16 13:08:17 -04:00
Ian Gilman
6ab3d5b33c Changelog for #935 2016-05-16 09:42:06 -07:00
Ian Gilman
ea32e1b090 Merge pull request #935 from leesei/master
feat(navigator): add option autoFade
2016-05-16 09:40:23 -07:00
Daniel Zimmermann
c25bf0a239 Correctly handle touch PointerEvents
`onPointerDown/Up` may call `capture/releasePointer`
with `"touch"` as the pointerType, which would result
in a bug as `touchCount` would be `undefined`.

`capture/releasePointer` should just default to a
count of `1` if not specified. This properly retains
the existing behaviour for non-TouchEvent handling.
2016-05-16 06:26:52 +10:00
Daniel Zimmermann
a4dbae0754 Handle simultaneous touch events
Found and tested on an iPhone 5s w/ iOS 9.2.
Not sure about other devices.

Fixes #877
2016-05-16 06:26:52 +10:00
Antoine Vandecreme
b11edddf68 Fix jshint. 2016-05-13 15:35:33 -04:00
Antoine Vandecreme
352bfbc3a5 Avoid loading clipped out tiles. Fix #889. 2016-05-13 15:18:37 -04:00
Ian Gilman
6099962e40 Changelog for #934 2016-05-13 11:24:15 -07:00
Ian Gilman
c5fc9a6922 Merge pull request #934 from avandecreme/fitBounds
Take rotation into account in viewport getBounds and fitBounds methods
2016-05-13 11:21:40 -07:00
Ralph Krimmel
44874b25b1 Using more interesting image for test 2016-05-13 09:10:49 +02:00
Antoine Vandecreme
1014d5767c Fix resize handling. 2016-05-12 19:23:09 -04:00
Antoine Vandecreme
14069a64e1 Fix applyConstraints with rotation. 2016-05-12 18:47:35 -04:00
Antoine Vandecreme
07d66ce655 Restore applyConstraints to avoid panning when clicking at max zoom. 2016-05-12 18:01:18 -04:00
Antoine Vandecreme
0c398eacdb Add test for fitBounds with a rotated rectangle. 2016-05-10 21:19:33 -04:00
Antoine Vandecreme
e4c29d649b Remove code duplication in Viewport.applyConstraints. 2016-05-10 18:49:55 -04:00
leesei
7ea8733e5b feat(navigator): add option autoFade 2016-05-07 17:16:59 +08:00
Antoine Vandecreme
521e020b9a Viewport getBounds and fitBounds methods now take rotation into account. Fix #924 2016-05-04 22:26:33 -04:00
Ian Gilman
1d02ba7853 Changelog for #927 2016-04-29 10:11:15 -07:00
Ian Gilman
07429f5890 Merge pull request #927 from avandecreme/perf
Optimize sketch canvas clearing and blending.
2016-04-29 10:08:47 -07:00
Antoine Vandecreme
cac7052bf8 Take pixelDensityRatio into account. 2016-04-28 11:26:09 -04:00
Antoine Vandecreme
684029bc79 Optimize sketch canvas clearing and blending. 2016-04-27 11:08:44 -04:00
Antoine Vandecreme
3106d8f85b Fix viewport.fitBounds tests. 2016-04-23 08:29:32 -04:00
Ian Gilman
66ffa03132 Merge pull request #923 from avandecreme/fitbounds
Fix Viewport.update with zoomPoint.
2016-04-22 11:10:34 -07:00
Ian Gilman
b2dbf35dcb Changelog for #910 and #923 2016-04-22 11:09:27 -07:00
Ian Gilman
5785d10cbb Merge pull request #910 from avandecreme/home-clip
Fix home bounds with clipping. Fix #891
2016-04-22 11:01:05 -07:00
Ian Gilman
1b39167780 Merge pull request #922 from avandecreme/master
Fix getScaleForEdgeSmoothing with image tile source.
2016-04-22 10:15:01 -07:00
Antoine Vandecreme
79977b09a0 Fix Viewport.update with zoomPoint. 2016-04-21 16:06:07 -04:00
Antoine Vandecreme
65a95d4a49 Add asserts on this.viewer. 2016-04-21 10:57:39 -04:00
Antoine Vandecreme
f8de9b33b0 Fix getScaleForEdgeSmoothing with image tile source. 2016-04-21 10:31:49 -04:00
Antoine Vandecreme
3775a877e2 Remove trailing spaces. 2016-04-21 10:02:02 -04:00
Antoine Vandecreme
b1a0abd104 Add this.viewer test. 2016-04-19 18:13:12 -04:00
Ian Gilman
766e2b0e1f Merge pull request #902 from avandecreme/dead-code
Remove dead code.
2016-04-15 16:55:57 -07:00
Ian Gilman
b9df7f3cde Merge pull request #905 from avandecreme/doc
Fix JSDoc.
2016-04-14 16:38:36 -07:00
Antoine Vandecreme
4bf7b62939 Fix enums doc. 2016-04-10 19:01:30 -04:00
Antoine Vandecreme
55e0811294 Merge remote-tracking branch 'upstream/master' into doc 2016-04-10 18:37:11 -04:00
Antoine Vandecreme
e0e6ce9b65 Add unit tests for home bounds with clip. 2016-04-09 18:13:37 -04:00
Antoine Vandecreme
b8c87ddb61 Use Util.assertRectangleEquals 2016-04-09 11:56:34 -04:00
Antoine Vandecreme
686176f821 Add TiledImage.getClippedBounds test. 2016-04-09 11:37:05 -04:00
Antoine Vandecreme
e436fc93fd Fix test. 2016-04-09 11:23:59 -04:00
Antoine Vandecreme
ea86237a4a Merge branch 'master' of https://github.com/openseadragon/openseadragon into home-clip 2016-04-09 11:16:16 -04:00
Antoine Vandecreme
4fa7ed1590 Adapt doc to new version of JSDoc. 2016-04-09 10:15:02 -04:00
Antoine Vandecreme
5ebf84a580 Fix typo in doc. 2016-04-09 10:14:09 -04:00
Ian Gilman
eec0d4c9ff Merge pull request #896 from avandecreme/overlays
Overlays improvements
2016-04-08 10:42:05 -07:00
Antoine Vandecreme
cd7bb8a8c4 Fix doc and debug message. 2016-04-06 12:55:50 -04:00
Antoine Vandecreme
81f439d430 Document the viewport parameter as mandatory in Overlay.getBounds. 2016-04-06 09:10:51 -04:00
Antoine Vandecreme
bd4cabaec2 Fix JSDoc. 2016-04-05 20:00:35 -04:00
Antoine Vandecreme
9e68f6c27b Fix home bounds with clipping. Fix #891 2016-04-05 17:51:50 -04:00
Antoine Vandecreme
53d1534cc2 Add old properties for backward compatibility. 2016-04-05 13:05:32 -04:00
Antoine Vandecreme
96a032164f Update changelog 2016-04-04 13:59:51 -04:00
Antoine Vandecreme
55dfc146c9 Remove dead code. 2016-04-03 07:59:10 -04:00
Antoine Vandecreme
824dc192bc Add unit tests for overlays with rotation mode EXACT 2016-04-01 16:54:29 -04:00
Antoine Vandecreme
5f9053fb6e Fix Overlay.getBounds with BOUNDING_BOX rotation mode. 2016-04-01 15:46:43 -04:00
Antoine Vandecreme
fafb7f8db6 Readd blank lines. 2016-04-01 13:31:36 -04:00
Antoine Vandecreme
bd62d56a37 Fix Overlays.getBounds with rotation. 2016-04-01 13:29:09 -04:00
Antoine Vandecreme
0685d8a3a4 Use outline instead of border in overlay demo. 2016-04-01 09:19:40 -04:00
Antoine Vandecreme
c8ed3893ad Fix method name. 2016-03-31 16:59:26 -04:00
Antoine Vandecreme
05a7e5e467 Fix bounding box rotation mode with placement other than top left. 2016-03-31 16:53:19 -04:00
Antoine Vandecreme
15a0db045e Fix changelog and add comments. 2016-03-31 15:45:44 -04:00
Antoine Vandecreme
70b39d681b Fix viewer.addOverlay and Overlay.getBounds 2016-03-31 13:25:59 -04:00
Antoine Vandecreme
577327a629 Change overlays to now always having Point location. 2016-03-30 15:12:50 -04:00
Antoine Vandecreme
ffbb8b2cfe Add support of overlays rotation on IE9. 2016-03-30 11:16:29 -04:00
Antoine Vandecreme
33bd943b7a Set overlays position and size with floating point values. 2016-03-29 15:29:36 -04:00
Antoine Vandecreme
f6c09ca716 Add viewport.viewportToViewerElementRectangle 2016-03-28 17:07:47 -04:00
Antoine Vandecreme
cac5f6dec3 Add overlays rotation support. 2016-03-28 17:06:59 -04:00
Antoine Vandecreme
3e3ce188b1 Add scaleWidth and scaleHeight options to overlays. 2016-03-25 16:49:58 -04:00
Ian Gilman
d631d97545 Changelog for #887 and #888 2016-03-24 09:50:17 -07:00
Ian Gilman
430804ef16 Merge pull request #888 from avandecreme/fit-in-bounds
Add TiledImage.fitInBounds method.
2016-03-24 09:47:15 -07:00
Ian Gilman
24f552c1fb Merge pull request #887 from avandecreme/eventsource
Add addOnceHandler method to EventSource.
2016-03-24 09:24:54 -07:00
Antoine Vandecreme
a52f4cadc5 Fix TiledImage.fitBounds with clipping. 2016-03-24 11:48:29 -04:00
Antoine Vandecreme
3cacc8edcf Add fitBounds option to TiledImage constructor. 2016-03-22 16:41:28 -04:00
Antoine Vandecreme
9c461824b3 Update OpenSeadragon.Placement to be serializable. 2016-03-22 15:50:48 -04:00
Antoine Vandecreme
0f82eed0db Add times parameter to addOnceHandler. 2016-03-22 13:54:35 -04:00
Ian Gilman
55cf2bd6b9 Merge pull request #884 from avandecreme/master
Fix flick gesture with rotation. Fix #869
2016-03-22 09:18:18 -07:00
Antoine Vandecreme
fddf0fb938 Use variable instead of function name. 2016-03-22 10:03:52 -04:00
Antoine Vandecreme
e4fca14c33 Add TiledImage.fitInBounds method. 2016-03-21 16:11:50 -04:00
Antoine Vandecreme
d3b027bade Add addOnceHandler method to EventSource. 2016-03-21 11:27:43 -04:00
Antoine Vandecreme
2386900e29 Fix drag with panHorizontal/panVertical set to false. 2016-03-20 11:01:26 -04:00
Antoine Vandecreme
43a9c14d3b Merge branch 'master' of https://github.com/avandecreme/openseadragon 2016-03-20 10:04:44 -04:00
Antoine Vandecreme
2740792df3 Fix flick gesture with rotation. Fix #869 2016-03-20 10:04:23 -04:00
Ian Gilman
030fec590e Merge pull request #873 from openseadragon/ian
Really no tabIndex if you pass "".
2016-03-08 10:07:18 -08:00
Ian Gilman
66f99a1d39 Really no tabIndex if you pass "". 2016-03-08 09:58:50 -08:00
Ian Gilman
5ca04c56f7 Changelog for #872 2016-03-07 09:46:20 -08:00
Ian Gilman
7c5e7bf093 Merge pull request #872 from rvdb/fix-page-jump
removed automatic focus from reference strip, which caused HTML pages…
2016-03-07 09:44:23 -08:00
Ian Gilman
37dcb6947b Merge pull request #871 from fs-webdev/master
Added note about locations being viewport relative for overlays.
2016-03-07 09:32:27 -08:00
rvdb
ef1e5c7d06 removed automatic focus from reference strip, which caused HTML pages to jump unwantedly to the reference strip upon loading 2016-03-04 22:43:20 +01:00
Grant Echols
a54d896a45 Added note about locations being viewport relative for overlays. 2016-03-04 11:26:53 -07:00
Ralph Krimmel
e993297f60 Removing unneccessary blank lines 2016-02-26 17:18:52 +01:00
Ian Gilman
0fdebe052c Changelog for #861 2016-02-25 09:43:14 -08:00
Ian Gilman
4e1a56472c Merge pull request #861 from avandecreme/transparency
Fix transparent images clearing the images in background. Fix #849
2016-02-25 09:29:50 -08:00
Ralph Krimmel
c9144c0add Adding missing newline at the end of the file 2016-02-25 11:53:55 +01:00
Ralph Krimmel
044a5b6794 Adding test for zoomify format 2016-02-25 11:51:16 +01:00
Ralph Krimmel
8637388cab Respecting hints from jslint 2016-02-25 11:48:01 +01:00
Ralph Krimmel
e670ad6e1f Adding zoomifytilesource to gruntfile so it is considered in build job 2016-02-25 11:46:56 +01:00
Ralph Krimmel
75e5365ecd Adding zoomify format example 2016-02-25 11:46:37 +01:00
Ralph Krimmel
e54f1a24f0 Fixing intendation 2016-02-25 10:18:48 +01:00
Ralph Krimmel
7d4eff0bb8 Minor style fixes 2016-02-25 10:16:08 +01:00
Antoine Vandecreme
963986d187 Add missing parenthesis. 2016-02-24 19:53:35 -05:00
Antoine Vandecreme
d18485844d Fix crash and improve tests.. 2016-02-24 19:48:11 -05:00
Ian Gilman
510c8c2b97 Changelog for #860 2016-02-24 09:27:19 -08:00
Ian Gilman
322bf28a3e Merge pull request #860 from avandecreme/master
Fix edge smoothing with png tiles. Fix #854
2016-02-24 09:24:51 -08:00
Ralph Krimmel
48eee7e75c Added first version of zoomifytilesource.js 2016-02-24 09:16:28 +01:00
Antoine Vandecreme
7e3320c167 Fix transparent images clearing the images in backgroumd. Fix #849 2016-02-23 19:37:41 -05:00
Antoine Vandecreme
b17b9c6f03 Fix edge smoothing with png tiles. Fix #854 2016-02-23 13:49:11 -05:00
Ian Gilman
71f93a27cd Changelog for #859 2016-02-23 10:28:16 -08:00
Ian Gilman
ef8ac2ecf8 Merge pull request #859 from altert/smallfix
don't draw tiles with opacity 0
2016-02-23 10:26:59 -08:00
Alexey Tikhonov
0737ba1a83 update to new coding style 2016-02-23 20:47:16 +03:00
Alexey Tikhonov
f51658f0af don't draw tiles with opacity 0, see #806 2016-02-23 20:42:21 +03:00
Ian Gilman
856f00994b Changelog for #853 2016-02-23 09:22:53 -08:00
Ian Gilman
cb1318de1f Merge pull request #853 from altert/smallfix
Add Viewer.getOverlayById and Overlay.getBounds functions
2016-02-23 09:21:16 -08:00
Ian Gilman
cf826ddd2b Changelog for #858 2016-02-23 09:10:50 -08:00
Ian Gilman
c1d9f6c5a8 Merge pull request #858 from fs-webdev/master
Added check to see if we were zooming before swallowing the canvas sc…
2016-02-23 09:08:58 -08:00
Alexey Tikhonov
655f5e5996 Merge branch 'master' of https://github.com/openseadragon/openseadragon into smallfix 2016-02-23 03:57:20 +03:00
Alexey Tikhonov
c44f134a6a remove 'to be removed' from getOverlayById @param comment to avoid confusion 2016-02-23 02:22:47 +03:00
Grant Echols
5f3eebe4e9 Added check to see if we were zooming before swallowing the canvas scroll event. 2016-02-22 11:59:37 -07:00
Alexey Tikhonov
97381b04a9 return null instead of false in Viewer.getOverlayById function and correct documentation 2016-02-20 00:45:33 +03:00
Alexey Tikhonov
7bcb1cc59f return clone of bounds in Overlay.getBounds so original bounds wouldn't be affected 2016-02-20 00:44:33 +03:00
Ian Gilman
458bbd61b6 Merge pull request #846 from avandecreme/rotation
Fix viewport.applyContraints (#833)
2016-02-18 11:12:23 -08:00
Antoine Vandecreme
57a52835a2 Merge branch 'master' of https://github.com/openseadragon/openseadragon into rotation 2016-02-17 18:33:43 -05:00
Antoine Vandecreme
aa5dc63a20 Changelog for #853 2016-02-17 18:31:31 -05:00
Antoine Vandecreme
015b1ca266 Rename worldContentSize to contentSizeNoRotate. 2016-02-17 18:08:26 -05:00
Alexey Tikhonov
06d263b4be Add Viewer.getOverlayById and Overlay.getBounds functions 2016-02-18 01:43:53 +03:00
Ian Gilman
42a24e5697 Changelog for #845 2016-02-16 09:28:24 -08:00
Ian Gilman
1338847ac5 Merge pull request #845 from altert/smallfix
start/stop tracking outerTracker on setMouseNavEnabled
2016-02-16 09:25:40 -08:00
Antoine Vandecreme
0725645344 Fix applyConstraints. Fix #833. 2016-02-15 17:09:31 -05:00
Antoine Vandecreme
eaab4fb4c5 Replace call to viewport.setHomeBounds by viewport._setContentBounds 2016-02-13 11:39:40 -05:00
Antoine Vandecreme
925ba8a78e Rename viewport.contentAspectX to viewport.contentAspectRatio. Remove viewport.contentAspectY. 2016-02-13 11:20:34 -05:00
Antoine Vandecreme
4634d90715 Rename this.homeBounds to this._contentBounds. 2016-02-11 20:14:49 -05:00
Alexey Tikhonov
d43c854c9f start/stop tracking outerTracker on setMouseNavEnabled 2016-02-11 23:54:31 +03:00
Ian Gilman
deddfa2a18 Changelog for #840 2016-02-10 09:49:53 -08:00
Ian Gilman
0fbc71ef49 Merge pull request #840 from avandecreme/rotation
Fix navigator not rotated when viewport rotation set in constructor.
2016-02-10 09:48:13 -08:00
Antoine Vandecreme
18b101ccf5 Fix navigator not rotated when viewport rotation set in constructor. 2016-02-09 19:20:52 -05:00
Ian Gilman
f1cdf90653 Added "fully-loaded" event to TiledImage 2016-02-05 09:14:43 -08:00
Ian Gilman
09afedb42f Changelog for #835 2016-02-04 09:05:13 -08:00
Ian Gilman
2f8bb4fbf5 Merge pull request #835 from gaetano-guerriero/fix/dzi-auto-tiles-url
fixed dzitilesource guessing of tilesUrl.
2016-02-04 09:03:28 -08:00
Gaetano Guerriero
110e7f17d7 added dzitilesource test module to coverage 2016-02-03 19:08:01 +01:00
Gaetano Guerriero
4508405d42 test module for dzitilesource was bad named 2016-02-03 11:30:19 +01:00
Gaetano Guerriero
d3e23a2986 fixed dzitilesource guessing of tilesUrl.
Now the regex guessing the root url of tiles works also if the data
url (the url from which information about the tile was downloaded) does
not ends with .dzi, .xml or .js.
2016-02-03 00:27:14 +01:00
Ian Gilman
a15b710e31 Merge pull request #831 from avandecreme/npm
Disable sequences and join_vars in uglify.
2016-02-01 14:17:48 -08:00
Antoine Vandecreme
4434361033 Disable sequences and join_vars in uglify. 2016-01-31 11:44:53 -05:00
Ian Gilman
3c8e79ded5 Merge pull request #830 from avandecreme/patch-1
Fix link to issue
2016-01-29 09:23:16 -08:00
Antoine Vandecreme
67b17b1fdf Fix link to issue 2016-01-28 18:22:45 -05:00
Ian Gilman
a7f255fad9 Merge branch 'master' of github.com:openseadragon/openseadragon 2016-01-28 11:52:17 -08:00
Ian Gilman
0a833805d8 Changelog for #827 2016-01-28 11:52:06 -08:00
Ian Gilman
949740d030 Merge pull request #827 from avandecreme/addsimpleimage
Add Viewer.addSimpleImage method. Fix #818
2016-01-28 11:35:02 -08:00
Ian Gilman
f3716ab2e2 Merge pull request #828 from avandecreme/npm
Build and doc update
2016-01-28 11:30:04 -08:00
Ian Gilman
a244d7ef86 Merge pull request #825 from avandecreme/rotation
Fix edge smoothing with rotation.
2016-01-28 11:27:31 -08:00
Antoine Vandecreme
9dbcd28a5a English fixes. 2016-01-27 21:49:05 -05:00
Antoine Vandecreme
e10eced7d0 Use self instead of _this. 2016-01-26 19:30:09 -05:00
Antoine Vandecreme
20756423af Tell travis to install grunt before doing anything else. 2016-01-26 19:14:45 -05:00
Antoine Vandecreme
9258d33caf Set travisCI nodejs version to stable. 2016-01-26 19:01:17 -05:00
Antoine Vandecreme
2d27944d4e Fix links 2016-01-26 18:57:34 -05:00
Antoine Vandecreme
c032b19944 Create CONTRIBUTING.md file. Fix #783 2016-01-26 18:53:23 -05:00
Antoine Vandecreme
4fea91e936 Add build as pre-publish step to npm. Fix #784 2016-01-26 18:32:08 -05:00
Antoine Vandecreme
c17f22f82b Generate source map for concat. Remove comments except banner for min. 2016-01-26 18:16:54 -05:00
Antoine Vandecreme
baaadad34d Update dev dependencies. 2016-01-26 18:15:26 -05:00
Antoine Vandecreme
ea6addb4c8 Add Viewer.addSimpleImage method. Fix #818 2016-01-26 18:02:11 -05:00
Antoine Vandecreme
3e56092445 Fix tests. 2016-01-26 15:59:10 -05:00
Ian Gilman
a1b7a5414c Merge pull request #826 from avandecreme/doc
Fix @lends for new JSDoc. Fix polymorphic functions doc (#824).
2016-01-26 09:05:21 -08:00
Antoine Vandecreme
43bb0d7741 Only use a larger sketch canvas if the viewport get rotated. 2016-01-26 12:04:34 -05:00
Antoine Vandecreme
a12b74ec17 Fix @lends for new JSDoc. Fix polymorphic functions doc (#824). 2016-01-24 16:09:18 -05:00
Antoine Vandecreme
33021ac24f Merge. 2016-01-23 18:49:58 -05:00
Antoine Vandecreme
c639dd5123 Fix edge smoothing with rotation. 2016-01-23 18:40:53 -05:00
Ian Gilman
8d453b5755 Changelog for #814 2016-01-21 09:09:39 -08:00
Ian Gilman
0a61e160dd Merge pull request #814 from informatics-isi-edu/master
adding setting of globalCompositeOperation for tiledImage
2016-01-21 09:07:29 -08:00
Mei-Hui Su
69cce5770c simplify the checks on compositeOperation 2016-01-20 09:48:15 -08:00
Mei-Hui Su
91ecd80a4f Add check for null compositeOperation option when setting useSketch 2016-01-20 09:14:10 -08:00
Ian Gilman
1409091643 Merge pull request #823 from roof12/bug/doc-fixes
escape HTML in documentation
2016-01-20 09:06:30 -08:00
Mei-Hui Su
ac0438e07b Fix the optional check to include null 2016-01-19 22:36:19 -08:00
Mei-Hui Su
41ee1e27fd put back the 'options.' 2016-01-19 14:29:15 -08:00
Mei-Hui Su
c214e2f0c4 change option compositeOperation default to null instead of 'source-over' 2016-01-19 14:17:52 -08:00
Scott Lewis
404e952711 escape HTML in documentation 2016-01-19 14:23:29 -07:00
Mei-Hui Su
efc9098ce4 Make setting of globalCompositeOperation optional in drawer.js 2016-01-19 11:49:04 -08:00
Ian Gilman
8899ea2c30 Changelog for #807 and #819 2016-01-18 09:12:45 -08:00
Ian Gilman
3e5a897eb5 Merge pull request #819 from fs-webdev/master
Broadened the check for mime type in the url to allow query strings
2016-01-18 09:06:44 -08:00
Mei-Hui Su
a3acaf4b8c Merge https://github.com/openseadragon/openseadragon 2016-01-15 10:58:32 -08:00
Grant Echols
746f79e3f1 Restored the mime comparison regex - I was too agressive in my changes earlier. 2016-01-15 11:42:18 -07:00
Ian Gilman
5810f7378d Merge pull request #820 from openseadragon/ian
Fixed erroneous asserts in spring
2016-01-15 09:20:36 -08:00
Ian Gilman
176e13cb13 Fixed erroneous asserts in spring 2016-01-15 09:19:18 -08:00
Mei-Hui Su
e89d1f4c97 fix couple of typos 2016-01-14 12:42:02 -08:00
Mei-Hui Su
3cfe8ecac2 Merge https://github.com/openseadragon/openseadragon 2016-01-14 12:32:54 -08:00
Grant Echols
7c4ef5c1e9 Broadened the check for mime type in the url to allow query strings 2016-01-14 11:00:25 -07:00
Ian Gilman
a0a44dbeb5 Changelog for #805 2016-01-14 09:42:41 -08:00
Ian Gilman
dd45e56dc4 Merge pull request #805 from accraze/tabindex-bug
fixed tabIndex to handle empty string
2016-01-14 09:37:35 -08:00
Ian Gilman
5390cb96c7 Removed redundant open-failed doc comment 2016-01-11 14:18:06 -08:00
Ian Gilman
f6ba891e8f Changelog for #816 2016-01-11 11:05:28 -08:00
Ian Gilman
11dad96eb7 Merge pull request #816 from tomcrane/iiif-sizes-pr
Support tile-less IIIF as per LegacyTileSource: Fix #737
2016-01-11 11:04:05 -08:00
Tom Crane
f7c9585003 Support tile-less IIIF as per LegacyTileSource: Fix #737 2016-01-09 14:04:21 +00:00
Mei-Hui Su
087507c823 1) update according to comments from openseadragon's 2016-01-07 12:47:17 -08:00
accraze
a3f0216ad7 Added tabIndex to default to zero
empty string is also accepted as well.
2016-01-06 20:00:38 -08:00
Ian Gilman
0d43f7e01a Fixing white space 2016-01-06 17:25:58 -08:00
Ian Gilman
1e7153e88f Merge pull request #815 from openseadragon/ian
Removed duplicate event doc
2016-01-06 15:32:18 -08:00
Ian Gilman
62a81c9a27 Removed duplicate event doc 2016-01-06 15:28:40 -08:00
Mei-Hui Su
ea833a780c Update to allow setting of globalCompositeOperation when
html <canvas> is used to process multiple tiledImages to blend
is a specific way.
(special handling,
   when compositeOperation is 'source-over' and opacity is 1,
   useSketch is false, otherwise useSketch is true
)
Valid values are 'source-atop', 'source-in', 'source-out',
  'destination-over', 'destination-atop', 'destination-in',
  'destination-out', 'lighter', 'copy' or 'xor'
http://www.w3schools.com/tags/canvas_globalcompositeoperation.asp
2016-01-06 07:58:36 -08:00
Ian Gilman
af527e95b8 Merge pull request #807 from hiroakit/navigator
Fix issue that rectangle can't move to clicked destination on navigator
2016-01-04 09:35:30 -08:00
Hiroaki ENDOH
27c91204b6 Refactor to reflect the reviewer comments
See also:
https://github.com/openseadragon/openseadragon/pull/807#discussion_r48447403
2015-12-27 12:15:17 +09:00
Hiroaki ENDOH
fb222d9fe9 Fix issue that rectangle can't move to clicked destination on navigator.
This issue can reproduce by these steps.
1. Open http://localhost:8000/test/demo/coordinates.html
2. Click Rotate button
3. Click canvas of navigator
2015-12-26 00:41:40 +09:00
Hiroaki ENDOH
3524386543 Fix typo 2015-12-25 23:33:07 +09:00
Ian Gilman
3c446663c3 Changelog for #796 2015-12-23 09:22:11 -08:00
Ian Gilman
c7db21f8b4 Merge pull request #796 from avandecreme/rotation
Fix coordinates conversion with rotation.
2015-12-23 09:20:40 -08:00
accraze
3925d1cb14 fixed tabIndex to handle empty string
chrome acts buggy and jumps when tabindex is not set to empty string.

fixes #769
2015-12-22 16:55:08 -08:00
Antoine Vandecreme
ebbf4ea4a0 Rename scale functions with NoRotate suffix. 2015-12-22 18:19:22 -05:00
Antoine Vandecreme
764d8f6f2c Fix crash in debug mode when tile is missing. 2015-12-16 17:40:28 -05:00
Ian Gilman
c4b1e05e25 Changelog for #790 2015-12-15 10:04:24 -08:00
Ian Gilman
0b411969ad Merge pull request #790 from Riksarkivet/iframe
Partial fix for drag release outside an iframe
2015-12-15 09:59:06 -08:00
Ian Gilman
2a430f3335 Merge pull request #801 from openseadragon/ian
Fixed broken assert
2015-12-15 09:57:40 -08:00
Ian Gilman
28d49df72f Fixed broken assert 2015-12-15 09:56:33 -08:00
Antoine Vandecreme
13bfb4ecfc Fix conversion methods doc. 2015-12-14 18:36:18 -05:00
Ian Gilman
64e90b919d Merge pull request #799 from openseadragon/ian
Removed redundant event handler in navigator
2015-12-14 11:04:43 -08:00
Ian Gilman
4935fcd225 Removed redundant event handler in navigator 2015-12-14 11:03:25 -08:00
Antoine Vandecreme
2dcd40afc6 Fix flickering issue at certain rotation angles. 2015-12-13 11:49:58 -05:00
Antoine Vandecreme
4a6d31ae37 Add units conversion with rotation unit tests. 2015-12-12 10:47:12 -05:00
Antoine Vandecreme
52f8ad6aa2 Fix coordinates conversion with rotation. 2015-12-11 19:07:23 -05:00
Sebastian Öberg
8f9d2a9bfe Converted jsdoc to plain comments 2015-12-09 18:28:41 +01:00
Ian Gilman
d1afae6ca0 Changelog for #782 2015-12-09 09:11:54 -08:00
Ian Gilman
c3c91ed612 Merge pull request #782 from avandecreme/rotation
Rotation
2015-12-09 09:10:39 -08:00
Sebastian Öberg
2ab6f18cee Changed isInIframe to a variable for caching 2015-12-09 11:04:37 +01:00
Sebastian Öberg
703f922ed8 Fixed drag release outside of iframe when the iframe is on the same domain. 2015-12-08 11:22:29 +01:00
Antoine Vandecreme
1d04ceadff Fix home bounds with rotation. Fix #567 and #463 2015-12-05 19:18:56 -05:00
Antoine Vandecreme
5e362554e2 Normalize the rectangles 2015-12-05 17:51:21 -05:00
Ian Gilman
92be395d66 Added more npm keywords 2015-12-03 09:31:46 -08:00
Ian Gilman
30c6e2b762 Made package name lower case 2015-12-01 09:16:42 -08:00
Ian Gilman
656d54cf3b Merge pull request #781 from avandecreme/npm
Prepare package.json for publishing on npm.
2015-12-01 09:06:39 -08:00
Antoine Vandecreme
fc919ff56d Make union reasons on bounding boxes. 2015-11-30 20:44:06 -05:00
Antoine Vandecreme
abc1168582 Remove superfluous comment. 2015-11-30 20:18:05 -05:00
Antoine Vandecreme
2e26ae5ff1 Remove Rect options contructor. 2015-11-30 19:11:41 -05:00
Antoine Vandecreme
94186826af Extend Rect class to support rotation. 2015-11-26 17:25:50 -05:00
Antoine Vandecreme
4bbcd63826 Fix formatting on netbeans. 2015-11-26 17:24:37 -05:00
Antoine Vandecreme
7244d96274 Merge branch 'master' of https://github.com/openseadragon/openseadragon into npm 2015-11-26 11:15:17 -05:00
Antoine Vandecreme
f3d5e4e155 Prepare package.json for publishing on npm. 2015-11-26 09:59:44 -05:00
Ian Gilman
0ded84f81a Changelog for #779 2015-11-25 11:53:02 -08:00
Ian Gilman
7f08f27e7e Merge pull request #779 from TMUND/master
Fixes #777: next button click pops up virtual keyboard on mobile devices
2015-11-25 09:59:21 -08:00
Toni Munder
de29b56c59 Fixes #777: next button click pops up virtual keyboard on mobile devices 2015-11-24 18:23:54 -08:00
tmund
ad8f12eeef Merge pull request #1 from openseadragon/master
Getting the latest
2015-11-24 18:20:28 -08:00
Ian Gilman
174ff02904 Changelog for #764 2015-11-23 09:49:16 -08:00
Ian Gilman
f07c9a7026 Merge pull request #764 from picturae/master
tile edge smoothing at high zoom - #755
2015-11-23 09:47:32 -08:00
Petar Petrov
9922d2a4bb edge smoothing fix for Mac 2015-11-19 10:06:43 +02:00
Petar Petrov
7406727090 Merge branch 'master' of https://github.com/openseadragon/openseadragon 2015-11-16 16:44:31 +02:00
Ian Gilman
87f1c97295 Changelog back to normal 2015-11-12 14:00:00 -08:00
Ian Gilman
b2c17b5604 Changelog twiddling 2015-11-12 13:57:31 -08:00
Ian Gilman
fca0a7ca1b Doc comment fix 2015-11-12 13:55:47 -08:00
Ian Gilman
0e587f7c33 Ready for next version 2015-11-12 13:48:23 -08:00
Petar Petrov
8bee1e7b8b doc tweak for edge smoothing changes - #755 2015-11-06 08:55:30 +02:00
Petar Petrov
7eda39c9a9 fixed edge smoothing to work with clipping and placeholderFillRect - #755 2015-11-05 16:31:13 +02:00
Petar Petrov
515c15bf98 various fixes for edge smoothing - #755 2015-11-05 16:19:56 +02:00
Petar Petrov
8c4fcc9ca9 tile edge smoothing at high zoom - #755 2015-11-04 17:04:50 +02:00
285 changed files with 36871 additions and 8337 deletions

1
.browserslistrc Normal file
View file

@ -0,0 +1 @@
defaults

286
.eslintrc.hound.json Normal file
View file

@ -0,0 +1,286 @@
{
"env": {
"browser": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"no-unused-vars": [
"error",
{
"args": "none"
}
],
"block-scoped-var": [
"error"
],
"consistent-return": [
"error"
],
"curly": [
"error",
"all"
],
"eqeqeq": [
"error"
],
"no-eval": [
"error"
],
"no-implicit-globals": [
"error"
],
"no-implied-eval": [
"error"
],
"no-invalid-this": [
"error"
],
"no-multi-spaces": [
"error",
{
"exceptions": {
"Property": true,
"VariableDeclarator": true,
"AssignmentExpression": true
}
}
],
"no-new-wrappers": [
"error"
],
"no-new": [
"error"
],
"no-return-assign": [
"error"
],
"no-self-compare": [
"error"
],
"no-unmodified-loop-condition": [
"error"
],
"no-unused-expressions": [
"error"
],
"no-useless-call": [
"error"
],
"no-useless-concat": [
"error"
],
"no-useless-escape": [
"error"
],
"no-useless-return": [
"error"
],
"no-with": [
"error"
],
"radix": [
"error"
],
"yoda": [
"error"
],
"no-undef-init": [
"error"
],
"no-use-before-define": [
"error",
{
"functions": false
}
],
"array-bracket-spacing": [
"error",
"never"
],
"block-spacing": [
"error"
],
"brace-style": [
"error"
],
"camelcase": [
"error"
],
"comma-spacing": [
"error"
],
"comma-style": [
"error"
],
"computed-property-spacing": [
"error"
],
"consistent-this": [
"error",
"self"
],
"eol-last": [
"error"
],
"func-call-spacing": [
"error"
],
"func-name-matching": [
"error"
],
"key-spacing": [
"error",
{
"mode": "minimum"
}
],
"keyword-spacing": [
"error"
],
"max-len": [
"error",
80
],
"max-statements-per-line": [
"error",
{
"max": 1
}
],
"new-cap": [
"error"
],
"new-parens": [
"error"
],
"no-array-constructor": [
"error"
],
"no-mixed-operators": [
"error",
{
"groups": [
[
"&",
"|",
"^",
"~",
"<<",
">>",
">>>"
],
[
"==",
"!=",
"===",
"!==",
">",
">=",
"<",
"<="
],
[
"&&",
"||"
],
[
"in",
"instanceof"
]
]
}
],
"no-new-object": [
"error"
],
"no-tabs": [
"error"
],
"no-trailing-spaces": [
"error"
],
"no-unneeded-ternary": [
"error"
],
"no-whitespace-before-property": [
"error"
],
"object-curly-spacing": [
"error",
"always"
],
"one-var-declaration-per-line": [
"error"
],
"one-var": [
"error",
"never"
],
"operator-assignment": [
"error"
],
"operator-linebreak": [
"error",
"after"
],
"quote-props": [
"error",
"as-needed"
],
"semi-spacing": [
"error"
],
"space-before-blocks": [
"error"
],
"space-before-function-paren": [
"error",
"never"
],
"space-in-parens": [
"error",
"never"
],
"space-infix-ops": [
"error"
],
"space-unary-ops": [
"error",
{
"words": false,
"nonwords": false
}
],
"unicode-bom": [
"error"
],
"no-caller": [
"error"
],
"no-loop-func": [
"error"
]
},
"globals": {
"OpenSeadragon": "writable",
"define": "readonly",
"module": "readonly",
"Map": "readonly"
}
}

300
.eslintrc.json Normal file
View file

@ -0,0 +1,300 @@
{
"root": true,
"plugins": ["compat"],
"extends": [
"eslint:recommended",
"plugin:compat/recommended"
],
"env": {
"es6": true,
"browser": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "script",
"ecmaFeatures": {
"globalReturn": false,
"impliedStrict": false,
"jsx": false
}
},
"globals": {
"OpenSeadragon": "writable",
"define": "readonly",
"module": "readonly",
"Map": "readonly"
},
"rules": {
"no-unused-vars": [
"error",
{
"args": "none"
}
],
"indent": [
"off",
4
],
"quotes": [
"off",
"double"
],
"semi": [
"error",
"always"
],
"block-scoped-var": [
"error"
],
"consistent-return": [
"error"
],
"curly": [
"error",
"all"
],
"eqeqeq": [
"error"
],
"no-eval": [
"error"
],
"no-implicit-globals": [
"error"
],
"no-implied-eval": [
"error"
],
"no-invalid-this": [
"error"
],
"no-multi-spaces": [
"error",
{
"ignoreEOLComments": true,
"exceptions": {
"Property": true,
"VariableDeclarator": true,
"AssignmentExpression": true
}
}
],
"no-new-wrappers": [
"error"
],
"no-new": [
"error"
],
"no-return-assign": [
"error"
],
"no-self-compare": [
"error"
],
"no-unmodified-loop-condition": [
"error"
],
"no-unused-expressions": [
"error"
],
"no-useless-call": [
"error"
],
"no-useless-concat": [
"error"
],
"no-useless-escape": [
"error"
],
"no-useless-return": [
"error"
],
"no-with": [
"error"
],
"radix": [
"error"
],
"yoda": [
"off"
],
"no-undef-init": [
"error"
],
"no-use-before-define": [
"error",
{
"functions": false,
"classes": true,
"variables": true
}
],
"array-bracket-spacing": [
"off",
"never"
],
"block-spacing": [
"off"
],
"brace-style": [
"off"
],
"camelcase": [
"error"
],
"comma-spacing": [
"error"
],
"comma-style": [
"error"
],
"computed-property-spacing": [
"off"
],
"consistent-this": [
"off",
"self"
],
"eol-last": [
"error"
],
"func-call-spacing": [
"error"
],
"func-name-matching": [
"error"
],
"key-spacing": [
"error",
{
"mode": "minimum"
}
],
"keyword-spacing": [
"off"
],
"max-len": [
"off",
80
],
"max-statements-per-line": [
"error",
{
"max": 1
}
],
"new-cap": [
"error"
],
"new-parens": [
"error"
],
"no-array-constructor": [
"error"
],
"no-mixed-operators": [
"error",
{
"groups": [
[
"&",
"|",
"^",
"~",
"<<",
">>",
">>>"
],
[
"==",
"!=",
"===",
"!==",
">",
">=",
"<",
"<="
],
[
"&&",
"||"
],
[
"in",
"instanceof"
]
]
}
],
"no-new-object": [
"error"
],
"no-tabs": [
"error"
],
"no-trailing-spaces": [
"error"
],
"no-unneeded-ternary": [
"error"
],
"no-whitespace-before-property": [
"error"
],
"object-curly-spacing": [
"off",
"always"
],
"one-var-declaration-per-line": [
"error"
],
"one-var": [
"off",
"never"
],
"operator-assignment": [
"error"
],
"operator-linebreak": [
"error",
"after"
],
"quote-props": [
"error",
"as-needed"
],
"semi-spacing": [
"error"
],
"space-before-blocks": [
"off"
],
"space-before-function-paren": [
"off",
"never"
],
"space-in-parens": [
"off",
"never"
],
"space-infix-ops": [
"error"
],
"space-unary-ops": [
"error",
{
"words": true,
"nonwords": false
}
],
"unicode-bom": [
"error"
],
"no-caller": [
"error"
],
"no-loop-func": [
"error"
]
}
}

12
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # iangilman
patreon: # iangilman
open_collective: openseadragon
ko_fi: # iangilman
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

4
.gitignore vendored
View file

@ -3,7 +3,9 @@ node_modules
build/
sftp-config.json
coverage/
temp/
instrumented/
.idea
/nbproject/private/
.directory
local-test
.DS_Store

3
.hound.yml Normal file
View file

@ -0,0 +1,3 @@
eslint:
enabled: true
config_file: .eslintrc.hound.json

View file

@ -1,15 +0,0 @@
{
"browser": true,
"curly": true,
"eqeqeq": false,
"loopfunc": false,
"noarg": true,
"trailing": true,
"undef": true,
"unused": false,
"globals": {
"OpenSeadragon": true,
"define": false
}
}

View file

@ -1,6 +1,10 @@
# Specify dist until Travis CI default Runner OS updates to one
# with glibc version required by newer Node versions
# See: https://github.com/nodejs/node/issues/42351#issuecomment-1068424442
dist: jammy
language: node_js
sudo: false
node_js:
- 0.10
before_script:
- lts/*
before_install:
- npm install -g grunt-cli

23
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,23 @@
// Place your settings in this file to overwrite default and user settings.
{
// The number of spaces a tab is equal to.
"editor.tabSize": 4,
// Insert spaces when pressing Tab.
"editor.insertSpaces": true,
// When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.
"editor.detectIndentation": false,
// Columns at which to show vertical rulers
"editor.rulers": [80],
// The default character set encoding to use when reading and writing files.
"files.encoding": "utf8",
// The default end of line character.
"files.eol": "\n",
// When enabled, will trim trailing whitespace when you save a file.
"files.trimTrailingWhitespace": true
}

26
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,26 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"command": "grunt",
"tasks": [
{
"label": "build",
"type": "grunt",
"task": "build",
"problemMatcher": [
"$lessCompile",
"$tsc",
"$jshint"
],
"group": "build"
},
{
"label": "test",
"type": "grunt",
"task": "test",
"problemMatcher": [],
"group": "test"
}
]
}

25
.vscode/tasks.json.old vendored Normal file
View file

@ -0,0 +1,25 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "grunt",
"isShellCommand": true,
"tasks": [
{
"taskName": "build",
"args": [],
"isBuildCommand": true,
"isWatching": false,
"problemMatcher": [
"$lessCompile",
"$tsc",
"$jshint"
]
},
{
"taskName": "test",
"args": [],
"isTestCommand": true
}
]
}

39
CITATION.cff Normal file
View file

@ -0,0 +1,39 @@
cff-version: 1.2.0
title: OpenSeadragon
message: "If you use this software, please cite it using the metadata from this file."
type: software
authors:
- given-names: Ian
family-names: Gilman
email: ian@iangilman.com
- given-names: Aseem
family-names: Kishore
- given-names: Chris
family-names: Thatcher
- given-names: Mark
family-names: Salsbery
- given-names: Antoine
family-names: Vandecreme
- given-names: Thomas
family-names: Pearce
identifiers:
- type: url
value: https://openseadragon.github.io/
description: Homepage
- type: url
value: https://github.com/openseadragon/openseadragon
description: Repository
repository-code: https://github.com/openseadragon/openseadragon
url: https://openseadragon.github.io/
abstract: "An open-source, web-based viewer for high-resolution zoomable images, implemented in pure JavaScript, for desktop and mobile."
keywords:
- javascript
- image
- zooming
- viewer
- image-viewer
- high-resolution
- iiif
license: BSD-3-Clause
version: 5.0.1
date-released: 2024-11-09

96
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,96 @@
### Contributing
OpenSeadragon is truly a community project; we welcome your involvement!
When contributing, please attempt to match the code style already in the codebase.
However, we are in the process of changing our code style (see issue [#456](https://github.com/openseadragon/openseadragon/issues/456)), so avoid spaces inside parentheses and square brackets. Note that we use four spaces per indentation stop. For easier setup you can also install [EditorConfig](https://editorconfig.org/) if your IDE is supported. For more thoughts on code style, see [idiomatic.js](https://github.com/rwldrn/idiomatic.js/).
When fixing bugs and adding features, when appropriate please also:
* Update related doc comments (we use [JSDoc 3](https://jsdoc.app/))
* Add/update related unit tests
If you're new to the project, check out our [good first issues](https://github.com/openseadragon/openseadragon/issues?labels=good+first+issue&page=1&state=open) for some places to dip your toe in the water.
If you're new to open source in general, check out [GitHub's open source intro guide](https://guides.github.com/activities/contributing-to-open-source/).
### First Time Setup
All command-line operations for building and testing OpenSeadragon are scripted using [Grunt](https://gruntjs.com/) which is based on [Node.js](https://nodejs.org/). To get set up:
1. Install Node, if you haven't already (available at the link above)
1. Install the Grunt command line runner (if you haven't already); on the command line, run `npm install -g grunt-cli`
1. Clone the openseadragon repository
1. On the command line, go in to the openseadragon folder
1. Run `npm install`
You're set, all development dependencies should have been installed and the project built...
continue reading for build and test instructions.
### Building from Source
To build, just run (on the command line, in the openseadragon folder):
grunt
If you want Grunt to watch your source files and rebuild every time you change one, use:
grunt watch
To have it watch your source files and also run a server for you to test in:
grunt dev
The built files appear in the `build` folder.
If you want to build tar and zip files for distribution (they will also appear in the `build` folder), use:
grunt package
Note that the `build` folder is masked with .gitignore; it's just for your local use, and won't be checked in to the repository.
You can also publish the built version to the site-build repository. This assumes you have cloned it next to this repository. The command is:
grunt publish
... 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
Our tests are based on [QUnit](https://qunitjs.com/) and [Puppeteer](https://github.com/GoogleChrome/puppeteer); they're both installed when you run `npm install`. To run on the command line:
grunt test
To test a specific module (`navigator` here) only:
grunt test --module="navigator"
If you wish to work interactively with the tests or test your changes:
grunt connect watch
and open `http://localhost:8000/test/test.html` in your browser.
Another good page, if you want to interactively test out your changes, is `http://localhost:8000/test/demo/basic.html`.
> Note: corresponding npm commands for the above are:
> - npm run test
> - npm run test -- --module="navigator"
> - npm run dev
You can also get a report of the tests' code coverage:
grunt coverage
The report shows up at `coverage/html/index.html` viewable in a browser.
### Installing from forked Github repo/branch
This project is now compatible with direct installation of forked Github repos/branches via npm/yarn (possible because of the new [prepare](https://docs.npmjs.com/misc/scripts) command). This enables quick testing of a bugfix or feature addition via a forked repo. In order to do this:
1. Install the Grunt command line runner (if you haven't already); on the command line, run `npm install -g grunt-cli` (or `yarn global add grunt-cli`)
1. Remove any currently installed openseadragon package via `npm uninstall openseadragon` or `yarn remove openseadragon`
1. Add the specific forked repo/branch by running `npm install git://github.com/username/openseadragon.git#branch-name` or `yarn add git://github.com/username/openseadragon.git#branch-name`. Make sure to replace username and branch-name with proper targets.
During installation, the package should be correctly built via grunt and can then be used via `import Openseadragon from 'openseadragon'` or `var Openseadragon = require('openseadragon')` statements as if the official package were installed.

View file

@ -1,18 +1,22 @@
/* eslint-disable no-redeclare */
/* global module */
module.exports = function(grunt) {
/* eslint-disable no-undef */
var dateFormat = require('dateformat');
// ----------
grunt.loadNpmTasks("grunt-contrib-compress");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-qunit-istanbul");
grunt.loadNpmTasks("grunt-contrib-qunit");
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-eslint");
grunt.loadNpmTasks("grunt-git-describe");
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks('grunt-istanbul');
// ----------
var packageJson = grunt.file.readJSON("package.json"),
@ -21,13 +25,16 @@ module.exports = function(grunt) {
packageDirName = "openseadragon-bin-" + packageJson.version,
packageDir = "build/" + packageDirName + "/",
releaseRoot = "../site-build/built-openseadragon/",
coverageDir = 'coverage/' + dateFormat(new Date(), 'yyyymmdd-HHMMss'),
sources = [
"src/openseadragon.js",
"src/matrix3.js",
"src/fullscreen.js",
"src/eventsource.js",
"src/mousetracker.js",
"src/control.js",
"src/controldock.js",
"src/placement.js",
"src/viewer.js",
"src/navigator.js",
"src/strings.js",
@ -38,9 +45,12 @@ module.exports = function(grunt) {
"src/iiiftilesource.js",
"src/osmtilesource.js",
"src/tmstilesource.js",
"src/zoomifytilesource.js",
"src/legacytilesource.js",
"src/imagetilesource.js",
"src/tilesourcecollection.js",
"src/priorityqueue.js",
"src/datatypeconvertor.js",
"src/button.js",
"src/buttongroup.js",
"src/rectangle.js",
@ -50,18 +60,32 @@ module.exports = function(grunt) {
"src/imageloader.js",
"src/tile.js",
"src/overlay.js",
"src/drawer.js",
"src/drawerbase.js",
"src/htmldrawer.js",
"src/canvasdrawer.js",
"src/webgldrawer.js",
"src/viewport.js",
"src/tiledimage.js",
"src/tilecache.js",
"src/world.js"
"src/world.js",
];
var banner = "//! <%= pkg.name %> <%= pkg.version %>\n" +
"//! Built on <%= grunt.template.today('yyyy-mm-dd') %>\n" +
"//! Git commit: <%= gitInfo %>\n" +
"//! http://openseadragon.github.io\n" +
"//! License: http://openseadragon.github.io/license/\n\n";
// ----------
grunt.event.once('git-describe', function (rev) {
grunt.config.set('gitInfo', rev);
});
let moduleFilter = '';
if (grunt.option('module')) {
moduleFilter = '?module=' + grunt.option('module')
}
// ----------
// Project configuration.
grunt.initConfig({
@ -75,7 +99,7 @@ module.exports = function(grunt) {
clean: {
build: ["build"],
package: [packageDir],
coverage: ["coverage"],
coverage: ["instrumented"],
release: {
src: [releaseRoot],
options: {
@ -85,12 +109,9 @@ module.exports = function(grunt) {
},
concat: {
options: {
banner: "//! <%= pkg.name %> <%= pkg.version %>\n" +
"//! Built on <%= grunt.template.today('yyyy-mm-dd') %>\n" +
"//! Git commit: <%= gitInfo %>\n" +
"//! http://openseadragon.github.io\n" +
"//! License: http://openseadragon.github.io/license/\n\n",
process: true
banner: banner,
process: true,
sourceMap: true
},
dist: {
src: [ "<banner>" ].concat(sources),
@ -111,12 +132,19 @@ module.exports = function(grunt) {
},
uglify: {
options: {
preserveComments: "some",
preserveComments: false,
banner: banner,
compress: {
sequences: false,
/* eslint-disable camelcase */
join_vars: false
},
sourceMap: true,
sourceMapName: 'build/openseadragon/openseadragon.min.js.map'
sourceMapName: 'build/openseadragon/openseadragon.min.js.map',
sourceMapIn: 'build/openseadragon/openseadragon.js.map'
},
openseadragon: {
src: [ distribution ],
src: distribution,
dest: minified
}
},
@ -143,19 +171,24 @@ module.exports = function(grunt) {
qunit: {
normal: {
options: {
urls: [ "http://localhost:8000/test/test.html" ]
}
urls: [ "http://localhost:8000/test/test.html" + moduleFilter ],
timeout: 10000,
puppeteer: {
headless: 'new'
}
},
},
coverage: {
options: {
urls: [ "http://localhost:8000/test/coverage.html" ],
urls: [ "http://localhost:8000/test/coverage.html" + moduleFilter ],
coverage: {
src: ['src/*.js'],
htmlReport: 'coverage/html/',
instrumentedFiles: 'temp/',
htmlReport: coverageDir + '/html/',
instrumentedFiles: 'instrumented/src/',
baseUrl: '.',
disposeCollector: true
}
},
timeout: 10000
}
},
all: {
@ -168,7 +201,12 @@ module.exports = function(grunt) {
server: {
options: {
port: 8000,
base: "."
base: {
path: ".",
options: {
stylesheet: 'style.css'
}
}
}
}
},
@ -176,16 +214,50 @@ module.exports = function(grunt) {
files: [ "Gruntfile.js", "src/*.js", "images/*" ],
tasks: "watchTask"
},
jshint: {
eslint: {
options: {
jshintrc: '.jshintrc'
overrideConfigFile: '.eslintrc.json'
},
beforeconcat: sources,
afterconcat: [ distribution ]
target: sources
},
"git-describe": {
options: {
failOnError: false
},
build: {}
}
},
gitInfo: "unknown",
instrument: {
files: sources,
options: {
lazy: false,
basePath: 'instrumented/'
}
},
reloadTasks: {
rootPath: "instrumented/src/"
},
storeCoverage: {
options: {
dir: coverageDir,
'include-all-sources': true
}
},
makeReport: {
src: "coverage/**/*.json",
options: {
type: [ "lcov", "html" ],
dir: coverageDir,
print: "detail"
}
}
});
grunt.event.on("qunit.coverage", function(coverage) {
var reportPath = coverageDir + "/coverage.json";
// Create the coverage file
grunt.file.write(reportPath, JSON.stringify(coverage));
});
// ----------
@ -254,8 +326,8 @@ module.exports = function(grunt) {
// Build task.
// Cleans out the build folder and builds the code and images into it, checking lint.
grunt.registerTask("build", [
"clean:build", "jshint:beforeconcat", "git-describe", "concat", "jshint:afterconcat",
"uglify", "replace:cleanPaths", "copy:build"
"clean:build", "git-describe", "eslint", "concat", "uglify",
"replace:cleanPaths", "copy:build"
]);
// ----------
@ -273,7 +345,7 @@ module.exports = function(grunt) {
// ----------
// Coverage task.
// Outputs unit test code coverage report.
grunt.registerTask("coverage", ["clean:coverage", "connect", "qunit:coverage"]);
grunt.registerTask("coverage", ["clean:coverage", "instrument", "connect", "qunit:coverage", "makeReport"]);
// ----------
// Package task.

View file

@ -1,5 +1,5 @@
Copyright (C) 2009 CodePlex Foundation
Copyright (C) 2010-2013 OpenSeadragon contributors
Copyright (C) 2010-2024 OpenSeadragon contributors
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

106
README.md
View file

@ -1,95 +1,39 @@
# OpenSeadragon
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/openseadragon/openseadragon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<!-- [![Gitter][gitter-badge]][gitter]
[![Build Status][build-badge]][build] -->
An open-source, web-based viewer for zoomable images, implemented in pure JavaScript.
See it in action and get started using it at http://openseadragon.github.io/.
See it in action and get started using it at [https://openseadragon.github.io/][openseadragon].
## Stable Builds
See the [GitHub releases page](https://github.com/openseadragon/openseadragon/releases).
See the [GitHub releases page][github-releases].
## Development
If you want to use OpenSeadragon in your own projects, you can find the latest stable build, API documentation, and example code at http://openseadragon.github.io/. If you want to modify OpenSeadragon and/or contribute to its development, read on.
### First Time Setup
All command-line operations for building and testing OpenSeadragon are scripted using [Grunt](http://gruntjs.com/) which is based on [Node.js](http://nodejs.org/). To get set up:
1. Install Node, if you haven't already (available at the link above)
1. Install the Grunt command line runner (if you haven't already); on the command line, run `npm install -g grunt-cli`
1. Clone the openseadragon repository
1. On the command line, go in to the openseadragon folder
1. Run `npm install`
You're set... continue reading for build and test instructions.
### Building from Source
To build, just run (on the command line, in the openseadragon folder):
grunt
If you want Grunt to watch your source files and rebuild every time you change one, use:
grunt watch
To have it watch your source files and also run a server for you to test in:
grunt dev
The built files appear in the `build` folder.
If you want to build tar and zip files for distribution (they will also appear in the `build` folder), use:
grunt package
Note that the `build` folder is masked with .gitignore; it's just for your local use, and won't be checked in to the repository.
You can also publish the built version to the site-build repository. This assumes you have cloned it next to this repository. The command is:
grunt publish
... 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
Our tests are based on [QUnit](http://qunitjs.com/) and [PhantomJS](http://phantomjs.org/); they're both installed when you run `npm install`. At the moment we don't have much in the way of tests, but we're working to fix that. To run on the command line:
grunt test
If you wish to work interactively with the tests or test your changes:
grunt connect watch
and open `http://localhost:8000/test/test.html` in your browser.
Another good page, if you want to interactively test out your changes, is `http://localhost:8000/test/demo/basic.html`.
You can also get a report of the tests' code coverage:
grunt coverage
The report shows up at `coverage/html/index.html` viewable in a browser.
### Contributing
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 easier setup you can also install [EditorConfig](http://editorconfig.org/) if your IDE is supported. For more thoughts on code style, see [idiomatic.js](https://github.com/rwldrn/idiomatic.js/).
When fixing bugs and adding features, when appropriate please also:
* Update related doc comments (we use [JSDoc 3](http://usejsdoc.org/))
* Add/update related unit tests
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.
If you're new to open source in general, check out [GitHub's open source intro guide](https://guides.github.com/overviews/os-contributing/).
If you want to use OpenSeadragon in your own projects, you can find the latest stable build, API documentation, and example code at [https://openseadragon.github.io/][openseadragon]. If you want to modify OpenSeadragon and/or contribute to its development, read the [contributing guide][github-contributing] for instructions.
## License
OpenSeadragon is released under the New BSD license. For details, see the file LICENSE.txt.
OpenSeadragon is released under the New BSD license. For details, see the [LICENSE.txt file][github-license].
[![Build Status](https://secure.travis-ci.org/openseadragon/openseadragon.png?branch=master)](http://travis-ci.org/openseadragon/openseadragon)
[openseadragon]: https://openseadragon.github.io/
<!-- [gitter-badge]: https://badges.gitter.im/Join%20Chat.svg
[gitter]: https://gitter.im/openseadragon/openseadragon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[build-badge]: https://secure.travis-ci.org/openseadragon/openseadragon.png?branch=master
[build]: https://travis-ci.org/openseadragon/openseadragon -->
[github-releases]: https://github.com/openseadragon/openseadragon/releases
[github-contributing]: https://github.com/openseadragon/openseadragon/blob/master/CONTRIBUTING.md
[github-license]: https://github.com/openseadragon/openseadragon/blob/master/LICENSE.txt
## Sponsors
We are grateful for the (development or financial) contribution to the OpenSeadragon project.
<a href="https://www.bbmri-eric.eu"><img alt="BBMRI ERIC Logo" src="assets/logos/bbmri-logo.png" height="70" /></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.pitt.edu/"><img alt="University of Pittsburgh Logo" src="assets/logos/pitt-logo.png" height="70" /></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.stanford.edu/"><img alt="Stanford University Logo" src="assets/logos/stanford-logo.png" height="70" /></a>

BIN
assets/logos/bbmri-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
assets/logos/pitt-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View file

@ -1,6 +1,376 @@
OPENSEADRAGON CHANGELOG
=======================
6.0.0: (in progress...)
* NEW BEHAVIOR: OpenSeadragon Data Pipeline Overhaul (#2407, #2643 @Aiosa)
* DEPRECATION: Properties on tile that manage drawer data, or store data to draw: Tile.[element|imgElement|style|context2D|getImage|getCanvasContext] and transitively Tile.getScaleForEdgeSmoothing
* DEPRECATION: TileSource data lifecycle handlers: system manages these automatically: TileSource.[createTileCache|destroyTileCache|getTileCacheData|getTileCacheDataAsImage|getTileCacheDataAsContext2D]
* Tiles data is driven by caches: tiles can have multiple caches and cache can reference multiple tiles.
* Data types & conversion pipeline: caches support automated conversion between types, and call optionally destructors. These are asynchronous.
* Data conversion reasoning: the system keeps costs of convertors and seeks the cheapest conversion to a target format (using Dijkstra).
* Async support: events can now await handlers. Added OpenSeadragon.Promise proxy object. This object supports also synchronous mode.
* Drawers define what data they are able to work with, and receive automatically data from one of the declared types.
* Drawers now store data only inside cache, and provide optional type convertors to move data into a format they can work with.
* TileSource equality operator. TileSource destructor support. TileSources now must output type of the data they download [context.finish].
* Zombies: data can outlive tiles, and be kept in the system to wait if they are not suddenly needed. Turned on automatically with TiledImage addition with `replace: true` and equality test success.
* ImagesLoadedPerFrame is boosted 10 times when system is fresh (reset / open) and then declines back to original value.
* CacheRecord supports 'internal cache' of 'SimpleCache' type. This cache can be used by drawers to hide complex types used for rendering. Such caches are stored internally on CacheRecord objects.
* CacheRecord drives asynchronous data management and ensures correct behavior through awaiting Promises.
* TileCache adds new methods for cache modification: renameCache, cloneCache, injectCache, replaceCache, restoreTilesThatShareOriginalCache, safeUnloadCache, unloadCacheForTile and more. Used internally within invalidation events
* Tiles have up to two 'originalCacheKey' and 'cacheKey' caches, which keep original data and target drawn data (if modified).
* Invalidation Pipeline: New event 'tile-invalidated' and requestInvalidate methods on World and TiledImage. Tiles get methods to modify data to draw, system prepares data for drawing and swaps them with the current main tile cache.
* New test suites for the new cache system, conversion pipeline and invalidation events.
* New testing/demo utilities (MockSeadragon, DrawerSwitcher for switching drawers in demos, getBuiltInDrawersForTest for testing all drawers), serialization guard in tests to remove circular references.
* New demos, demonstrating the new pipeline. New demos for older plugins to show how compatible new version is.
* Misc: updated CSS for dev server, new dev & test commands.
* New option: loadDestinationTilesOnAnimation. With it on, during animations, OSD loads tiles in the destination region, rather than the areas passed through on the way to the destination. This new feature is on by default. (#2686, #2690 @MichaelWGibson)
* Overlay wrapper elements now have a "openseadragon-overlay-wrapper" class. If the overlay element has an ID, the wrapper gets a variant on that ID, but if the overlay element does not have an ID, we no longer give the wrapper an ID. (#2698 @lokaesshwar)
* The functions the viewer uses to operate the zoom in and zoom out buttons are now accessible to be called programatically (#2702 @achu1998)
* Improved how OpenSeadragon is imported in various environments (#2644 @Aiosa)
* Improved documentation (#2676 @bennlich)
* Improved unit tests (#2640 @harshkg23)
* Fixed: Transparency detection didn't always work properly (#2636 @pcram-techcyte)
* Fixed: MouseTracker's hasGestureHandlers and hasScrollHandler values were not getting updated upon dynamically adding/removing handlers (#2649 @Seafret)
* Fixed: Sometimes images wouldn't update when you changed their opacity (#2652 @pearcetm)
* Fixed: Possible MouseTracker hash collision (#2657 @cff29546)
5.0.1:
* Improved overlay handling so it plays better with other libraries (#2582 @BeebBenjamin)
* WebGLDrawer now supports the imageSmoothingEnabled option (#2615 @pearcetm)
* Fixed: If you switched from WebGL drawer to canvas drawer, it didn't clean up properly (#2570 @pearcetm)
* Fixed: TiledImage.setClip would sometimes leave tiles unloaded (#2590 @pearcetm)
* Fixed: The WebGL drawer didn't support viewportMargins (#2600, #2606 @pearcetm)
* Fixed: If you set viewport rotation before flip, the navigator display region would be drawn wrong (#2619 @jbakarich)
* Fixed: In some cases, the WebGL drawer would draw the image in white (#2620 @sbarex)
* Fixed: If the user changed the page zoom or moved the window a different monitor, the image would disappear (#2627 @pearcetm)
5.0.0:
* BREAKING CHANGE: Dropped support for IE11 (#2300, #2361, #2553 @AndrewADev, @msalsbery)
* DEPRECATION: The OpenSeadragon.createCallback function is no longer recommended (#2367 @akansjain)
* The viewer now uses WebGL when available (#2310, #2462, #2466, #2468, #2469, #2472, #2478, #2488, #2492, #2521, #2537, #2557, #2558 @pearcetm, @Aiosa, @thec0keman)
* Added webp to supported image formats (#2455 @BeebBenjamin)
* Added avif to supported image formats (#2544 @msalsbery)
* Introduced maxTilesPerFrame option to allow loading more tiles simultaneously (#2387 @jetic83)
* Now when creating a viewer or navigator, we leave its position style alone if possible (#2393 @VIRAT9358)
* Added getter & setter for Viewport.maxZoomPixelRatio (#2506 @eug-L)
* Overlays are now positioned properly when the viewport is flipped (#2546 @BeebBenjamin)
* Added overlayPreserveContentDirection option to keep overlays readable when viewport is flipped (#2546 @BeebBenjamin)
* Test improvements (#2382 @AndrewADev)
* MouseTracker options documentation fixes (#2389 @msalsbery)
* Improved documentation and error message for Viewport.imageToViewportZoom (#2505 @eug-L)
* Fixed documentation typos (#2507 @frameflare)
* Additional documentation fixes (#2563 @msalsbery)
* Fixed: Sometimes if the viewport was flipped and the user zoomed in far enough, it would flip back (#2364 @SebDelile)
* Fixed: Two-finger tap on a Mac trackpad would zoom you out (#2431 @cavenel)
* Fixed: dragToPan gesture could not be disabled when flickEnabled was activated (#2464 @jonasengelmann)
* Fixed: placeholderFillStyle didn't work properly when the image was rotated (#2469 @pearcetm)
* Fixed: Sometimes exponential springs wouldn't ever settle (#2469 @pearcetm)
* Fixed: The navigator wouldn't update its tracking rectangle when the navigator was resized (#2491 @pearcetm)
* Fixed: The drawer would improperly crop when the viewport was flipped and a tiled image was rotated (#2511 @pearcetm, @eug-L)
* Fixed: Flipped viewport caused image to be flipped again when going fullscreen or resizing (#2518 @pearcetm)
* Fixed: Viewer ajax options (loadTilesWithAjax, ajaxHeaders, and ajaxWithCredentials) weren't being propogated to the navigator. (#2539 @eug-L)
4.1.1:
* Fixed: Strange behavior if IIIF sizes were not in ascending order (#2416 @lutzhelm)
4.1.0:
* NEW BEHAVIOR: When `navigatorRotate` is false, while the navigator image doesn't rotate, the red outline now does (#2356 @lcl45)
* The viewer no longer emits `canvas-key` events for both keydown and keypress events; canvas-key is now just for keydown, and the new `canvas-key-press` is for keypress (#2270 @hrghauri)
* You can now specify a priority when calling addHandler, to control when your event handler gets called relative to others (#2273 @Aiosa)
* Added tileRetryMax and tileRetryDelay options, so the viewer can retry loading failed tiles (#2238 @Ughuuu @paaddyy, #2334 @Ughuuu @Titan21)
* All of the viewers keyboard handling is now in response to keydown events (it used to be split between keydown and keypress) (#2291 @MohitBansal321)
* Added `canvas-focus` and `canvas-blur` events to Viewer (#2301 @MohitBansal321)
* You can now more easily add custom buttons to the viewer (#2306 @MohitBansal321)
* The fitBounds function now takes zoom constraints into account (#2293 @pearcetm)
* The viewer now has an `after-resize` event what happens after the viewport bounds have been updated, to complement the `resize` event which happens before (#2317 @pearcetm)
* IIIFTileSource now uses resolution level dimensions provided in the info.json "sizes" field for more accurate tile requests (#2337 @ruven)
* Added setAjaxHeaders method to Viewer and TiledImage (#2346 @uschmidt83)
* Improved documentation (#2297 @KevinBritten)
* Fixed: The `tile-loaded` event's completionCallback could be called more than once in some circumstances (#2282 @Aiosa, @pearcetm)
* Fixed: Navigator display rectangle was off if the page had `box-sizing: border-box` (#2276 @ambujsahu81)
* Fixed: Code that required identifying functions would fail for async functions (#2273 @Aiosa)
* Fixed: Reference strip click detection was not accurate for long reference strips (#2280 @damonsson)
* Fixed: Translation problems in some circumstances with cropping polygons enabled (#2316 @pearcetm)
* Fixed: The navigator area rectangle would grow larger when you zoom in very far (#2318 @donotloveshampo)
* Fixed: JSON with embedded XML was being incorrectly identified as XML (#2328 @craigberry)
* Fixed: Touch/pinch rotate was not working properly on some platforms (#2324 @rsimon, @pearcetm)
* Fixed: Navigator rotation didn't honor `immediately` parameter (#2333 @robertjcolley)
* Fixed: The navigator didn't update for its new size in certain circumstances (#2347 @pearcetm)
4.0.0:
* NEW BEHAVIOR: Setting the viewport rotation now animates by default (pass true for the new `immediately` parameter to disable) (#2136 @jonasengelmann)
* NEW BEHAVIOR: The auto resize now takes both width and height into account when scaling the contents proportionally to the viewer (#2256 @pearcetm)
* DEPRECATION: Don't access the viewport's degrees property directly anymore; instead use setRotation and getRotation (#2136 @jonasengelmann)
* New gesture: Double-click and drag to zoom (on by default for touch) (#2225 @HamzaTatheer)
* You can now provide a pivot point when rotating the viewport (#2233 #2253 @pearcetm)
* Improved the constraints that keep the image in the viewer, specifically when zoomed out a lot (#2160 @joedf, #2246 @pearcetm)
* You can now provide an element for the navigator (as an alternative to an ID) (#1303 @cameronbaney, #2166 #2175 @joedf)
* Now supporting IIIF "id" and "identifier" in addition to "@id" (#2173 @ahankinson)
* We now delegate tile fetching and caching to the TileSource, to allow for custom tile formats (#2148 @Aiosa)
* Added support for dynamic URLs from tile sources (#2247 @JohnReagan)
* The viewer now emits before-destroy and destroy events (#2239 @pearcetm)
* Auto resize detection is now more efficient (#2256 @pearcetm)
* Improved documentation (#2211 @shyamkumaryadav)
* Fixed: Cropping tiled images with polygons was broken (#2183 @altert)
* Fixed: Boundary constraints were wrong when the viewport was rotated (#2249 @pearcetm)
* Fixed: IIIF tile sizes would be calculated wrong on rare occasions (#2206 @filak)
* Fixed: Disabling buttons only changed their appearance, but they were still clickable (#2187 @pearcetm)
* Fixed: ImageTileSource produced an error having to do with getTileHashKey (#2190 @Aiosa)
* Fixed: On startup you would get an unnecessary "Viewer.buttons is deprecated" warning (#2201 @joedf, #2219 @jssullivan, #2212 @joedf)
3.1.0:
* Added subPixelRoundingForTransparency Viewer option to address seams that can appear in semi-transparent images (#2075 @TanukiSharp)
* Added Viewer.isAnimating() (#2075 @TanukiSharp)
* Added isFullScreen method to Viewer (#2067 @JachiOnuoha)
* Added option to include POST data when loading files via Ajax (#2072 @Aiosa)
* Exposed TiledImage's private functions for better maintainability (#2134 @Aiosa)
* Tile cache keys are now generated by the tile source, so it's easier to override them as needed (#2138 @Aiosa)
* Pinch to zoom now zooms around the center of the pinch, rather than the center of the viewer (#2158 @cavenel)
* Added fallback and deprecation warning for Viewer.buttons (which got changed to buttonGroup in 3.0.0) (#2153 @devbyjonah)
* Fixed an issue where turning off panVertical or panHorizontal would not affect the panning keyboard combos (#2069 @JachiOnuoha)
* Cleaned up console.logs so that errors and warnings use console.error and console.warn as appropriate (#2073 @Abhishek-90)
* Improved documentation (#2067 @JachiOnuoha, #2112 @shyamkumaryadav, #2152 @joedf, #2155 @samwilson)
* Fixed: Setting useCanvas to false would break the viewer (#2116 @rvv-bouvet)
* Allow silencing multi-image warnings on viewport coordinate conversion functions (#2120 @claycoleman)
* Fixed: Swiping fast multiple times made contact points in MouseTracker out of sync for touch events (#2121 @ronnymikalsen)
* Made MouseTracker more robust in certain scenarios (#2134, #2147 @Aiosa)
* Fixed an issue where full page mode wouldn't grow properly if you resized the window (#2100 @TanukiSharp)
* Now if you pass an error handler into makeAjaxRequest, it doesn't report errors into the console (#2142 @Aiosa)
* Fixed error caused by attaching MouseTracker to the page's document element (#2145 @tdiprima)
* Fixed an issue that would sometimes cause problems with freeing up ImageTileSource memory (#2162 @pearcetm)
3.0.0:
* BREAKING CHANGE: Dropped support for older browsers (IE < 11) (#1872 #1949 #1951 @msalsbery, #1950 @rmontroy)
* BREAKING CHANGE: Removed deprecated OpenSeadragon.getEvent function (#1949 @msalsbery)
* DEPRECATION: MouseTracker exitHandler deprecated for name change to leaveHandler for consistency with DOM event names (#1872 @msalsbery)
* Now when "simple image" tile sources are removed from the viewer, they free the memory used by the pyramid they create (#1789 @TakumaKira)
* Improvements to docs (#1814 @kenanchristian, #1872 @msalsbery, #1996 @tdiprima)
* Better cleanup on destruction, to avoid memory leaks (#1832 @JoFrMueller)
* Better handle destruction when navigator in custom location (#1884 @woodchuck)
* Miscellaneous code cleanup (#1840 @msalsbery)
* You can now specify tileSize for the Zoomify Tile Source (#1868 @abrlam)
* Better use of IIIF "max" and "full" URL parameters (#1871 @MImranAsghar)
* You can now specify the file format of the tiles in the Zoomify tile source (#1889 @abrlam)
* Improved browser sniffing - detect EDGE and CHROMEEDGE browsers (#1872 @msalsbery)
* Improved DOM event model feature detection (#1872 @msalsbery)
* Added support for options parameter on addEvent()/removeEvent (to support passive option) (#1872 @msalsbery)
* Added OpenSeadragon.eventIsCanceled() function for defaultPrevented detection on DOM events (#1872 @msalsbery)
* MouseTracker: better PointerEvent model detection - removed use of deprecated window.navigator.pointerEnabled (#1872 @msalsbery)
* MouseTracker: added overHandler/outHandler options for handling corresponding pointerover/pointerout events (#1872 @msalsbery)
* MouseTracker: changed enterHandler/leaveHandler to use DOM pointerenter/pointerleave events instead of simulating using pointerover/pointerout (#1872 @msalsbery)
* All internal uses of MouseTracker use pointerenter/pointerleave events instead of pointerover/pointerout events for more consistent pointer tracking (#1872 @msalsbery)
* Fixed bug in Button class where two MouseTracker event handlers used an invalid "this" causing issues in some browsers (#1872 @msalsbery)
* Added pointerType property to Viewer container-enter, container-exit, canvas-drag, canvas-drag-end, canvas-pinch events (#1872 @msalsbery)
* MouseTracker: Fire dragEndHandler event even if release point same as initial contact point (#1872 @msalsbery)
* MouseTracker: Pointer capture implemented with capture APIs where available. Only fallback to emulated capture on extremely old browsers (#1872 @msalsbery)
* MouseTracker: Added preProcessEventHandler option to allow MouseTracker instances to control bubbling and default behavior of events on their associated element (#1872 @msalsbery)
* MouseTracker: Improved handling of canceled events (#1872 @msalsbery)
* MouseTracker: Improved releasing of tracked pointers on destroy()/stopTracking() (#1872 @msalsbery)
* Updated Viewer, Button, Drawer, Navigator, ReferenceStrip DOM for proper DOM event handling (#1872 @msalsbery)
* Added OpenSeadragon.setElementPointerEventsNone() for setting pointer-events:'none' on DOM elements (#1872 @msalsbery)
* MouseTracker: added contextMenuHandler option for handling contextmenu events (#1872 @msalsbery)
* Viewer: added a canvas-contextmenu event (#1872 @msalsbery)
* Fixed simulated drag events in navigator tests (#1949 @msalsbery)
* Added preventDefault option to MouseTracker.contextMenuHandler and Viewer 'canvas-contextmenu' event args (#1951 @msalsbery)
* MouseTracker: Added preProcessEventHandler for keydown, keyup, keypress, focus, blur Events (#1951 @msalsbery)
* Fixed preventDefaultAction functionality in viewer events (#1953 @msalsbery)
* Added setImageFormatsSupported function (#1954 @pandaxtc)
* Added dragToPan to the GestureSettings class, implemented in Viewer (#1956 @msalsbery)
* Added preventDefault option to MouseTracker handlers: scrollHandler, keyDownHandler, keyUpHandler, keyHandler (#1957 @msalsbery)
* Fixed test "Events: Viewer: preventDefaultAction in dblClickHandler". Fixes #1372 (#1960 @msalsbery)
* ReferenceStrip: Fixed issue where its element was being removed from its parent element twice on destroy, causing an exception (#1958 @msalsbery)
* ReferenceStrip: Made its element focusable for keyboard navigation (#1958 @msalsbery)
* You can now flip individual images (not just the whole viewport) (#1903 @ali1234)
* Accessibility: we now take the browser's zoom into account when choosing what detail level to draw (#1937 @ronnymikalsen)
* Fixed a bug causing overlays to disappear in Sequence Mode (#1865 @gunmiosb)
* Fixed a bug where the ajaxHeaders provided per-image were not being used for image requests (#1968 @maxshuty)
* MouseTracker: Added workaround for WebKit Pointer Event Implicit Capture Bug (#1972 @msalsbery)
* Removed test for move-leave (fly-over, no enter event)...not a valid, handleable event state, no longer supported (#1972 @msalsbery)
* Added OpenSeadragon.setElementPointerEvents() for setting pointer-events to other values besides 'none' on DOM elements (#1972 @msalsbery)
* Now ensuring the page body is display:block when in fullscreen (#1995 @thewilkybarkid)
* Added a static method in OpenSeadragon to get an existing viewer (#2000 @HerCerM)
* Now ensuring that the new item is already in the navigator when the "add-item" event fires (#2005 @RammasEchor)
* Added keys to change image in sequence mode (j: previous, k: next) (#2007 @RammasEchor)
* Fixed a bug where the navigator wouldn't pick up opacity/composite changes made while it is loading (#2018 @crydell)
* Explicitly set passive:false for wheel event handlers to suppress console warnings. Fixes #1669 (#2043 @msalsbery)
* Viewer's canvas-click events now include an originalTarget property so you can know which element received the click (#2037 @iangilman)
* Added method for getting the size of an image in window coordinates (#2049 @superbland)
* Added a setMaxLevel function to TileSource so you can change its maxLevel if needed (#2059, #2066 @kim-sanghoon)
2.4.2:
* Add support for IIIF Image API 3.0 beta (#1764)
* You can now crop an image with arbitrary polygons (#1772)
* Improved support for using the Reference Strip in an OpenSeadragon Viewer inside a Web Component (#1676)
* Added setWidth and setHeight methods to Navigator (#1686)
* Improvements to docs (#1696, #1698, #1716, #1719)
* Now passing Viewer AJAX configs down to ReferenceStrip thumbnails (#1701)
* The ReferenceStrip now honors the useCanvas option from the Viewer (#1742)
* Fixed: Navigator was still resizing after you explicitly set its width and height with navigatorWidth and navigatorHeight (#1686)
* Fixed issues with touches on iOS 13 and iPad (#1754, #1756)
* No longer throwing an exception on pages that have malformed URL parameters (#1758)
* Fixed an issue with flipping the viewport on high pixel density screens (#1779)
* Removed use of deprecated imageSmoothingEnabled prefixes (#1740)
2.4.1:
* You can now turn off the default canvas image smoothing, if you want sharp pixels when zoomed in past 100% (#1507, #1593, #1595, #1647, #1648)
* Fixed problem with navigator highlight rectangle when returning from full screen with a custom navigator location (#1515)
* Added option to set rotation increment for nav buttons and keyboard (#1524)
* Fixed issue with flipping and opacity with multi-image (#1549)
* Removed vestigial button group label element that was causing issues for accessibility tools (#1560)
* Fixed a bug causing Viewer.areControlsEnabled to throw an exception (#1562)
* Added tileFormat option to IIIFTileSource so you can specify the tile format (#1625)
* Now using canonical URIs more consistently in IIIF to make caching and processing time easier on the server side (#1625)
* Added support for IIIF's new preferredFormats property (#1656)
2.4.0:
* BREAKING CHANGE: Viewer's canvas-double-click event is now fired before it initiates the zoom (#1288)
* You can now flip the viewport to get a mirror image of the original (#1441)
* You can now prevent canvas-double-click events from zooming on a per-event basis (#1288)
* Fixed: Opacity 0 images were causing unnecessary redraws (#1319)
* The "page" event is now fired after the page index has been updated (#1330)
* Added option pixelsPerArrowPress that sets the speed of arrow keys (#1364)
* Improved IIIF options.maxLevel calculation (#1401)
* Added canvas-key events, along with the ability to cancel key actions (#1414)
* Added optional zoom in the middle of the image instead of pointer position (#1423)
* Now supporting square edge tiles that are padded rather than cropped (#1426)
* Fixed an issue causing the simple image tileSource to sometimes show duplicate copies (#1370)
* Fixed an issue causing seams to appear in semi-transparent PNG tiled images (#1470)
* Added visual customization options for the navigator (#1480)
* You can now prevent canvas-drag events on the navigator (#1484)
* You can now prevent canvas-click events on the navigator (#1416)
* The navigator can now be restricted to just horizontal or just vertical panning (#1416)
* Fixed DziTileSource so it doesn't load levels above maxLevel or below minLevel, if set (#1492)
2.3.1:
* Debug mode now uses different colors for different tiled images (customizable via debugGridColor) (#1271)
* Fixed a problem with preventDefaultAction for the canvas-drag event (#1278)
* Fixed an issue causing double images with certain aspect ratios (#1280)
* Fixed: placeholderFillStyle had no effect (#1286)
* Fixed seams that appear in wrap mode on Safari and Firefox (#1305)
2.3.0:
* BREAKING CHANGE: Tile.distance has been removed (#1027)
* BREAKING CHANGE: Viewer's canvas-click event is now fired before it initiates the zoom (#1148)
* BREAKING CHANGE: Viewer's canvas-drag event is now fired before it pans (#1149)
* Added Zoomify tile source (#863)
* You can now set the rotation of individual tiled images (#1006)
* Added getFullyLoaded method and "fully-loaded-change" event to TiledImage to know when tiles are fully loaded (#837, #1073)
* You can now preload images without drawing them to the screen (#1071)
* Added support for commonjs (#984)
* Added an option to addTiledImage to change the crossOriginPolicy (#981)
* You can now load tiles via AJAX and custom AJAX request headers (#1055)
* Added ability to provide thumbnail URLs for reference strip (#1241)
* Improved panning constraints for constrainDuringPan (#1133 and #1245)
* You can now prevent canvas-click events from zooming on a per-event basis (#1148)
* You can now prevent canvas-drag events from panning on a per-event basis (#1149)
* The navigationControlAnchor option now works for custom toolbar as well (#1004)
* LegacyTileSource now allows any image URLs regardless of type (#1056)
* Enabled configuration of ImageLoader timeout (#1192)
* Viewer.open() now supports an initialPage argument for sequenceMode (#1196)
* New events for opacity and compositeOperation changes (#1203)
* Added support for setting debug mode after the Viewer object has been constructed (#1224)
* Added functions for dynamically adding and removing the reference strip in sequence mode (#1213)
* Better calculation for TileCache release cutoff (#1214)
* The navigator now picks up opacity and compositeOperation changes (#1203)
* Improved calculation for determining which level to load first (#1198)
* Added fix for supporting weird filenames that look like JSONs (#1189)
* Improved DziTileSource guessing of tilesUrl (#1074)
* The Viewer's tileSources option is now smarter about detecting JSON vs XML vs URL (#999)
* Better compression for our UI images (#1134)
* Optimization: Use the squared distance when comparing tiles (#1027)
* Now clamping pixel ratio density to a minimum of 1, fixing display issues on low density devices (#1200)
* More forgiving check for DZI schema (#1249)
* ImageTileSource now works in IE8 (#1041)
* Fixed CORS bug in IE 10 (#967)
* Fixed issue with tiles not appearing with wrapHorizontal/wrapVertical if you pan too far away from the origin (#987, #1066)
* Fixed: Initial tile load wasn't happening in parallel (#1014)
* Fixed problem with "sparse image" DZI files (#995)
* Fix IndexSizeError on IE and Edge that occurred under certain circumstances (e.g. multi-image with transparency) (#1035)
* Fixed error in IE8 when zooming in (due to edge smoothing) (#1064)
* Fixed issue with OpenSeadragon.version in the minified JavaScript (#1099)
* Fixed smoothTileEdgesMinZoom performance degradation on single-tile images (#1101)
* Fixed issue with tiles not appearing after rotation (#1102)
* Fixed: The navigator wasn't respecting the constrainDuringPan setting (#1104)
* Fixed an issue causing overlays to be mis-positioned in some circumstances (#1119)
* Fixed: ImageTileSource would sometimes produce a double image (#1123)
* Fixed: console.debug caused exceptions on IE10 (#1129)
* Fixed: the reference strip would leak memory when opening new sets of images (#1175)
* Fixed: zoomTo/zoomBy ignore refPoint if immediately is true (#1184)
* Fixed: IIPImageServer didn't work with the latest OSD release (#1199)
* Fixed: setItemIndex method not working with navigator inside "open" event (#1201)
* Fixed: The reference strip didn't show the initial page if it wasn't the first page (#1208)
* Fixed: Sometimes the image would stick to the mouse when right-clicking and left-clicking simultaneously (#1223)
* Fixed issue with transparent images sometimes disappearing on Safari (#1222)
* Fixed: One image failing to load could cause the others to never load (#1229)
* Fixed: Mouse up outside map will cause "canvas-drag" event to stick (#1133)
* Fixed more issues with tracking multiple pointers (#1244)
2.2.1:
* Fixed problems with zoom/pan constraints with certain extreme settings (#965)
* Fixed an issue causing the browser to crash on iOS (#966)
2.2.0:
* BREAKING CHANGE: Viewport.homeBounds, Viewport.contentSize, Viewport.contentAspectX and
Viewport.contentAspectY have been removed. (#846)
* BREAKING CHANGE: The Overlay.getBounds method now takes the viewport as parameter. (#896)
* DEPRECATION: Overlay.scales, Overlay.bounds and Overlay.position have been deprecated. (#896)
* Overlay.width !== null should be used to test whether the overlay scales horizontally
* Overlay.height !== null should be used to test whether the overlay scales vertically
* The Overlay.getBounds method should be used to get the bounds of the overlay in viewport coordinates
* Overlay.location replaces Overlay.position
* DEPRECATION: Viewport.setHomeBounds has been deprecated (#846)
* DEPRECATION: the Viewport constructor is now ignoring the contentSize option (#846)
* Tile edge smoothing at high zoom (#764)
* Fixed issue with reference strip popping up virtual keyboard on mobile devices (#779)
* Now supporting rotation in the Rect class (#782)
* Drag outside of iframe now works better, as long as both pages are on the same domain (#790)
* Coordinate conversion now takes rotation into account (#796)
* Support tile-less IIIF as per LegacyTileSource (#816)
* You can now give an empty string to the tabIndex option (#805)
* Fixed issue with rotation and clicking in the navigator (#807)
* Broadened the check for mime type in LegacyTileSource URLs to allow query strings (#819)
* Added globalCompositeOperation option for tiledImage, to allow for different transfer modes (#814)
* Added Viewer.addSimpleImage method for easily adding non-tiled images (#827)
* DziTileSource now works properly with DZI files that have no extension (#835)
* Fixed content clipping with rotation (#463, #567 and #833)
* Fixed navigator not being rotated when viewport rotation is set in constructor (#840)
* Fixed: Viewer.setMouseNavEnabled wasn't affecting all of the viewer's trackers (#845)
* Fixed: with scrollToZoom disabled, the viewer caused page scrolling to slow down (#858)
* Added Viewer.getOverlayById and Overlay.getBounds functions (#853)
* Tiled images with 0 opacity no longer load their tiles or do drawing calculations (#859)
* Fixed issue with edge smoothing with PNG tiles at high zoom (#860)
* Fixed: Images with transparency were clearing images layered below them (#861)
* Fixed issue causing HTML pages to jump unwantedly to the reference strip upon loading (#872)
* Added addOnceHandler method to EventSource (#887)
* Added TiledImage.fitBounds method (#888)
* Overlays can now be scaled in a single dimension by providing a point location and either width or height (#896)
* Added full rotation support to overlays (#729, #193)
* Viewport.goHome() now takes clipping into account (#910)
* Improved zoom to point (#923)
* Optimized sketch canvas clearing and blending for images with opacity or transfer modes (#927)
* Now taking rotation into account in viewport getBounds and fitBounds methods (#934)
* Added option to disable navigator auto-fade (#935)
* Fixed issue with maintaining viewport position with full screen (#940)
* Fixed an issue with simultaneous touch events (#930)
* Avoid loading clipped out tiles (#939)
* Improved precision for subtle moves with fitBounds (#939)
* Fixed an issue in viewer.addTiledImage with replace:true when viewer has navigator (#948)
2.1.0:
* BREAKING CHANGE: the tile does not hold a reference to its image anymore. Only the tile cache keep a reference to images.

BIN
images/button_grouphover.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
images/button_hover.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/button_pressed.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
images/button_rest.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

BIN
images/flip_grouphover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
images/flip_hover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
images/flip_pressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
images/flip_rest.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 977 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -5,7 +5,9 @@ auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
auxiliary.org-netbeans-modules-editor-indent.text.javascript.CodeStyle.project.continuationIndentSize=4
auxiliary.org-netbeans-modules-editor-indent.text.javascript.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.text.javascript.CodeStyle.project.spaceBeforeAnonMethodDeclParen=false
auxiliary.org-netbeans-modules-editor-indent.text.x-json.CodeStyle.project.indent-shift-width=2
auxiliary.org-netbeans-modules-editor-indent.text.x-json.CodeStyle.project.spaces-per-tab=2
auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=src

5220
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,22 +1,53 @@
{
"name": "OpenSeadragon",
"version": "2.1.0",
"description": "Provides a smooth, zoomable user interface for HTML/Javascript.",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.5.0",
"grunt-contrib-compress": "^0.9.1",
"grunt-contrib-concat": "^0.4.0",
"grunt-contrib-connect": "^0.7.1",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.4.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-git-describe": "^2.3.2",
"grunt-qunit-istanbul": "^0.5.0",
"grunt-text-replace": "^0.3.11",
"qunitjs": "^1.18.0"
},
"scripts": {
"test": "grunt test"
}
"name": "openseadragon",
"version": "5.0.1",
"description": "Provides a smooth, zoomable user interface for HTML/Javascript.",
"keywords": [
"image",
"zoom",
"pan",
"openseadragon",
"seadragon",
"deepzoom",
"dzi",
"iiif",
"osm",
"tms"
],
"homepage": "https://openseadragon.github.io/",
"funding": "https://opencollective.com/openseadragon",
"bugs": {
"url": "https://github.com/openseadragon/openseadragon/issues"
},
"license": "BSD-3-Clause",
"files": [
"build/openseadragon/"
],
"main": "build/openseadragon/openseadragon.js",
"repository": {
"type": "git",
"url": "https://github.com/openseadragon/openseadragon.git"
},
"devDependencies": {
"eslint-plugin-compat": "^4.1.2",
"grunt": "^1.6.1",
"grunt-contrib-clean": "^2.0.1",
"grunt-contrib-compress": "^2.0.0",
"grunt-contrib-concat": "^2.1.0",
"grunt-contrib-connect": "^3.0.0",
"grunt-contrib-qunit": "^7.0.1",
"grunt-contrib-uglify": "^5.0.1",
"grunt-contrib-watch": "^1.1.0",
"grunt-eslint": "^24.0.1",
"grunt-git-describe": "^2.4.4",
"grunt-istanbul": "^0.8.0",
"grunt-text-replace": "^0.4.0",
"qunit": "^2.19.4"
},
"scripts": {
"test": "grunt test",
"prepare": "grunt build",
"build": "grunt build",
"dev": "grunt dev"
}
}

BIN
psd/button.psd Executable file

Binary file not shown.

View file

@ -2,7 +2,7 @@
* OpenSeadragon - Button
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -61,7 +61,7 @@ $.ButtonState = {
* @memberof OpenSeadragon
* @extends OpenSeadragon.EventSource
* @param {Object} options
* @param {Element} [options.element=null] Element to use as the button. If not specified, an HTML &lt;button&gt; element is created.
* @param {Element} [options.element=null] Element to use as the button. If not specified, an HTML &lt;div&gt; element is created.
* @param {String} [options.tooltip=null] Provides context help for the button when the
* user hovers over it.
* @param {String} [options.srcRest=null] URL of image to use in 'rest' state.
@ -77,6 +77,7 @@ $.ButtonState = {
* @param {OpenSeadragon.EventHandler} [options.onExit=null] Event handler callback for {@link OpenSeadragon.Button.event:exit}.
* @param {OpenSeadragon.EventHandler} [options.onFocus=null] Event handler callback for {@link OpenSeadragon.Button.event:focus}.
* @param {OpenSeadragon.EventHandler} [options.onBlur=null] Event handler callback for {@link OpenSeadragon.Button.event:blur}.
* @param {Object} [options.userData=null] Arbitrary object to be passed unchanged to any attached handler methods.
*/
$.Button = function( options ) {
@ -111,7 +112,8 @@ $.Button = function( options ) {
onEnter: null,
onExit: null,
onFocus: null,
onBlur: null
onBlur: null,
userData: null
}, options );
@ -120,7 +122,7 @@ $.Button = function( options ) {
* @member {Element} element
* @memberof OpenSeadragon.Button#
*/
this.element = options.element || $.makeNeutralElement( "div" );
this.element = options.element || $.makeNeutralElement("div");
//if the user has specified the element to bind the control to explicitly
//then do not add the default control images
@ -136,6 +138,13 @@ $.Button = function( options ) {
this.imgDown.alt =
this.tooltip;
// Allow pointer events to pass through the img elements so implicit
// pointer capture works on touch devices
$.setElementPointerEventsNone( this.imgRest );
$.setElementPointerEventsNone( this.imgGroup );
$.setElementPointerEventsNone( this.imgHover );
$.setElementPointerEventsNone( this.imgDown );
this.element.style.position = "relative";
$.setElementTouchActionNone( this.element );
@ -158,13 +167,6 @@ $.Button = function( options ) {
this.imgDown.style.visibility =
"hidden";
if ( $.Browser.vendor == $.BROWSERS.FIREFOX && $.Browser.version < 3 ){
this.imgGroup.style.top =
this.imgHover.style.top =
this.imgDown.style.top =
"";
}
this.element.appendChild( this.imgRest );
this.element.appendChild( this.imgGroup );
this.element.appendChild( this.imgHover );
@ -172,13 +174,13 @@ $.Button = function( options ) {
}
this.addHandler( "press", this.onPress );
this.addHandler( "release", this.onRelease );
this.addHandler( "click", this.onClick );
this.addHandler( "enter", this.onEnter );
this.addHandler( "exit", this.onExit );
this.addHandler( "focus", this.onFocus );
this.addHandler( "blur", this.onBlur );
this.addHandler("press", this.onPress);
this.addHandler("release", this.onRelease);
this.addHandler("click", this.onClick);
this.addHandler("enter", this.onEnter);
this.addHandler("exit", this.onExit);
this.addHandler("focus", this.onFocus);
this.addHandler("blur", this.onBlur);
/**
* The button's current state.
@ -203,6 +205,7 @@ $.Button = function( options ) {
*/
this.tracker = new $.MouseTracker({
userData: 'Button.tracker',
element: this.element,
clickTimeThreshold: this.clickTimeThreshold,
clickDistThreshold: this.clickDistThreshold,
@ -227,7 +230,7 @@ $.Button = function( options ) {
},
focusHandler: function ( event ) {
this.enterHandler( event );
_this.tracker.enterHandler( event );
/**
* Raised when the Button element receives focus.
*
@ -241,7 +244,7 @@ $.Button = function( options ) {
_this.raiseEvent( "focus", { originalEvent: event.originalEvent } );
},
exitHandler: function( event ) {
leaveHandler: function( event ) {
outTo( _this, $.ButtonState.GROUP );
if ( event.insideElementPressed ) {
/**
@ -259,7 +262,7 @@ $.Button = function( options ) {
},
blurHandler: function ( event ) {
this.exitHandler( event );
_this.tracker.leaveHandler( event );
/**
* Raised when the Button element loses focus.
*
@ -350,9 +353,11 @@ $.Button = function( options ) {
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
_this.raiseEvent( "release", { originalEvent: event.originalEvent } );
return false;
event.preventDefault = true;
} else{
event.preventDefault = false;
}
return true;
}
});
@ -363,8 +368,8 @@ $.Button = function( options ) {
$.extend( $.Button.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.Button.prototype */{
/**
* TODO: Determine what this function is intended to do and if it's actually
* useful as an API point.
* Used by a button container element (e.g. a ButtonGroup) to transition the button state
* to ButtonState.GROUP.
* @function
*/
notifyGroupEnter: function() {
@ -372,8 +377,8 @@ $.extend( $.Button.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.
},
/**
* TODO: Determine what this function is intended to do and if it's actually
* useful as an API point.
* Used by a button container element (e.g. a ButtonGroup) to transition the button state
* to ButtonState.REST.
* @function
*/
notifyGroupExit: function() {
@ -386,6 +391,7 @@ $.extend( $.Button.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.
disable: function(){
this.notifyGroupExit();
this.element.disabled = true;
this.tracker.setTracking(false);
$.setElementOpacity( this.element, 0.2, true );
},
@ -394,8 +400,31 @@ $.extend( $.Button.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.
*/
enable: function(){
this.element.disabled = false;
this.tracker.setTracking(true);
$.setElementOpacity( this.element, 1.0, true );
this.notifyGroupEnter();
},
destroy: function() {
if (this.imgRest) {
this.element.removeChild(this.imgRest);
this.imgRest = null;
}
if (this.imgGroup) {
this.element.removeChild(this.imgGroup);
this.imgGroup = null;
}
if (this.imgHover) {
this.element.removeChild(this.imgHover);
this.imgHover = null;
}
if (this.imgDown) {
this.element.removeChild(this.imgDown);
this.imgDown = null;
}
this.removeAllHandlers();
this.tracker.destroy();
this.element = null;
}
});
@ -451,13 +480,13 @@ function inTo( button, newState ) {
}
if ( newState >= $.ButtonState.GROUP &&
button.currentState == $.ButtonState.REST ) {
button.currentState === $.ButtonState.REST ) {
stopFading( button );
button.currentState = $.ButtonState.GROUP;
}
if ( newState >= $.ButtonState.HOVER &&
button.currentState == $.ButtonState.GROUP ) {
button.currentState === $.ButtonState.GROUP ) {
if( button.imgHover ){
button.imgHover.style.visibility = "";
}
@ -465,7 +494,7 @@ function inTo( button, newState ) {
}
if ( newState >= $.ButtonState.DOWN &&
button.currentState == $.ButtonState.HOVER ) {
button.currentState === $.ButtonState.HOVER ) {
if( button.imgDown ){
button.imgDown.style.visibility = "";
}
@ -481,7 +510,7 @@ function outTo( button, newState ) {
}
if ( newState <= $.ButtonState.HOVER &&
button.currentState == $.ButtonState.DOWN ) {
button.currentState === $.ButtonState.DOWN ) {
if( button.imgDown ){
button.imgDown.style.visibility = "hidden";
}
@ -489,7 +518,7 @@ function outTo( button, newState ) {
}
if ( newState <= $.ButtonState.GROUP &&
button.currentState == $.ButtonState.HOVER ) {
button.currentState === $.ButtonState.HOVER ) {
if( button.imgHover ){
button.imgHover.style.visibility = "hidden";
}
@ -497,7 +526,7 @@ function outTo( button, newState ) {
}
if ( newState <= $.ButtonState.REST &&
button.currentState == $.ButtonState.GROUP ) {
button.currentState === $.ButtonState.GROUP ) {
beginFading( button );
button.currentState = $.ButtonState.REST;
}

View file

@ -2,7 +2,7 @@
* OpenSeadragon - ButtonGroup
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -70,11 +70,11 @@ $.ButtonGroup = function( options ) {
// TODO What if there IS an options.group specified?
if( !options.group ){
this.label = $.makeNeutralElement( "label" );
this.element.style.display = "inline-block";
//this.label = $.makeNeutralElement( "label" );
//TODO: support labels for ButtonGroups
//this.label.innerHTML = this.labelText;
this.element.style.display = "inline-block";
this.element.appendChild( this.label );
//this.element.appendChild( this.label );
for ( i = 0; i < buttons.length; i++ ) {
this.element.appendChild( buttons[ i ].element );
}
@ -83,11 +83,12 @@ $.ButtonGroup = function( options ) {
$.setElementTouchActionNone( this.element );
/**
* Tracks mouse/touch/key events accross the group of buttons.
* Tracks mouse/touch/key events across the group of buttons.
* @member {OpenSeadragon.MouseTracker} tracker
* @memberof OpenSeadragon.ButtonGroup#
*/
this.tracker = new $.MouseTracker({
userData: 'ButtonGroup.tracker',
element: this.element,
clickTimeThreshold: this.clickTimeThreshold,
clickDistThreshold: this.clickDistThreshold,
@ -97,7 +98,7 @@ $.ButtonGroup = function( options ) {
_this.buttons[ i ].notifyGroupEnter();
}
},
exitHandler: function ( event ) {
leaveHandler: function ( event ) {
var i;
if ( !event.insideElementPressed ) {
for ( i = 0; i < _this.buttons.length; i++ ) {
@ -108,7 +109,19 @@ $.ButtonGroup = function( options ) {
});
};
$.ButtonGroup.prototype = /** @lends OpenSeadragon.ButtonGroup.prototype */{
/** @lends OpenSeadragon.ButtonGroup.prototype */
$.ButtonGroup.prototype = {
/**
* Adds the given button to this button group.
*
* @function
* @param {OpenSeadragon.Button} button
*/
addButton: function( button ){
this.buttons.push(button);
this.element.appendChild(button.element);
},
/**
* TODO: Figure out why this is used on the public API and if a more useful
@ -126,8 +139,18 @@ $.ButtonGroup.prototype = /** @lends OpenSeadragon.ButtonGroup.prototype */{
* @function
* @private
*/
emulateExit: function() {
this.tracker.exitHandler( { eventSource: this.tracker } );
emulateLeave: function() {
this.tracker.leaveHandler( { eventSource: this.tracker } );
},
destroy: function() {
while (this.buttons.length) {
var button = this.buttons.pop();
this.element.removeChild(button.element);
button.destroy();
}
this.tracker.destroy();
this.element = null;
}
};

1054
src/canvasdrawer.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@
* OpenSeadragon - Control
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -74,6 +74,7 @@ $.ControlAnchor = {
* @param {Element} container - the element to control will be anchored too.
*/
$.Control = function ( element, options, container ) {
var parent = element.parentNode;
if (typeof options === 'number')
{
@ -112,13 +113,13 @@ $.Control = function ( element, options, container ) {
* @member {Element} wrapper
* @memberof OpenSeadragon.Control#
*/
if ( this.anchor == $.ControlAnchor.ABSOLUTE ) {
if ( this.anchor === $.ControlAnchor.ABSOLUTE ) {
this.wrapper = $.makeNeutralElement( "div" );
this.wrapper.style.position = "absolute";
this.wrapper.style.top = typeof ( options.top ) == "number" ? ( options.top + 'px' ) : options.top;
this.wrapper.style.left = typeof ( options.left ) == "number" ? (options.left + 'px' ) : options.left;
this.wrapper.style.height = typeof ( options.height ) == "number" ? ( options.height + 'px' ) : options.height;
this.wrapper.style.width = typeof ( options.width ) == "number" ? ( options.width + 'px' ) : options.width;
this.wrapper.style.top = typeof (options.top) === "number" ? (options.top + 'px') : options.top;
this.wrapper.style.left = typeof (options.left) === "number" ? (options.left + 'px') : options.left;
this.wrapper.style.height = typeof (options.height) === "number" ? (options.height + 'px') : options.height;
this.wrapper.style.width = typeof (options.width) === "number" ? (options.width + 'px') : options.width;
this.wrapper.style.margin = "0px";
this.wrapper.style.padding = "0px";
@ -130,7 +131,7 @@ $.Control = function ( element, options, container ) {
} else {
this.wrapper = $.makeNeutralElement( "div" );
this.wrapper.style.display = "inline-block";
if ( this.anchor == $.ControlAnchor.NONE ) {
if ( this.anchor === $.ControlAnchor.NONE ) {
// IE6 fix
this.wrapper.style.width = this.wrapper.style.height = "100%";
}
@ -138,8 +139,8 @@ $.Control = function ( element, options, container ) {
this.wrapper.appendChild( this.element );
if (options.attachToViewer ) {
if ( this.anchor == $.ControlAnchor.TOP_RIGHT ||
this.anchor == $.ControlAnchor.BOTTOM_RIGHT ) {
if ( this.anchor === $.ControlAnchor.TOP_RIGHT ||
this.anchor === $.ControlAnchor.BOTTOM_RIGHT ) {
this.container.insertBefore(
this.wrapper,
this.container.firstChild
@ -150,9 +151,11 @@ $.Control = function ( element, options, container ) {
} else {
parent.appendChild( this.wrapper );
}
};
$.Control.prototype = /** @lends OpenSeadragon.Control.prototype */{
/** @lends OpenSeadragon.Control.prototype */
$.Control.prototype = {
/**
* Removes the control from the container.
@ -160,16 +163,18 @@ $.Control.prototype = /** @lends OpenSeadragon.Control.prototype */{
*/
destroy: function() {
this.wrapper.removeChild( this.element );
this.container.removeChild( this.wrapper );
if (this.anchor !== $.ControlAnchor.NONE) {
this.container.removeChild(this.wrapper);
}
},
/**
* Determines if the control is currently visible.
* @function
* @return {Boolean} true if currenly visible, false otherwise.
* @returns {Boolean} true if currently visible, false otherwise.
*/
isVisible: function() {
return this.wrapper.style.display != "none";
return this.wrapper.style.display !== "none";
},
/**
@ -179,7 +184,7 @@ $.Control.prototype = /** @lends OpenSeadragon.Control.prototype */{
*/
setVisible: function( visible ) {
this.wrapper.style.display = visible ?
( this.anchor == $.ControlAnchor.ABSOLUTE ? 'block' : 'inline-block' ) :
( this.anchor === $.ControlAnchor.ABSOLUTE ? 'block' : 'inline-block' ) :
"none";
},
@ -189,11 +194,7 @@ $.Control.prototype = /** @lends OpenSeadragon.Control.prototype */{
* @param {Number} opactiy - a value between 1 and 0 inclusively.
*/
setOpacity: function( opacity ) {
if ( this.element[ $.SIGNAL ] && $.Browser.vendor == $.BROWSERS.IE ) {
$.setElementOpacity( this.element, opacity, true );
} else {
$.setElementOpacity( this.wrapper, opacity, true );
}
$.setElementOpacity( this.wrapper, opacity, true );
}
};

View file

@ -2,7 +2,7 @@
* OpenSeadragon - ControlDock
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -45,7 +45,7 @@
i;
$.extend( true, this, {
id: 'controldock-'+$.now()+'-'+Math.floor(Math.random()*1000000),
id: 'controldock-' + $.now() + '-' + Math.floor(Math.random() * 1000000),
container: $.makeNeutralElement( 'div' ),
controls: []
}, options );
@ -59,7 +59,9 @@
if( this.element ){
this.element = $.getElement( this.element );
this.element.appendChild( this.container );
this.element.style.position = 'relative';
if( $.getElementStyle(this.element).position === 'static' ){
this.element.style.position = 'relative';
}
this.container.style.width = '100%';
this.container.style.height = '100%';
}
@ -88,7 +90,8 @@
this.container.appendChild( this.controls.bottomleft );
};
$.ControlDock.prototype = /** @lends OpenSeadragon.ControlDock.prototype */{
/** @lends OpenSeadragon.ControlDock.prototype */
$.ControlDock.prototype = {
/**
* @function
@ -148,7 +151,7 @@
/**
* @function
* @return {OpenSeadragon.ControlDock} Chainable.
* @returns {OpenSeadragon.ControlDock} Chainable.
*/
removeControl: function ( element ) {
element = $.getElement( element );
@ -164,7 +167,7 @@
/**
* @function
* @return {OpenSeadragon.ControlDock} Chainable.
* @returns {OpenSeadragon.ControlDock} Chainable.
*/
clearControls: function () {
while ( this.controls.length > 0 ) {
@ -177,7 +180,7 @@
/**
* @function
* @return {Boolean}
* @returns {Boolean}
*/
areControlsEnabled: function () {
var i;
@ -194,7 +197,7 @@
/**
* @function
* @return {OpenSeadragon.ControlDock} Chainable.
* @returns {OpenSeadragon.ControlDock} Chainable.
*/
setControlsEnabled: function( enabled ) {
var i;
@ -217,7 +220,7 @@
i;
for ( i = controls.length - 1; i >= 0; i-- ) {
if ( controls[ i ].element == element ) {
if ( controls[ i ].element === element ) {
return i;
}
}

488
src/datatypeconvertor.js Normal file
View file

@ -0,0 +1,488 @@
/*
* OpenSeadragon.convertor (static property)
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2024 OpenSeadragon contributors
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of CodePlex Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function($){
/**
* modified from https://gist.github.com/Prottoy2938/66849e04b0bac459606059f5f9f3aa1a
* @private
*/
class WeightedGraph {
constructor() {
this.adjacencyList = {};
this.vertices = {};
}
/**
* Add vertex to graph
* @param vertex unique vertex ID
* @return {boolean} true if inserted, false if exists (no-op)
*/
addVertex(vertex) {
if (!this.vertices[vertex]) {
this.vertices[vertex] = new $.PriorityQueue.Node(0, vertex);
this.adjacencyList[vertex] = [];
return true;
}
return false;
}
/**
* Add edge to graph
* @param vertex1 id, must exist by calling addVertex()
* @param vertex2 id, must exist by calling addVertex()
* @param weight
* @param transform function that transforms on path vertex1 -> vertex2
* @return {boolean} true if new edge, false if replaced existing
*/
addEdge(vertex1, vertex2, weight, transform) {
if (weight < 0) {
$.console.error("WeightedGraph: negative weights will make for invalid shortest path computation!");
}
const outgoingPaths = this.adjacencyList[vertex1],
replacedEdgeIndex = outgoingPaths.findIndex(edge => edge.target === this.vertices[vertex2]),
newEdge = { target: this.vertices[vertex2], origin: this.vertices[vertex1], weight, transform };
if (replacedEdgeIndex < 0) {
this.adjacencyList[vertex1].push(newEdge);
return true;
}
this.adjacencyList[vertex1][replacedEdgeIndex] = newEdge;
return false;
}
/**
* @return {{path: ConversionStep[], cost: number}|undefined} cheapest path from start to finish
*/
dijkstra(start, finish) {
let path = []; //to return at end
if (start === finish) {
return {path: path, cost: 0};
}
const nodes = new OpenSeadragon.PriorityQueue();
let smallestNode;
//build up initial state
for (let vertex in this.vertices) {
vertex = this.vertices[vertex];
if (vertex.value === start) {
vertex.key = 0; //keys are known distances
nodes.insertNode(vertex);
} else {
vertex.key = Infinity;
delete vertex.index;
}
vertex._previous = null;
}
// as long as there is something to visit
while (nodes.getCount() > 0) {
smallestNode = nodes.remove();
if (smallestNode.value === finish) {
break;
}
const neighbors = this.adjacencyList[smallestNode.value];
for (let neighborKey in neighbors) {
let edge = neighbors[neighborKey];
//relax node
let newCost = smallestNode.key + edge.weight;
let nextNeighbor = edge.target;
if (newCost < nextNeighbor.key) {
nextNeighbor._previous = smallestNode;
//key change
nodes.decreaseKey(nextNeighbor, newCost);
}
}
}
if (!smallestNode || !smallestNode._previous || smallestNode.value !== finish) {
return undefined; //no path
}
let finalCost = smallestNode.key; //final weight last node
// done, build the shortest path
while (smallestNode._previous) {
//backtrack
const to = smallestNode.value,
parent = smallestNode._previous,
from = parent.value;
path.push(this.adjacencyList[from].find(x => x.target.value === to));
smallestNode = parent;
}
return {
path: path.reverse(),
cost: finalCost
};
}
}
/**
* Edge.transform function on the conversion path in OpenSeadragon.converter.getConversionPath().
* It can be also conversion to undefined if used as destructor implementation.
*
* @callback TypeConvertor
* @memberof OpenSeadragon
* @param {OpenSeadragon.Tile} tile reference tile that owns the data
* @param {any} data data in the input format
* @returns {any} data in the output format
*/
/**
* Destructor called every time a data type is to be destroyed or converted to another type.
*
* @callback TypeDestructor
* @memberof OpenSeadragon
* @param {any} data data in the format the destructor is registered for
* @returns {any} can return any value that is carried over to the caller if desirable.
* Note: not used by the OSD cache system.
*/
/**
* Node on the conversion path in OpenSeadragon.converter.getConversionPath().
*
* @typedef {Object} ConversionStep
* @memberof OpenSeadragon
* @param {OpenSeadragon.PriorityQueue.Node} target - Target node of the conversion step.
* Its value is the target format.
* @param {OpenSeadragon.PriorityQueue.Node} origin - Origin node of the conversion step.
* Its value is the origin format.
* @param {number} weight cost of the conversion
* @param {TypeConvertor} transform the conversion itself
*/
/**
* Class that orchestrates automated data types conversion. Do not instantiate
* this class, use OpenSeadragon.convertor - a global instance, instead.
* @class DataTypeConvertor
* @memberOf OpenSeadragon
*/
$.DataTypeConvertor = class {
constructor() {
this.graph = new WeightedGraph();
this.destructors = {};
this.copyings = {};
// Teaching OpenSeadragon built-in conversions:
const imageCreator = (tile, url) => new $.Promise((resolve, reject) => {
if (!$.supportsAsync) {
throw "Not supported in sync mode!";
}
const img = new Image();
img.onerror = img.onabort = reject;
img.onload = () => resolve(img);
img.src = url;
});
const canvasContextCreator = (tile, imageData) => {
const canvas = document.createElement( 'canvas' );
canvas.width = imageData.width;
canvas.height = imageData.height;
const context = canvas.getContext('2d', { willReadFrequently: true });
context.drawImage( imageData, 0, 0 );
return context;
};
this.learn("context2d", "webImageUrl", (tile, ctx) => ctx.canvas.toDataURL(), 1, 2);
this.learn("image", "webImageUrl", (tile, image) => image.url);
this.learn("image", "context2d", canvasContextCreator, 1, 1);
this.learn("url", "image", imageCreator, 1, 1);
//Copies
this.learn("image", "image", (tile, image) => imageCreator(tile, image.src), 1, 1);
this.learn("url", "url", (tile, url) => url, 0, 1); //strings are immutable, no need to copy
this.learn("context2d", "context2d", (tile, ctx) => canvasContextCreator(tile, ctx.canvas));
/**
* Free up canvas memory
* (iOS 12 or higher on 2GB RAM device has only 224MB canvas memory,
* and Safari keeps canvas until its height and width will be set to 0).
*/
this.learnDestroy("context2d", ctx => {
ctx.canvas.width = 0;
ctx.canvas.height = 0;
});
}
/**
* Unique identifier (unlike toString.call(x)) to be guessed
* from the data value. This type guess is more strict than
* OpenSeadragon.type() implementation, but for most type recognition
* this test relies on the output of OpenSeadragon.type().
*
* Note: although we try to implement the type guessing, do
* not rely on this functionality! Prefer explicit type declaration.
*
* @function guessType
* @param x object to get unique identifier for
* - can be array, in that case, alphabetically-ordered list of inner unique types
* is returned (null, undefined are ignored)
* - if $.isPlainObject(x) is true, then the object can define
* getType function to specify its type
* - otherwise, toString.call(x) is applied to get the parameter description
* @return {string} unique variable descriptor
*/
guessType( x ) {
if (Array.isArray(x)) {
const types = [];
for (let item of x) {
if (item === undefined || item === null) {
continue;
}
const type = this.guessType(item);
if (!types.includes(type)) {
types.push(type);
}
}
types.sort();
return `Array [${types.join(",")}]`;
}
const guessType = $.type(x);
if (guessType === "dom-node") {
//distinguish nodes
return guessType.nodeName.toLowerCase();
}
if (guessType === "object") {
if ($.isFunction(x.getType)) {
return x.getType();
}
}
return guessType;
}
/**
* Teach the system to convert data type 'from' -> 'to'
* @param {string} from unique ID of the data item 'from'
* @param {string} to unique ID of the data item 'to'
* @param {OpenSeadragon.TypeConvertor} callback convertor that takes two arguments: a tile reference, and
* a data object of a type 'from'; and converts this data object to type 'to'. It can return also the value
* wrapped in a Promise (returned in resolve) or it can be async function.
* @param {Number} [costPower=0] positive cost class of the conversion, smaller or equal than 7.
* Should reflect the actual cost of the conversion:
* - if nothing must be done and only reference is retrieved (or a constant operation done),
* return 0 (default)
* - if a linear amount of work is necessary,
* return 1
* ... and so on, basically the number in O() complexity power exponent (for simplification)
* @param {Number} [costMultiplier=1] multiplier of the cost class, e.g. O(3n^2) would
* use costPower=2, costMultiplier=3; can be between 1 and 10^5
*/
learn(from, to, callback, costPower = 0, costMultiplier = 1) {
$.console.assert(costPower >= 0 && costPower <= 7, "[DataTypeConvertor] Conversion costPower must be between <0, 7>.");
$.console.assert($.isFunction(callback), "[DataTypeConvertor:learn] Callback must be a valid function!");
if (from === to) {
this.copyings[to] = callback;
} else {
//we won't know if somebody added multiple edges, though it will choose some edge anyway
costPower++;
costMultiplier = Math.min(Math.max(costMultiplier, 1), 10 ^ 5);
this.graph.addVertex(from);
this.graph.addVertex(to);
this.graph.addEdge(from, to, costPower * 10 ^ 5 + costMultiplier, callback);
this._known = {}; //invalidate precomputed paths :/
}
}
/**
* Teach the system to destroy data type 'type'
* for example, textures loaded to GPU have to be also manually removed when not needed anymore.
* Needs to be defined only when the created object has extra deletion process.
* @param {string} type
* @param {OpenSeadragon.TypeDestructor} callback destructor, receives the object created,
* it is basically a type conversion to 'undefined' - thus the type.
*/
learnDestroy(type, callback) {
this.destructors[type] = callback;
}
/**
* Convert data item x of type 'from' to any of the 'to' types, chosen is the cheapest known conversion.
* Data is destroyed upon conversion. For different behavior, implement your conversion using the
* path rules obtained from getConversionPath().
* Note: conversion DOES NOT COPY data if [to] contains type 'from' (e.g., the cheapest conversion is no conversion).
* It automatically calls destructor on immediate types, but NOT on the x and the result. You should call these
* manually if these should be destroyed.
* @param {OpenSeadragon.Tile} tile
* @param {any} data data item to convert
* @param {string} from data item type
* @param {string} to desired type(s)
* @return {OpenSeadragon.Promise<?>} promise resolution with type 'to' or undefined if the conversion failed
*/
convert(tile, data, from, ...to) {
const conversionPath = this.getConversionPath(from, to);
if (!conversionPath) {
$.console.error(`[OpenSeadragon.convertor.convert] Conversion ${from} ---> ${to} cannot be done!`);
return $.Promise.resolve();
}
const stepCount = conversionPath.length,
_this = this;
const step = (x, i, destroy = true) => {
if (i >= stepCount) {
return $.Promise.resolve(x);
}
let edge = conversionPath[i];
let y = edge.transform(tile, x);
if (y === undefined) {
$.console.error(`[OpenSeadragon.convertor.convert] data mid result undefined value (while converting using %s)`, edge);
return $.Promise.resolve();
}
//node.value holds the type string
if (destroy) {
_this.destroy(x, edge.origin.value);
}
const result = $.type(y) === "promise" ? y : $.Promise.resolve(y);
return result.then(res => step(res, i + 1));
};
//destroy only mid-results, but not the original value
return step(data, 0, false);
}
/**
* Copy the data item given.
* @param {OpenSeadragon.Tile} tile
* @param {any} data data item to convert
* @param {string} type data type
* @return {OpenSeadragon.Promise<?>|undefined} promise resolution with data passed from constructor
*/
copy(tile, data, type) {
const copyTransform = this.copyings[type];
if (copyTransform) {
const y = copyTransform(tile, data);
return $.type(y) === "promise" ? y : $.Promise.resolve(y);
}
$.console.warn(`[OpenSeadragon.convertor.copy] is not supported with type %s`, type);
return $.Promise.resolve(undefined);
}
/**
* Destroy the data item given.
* @param {string} type data type
* @param {any} data
* @return {OpenSeadragon.Promise<any>|undefined} promise resolution with data passed from constructor, or undefined
* if not such conversion exists
*/
destroy(data, type) {
const destructor = this.destructors[type];
if (destructor) {
const y = destructor(data);
return $.type(y) === "promise" ? y : $.Promise.resolve(y);
}
return undefined;
}
/**
* Get possible system type conversions and cache result.
* @param {string} from data item type
* @param {string|string[]} to array of accepted types
* @return {ConversionStep[]|undefined} array of required conversions (returns empty array
* for from===to), or undefined if the system cannot convert between given types.
* Each object has 'transform' function that converts between neighbouring types, such
* that x = arr[i].transform(x) is valid input for convertor arr[i+1].transform(), e.g.
* arr[i+1].transform(arr[i].transform( ... )) is a valid conversion procedure.
*
* Note: if a function is returned, it is a callback called once the data is ready.
*/
getConversionPath(from, to) {
let bestConvertorPath, selectedType;
let knownFrom = this._known[from];
if (!knownFrom) {
this._known[from] = knownFrom = {};
}
if (Array.isArray(to)) {
$.console.assert(to.length > 0, "[getConversionPath] conversion 'to' type must be defined.");
let bestCost = Infinity;
//FIXME: pre-compute all paths in 'to' array? could be efficient for multiple
// type system, but overhead for simple use cases... now we just use the first type if costs unknown
selectedType = to[0];
for (const outType of to) {
const conversion = knownFrom[outType];
if (conversion && bestCost > conversion.cost) {
bestConvertorPath = conversion;
bestCost = conversion.cost;
selectedType = outType;
}
}
} else {
$.console.assert(typeof to === "string", "[getConversionPath] conversion 'to' type must be defined.");
bestConvertorPath = knownFrom[to];
selectedType = to;
}
if (!bestConvertorPath) {
bestConvertorPath = this.graph.dijkstra(from, selectedType);
this._known[from][selectedType] = bestConvertorPath;
}
return bestConvertorPath ? bestConvertorPath.path : undefined;
}
/**
* Return a list of known conversion types
* @return {string[]}
*/
getKnownTypes() {
return Object.keys(this.graph.vertices);
}
/**
* Check whether given type is known to the convertor
* @param {string} type type to test
* @return {boolean}
*/
existsType(type) {
return !!this.graph.vertices[type];
}
};
/**
* Static convertor available throughout OpenSeadragon.
*
* Built-in conversions include types:
* - context2d canvas 2d context
* - image HTMLImage element
* - url url string carrying or pointing to 2D raster data
* - canvas HTMLCanvas element
*
* @type OpenSeadragon.DataTypeConvertor
* @memberOf OpenSeadragon
*/
$.convertor = new $.DataTypeConvertor();
}(OpenSeadragon));

View file

@ -2,7 +2,7 @@
* OpenSeadragon - DisplayRect
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are

View file

@ -1,518 +0,0 @@
/*
* OpenSeadragon - Drawer
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of CodePlex Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function( $ ){
/**
* @class Drawer
* @memberof OpenSeadragon
* @classdesc Handles rendering of tiles for an {@link OpenSeadragon.Viewer}.
* @param {Object} options - Options for this Drawer.
* @param {OpenSeadragon.Viewer} options.viewer - The Viewer that owns this Drawer.
* @param {OpenSeadragon.Viewport} options.viewport - Reference to Viewer viewport.
* @param {Element} options.element - Parent element.
* @param {Number} [options.debugGridColor] - See debugGridColor in {@link OpenSeadragon.Options} for details.
*/
$.Drawer = function( options ) {
$.console.assert( options.viewer, "[Drawer] options.viewer is required" );
//backward compatibility for positional args while prefering more
//idiomatic javascript options object as the only argument
var args = arguments;
if( !$.isPlainObject( options ) ){
options = {
source: args[ 0 ], // Reference to Viewer tile source.
viewport: args[ 1 ], // Reference to Viewer viewport.
element: args[ 2 ] // Parent element.
};
}
$.console.assert( options.viewport, "[Drawer] options.viewport is required" );
$.console.assert( options.element, "[Drawer] options.element is required" );
if ( options.source ) {
$.console.error( "[Drawer] options.source is no longer accepted; use TiledImage instead" );
}
this.viewer = options.viewer;
this.viewport = options.viewport;
this.debugGridColor = options.debugGridColor || $.DEFAULT_SETTINGS.debugGridColor;
if (options.opacity) {
$.console.error( "[Drawer] options.opacity is no longer accepted; set the opacity on the TiledImage instead" );
}
this.useCanvas = $.supportsCanvas && ( this.viewer ? this.viewer.useCanvas : true );
/**
* The parent element of this Drawer instance, passed in when the Drawer was created.
* The parent of {@link OpenSeadragon.Drawer#canvas}.
* @member {Element} container
* @memberof OpenSeadragon.Drawer#
*/
this.container = $.getElement( options.element );
/**
* A &lt;canvas&gt; element if the browser supports them, otherwise a &lt;div&gt; element.
* Child element of {@link OpenSeadragon.Drawer#container}.
* @member {Element} canvas
* @memberof OpenSeadragon.Drawer#
*/
this.canvas = $.makeNeutralElement( this.useCanvas ? "canvas" : "div" );
/**
* 2d drawing context for {@link OpenSeadragon.Drawer#canvas} if it's a &lt;canvas&gt; element, otherwise null.
* @member {Object} context
* @memberof OpenSeadragon.Drawer#
*/
this.context = this.useCanvas ? this.canvas.getContext( "2d" ) : null;
/**
* Sketch canvas used to temporarily draw tiles which cannot be drawn directly
* to the main canvas due to opacity. Lazily initialized.
*/
this.sketchCanvas = null;
this.sketchContext = null;
/**
* @member {Element} element
* @memberof OpenSeadragon.Drawer#
* @deprecated Alias for {@link OpenSeadragon.Drawer#container}.
*/
this.element = this.container;
// We force our container to ltr because our drawing math doesn't work in rtl.
// This issue only affects our canvas renderer, but we do it always for consistency.
// Note that this means overlays you want to be rtl need to be explicitly set to rtl.
this.container.dir = 'ltr';
// check canvas available width and height, set canvas width and height such that the canvas backing store is set to the proper pixel density
if (this.useCanvas) {
var viewportSize = this._calculateCanvasSize();
this.canvas.width = viewportSize.x;
this.canvas.height = viewportSize.y;
}
this.canvas.style.width = "100%";
this.canvas.style.height = "100%";
this.canvas.style.position = "absolute";
$.setElementOpacity( this.canvas, this.opacity, true );
// explicit left-align
this.container.style.textAlign = "left";
this.container.appendChild( this.canvas );
};
$.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{
// deprecated
addOverlay: function( element, location, placement, onDraw ) {
$.console.error("drawer.addOverlay is deprecated. Use viewer.addOverlay instead.");
this.viewer.addOverlay( element, location, placement, onDraw );
return this;
},
// deprecated
updateOverlay: function( element, location, placement ) {
$.console.error("drawer.updateOverlay is deprecated. Use viewer.updateOverlay instead.");
this.viewer.updateOverlay( element, location, placement );
return this;
},
// deprecated
removeOverlay: function( element ) {
$.console.error("drawer.removeOverlay is deprecated. Use viewer.removeOverlay instead.");
this.viewer.removeOverlay( element );
return this;
},
// deprecated
clearOverlays: function() {
$.console.error("drawer.clearOverlays is deprecated. Use viewer.clearOverlays instead.");
this.viewer.clearOverlays();
return this;
},
/**
* Set the opacity of the drawer.
* @param {Number} opacity
* @return {OpenSeadragon.Drawer} Chainable.
*/
setOpacity: function( opacity ) {
$.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");
var world = this.viewer.world;
for (var i = 0; i < world.getItemCount(); i++) {
world.getItemAt( i ).setOpacity( opacity );
}
return this;
},
/**
* Get the opacity of the drawer.
* @returns {Number}
*/
getOpacity: function() {
$.console.error("drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.");
var world = this.viewer.world;
var maxOpacity = 0;
for (var i = 0; i < world.getItemCount(); i++) {
var opacity = world.getItemAt( i ).getOpacity();
if ( opacity > maxOpacity ) {
maxOpacity = opacity;
}
}
return maxOpacity;
},
// deprecated
needsUpdate: function() {
$.console.error( "[Drawer.needsUpdate] this function is deprecated. Use World.needsDraw instead." );
return this.viewer.world.needsDraw();
},
// deprecated
numTilesLoaded: function() {
$.console.error( "[Drawer.numTilesLoaded] this function is deprecated. Use TileCache.numTilesLoaded instead." );
return this.viewer.tileCache.numTilesLoaded();
},
// deprecated
reset: function() {
$.console.error( "[Drawer.reset] this function is deprecated. Use World.resetItems instead." );
this.viewer.world.resetItems();
return this;
},
// deprecated
update: function() {
$.console.error( "[Drawer.update] this function is deprecated. Use Drawer.clear and World.draw instead." );
this.clear();
this.viewer.world.draw();
return this;
},
/**
* @return {Boolean} True if rotation is supported.
*/
canRotate: function() {
return this.useCanvas;
},
/**
* Destroy the drawer (unload current loaded tiles)
*/
destroy: function() {
//force unloading of current canvas (1x1 will be gc later, trick not necessarily needed)
this.canvas.width = 1;
this.canvas.height = 1;
this.sketchCanvas = null;
this.sketchContext = null;
},
/**
* Clears the Drawer so it's ready to draw another frame.
*/
clear: function() {
this.canvas.innerHTML = "";
if ( this.useCanvas ) {
var viewportSize = this._calculateCanvasSize();
if( this.canvas.width != viewportSize.x ||
this.canvas.height != viewportSize.y ) {
this.canvas.width = viewportSize.x;
this.canvas.height = viewportSize.y;
if ( this.sketchCanvas !== null ) {
this.sketchCanvas.width = this.canvas.width;
this.sketchCanvas.height = this.canvas.height;
}
}
this._clear();
}
},
_clear: function ( useSketch ) {
if ( !this.useCanvas ) {
return;
}
var context = this._getContext( useSketch );
var canvas = context.canvas;
context.clearRect( 0, 0, canvas.width, canvas.height );
},
/**
* Translates from OpenSeadragon viewer rectangle to drawer rectangle.
* @param {OpenSeadragon.Rect} rectangle - The rectangle in viewport coordinate system.
* @return {OpenSeadragon.Rect} Rectangle in drawer coordinate system.
*/
viewportToDrawerRectangle: function(rectangle) {
var topLeft = this.viewport.pixelFromPoint(rectangle.getTopLeft(), true);
var size = this.viewport.deltaPixelsFromPoints(rectangle.getSize(), true);
return new $.Rect(
topLeft.x * $.pixelDensityRatio,
topLeft.y * $.pixelDensityRatio,
size.x * $.pixelDensityRatio,
size.y * $.pixelDensityRatio
);
},
/**
* Draws the given tile.
* @param {OpenSeadragon.Tile} tile - The tile to draw.
* @param {Function} drawingHandler - Method for firing the drawing event if using canvas.
* drawingHandler({context, tile, rendered})
* @param {Boolean} useSketch - Whether to use the sketch canvas or not.
* where <code>rendered</code> is the context with the pre-drawn image.
*/
drawTile: function( tile, drawingHandler, useSketch ) {
$.console.assert(tile, '[Drawer.drawTile] tile is required');
$.console.assert(drawingHandler, '[Drawer.drawTile] drawingHandler is required');
if ( this.useCanvas ) {
var context = this._getContext( useSketch );
// TODO do this in a more performant way
// specifically, don't save,rotate,restore every time we draw a tile
if( this.viewport.degrees !== 0 ) {
this._offsetForRotation( tile, this.viewport.degrees, useSketch );
tile.drawCanvas( context, drawingHandler );
this._restoreRotationChanges( tile, useSketch );
} else {
tile.drawCanvas( context, drawingHandler );
}
} else {
tile.drawHTML( this.canvas );
}
},
_getContext: function( useSketch ) {
var context = this.context;
if ( useSketch ) {
if (this.sketchCanvas === null) {
this.sketchCanvas = document.createElement( "canvas" );
this.sketchCanvas.width = this.canvas.width;
this.sketchCanvas.height = this.canvas.height;
this.sketchContext = this.sketchCanvas.getContext( "2d" );
}
context = this.sketchContext;
}
return context;
},
// private
saveContext: function( useSketch ) {
if (!this.useCanvas) {
return;
}
this._getContext( useSketch ).save();
},
// private
restoreContext: function( useSketch ) {
if (!this.useCanvas) {
return;
}
this._getContext( useSketch ).restore();
},
// private
setClip: function(rect, useSketch) {
if (!this.useCanvas) {
return;
}
var context = this._getContext( useSketch );
context.beginPath();
context.rect(rect.x, rect.y, rect.width, rect.height);
context.clip();
},
// private
drawRectangle: function(rect, fillStyle, useSketch) {
if (!this.useCanvas) {
return;
}
var context = this._getContext( useSketch );
context.save();
context.fillStyle = fillStyle;
context.fillRect(rect.x, rect.y, rect.width, rect.height);
context.restore();
},
/**
* Blends the sketch canvas in the main canvas.
* @param {Float} opacity The opacity of the blending.
* @returns {undefined}
*/
blendSketch: function(opacity) {
if (!this.useCanvas || !this.sketchCanvas) {
return;
}
this.context.save();
this.context.globalAlpha = opacity;
this.context.drawImage(this.sketchCanvas, 0, 0);
this.context.restore();
},
// private
drawDebugInfo: function( tile, count, i ){
if ( !this.useCanvas ) {
return;
}
var context = this.context;
context.save();
context.lineWidth = 2 * $.pixelDensityRatio;
context.font = 'small-caps bold ' + (13 * $.pixelDensityRatio) + 'px arial';
context.strokeStyle = this.debugGridColor;
context.fillStyle = this.debugGridColor;
if ( this.viewport.degrees !== 0 ) {
this._offsetForRotation( tile, this.viewport.degrees );
}
context.strokeRect(
tile.position.x * $.pixelDensityRatio,
tile.position.y * $.pixelDensityRatio,
tile.size.x * $.pixelDensityRatio,
tile.size.y * $.pixelDensityRatio
);
var tileCenterX = (tile.position.x + (tile.size.x / 2)) * $.pixelDensityRatio;
var tileCenterY = (tile.position.y + (tile.size.y / 2)) * $.pixelDensityRatio;
// Rotate the text the right way around.
context.translate( tileCenterX, tileCenterY );
context.rotate( Math.PI / 180 * -this.viewport.degrees );
context.translate( -tileCenterX, -tileCenterY );
if( tile.x === 0 && tile.y === 0 ){
context.fillText(
"Zoom: " + this.viewport.getZoom(),
tile.position.x * $.pixelDensityRatio,
(tile.position.y - 30) * $.pixelDensityRatio
);
context.fillText(
"Pan: " + this.viewport.getBounds().toString(),
tile.position.x * $.pixelDensityRatio,
(tile.position.y - 20) * $.pixelDensityRatio
);
}
context.fillText(
"Level: " + tile.level,
(tile.position.x + 10) * $.pixelDensityRatio,
(tile.position.y + 20) * $.pixelDensityRatio
);
context.fillText(
"Column: " + tile.x,
(tile.position.x + 10) * $.pixelDensityRatio,
(tile.position.y + 30) * $.pixelDensityRatio
);
context.fillText(
"Row: " + tile.y,
(tile.position.x + 10) * $.pixelDensityRatio,
(tile.position.y + 40) * $.pixelDensityRatio
);
context.fillText(
"Order: " + i + " of " + count,
(tile.position.x + 10) * $.pixelDensityRatio,
(tile.position.y + 50) * $.pixelDensityRatio
);
context.fillText(
"Size: " + tile.size.toString(),
(tile.position.x + 10) * $.pixelDensityRatio,
(tile.position.y + 60) * $.pixelDensityRatio
);
context.fillText(
"Position: " + tile.position.toString(),
(tile.position.x + 10) * $.pixelDensityRatio,
(tile.position.y + 70) * $.pixelDensityRatio
);
if ( this.viewport.degrees !== 0 ) {
this._restoreRotationChanges( tile );
}
context.restore();
},
// private
debugRect: function(rect) {
if ( this.useCanvas ) {
var context = this.context;
context.save();
context.lineWidth = 2 * $.pixelDensityRatio;
context.strokeStyle = this.debugGridColor;
context.fillStyle = this.debugGridColor;
context.strokeRect(
rect.x * $.pixelDensityRatio,
rect.y * $.pixelDensityRatio,
rect.width * $.pixelDensityRatio,
rect.height * $.pixelDensityRatio
);
context.restore();
}
},
// private
_offsetForRotation: function( tile, degrees, useSketch ){
var cx = this.canvas.width / 2,
cy = this.canvas.height / 2;
var context = this._getContext( useSketch );
context.save();
context.translate(cx, cy);
context.rotate( Math.PI / 180 * degrees);
context.translate(-cx, -cy);
},
// private
_restoreRotationChanges: function( tile, useSketch ){
var context = this._getContext( useSketch );
context.restore();
},
// private
_calculateCanvasSize: function() {
var pixelDensityRatio = $.pixelDensityRatio;
var viewportSize = this.viewport.getContainerSize();
return {
x: viewportSize.x * pixelDensityRatio,
y: viewportSize.y * pixelDensityRatio
};
}
};
}( OpenSeadragon ));

426
src/drawerbase.js Normal file
View file

@ -0,0 +1,426 @@
/*
* OpenSeadragon - DrawerBase
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of CodePlex Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function( $ ){
/**
* @typedef BaseDrawerOptions
* @memberOf OpenSeadragon
* @property {boolean} [usePrivateCache=false] specify whether the drawer should use
* detached (=internal) cache object in case it has to perform custom type conversion atop
* what cache performs. In that case, drawer must implement internalCacheCreate() which gets data in one
* of formats the drawer declares as supported. This method must return object to be used during drawing.
* You should probably implement also internalCacheFree() to provide cleanup logics.
*
* @property {boolean} [preloadCache=true]
* When internalCacheCreate is used, it can be applied offline (asynchronously) during data processing = preloading,
* or just in time before rendering (if necessary). Preloading supports
*/
const OpenSeadragon = $; // (re)alias back to OpenSeadragon for JSDoc
/**
* @class OpenSeadragon.DrawerBase
* @classdesc Base class for Drawers that handle rendering of tiles for an {@link OpenSeadragon.Viewer}.
* @param {Object} options - Options for this Drawer.
* @param {OpenSeadragon.Viewer} options.viewer - The Viewer that owns this Drawer.
* @param {OpenSeadragon.Viewport} options.viewport - Reference to Viewer viewport.
* @param {HTMLElement} options.element - Parent element.
* @abstract
*/
OpenSeadragon.DrawerBase = class DrawerBase{
constructor(options){
$.console.assert( options.viewer, "[Drawer] options.viewer is required" );
$.console.assert( options.viewport, "[Drawer] options.viewport is required" );
$.console.assert( options.element, "[Drawer] options.element is required" );
this._id = this.getType() + $.now();
this.viewer = options.viewer;
this.viewport = options.viewport;
this.debugGridColor = typeof options.debugGridColor === 'string' ? [options.debugGridColor] : options.debugGridColor || $.DEFAULT_SETTINGS.debugGridColor;
this.options = $.extend({}, this.defaultOptions, options.options);
this.container = $.getElement( options.element );
this._renderingTarget = this._createDrawingElement();
this.canvas.style.width = "100%";
this.canvas.style.height = "100%";
this.canvas.style.position = "absolute";
// set canvas.style.left = 0 so the canvas is positioned properly in ltr and rtl html
this.canvas.style.left = "0";
$.setElementOpacity( this.canvas, this.viewer.opacity, true );
// Allow pointer events to pass through the canvas element so implicit
// pointer capture works on touch devices
$.setElementPointerEventsNone( this.canvas );
$.setElementTouchActionNone( this.canvas );
// explicit left-align
this.container.style.textAlign = "left";
this.container.appendChild( this.canvas );
this._checkInterfaceImplementation();
this.setInternalCacheNeedsRefresh(); // initializes stamp
}
/**
* Retrieve default options for the current drawer.
* The base implementation provides default shared options.
* Overrides should enumerate all defaults or extend from this implementation.
* return $.extend({}, super.options, { ... custom drawer instance options ... });
* @returns {BaseDrawerOptions} common options
*/
get defaultOptions() {
return {
usePrivateCache: false,
preloadCache: true,
};
}
// protect the canvas member with a getter
get canvas(){
return this._renderingTarget;
}
get element(){
$.console.error('Drawer.element is deprecated. Use Drawer.container instead.');
return this.container;
}
/**
* Get unique drawer ID
* @return {string}
*/
getId() {
return this._id;
}
/**
* @abstract
* @returns {String | undefined} What type of drawer this is. Must be overridden by extending classes.
*/
getType(){
$.console.error('Drawer.getType must be implemented by child class');
return undefined;
}
/**
* Retrieve required data formats the data must be converted to.
* This list MUST BE A VALID SUBSET OF getSupportedDataFormats()
* @abstract
* @return {string[]}
*/
getRequiredDataFormats() {
return this.getSupportedDataFormats();
}
/**
* Retrieve data types
* @abstract
* @return {string[]}
*/
getSupportedDataFormats() {
throw "Drawer.getSupportedDataFormats must define its supported rendering data types!";
}
/**
* Check a particular cache record is compatible.
* This function _MUST_ be called: if it returns a falsey
* value, the rendering _MUST NOT_ proceed. It should
* await next animation frames and check again for availability.
* @param {OpenSeadragon.Tile} tile
* @return {any|undefined} undefined if cache not available, compatible data otherwise.
*/
getDataToDraw(tile) {
const cache = tile.getCache(tile.cacheKey);
if (!cache) {
$.console.warn("Attempt to draw tile %s when not cached!", tile);
return undefined;
}
const dataCache = cache.getDataForRendering(this, tile);
return dataCache && dataCache.data;
}
/**
* @abstract
* @returns {Boolean} Whether the drawer implementation is supported by the browser. Must be overridden by extending classes.
*/
static isSupported() {
$.console.error('Drawer.isSupported must be implemented by child class');
}
/**
* @abstract
* @returns {Element} the element to draw into
* @private
*/
_createDrawingElement() {
$.console.error('Drawer._createDrawingElement must be implemented by child class');
return null;
}
/**
* @abstract
* @param {Array} tiledImages - An array of TiledImages that are ready to be drawn.
* @private
*/
draw(tiledImages) {
$.console.error('Drawer.draw must be implemented by child class');
}
/**
* @abstract
* @returns {Boolean} True if rotation is supported.
*/
canRotate() {
$.console.error('Drawer.canRotate must be implemented by child class');
}
/**
* @abstract
*/
destroy() {
$.console.error('Drawer.destroy must be implemented by child class');
}
/**
* Destroy internal cache. Should be called within destroy() when
* usePrivateCache is set to true. Ensures cleanup of anything created
* by internalCacheCreate(...).
*/
destroyInternalCache() {
this.viewer.tileCache.clearDrawerInternalCache(this);
}
/**
* @param {TiledImage} tiledImage the tiled image that is calling the function
* @returns {Boolean} Whether this drawer requires enforcing minimum tile overlap to avoid showing seams.
* @private
*/
minimumOverlapRequired(tiledImage) {
return false;
}
/**
* @abstract
* @param {Boolean} [imageSmoothingEnabled] - Whether or not the image is
* drawn smoothly on the canvas; see imageSmoothingEnabled in
* {@link OpenSeadragon.Options} for more explanation.
*/
setImageSmoothingEnabled(imageSmoothingEnabled){
$.console.error('Drawer.setImageSmoothingEnabled must be implemented by child class');
}
/**
* Optional public API to draw a rectangle (e.g. for debugging purposes)
* Child classes can override this method if they wish to support this
* @param {OpenSeadragon.Rect} rect
*/
drawDebuggingRect(rect) {
$.console.warn('[drawer].drawDebuggingRect is not implemented by this drawer');
}
// Deprecated functions
clear(){
$.console.warn('[drawer].clear() is deprecated. The drawer is responsible for clearing itself as needed before drawing tiles.');
}
/**
* If options.usePrivateCache is true, this method MUST RETURN the private cache content
* @param {OpenSeadragon.CacheRecord} cache
* @param {OpenSeadragon.Tile} tile
* @return any
*/
internalCacheCreate(cache, tile) {}
/**
* It is possible to perform any necessary cleanup on internal cache, necessary if you
* need to clean up some memory (e.g. destroy canvas by setting with & height to 0).
* @param {*} data object returned by internalCacheCreate(...)
*/
internalCacheFree(data) {}
/**
* Call to invalidate internal cache. It will be rebuilt. With synchronous converions,
* it will be rebuilt immediatelly. With asynchronous, it will be rebuilt once invalidation
* routine happens, e.g. you should call also requestInvalidate() if you need to happen
* it as soon as possible.
*/
setInternalCacheNeedsRefresh() {
this._dataNeedsRefresh = $.now();
}
// Private functions
/**
* Ensures that child classes have provided implementations for public API methods
* draw, canRotate, destroy, and setImageSmoothinEnabled. Throws an exception if the original
* placeholder methods are still in place.
* @private
*
*/
_checkInterfaceImplementation(){
if (this._createDrawingElement === $.DrawerBase.prototype._createDrawingElement) {
throw(new Error("[drawer]._createDrawingElement must be implemented by child class"));
}
if (this.draw === $.DrawerBase.prototype.draw) {
throw(new Error("[drawer].draw must be implemented by child class"));
}
if (this.canRotate === $.DrawerBase.prototype.canRotate) {
throw(new Error("[drawer].canRotate must be implemented by child class"));
}
if (this.destroy === $.DrawerBase.prototype.destroy) {
throw(new Error("[drawer].destroy must be implemented by child class"));
}
if (this.setImageSmoothingEnabled === $.DrawerBase.prototype.setImageSmoothingEnabled) {
throw(new Error("[drawer].setImageSmoothingEnabled must be implemented by child class"));
}
}
// Utility functions
/**
* Scale from OpenSeadragon viewer rectangle to drawer rectangle
* (ignoring rotation)
* @param {OpenSeadragon.Rect} rectangle - The rectangle in viewport coordinate system.
* @returns {OpenSeadragon.Rect} Rectangle in drawer coordinate system.
*/
viewportToDrawerRectangle(rectangle) {
var topLeft = this.viewport.pixelFromPointNoRotate(rectangle.getTopLeft(), true);
var size = this.viewport.deltaPixelsFromPointsNoRotate(rectangle.getSize(), true);
return new $.Rect(
topLeft.x * $.pixelDensityRatio,
topLeft.y * $.pixelDensityRatio,
size.x * $.pixelDensityRatio,
size.y * $.pixelDensityRatio
);
}
/**
* This function converts the given point from to the drawer coordinate by
* multiplying it with the pixel density.
* This function does not take rotation into account, thus assuming provided
* point is at 0 degree.
* @param {OpenSeadragon.Point} point - the pixel point to convert
* @returns {OpenSeadragon.Point} Point in drawer coordinate system.
*/
viewportCoordToDrawerCoord(point) {
var vpPoint = this.viewport.pixelFromPointNoRotate(point, true);
return new $.Point(
vpPoint.x * $.pixelDensityRatio,
vpPoint.y * $.pixelDensityRatio
);
}
// Internal utility functions
/**
* Calculate width and height of the canvas based on viewport dimensions
* and pixelDensityRatio
* @private
* @returns {OpenSeadragon.Point} {x, y} size of the canvas
*/
_calculateCanvasSize() {
var pixelDensityRatio = $.pixelDensityRatio;
var viewportSize = this.viewport.getContainerSize();
return new OpenSeadragon.Point( Math.round(viewportSize.x * pixelDensityRatio), Math.round(viewportSize.y * pixelDensityRatio));
}
/**
* Called by implementations to fire the tiled-image-drawn event (used by tests)
* @private
*/
_raiseTiledImageDrawnEvent(tiledImage, tiles){
if(!this.viewer) {
return;
}
/**
* Raised when a tiled image is drawn to the canvas. Used internally for testing.
* The update-viewport event is preferred if you want to know when a frame has been drawn.
*
* @event tiled-image-drawn
* @memberof OpenSeadragon.Viewer
* @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
* @property {OpenSeadragon.TiledImage} tiledImage - Which TiledImage is being drawn.
* @property {Array} tiles - An array of Tile objects that were drawn.
* @property {?Object} userData - Arbitrary subscriber-defined object.
* @private
*/
this.viewer.raiseEvent( 'tiled-image-drawn', {
tiledImage: tiledImage,
tiles: tiles,
});
}
/**
* Called by implementations to fire the drawer-error event
* @private
*/
_raiseDrawerErrorEvent(tiledImage, errorMessage){
if(!this.viewer) {
return;
}
/**
* Raised when a tiled image is drawn to the canvas. Used internally for testing.
* The update-viewport event is preferred if you want to know when a frame has been drawn.
*
* @event drawer-error
* @memberof OpenSeadragon.Viewer
* @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
* @property {OpenSeadragon.TiledImage} tiledImage - Which TiledImage is being drawn.
* @property {OpenSeadragon.DrawerBase} drawer - The drawer that raised the error.
* @property {String} error - A message describing the error.
* @property {?Object} userData - Arbitrary subscriber-defined object.
* @protected
*/
this.viewer.raiseEvent( 'drawer-error', {
tiledImage: tiledImage,
drawer: this,
error: errorMessage,
});
}
};
}( OpenSeadragon ));

View file

@ -2,7 +2,7 @@
* OpenSeadragon - DziTileSource
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -108,24 +108,27 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
if ( data.Image ) {
ns = data.Image.xmlns;
} else if ( data.documentElement) {
if ("Image" == data.documentElement.localName || "Image" == data.documentElement.tagName) {
if ("Image" === data.documentElement.localName || "Image" === data.documentElement.tagName) {
ns = data.documentElement.namespaceURI;
}
}
return ( "http://schemas.microsoft.com/deepzoom/2008" == ns ||
"http://schemas.microsoft.com/deepzoom/2009" == ns );
ns = (ns || '').toLowerCase();
return (ns.indexOf('schemas.microsoft.com/deepzoom/2008') !== -1 ||
ns.indexOf('schemas.microsoft.com/deepzoom/2009') !== -1);
},
/**
*
* @function
* @param {Object|XMLDocument} data - the raw configuration
* @param {String} url - the url the data was retreived from if any.
* @return {Object} options - A dictionary of keyword arguments sufficient
* @param {String} url - the url the data was retrieved from if any.
* @param {String} postData - HTTP POST data in k=v&k2=v2... form or null
* @returns {Object} options - A dictionary of keyword arguments sufficient
* to configure this tile sources constructor.
*/
configure: function( data, url ){
configure: function( data, url, postData ){
var options;
@ -139,9 +142,10 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
}
if (url && !options.tilesUrl) {
options.tilesUrl = url.replace(/([^\/]+)\.(dzi|xml|js)(\?.*|$)/, '$1_files/');
options.tilesUrl = url.replace(
/([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/, '$1_files/');
if (url.search(/\.(dzi|xml|js)\?/) != -1) {
if (url.search(/\.(dzi|xml|js)\?/) !== -1) {
options.queryParams = url.match(/\?.*/);
}else{
options.queryParams = '';
@ -163,6 +167,14 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
},
/**
* Equality comparator
*/
equals: function(otherSource) {
return this.tilesUrl === otherSource.tilesUrl;
},
/**
* @function
* @param {Number} level
@ -179,6 +191,10 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
yMax,
i;
if ((this.minLevel && level < this.minLevel) || (this.maxLevel && level > this.maxLevel)) {
return false;
}
if ( !rects || !rects.length ) {
return true;
}
@ -196,10 +212,10 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
xMax = xMin + rect.width * scale;
yMax = yMin + rect.height * scale;
xMin = Math.floor( xMin / this.tileSize );
yMin = Math.floor( yMin / this.tileSize );
xMax = Math.ceil( xMax / this.tileSize );
yMax = Math.ceil( yMax / this.tileSize );
xMin = Math.floor( xMin / this._tileWidth );
yMin = Math.floor( yMin / this._tileWidth ); // DZI tiles are square, so we just use _tileWidth
xMax = Math.ceil( xMax / this._tileWidth );
yMax = Math.ceil( yMax / this._tileWidth );
if ( xMin <= x && x < xMax && yMin <= y && y < yMax ) {
return true;
@ -233,7 +249,7 @@ function configureFromXML( tileSource, xmlDoc ){
sizeNode,
i;
if ( rootName == "Image" ) {
if ( rootName === "Image" ) {
try {
sizeNode = root.getElementsByTagName("Size" )[ 0 ];
@ -297,10 +313,12 @@ function configureFromXML( tileSource, xmlDoc ){
e :
new Error( $.getString("Errors.Dzi") );
}
} else if ( rootName == "Collection" ) {
} else if ( rootName === "Collection" ) {
throw new Error( $.getString( "Errors.Dzc" ) );
} else if ( rootName == "Error" ) {
return $._processDZIError( root );
} else if ( rootName === "Error" ) {
var messageNode = root.getElementsByTagName("Message")[0];
var message = messageNode.firstChild.nodeValue;
throw new Error(message);
}
throw new Error( $.getString( "Errors.Dzi" ) );

View file

@ -2,7 +2,7 @@
* OpenSeadragon - EventSource
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -37,9 +37,19 @@
/**
* Event handler method signature used by all OpenSeadragon events.
*
* @callback EventHandler
* @typedef {function(OpenSeadragon.Event): void} OpenSeadragon.EventHandler
* @memberof OpenSeadragon
* @param {Object} event - See individual events for event-specific properties.
* @param {OpenSeadragon.Event} event - The event object containing event-specific properties.
* @returns {void} This handler does not return a value.
*/
/**
* Event handler method signature used by all OpenSeadragon events.
*
* @typedef {function(OpenSeadragon.Event): Promise<void>} OpenSeadragon.AsyncEventHandler
* @memberof OpenSeadragon
* @param {OpenSeadragon.Event} event - The event object containing event-specific properties.
* @returns {Promise<void>} This handler does not return a value.
*/
@ -51,44 +61,87 @@
*/
$.EventSource = function() {
this.events = {};
this._rejectedEventList = {};
};
$.EventSource.prototype = /** @lends OpenSeadragon.EventSource.prototype */{
/** @lends OpenSeadragon.EventSource.prototype */
$.EventSource.prototype = {
// TODO: Add a method 'one' which automatically unbinds a listener after the first triggered event that matches.
/**
* Add an event handler to be triggered only once (or a given number of times)
* for a given event. It is not removable with removeHandler().
* @function
* @param {String} eventName - Name of event to register.
* @param {OpenSeadragon.EventHandler|OpenSeadragon.AsyncEventHandler} handler - Function to call when event
* is triggered.
* @param {Object} [userData=null] - Arbitrary object to be passed unchanged
* to the handler.
* @param {Number} [times=1] - The number of times to handle the event
* before removing it.
* @param {Number} [priority=0] - Handler priority. By default, all priorities are 0. Higher number = priority.
* @returns {Boolean} - True if the handler was added, false if it was rejected
*/
addOnceHandler: function(eventName, handler, userData, times, priority) {
const self = this;
times = times || 1;
let count = 0;
const onceHandler = function(event) {
count++;
if (count === times) {
self.removeHandler(eventName, onceHandler);
}
return handler(event);
};
return this.addHandler(eventName, onceHandler, userData, priority);
},
/**
* Add an event handler for a given event.
* @function
* @param {String} eventName - Name of event to register.
* @param {OpenSeadragon.EventHandler} handler - Function to call when event is triggered.
* @param {OpenSeadragon.EventHandler|OpenSeadragon.AsyncEventHandler} handler - Function to call when event is triggered.
* @param {Object} [userData=null] - Arbitrary object to be passed unchanged to the handler.
* @param {Number} [priority=0] - Handler priority. By default, all priorities are 0. Higher number = priority.
* @returns {Boolean} - True if the handler was added, false if it was rejected
*/
addHandler: function ( eventName, handler, userData ) {
var events = this.events[ eventName ];
addHandler: function ( eventName, handler, userData, priority ) {
if(Object.prototype.hasOwnProperty.call(this._rejectedEventList, eventName)){
$.console.error(`Error adding handler for ${eventName}. ${this._rejectedEventList[eventName]}`);
return false;
}
let events = this.events[ eventName ];
if ( !events ) {
this.events[ eventName ] = events = [];
}
if ( handler && $.isFunction( handler ) ) {
events[ events.length ] = { handler: handler, userData: userData || null };
let index = events.length,
event = { handler: handler, userData: userData || null, priority: priority || 0 };
events[ index ] = event;
while ( index > 0 && events[ index - 1 ].priority < events[ index ].priority ) {
events[ index ] = events[ index - 1 ];
events[ index - 1 ] = event;
index--;
}
}
return true;
},
/**
* Remove a specific event handler for a given event.
* @function
* @param {String} eventName - Name of event for which the handler is to be removed.
* @param {OpenSeadragon.EventHandler} handler - Function to be removed.
* @param {OpenSeadragon.EventHandler|OpenSeadragon.AsyncEventHandler} handler - Function to be removed.
*/
removeHandler: function ( eventName, handler ) {
var events = this.events[ eventName ],
handlers = [],
i;
const events = this.events[ eventName ],
handlers = [];
if ( !events ) {
return;
}
if ( $.isArray( events ) ) {
for ( i = 0; i < events.length; i++ ) {
for ( let i = 0; i < events.length; i++ ) {
if ( events[i].handler !== handler ) {
handlers.push( events[ i ] );
}
@ -97,6 +150,18 @@ $.EventSource.prototype = /** @lends OpenSeadragon.EventSource.prototype */{
}
},
/**
* Get the amount of handlers registered for a given event.
* @param {String} eventName - Name of event to inspect.
* @returns {number} amount of events
*/
numberOfHandlers: function (eventName) {
const events = this.events[ eventName ];
if ( !events ) {
return 0;
}
return events.length;
},
/**
* Remove all event handlers for a given event type. If no type is given all
@ -108,7 +173,7 @@ $.EventSource.prototype = /** @lends OpenSeadragon.EventSource.prototype */{
if ( eventName ){
this.events[ eventName ] = [];
} else{
for ( var eventType in this.events ) {
for ( let eventType in this.events ) {
this.events[ eventType ] = [];
}
}
@ -119,8 +184,8 @@ $.EventSource.prototype = /** @lends OpenSeadragon.EventSource.prototype */{
* @function
* @param {String} eventName - Name of event to get handlers for.
*/
getHandler: function ( eventName ) {
var events = this.events[ eventName ];
getHandler: function ( eventName) {
let events = this.events[ eventName ];
if ( !events || !events.length ) {
return null;
}
@ -128,9 +193,8 @@ $.EventSource.prototype = /** @lends OpenSeadragon.EventSource.prototype */{
[ events[ 0 ] ] :
Array.apply( null, events );
return function ( source, args ) {
var i,
length = events.length;
for ( i = 0; i < length; i++ ) {
let length = events.length;
for ( let i = 0; i < length; i++ ) {
if ( events[ i ] ) {
args.eventSource = source;
args.userData = events[ i ].userData;
@ -141,23 +205,106 @@ $.EventSource.prototype = /** @lends OpenSeadragon.EventSource.prototype */{
},
/**
* Trigger an event, optionally passing additional information.
* Get a function which iterates the list of all handlers registered for a given event,
* calling the handler for each and awaiting async ones.
* @function
* @param {String} eventName - Name of event to get handlers for.
* @param {any} bindTarget - Bound target to return with the promise on finish
*/
getAwaitingHandler: function ( eventName, bindTarget ) {
let events = this.events[ eventName ];
if ( !events || !events.length ) {
return null;
}
events = events.length === 1 ?
[ events[ 0 ] ] :
Array.apply( null, events );
return function ( source, args ) {
// We return a promise that gets resolved after all the events finish.
// Returning loop result is not correct, loop promises chain dynamically
// and outer code could process finishing logics in the middle of event loop.
return new $.Promise(resolve => {
const length = events.length;
function loop(index) {
if ( index >= length || !events[ index ] ) {
resolve(bindTarget);
return null;
}
args.eventSource = source;
args.userData = events[ index ].userData;
let result = events[ index ].handler( args );
result = (!result || $.type(result) !== "promise") ? $.Promise.resolve() : result;
return result.then(() => loop(index + 1));
}
loop(0);
});
};
},
/**
* Trigger an event, optionally passing additional information. Does not await async handlers, i.e.
* OpenSeadragon.AsyncEventHandler.
* @function
* @param {String} eventName - Name of event to register.
* @param {Object} eventArgs - Event-specific data.
* @returns {Boolean} True if the event was fired, false if it was rejected because of rejectEventHandler(eventName)
*/
raiseEvent: function( eventName, eventArgs ) {
//uncomment if you want to get a log of all events
//$.console.log( eventName );
var handler = this.getHandler( eventName );
//$.console.log( "Event fired:", eventName );
if ( handler ) {
if ( !eventArgs ) {
eventArgs = {};
}
handler( this, eventArgs );
if(Object.prototype.hasOwnProperty.call(this._rejectedEventList, eventName)){
$.console.error(`Error adding handler for ${eventName}. ${this._rejectedEventList[eventName]}`);
return false;
}
const handler = this.getHandler( eventName );
if ( handler ) {
handler( this, eventArgs || {} );
}
return true;
},
/**
* Trigger an event, optionally passing additional information.
* This events awaits every asynchronous or promise-returning function, i.e.
* OpenSeadragon.AsyncEventHandler.
* @param {String} eventName - Name of event to register.
* @param {Object} eventArgs - Event-specific data.
* @param {?} [bindTarget = null] - Promise-resolved value on the event finish
* @return {OpenSeadragon.Promise|undefined} - Promise resolved upon the event completion.
*/
raiseEventAwaiting: function ( eventName, eventArgs, bindTarget = null ) {
//uncomment if you want to get a log of all events
//$.console.log( "Awaiting event fired:", eventName );
const awaitingHandler = this.getAwaitingHandler(eventName, bindTarget);
if (awaitingHandler) {
return awaitingHandler(this, eventArgs || {});
}
return $.Promise.resolve(bindTarget);
},
/**
* Set an event name as being disabled, and provide an optional error message
* to be printed to the console
* @param {String} eventName - Name of the event
* @param {String} [errorMessage] - Optional string to print to the console
* @private
*/
rejectEventHandler(eventName, errorMessage = ''){
this._rejectedEventList[eventName] = errorMessage;
},
/**
* Explicitly allow an event handler to be added for this event type, undoing
* the effects of rejectEventHandler
* @param {String} eventName - Name of the event
* @private
*/
allowEventHandler(eventName){
delete this._rejectedEventList[eventName];
}
};

View file

@ -2,7 +2,7 @@
* OpenSeadragon - full-screen support functions
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -67,10 +67,14 @@
return document.fullscreenElement;
};
fullScreenApi.requestFullScreen = function( element ) {
return element.requestFullscreen();
return element.requestFullscreen().catch(function (msg) {
$.console.error('Fullscreen request failed: ', msg);
});
};
fullScreenApi.exitFullScreen = function() {
document.exitFullscreen();
document.exitFullscreen().catch(function (msg) {
$.console.error('Error while exiting fullscreen: ', msg);
});
};
fullScreenApi.fullScreenEventName = "fullscreenchange";
fullScreenApi.fullScreenErrorEventName = "fullscreenerror";

288
src/htmldrawer.js Normal file
View file

@ -0,0 +1,288 @@
/*
* OpenSeadragon - HTMLDrawer
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of CodePlex Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function( $ ){
const OpenSeadragon = $; // alias back for JSDoc
/**
* @class OpenSeadragon.HTMLDrawer
* @extends OpenSeadragon.DrawerBase
* @classdesc HTML-based implementation of DrawerBase for an {@link OpenSeadragon.Viewer}.
* @param {Object} options - Options for this Drawer.
* @param {OpenSeadragon.Viewer} options.viewer - The Viewer that owns this Drawer.
* @param {OpenSeadragon.Viewport} options.viewport - Reference to Viewer viewport.
* @param {Element} options.element - Parent element.
* @param {Number} [options.debugGridColor] - See debugGridColor in {@link OpenSeadragon.Options} for details.
*/
class HTMLDrawer extends OpenSeadragon.DrawerBase{
constructor(options){
super(options);
/**
* The HTML element (div) that this drawer uses for drawing
* @member {Element} canvas
* @memberof OpenSeadragon.HTMLDrawer#
*/
/**
* The parent element of this Drawer instance, passed in when the Drawer was created.
* The parent of {@link OpenSeadragon.WebGLDrawer#canvas}.
* @member {Element} container
* @memberof OpenSeadragon.HTMLDrawer#
*/
// Reject listening for the tile-drawing event, which this drawer does not fire
this.viewer.rejectEventHandler("tile-drawing", "The HTMLDrawer does not raise the tile-drawing event");
// Since the tile-drawn event is fired by this drawer, make sure handlers can be added for it
this.viewer.allowEventHandler("tile-drawn");
// works with canvas & image objects
function _prepareTile(tile, data) {
const element = $.makeNeutralElement( "div" );
const imgElement = data.cloneNode();
imgElement.style.msInterpolationMode = "nearest-neighbor";
imgElement.style.width = "100%";
imgElement.style.height = "100%";
const style = element.style;
style.position = "absolute";
return {
element, imgElement, style, data
};
}
// The actual placing logics will not happen at draw event, but when the cache is created:
$.convertor.learn("context2d", HTMLDrawer.canvasCacheType, (t, d) => _prepareTile(t, d.canvas), 1, 1);
$.convertor.learn("image", HTMLDrawer.imageCacheType, _prepareTile, 1, 1);
// Also learn how to move back, since these elements can be just used as-is
$.convertor.learn(HTMLDrawer.canvasCacheType, "context2d", (t, d) => d.data.getContext('2d'), 1, 3);
$.convertor.learn(HTMLDrawer.imageCacheType, "image", (t, d) => d.data, 1, 3);
function _freeTile(data) {
if ( data.imgElement && data.imgElement.parentNode ) {
data.imgElement.parentNode.removeChild( data.imgElement );
}
if ( data.element && data.element.parentNode ) {
data.element.parentNode.removeChild( data.element );
}
}
$.convertor.learnDestroy(HTMLDrawer.canvasCacheType, _freeTile);
$.convertor.learnDestroy(HTMLDrawer.imageCacheType, _freeTile);
}
static get imageCacheType() {
return 'htmlDrawer[image]';
}
static get canvasCacheType() {
return 'htmlDrawer[canvas]';
}
/**
* @returns {Boolean} always true
*/
static isSupported() {
return true;
}
/**
*
* @returns 'html'
*/
getType(){
return 'html';
}
getSupportedDataFormats() {
return [HTMLDrawer.imageCacheType, HTMLDrawer.canvasCacheType];
}
/**
* @param {TiledImage} tiledImage the tiled image that is calling the function
* @returns {Boolean} Whether this drawer requires enforcing minimum tile overlap to avoid showing seams.
* @private
*/
minimumOverlapRequired(tiledImage) {
return true;
}
/**
* create the HTML element (e.g. canvas, div) that the image will be drawn into
* @returns {Element} the div to draw into
*/
_createDrawingElement(){
return $.makeNeutralElement("div");
}
/**
* Draws the TiledImages
*/
draw(tiledImages) {
var _this = this;
this._prepareNewFrame(); // prepare to draw a new frame
tiledImages.forEach(function(tiledImage){
if (tiledImage.opacity !== 0) {
_this._drawTiles(tiledImage);
}
});
}
/**
* @returns {Boolean} False - rotation is not supported.
*/
canRotate() {
return false;
}
/**
* Destroy the drawer (unload current loaded tiles)
*/
destroy() {
this.container.removeChild(this.canvas);
}
/**
* This function is ignored by the HTML Drawer. Implementing it is required by DrawerBase.
* @param {Boolean} [imageSmoothingEnabled] - Whether or not the image is
* drawn smoothly on the canvas; see imageSmoothingEnabled in
* {@link OpenSeadragon.Options} for more explanation.
*/
setImageSmoothingEnabled(){
// noop - HTML Drawer does not deal with this property
}
/**
* Clears the Drawer so it's ready to draw another frame.
* @private
*
*/
_prepareNewFrame() {
this.canvas.innerHTML = "";
}
/**
* Draws a TiledImage.
* @private
*
*/
_drawTiles( tiledImage ) {
var lastDrawn = tiledImage.getTilesToDraw().map(info => info.tile);
if (tiledImage.opacity === 0 || (lastDrawn.length === 0 && !tiledImage.placeholderFillStyle)) {
return;
}
// Iterate over the tiles to draw, and draw them
for (var i = lastDrawn.length - 1; i >= 0; i--) {
var tile = lastDrawn[ i ];
this._drawTile( tile );
if( this.viewer ){
/**
* Raised when a tile is drawn to the canvas. Only valid for
* context2d and html drawers.
*
* @event tile-drawn
* @memberof OpenSeadragon.Viewer
* @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
* @property {OpenSeadragon.TiledImage} tiledImage - Which TiledImage is being drawn.
* @property {OpenSeadragon.Tile} tile
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
this.viewer.raiseEvent( 'tile-drawn', {
tiledImage: tiledImage,
tile: tile
});
}
}
}
/**
* Draws the given tile.
* @private
* @param {OpenSeadragon.Tile} tile - The tile to draw.
* @param {Function} drawingHandler - Method for firing the drawing event if using canvas.
* drawingHandler({context, tile, rendered})
*/
_drawTile( tile ) {
$.console.assert(tile, '[Drawer._drawTile] tile is required');
let container = this.canvas;
if ( !tile.loaded ) {
$.console.warn(
"Attempting to draw tile %s when it's not yet loaded.",
tile.toString()
);
return;
}
//EXPERIMENTAL - trying to figure out how to scale the container
// content during animation of the container size.
const dataObject = this.getDataToDraw(tile);
if (!dataObject) {
return;
}
if ( dataObject.element.parentNode !== container ) {
container.appendChild( dataObject.element );
}
if ( dataObject.imgElement.parentNode !== dataObject.element ) {
dataObject.element.appendChild( dataObject.imgElement );
}
dataObject.style.top = tile.position.y + "px";
dataObject.style.left = tile.position.x + "px";
dataObject.style.height = tile.size.y + "px";
dataObject.style.width = tile.size.x + "px";
if (tile.flipped) {
dataObject.style.transform = "scaleX(-1)";
}
$.setElementOpacity( dataObject.element, tile.opacity );
}
}
$.HTMLDrawer = HTMLDrawer;
}( OpenSeadragon ));

View file

@ -2,7 +2,7 @@
* OpenSeadragon - IIIFTileSource
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -36,24 +36,34 @@
/**
* @class IIIFTileSource
* @classdesc A client implementation of the International Image Interoperability
* Format: Image API 1.0 - 2.0
* @classdesc A client implementation of the International Image Interoperability Framework
* Format: Image API 1.0 - 2.1
*
* @memberof OpenSeadragon
* @extends OpenSeadragon.TileSource
* @see http://iiif.io/api/image/
* @param {String} [options.tileFormat='jpg']
* The extension that will be used when requiring tiles.
*/
$.IIIFTileSource = function( options ){
/* eslint-disable camelcase */
$.extend( true, this, options );
if ( !( this.height && this.width && this['@id'] ) ) {
throw new Error( 'IIIF required parameters not provided.' );
/* Normalizes v3-style 'id' keys to an "_id" internal property */
this._id = this["@id"] || this["id"] || this['identifier'] || null;
if ( !( this.height && this.width && this._id) ) {
throw new Error( 'IIIF required parameters (width, height, or id) not provided.' );
}
options.tileSizePerScaleFactor = {};
this.tileFormat = this.tileFormat || 'jpg';
this.version = options.version;
// N.B. 2.0 renamed scale_factors to scaleFactors
if ( this.tile_width && this.tile_height ) {
options.tileWidth = this.tile_width;
@ -64,7 +74,7 @@ $.IIIFTileSource = function( options ){
options.tileSize = this.tile_height;
} else if ( this.tiles ) {
// Version 2.0 forwards
if ( this.tiles.length == 1 ) {
if ( this.tiles.length === 1 ) {
options.tileWidth = this.tiles[0].width;
// Use height if provided, otherwise assume square tiles and use width.
options.tileHeight = this.tiles[0].height || this.tiles[0].width;
@ -83,10 +93,10 @@ $.IIIFTileSource = function( options ){
}
}
}
} else {
} else if ( canBeTiled(options) ) {
// use the largest of tileOptions that is smaller than the short dimension
var shortDim = Math.min( this.height, this.width ),
tileOptions = [256,512,1024],
tileOptions = [256, 512, 1024],
smallerTiles = [];
for ( var c = 0; c < tileOptions.length; c++ ) {
@ -101,13 +111,45 @@ $.IIIFTileSource = function( options ){
// If we're smaller than 256, just use the short side.
options.tileSize = shortDim;
}
} else if (this.sizes && this.sizes.length > 0) {
// This info.json can't be tiled, but we can still construct a legacy pyramid from the sizes array.
// In this mode, IIIFTileSource will call functions from the abstract baseTileSource or the
// LegacyTileSource instead of performing IIIF tiling.
this.emulateLegacyImagePyramid = true;
options.levels = constructLevels( this );
// use the largest available size to define tiles
$.extend( true, options, {
width: options.levels[ options.levels.length - 1 ].width,
height: options.levels[ options.levels.length - 1 ].height,
tileSize: Math.max( options.height, options.width ),
tileOverlap: 0,
minLevel: 0,
maxLevel: options.levels.length - 1
});
this.levels = options.levels;
} else {
$.console.error("Nothing in the info.json to construct image pyramids from");
}
if ( !options.maxLevel ) {
if ( !this.scale_factors ) {
options.maxLevel = Number( Math.ceil( Math.log( Math.max( this.width, this.height ), 2 ) ) );
if (!options.maxLevel && !this.emulateLegacyImagePyramid) {
if (!this.scale_factors) {
options.maxLevel = Number(Math.round(Math.log(Math.max(this.width, this.height), 2)));
} else {
options.maxLevel = Math.floor( Math.pow( Math.max.apply(null, this.scale_factors), 0.5) );
var maxScaleFactor = Math.max.apply(null, this.scale_factors);
options.maxLevel = Math.round(Math.log(maxScaleFactor) * Math.LOG2E);
}
}
// Create an array with our exact resolution sizes if these have been supplied
if( this.sizes ) {
var sizeLength = this.sizes.length;
if ( (sizeLength === options.maxLevel) || (sizeLength === options.maxLevel + 1) ) {
this.levelSizes = this.sizes.slice().sort(( size1, size2 ) => size1.width - size2.width);
// Need to take into account that the list may or may not include the full resolution size
if( sizeLength === options.maxLevel ) {
this.levelSizes.push( {width: this.width, height: this.height} );
}
}
}
@ -120,17 +162,17 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
* this tile source.
* @function
* @param {Object|Array} data
* @param {String} optional - url
* @param {String} [url] - url
*/
supports: function( data, url ) {
// Version 2.0 and forwards
if (data.protocol && data.protocol == 'http://iiif.io/api/image') {
if (data.protocol && data.protocol === 'http://iiif.io/api/image') {
return true;
// Version 1.1
} else if ( data['@context'] && (
data['@context'] == "http://library.stanford.edu/iiif/image-api/1.1/context.json" ||
data['@context'] == "http://iiif.io/api/image/1/context.json") ) {
data['@context'] === "http://library.stanford.edu/iiif/image-api/1.1/context.json" ||
data['@context'] === "http://iiif.io/api/image/1/context.json") ) {
// N.B. the iiif.io context is wrong, but where the representation lives so likely to be used
return true;
@ -141,8 +183,8 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
} else if ( data.identifier && data.width && data.height ) {
return true;
} else if ( data.documentElement &&
"info" == data.documentElement.tagName &&
"http://library.stanford.edu/iiif/image-api/ns/" ==
"info" === data.documentElement.tagName &&
"http://library.stanford.edu/iiif/image-api/ns/" ===
data.documentElement.namespaceURI) {
return true;
@ -153,35 +195,80 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
},
/**
* A static function used to prepare an incoming IIIF Image API info.json
* response for processing by the tile handler. Normalizes data for all
* versions of IIIF (1.0, 1.1, 2.x, 3.x) and returns a data object that
* may be passed to the IIIFTileSource.
*
* @function
* @static
* @param {Object} data - the raw configuration
* @example <caption>IIIF 1.1 Info Looks like this</caption>
* @param {String} url - the url configuration was retrieved from
* @param {String} postData - HTTP POST data in k=v&k2=v2... form or null
* @returns {Object} A normalized IIIF data object
* @example <caption>IIIF 2.x Info Looks like this</caption>
* {
* "@context" : "http://library.stanford.edu/iiif/image-api/1.1/context.json",
* "@id" : "http://iiif.example.com/prefix/1E34750D-38DB-4825-A38A-B60A345E591C",
* "width" : 6000,
* "height" : 4000,
* "scale_factors" : [ 1, 2, 4 ],
* "tile_width" : 1024,
* "tile_height" : 1024,
* "formats" : [ "jpg", "png" ],
* "qualities" : [ "native", "grey" ],
* "profile" : "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0"
* "@context": "http://iiif.io/api/image/2/context.json",
* "@id": "http://iiif.example.com/prefix/1E34750D-38DB-4825-A38A-B60A345E591C",
* "protocol": "http://iiif.io/api/image",
* "height": 1024,
* "width": 775,
* "tiles" : [{"width":256, "scaleFactors":[1,2,4,8]}],
* "profile": ["http://iiif.io/api/image/2/level1.json", {
* "qualities": [ "native", "bitonal", "grey", "color" ],
* "formats": [ "jpg", "png", "gif" ]
* }]
* }
*/
configure: function( data, url ){
configure: function( data, url, postData ){
// Try to deduce our version and fake it upwards if needed
if ( !$.isPlainObject(data) ) {
var options = configureFromXml10( data );
options['@context'] = "http://iiif.io/api/image/1.0/context.json";
options['@id'] = url.replace('/info.xml', '');
options["@id"] = url.replace('/info.xml', '');
options.version = 1;
return options;
} else if ( !data['@context'] ) {
data['@context'] = 'http://iiif.io/api/image/1.0/context.json';
data['@id'] = url.replace('/info.json', '');
return data;
} else {
if ( !data['@context'] ) {
data['@context'] = 'http://iiif.io/api/image/1.0/context.json';
data["@id"] = url.replace('/info.json', '');
data.version = 1;
} else {
var context = data['@context'];
if (Array.isArray(context)) {
for (var i = 0; i < context.length; i++) {
if (typeof context[i] === 'string' &&
( /^http:\/\/iiif\.io\/api\/image\/[1-3]\/context\.json$/.test(context[i]) ||
context[i] === 'http://library.stanford.edu/iiif/image-api/1.1/context.json' ) ) {
context = context[i];
break;
}
}
}
switch (context) {
case 'http://iiif.io/api/image/1/context.json':
case 'http://library.stanford.edu/iiif/image-api/1.1/context.json':
data.version = 1;
break;
case 'http://iiif.io/api/image/2/context.json':
data.version = 2;
break;
case 'http://iiif.io/api/image/3/context.json':
data.version = 3;
break;
default:
$.console.error('Data has a @context property which contains no known IIIF context URI.');
}
}
if (data.preferredFormats) {
for (var f = 0; f < data.preferredFormats.length; f++ ) {
if ( $.imageFormatSupported(data.preferredFormats[f]) ) {
data.tileFormat = data.preferredFormats[f];
break;
}
}
}
return data;
}
},
@ -192,6 +279,11 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
* @param {Number} level
*/
getTileWidth: function( level ) {
if(this.emulateLegacyImagePyramid) {
return $.TileSource.prototype.getTileWidth.call(this, level);
}
var scaleFactor = Math.pow(2, this.maxLevel - level);
if (this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[scaleFactor]) {
@ -206,6 +298,11 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
* @param {Number} level
*/
getTileHeight: function( level ) {
if(this.emulateLegacyImagePyramid) {
return $.TileSource.prototype.getTileHeight.call(this, level);
}
var scaleFactor = Math.pow(2, this.maxLevel - level);
if (this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[scaleFactor]) {
@ -214,9 +311,99 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
return this._tileHeight;
},
/**
* @function
* @param {Number} level
*/
getLevelScale: function ( level ) {
if(this.emulateLegacyImagePyramid) {
var levelScale = NaN;
if (this.levels.length > 0 && level >= this.minLevel && level <= this.maxLevel) {
levelScale =
this.levels[level].width /
this.levels[this.maxLevel].width;
}
return levelScale;
}
return $.TileSource.prototype.getLevelScale.call(this, level);
},
/**
* Responsible for retreiving the url which will return an image for the
* @function
* @param {Number} level
*/
getNumTiles: function( level ) {
if(this.emulateLegacyImagePyramid) {
var scale = this.getLevelScale(level);
if (scale) {
return new $.Point(1, 1);
} else {
return new $.Point(0, 0);
}
}
// Use supplied list of scaled resolution sizes if these exist
if( this.levelSizes ) {
var levelSize = this.levelSizes[level];
var x = Math.ceil( levelSize.width / this.getTileWidth(level) ),
y = Math.ceil( levelSize.height / this.getTileHeight(level) );
return new $.Point( x, y );
}
// Otherwise call default TileSource->getNumTiles() function
else {
return $.TileSource.prototype.getNumTiles.call(this, level);
}
},
/**
* @function
* @param {Number} level
* @param {OpenSeadragon.Point} point
*/
getTileAtPoint: function( level, point ) {
if(this.emulateLegacyImagePyramid) {
return new $.Point(0, 0);
}
// Use supplied list of scaled resolution sizes if these exist
if( this.levelSizes ) {
var validPoint = point.x >= 0 && point.x <= 1 &&
point.y >= 0 && point.y <= 1 / this.aspectRatio;
$.console.assert(validPoint, "[TileSource.getTileAtPoint] must be called with a valid point.");
var widthScaled = this.levelSizes[level].width;
var pixelX = point.x * widthScaled;
var pixelY = point.y * widthScaled;
var x = Math.floor(pixelX / this.getTileWidth(level));
var y = Math.floor(pixelY / this.getTileHeight(level));
// When point.x == 1 or point.y == 1 / this.aspectRatio we want to
// return the last tile of the row/column
if (point.x >= 1) {
x = this.getNumTiles(level).x - 1;
}
var EPSILON = 1e-15;
if (point.y >= 1 / this.aspectRatio - EPSILON) {
y = this.getNumTiles(level).y - 1;
}
return new $.Point(x, y);
}
// Otherwise call default TileSource->getTileAtPoint() function
return $.TileSource.prototype.getTileAtPoint.call(this, level, point);
},
/**
* Responsible for retrieving the url which will return an image for the
* region specified by the given x, y, and level components.
* @function
* @param {Number} level - z index
@ -226,14 +413,21 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
*/
getTileUrl: function( level, x, y ){
if(this.emulateLegacyImagePyramid) {
var url = null;
if ( this.levels.length > 0 && level >= this.minLevel && level <= this.maxLevel ) {
url = this.levels[ level ].url;
}
return url;
}
//# constants
var IIIF_ROTATION = '0',
//## get the scale (level as a decimal)
scale = Math.pow( 0.5, this.maxLevel - level ),
//# image dimensions at this level
levelWidth = Math.ceil( this.width * scale ),
levelHeight = Math.ceil( this.height * scale ),
levelWidth,
levelHeight,
//## iiif region
tileWidth,
@ -246,40 +440,134 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
iiifTileW,
iiifTileH,
iiifSize,
iiifSizeW,
iiifSizeH,
iiifQuality,
uri;
tileWidth = this.getTileWidth(level);
tileHeight = this.getTileHeight(level);
iiifTileSizeWidth = Math.ceil( tileWidth / scale );
iiifTileSizeHeight = Math.ceil( tileHeight / scale );
if ( this['@context'].indexOf('/1.0/context.json') > -1 ||
this['@context'].indexOf('/1.1/context.json') > -1 ||
this['@context'].indexOf('/1/context.json') > -1 ) {
iiifQuality = "native.jpg";
} else {
iiifQuality = "default.jpg";
// Use supplied list of scaled resolution sizes if these exist
if( this.levelSizes ) {
levelWidth = this.levelSizes[level].width;
levelHeight = this.levelSizes[level].height;
}
// Otherwise calculate the sizes ourselves
else {
levelWidth = Math.ceil( this.width * scale );
levelHeight = Math.ceil( this.height * scale );
}
tileWidth = this.getTileWidth(level);
tileHeight = this.getTileHeight(level);
iiifTileSizeWidth = Math.round( tileWidth / scale );
iiifTileSizeHeight = Math.round( tileHeight / scale );
if (this.version === 1) {
iiifQuality = "native." + this.tileFormat;
} else {
iiifQuality = "default." + this.tileFormat;
}
if ( levelWidth < tileWidth && levelHeight < tileHeight ){
iiifSize = levelWidth + ",";
if ( this.version === 2 && levelWidth === this.width ) {
iiifSize = "full";
} else if ( this.version === 3 && levelWidth === this.width && levelHeight === this.height ) {
iiifSize = "max";
} else if ( this.version === 3 ) {
iiifSize = levelWidth + "," + levelHeight;
} else {
iiifSize = levelWidth + ",";
}
iiifRegion = 'full';
} else {
iiifTileX = x * iiifTileSizeWidth;
iiifTileY = y * iiifTileSizeHeight;
iiifTileW = Math.min( iiifTileSizeWidth, this.width - iiifTileX );
iiifTileH = Math.min( iiifTileSizeHeight, this.height - iiifTileY );
iiifSize = Math.ceil( iiifTileW * scale ) + ",";
iiifRegion = [ iiifTileX, iiifTileY, iiifTileW, iiifTileH ].join( ',' );
if ( x === 0 && y === 0 && iiifTileW === this.width && iiifTileH === this.height ) {
iiifRegion = "full";
} else {
iiifRegion = [ iiifTileX, iiifTileY, iiifTileW, iiifTileH ].join( ',' );
}
iiifSizeW = Math.min( tileWidth, levelWidth - (x * tileWidth) );
iiifSizeH = Math.min( tileHeight, levelHeight - (y * tileHeight) );
if ( this.version === 2 && iiifSizeW === this.width ) {
iiifSize = "full";
} else if ( this.version === 3 && iiifSizeW === this.width && iiifSizeH === this.height ) {
iiifSize = "max";
} else if (this.version === 3) {
iiifSize = iiifSizeW + "," + iiifSizeH;
} else {
iiifSize = iiifSizeW + ",";
}
}
uri = [ this['@id'], iiifRegion, iiifSize, IIIF_ROTATION, iiifQuality ].join( '/' );
uri = [ this._id, iiifRegion, iiifSize, IIIF_ROTATION, iiifQuality ].join( '/' );
return uri;
},
/**
* Equality comparator
*/
equals: function(otherSource) {
return this._id === otherSource._id;
},
__testonly__: {
canBeTiled: canBeTiled,
constructLevels: constructLevels
}
});
/**
* Determine whether arbitrary tile requests can be made against a service with the given profile
* @function
* @param {Object} options
* @param {Array|String} options.profile
* @param {Number} options.version
* @param {String[]} options.extraFeatures
* @returns {Boolean}
*/
function canBeTiled ( options ) {
var level0Profiles = [
"http://library.stanford.edu/iiif/image-api/compliance.html#level0",
"http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0",
"http://iiif.io/api/image/2/level0.json",
"level0",
"https://iiif.io/api/image/3/level0.json"
];
var profileLevel = Array.isArray(options.profile) ? options.profile[0] : options.profile;
var isLevel0 = (level0Profiles.indexOf(profileLevel) !== -1);
var hasCanoncicalSizeFeature = false;
if ( options.version === 2 && options.profile.length > 1 && options.profile[1].supports ) {
hasCanoncicalSizeFeature = options.profile[1].supports.indexOf( "sizeByW" ) !== -1;
}
if ( options.version === 3 && options.extraFeatures ) {
hasCanoncicalSizeFeature = options.extraFeatures.indexOf( "sizeByWh" ) !== -1;
}
return !isLevel0 || hasCanoncicalSizeFeature;
}
/**
* Build the legacy pyramid URLs (one tile per level)
* @function
* @param {object} options - infoJson
* @throws {Error}
*/
function constructLevels(options) {
var levels = [];
for(var i = 0; i < options.sizes.length; i++) {
levels.push({
url: options._id + '/full/' + options.sizes[i].width + ',' +
(options.version === 3 ? options.sizes[i].height : '') +
'/0/default.' + options.tileFormat,
width: options.sizes[i].width,
height: options.sizes[i].height
});
}
return levels.sort(function(a, b) {
return a.width - b.width;
});
}
function configureFromXml10(xmlDoc) {
//parse the xml
@ -291,7 +579,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
rootName = root.tagName,
configuration = null;
if ( rootName == "info" ) {
if ( rootName === "info" ) {
try {
configuration = {};
parseXML10( root, configuration );
@ -309,7 +597,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
function parseXML10( node, configuration, property ) {
var i,
value;
if ( node.nodeType == 3 && property ) {//text node
if ( node.nodeType === 3 && property ) {//text node
value = node.nodeValue.trim();
if( value.match(/^\d*$/)){
value = Number( value );
@ -322,7 +610,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
}
configuration[ property ].push( value );
}
} else if( node.nodeType == 1 ){
} else if( node.nodeType === 1 ){
for( i = 0; i < node.childNodes.length; i++ ){
parseXML10( node.childNodes[ i ], configuration, node.nodeName );
}
@ -330,4 +618,5 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
}
}( OpenSeadragon ));

View file

@ -2,7 +2,7 @@
* OpenSeadragon - ImageLoader
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -32,64 +32,133 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function( $ ){
(function($){
// private class
function ImageJob ( options ) {
/**
* @class ImageJob
* @classdesc Handles downloading of a single image.
*
* @memberof OpenSeadragon
* @param {Object} options - Options for this ImageJob.
* @param {String} [options.src] - URL of image to download.
* @param {Tile} [options.tile] - Tile that belongs the data to.
* @param {TileSource} [options.source] - Image loading strategy
* @param {String} [options.loadWithAjax] - Whether to load this image with AJAX.
* @param {String} [options.ajaxHeaders] - Headers to add to the image request if using AJAX.
* @param {Boolean} [options.ajaxWithCredentials] - Whether to set withCredentials on AJAX requests.
* @param {String} [options.crossOriginPolicy] - CORS policy to use for downloads
* @param {String} [options.postData] - HTTP POST data (usually but not necessarily in k=v&k2=v2... form,
* see TileSource::getTilePostData) or null
* @param {Function} [options.callback] - Called once image has been downloaded.
* @param {Function} [options.abort] - Called when this image job is aborted.
* @param {Number} [options.timeout] - The max number of milliseconds that this image job may take to complete.
* @param {Number} [options.tries] - Actual number of the current try.
*/
$.ImageJob = function(options) {
$.extend( true, this, {
timeout: $.DEFAULT_SETTINGS.timeout,
jobId: null
}, options );
$.extend(true, this, {
timeout: $.DEFAULT_SETTINGS.timeout,
jobId: null,
tries: 0
}, options);
/**
* Image object which will contain downloaded image.
* @member {Image} image
* Data object which will contain downloaded image data.
* @member {Image|*} data data object, by default an Image object (depends on TileSource)
* @memberof OpenSeadragon.ImageJob#
*/
this.image = null;
}
this.data = null;
ImageJob.prototype = {
errorMsg: null,
start: function(){
var _this = this;
/**
* User workspace to populate with helper variables
* @member {*} userData to append custom data and avoid namespace collision
* @memberof OpenSeadragon.ImageJob#
*/
this.userData = {};
this.image = new Image();
/**
* Error message holder
* @member {string} error message
* @memberof OpenSeadragon.ImageJob#
* @private
*/
this.errorMsg = null;
};
if ( this.crossOriginPolicy !== false ) {
this.image.crossOrigin = this.crossOriginPolicy;
}
$.ImageJob.prototype = {
/**
* Starts the image job.
* @method
* @memberof OpenSeadragon.ImageJob#
*/
start: function() {
this.tries++;
this.image.onload = function(){
_this.finish( true );
};
this.image.onabort = this.image.onerror = function(){
_this.errorMsg = "Image load aborted";
_this.finish( false );
};
var self = this;
var selfAbort = this.abort;
this.jobId = window.setTimeout( function(){
_this.errorMsg = "Image load exceeded timeout";
_this.finish( false );
this.jobId = window.setTimeout(function () {
self.fail("Image load exceeded timeout (" + self.timeout + " ms)", null);
}, this.timeout);
this.image.src = this.src;
this.abort = function() {
self.source.downloadTileAbort(self);
if (typeof selfAbort === "function") {
selfAbort();
}
};
this.source.downloadTileStart(this);
},
finish: function( successful ) {
this.image.onload = this.image.onerror = this.image.onabort = null;
if (!successful) {
this.image = null;
/**
* Finish this job.
* @param {*} data data that has been downloaded
* @param {XMLHttpRequest} request reference to the request if used
* @param {string} dataType data type identifier
* fallback compatibility behavior: dataType treated as errorMessage if data is falsey value
* @memberof OpenSeadragon.ImageJob#
*/
finish: function(data, request, dataType) {
if (!this.jobId) {
return;
}
// old behavior, no deprecation due to possible finish calls with invalid data item (e.g. different error)
if (data === null || data === undefined || data === false) {
this.fail(dataType || "[downloadTileStart->finish()] Retrieved data is invalid!", request);
return;
}
if ( this.jobId ) {
window.clearTimeout( this.jobId );
this.data = data;
this.request = request;
this.errorMsg = null;
this.dataType = dataType;
if (this.jobId) {
window.clearTimeout(this.jobId);
}
this.callback( this );
this.callback(this);
},
/**
* Finish this job as a failure.
* @param {string} errorMessage description upon failure
* @param {XMLHttpRequest} request reference to the request if used
*/
fail: function(errorMessage, request) {
this.data = null;
this.request = request;
this.errorMsg = errorMessage;
this.dataType = null;
if (this.jobId) {
window.clearTimeout(this.jobId);
this.jobId = null;
}
this.callback(this);
}
};
/**
@ -99,46 +168,83 @@ ImageJob.prototype = {
* You generally won't have to interact with the ImageLoader directly.
* @param {Object} options - Options for this ImageLoader.
* @param {Number} [options.jobLimit] - The number of concurrent image requests. See imageLoaderLimit in {@link OpenSeadragon.Options} for details.
* @param {Number} [options.timeout] - The max number of milliseconds that an image job may take to complete.
*/
$.ImageLoader = function( options ) {
$.ImageLoader = function(options) {
$.extend( true, this, {
$.extend(true, this, {
jobLimit: $.DEFAULT_SETTINGS.imageLoaderLimit,
timeout: $.DEFAULT_SETTINGS.timeout,
jobQueue: [],
failedTiles: [],
jobsInProgress: 0
}, options );
}, options);
};
$.ImageLoader.prototype = /** @lends OpenSeadragon.ImageLoader.prototype */{
/** @lends OpenSeadragon.ImageLoader.prototype */
$.ImageLoader.prototype = {
/**
* Add an unloaded image to the loader queue.
* @method
* @param {String} src - URL of image to download.
* @param {String} crossOriginPolicy - CORS policy to use for downloads
* @param {Function} callback - Called once image has been downloaded.
* @param {Object} options - Options for this job.
* @param {String} [options.src] - URL of image to download.
* @param {Tile} [options.tile] - Tile that belongs the data to. The tile instance
* is not internally used and serves for custom TileSources implementations.
* @param {TileSource} [options.source] - Image loading strategy
* @param {String} [options.loadWithAjax] - Whether to load this image with AJAX.
* @param {String} [options.ajaxHeaders] - Headers to add to the image request if using AJAX.
* @param {String|Boolean} [options.crossOriginPolicy] - CORS policy to use for downloads
* @param {String} [options.postData] - POST parameters (usually but not necessarily in k=v&k2=v2... form,
* see TileSource::getTilePostData) or null
* @param {Boolean} [options.ajaxWithCredentials] - Whether to set withCredentials on AJAX
* requests.
* @param {Function} [options.callback] - Called once image has been downloaded.
* @param {Function} [options.abort] - Called when this image job is aborted.
* @returns {boolean} true if job was immediatelly started, false if queued
*/
addJob: function( options ) {
var _this = this,
complete = function( job ) {
completeJob( _this, job, options.callback );
},
addJob: function(options) {
if (!options.source) {
$.console.error('ImageLoader.prototype.addJob() requires [options.source]. ' +
'TileSource since new API defines how images are fetched. Creating a dummy TileSource.');
var implementation = $.TileSource.prototype;
options.source = {
downloadTileStart: implementation.downloadTileStart,
downloadTileAbort: implementation.downloadTileAbort
};
}
const _this = this,
jobOptions = {
src: options.src,
tile: options.tile || {},
source: options.source,
loadWithAjax: options.loadWithAjax,
ajaxHeaders: options.loadWithAjax ? options.ajaxHeaders : null,
crossOriginPolicy: options.crossOriginPolicy,
callback: complete,
abort: options.abort
ajaxWithCredentials: options.ajaxWithCredentials,
postData: options.postData,
callback: (job) => completeJob(_this, job, options.callback),
abort: options.abort,
timeout: this.timeout
},
newJob = new ImageJob( jobOptions );
newJob = new $.ImageJob(jobOptions);
if ( !this.jobLimit || this.jobsInProgress < this.jobLimit ) {
newJob.start();
this.jobsInProgress++;
return true;
}
else {
this.jobQueue.push( newJob );
}
this.jobQueue.push( newJob );
return false;
},
/**
* @returns {boolean} true if a job can be submitted
*/
canAcceptNewJob() {
return !this.jobLimit || this.jobsInProgress < this.jobLimit;
},
/**
@ -158,25 +264,39 @@ $.ImageLoader.prototype = /** @lends OpenSeadragon.ImageLoader.prototype */{
};
/**
* Cleans up ImageJob once completed.
* Cleans up ImageJob once completed. Restarts job after tileRetryDelay seconds if failed
* but max tileRetryMax times
* @method
* @private
* @param loader - ImageLoader used to start job.
* @param job - The ImageJob that has completed.
* @param callback - Called once cleanup is finished.
*/
function completeJob( loader, job, callback ) {
var nextJob;
function completeJob(loader, job, callback) {
if (job.errorMsg && job.data === null && job.tries < 1 + loader.tileRetryMax) {
loader.failedTiles.push(job);
}
let nextJob;
loader.jobsInProgress--;
if ( (!loader.jobLimit || loader.jobsInProgress < loader.jobLimit) && loader.jobQueue.length > 0) {
if (loader.canAcceptNewJob() && loader.jobQueue.length > 0) {
nextJob = loader.jobQueue.shift();
nextJob.start();
loader.jobsInProgress++;
}
callback( job.image, job.errorMsg );
if (loader.tileRetryMax > 0 && loader.jobQueue.length === 0) {
if (loader.canAcceptNewJob() && loader.failedTiles.length > 0) {
nextJob = loader.failedTiles.shift();
setTimeout(function () {
nextJob.start();
}, loader.tileRetryDelay);
loader.jobsInProgress++;
}
}
callback(job.data, job.errorMsg, job.request, job.dataType);
}
}( OpenSeadragon ));
}(OpenSeadragon));

View file

@ -2,7 +2,7 @@
* OpenSeadragon - ImageTileSource
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -31,257 +31,235 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function ($) {
/**
* @class ImageTileSource
* @classdesc The ImageTileSource allows a simple image to be loaded
* into an OpenSeadragon Viewer.
* There are 2 ways to open an ImageTileSource:
* 1. viewer.open({type: 'image', url: fooUrl});
* 2. viewer.open(new OpenSeadragon.ImageTileSource({url: fooUrl}));
*
* With the first syntax, the crossOriginPolicy, ajaxWithCredentials and
* useCanvas options are inherited from the viewer if they are not
* specified directly in the options object.
*
* @memberof OpenSeadragon
* @extends OpenSeadragon.TileSource
* @param {Object} options Options object.
* @param {String} options.url URL of the image
* @param {Boolean} [options.buildPyramid=true] If set to true (default), a
* pyramid will be built internally to provide a better downsampling.
* @param {String|Boolean} [options.crossOriginPolicy=false] Valid values are
* 'Anonymous', 'use-credentials', and false. If false, image requests will
* not use CORS preventing internal pyramid building for images from other
* domains.
* @param {String|Boolean} [options.ajaxWithCredentials=false] Whether to set
* the withCredentials XHR flag for AJAX requests (when loading tile sources).
* @param {Boolean} [options.useCanvas=true] Set to false to prevent any use
* of the canvas API.
*/
$.ImageTileSource = class extends $.TileSource {
/**
* @class ImageTileSource
* @classdesc The ImageTileSource allows a simple image to be loaded
* into an OpenSeadragon Viewer.
* There are 2 ways to open an ImageTileSource:
* 1. viewer.open({type: 'image', url: fooUrl});
* 2. viewer.open(new OpenSeadragon.ImageTileSource({url: fooUrl}));
*
* With the first syntax, the crossOriginPolicy, ajaxWithCredentials and
* useCanvas options are inherited from the viewer if they are not
* specified directly in the options object.
*
* @memberof OpenSeadragon
* @extends OpenSeadragon.TileSource
* @param {Object} options Options object.
* @param {String} options.url URL of the image
* @param {Boolean} [options.buildPyramid=true] If set to true (default), a
* pyramid will be built internally to provide a better downsampling.
* @param {String|Boolean} [options.crossOriginPolicy=false] Valid values are
* 'Anonymous', 'use-credentials', and false. If false, image requests will
* not use CORS preventing internal pyramid building for images from other
* domains.
* @param {String|Boolean} [options.ajaxWithCredentials=false] Whether to set
* the withCredentials XHR flag for AJAX requests (when loading tile sources).
* @param {Boolean} [options.useCanvas=true] Set to false to prevent any use
* of the canvas API.
*/
$.ImageTileSource = function (options) {
options = $.extend({
constructor(props) {
super($.extend({
buildPyramid: true,
crossOriginPolicy: false,
ajaxWithCredentials: false,
useCanvas: true
}, options);
$.TileSource.apply(this, [options]);
}, props));
}
};
/**
* Determine if the data and/or url imply the image service is supported by
* this tile source.
* @function
* @param {Object|Array} data
* @param {String} url - optional
*/
supports(data, url) {
return data.type && data.type === "image";
}
/**
*
* @function
* @param {Object} options - the options
* @param {String} dataUrl - the url the image was retrieved from, if any.
* @param {String} postData - HTTP POST data in k=v&k2=v2... form or null
* @returns {Object} options - A dictionary of keyword arguments sufficient
* to configure this tile sources constructor.
*/
configure(options, dataUrl, postData) {
return options;
}
/**
* Responsible for retrieving, and caching the
* image metadata pertinent to this TileSources implementation.
* @function
* @param {String} url
* @throws {Error}
*/
getImageInfo(url) {
const image = new Image(),
_this = this;
$.extend($.ImageTileSource.prototype, $.TileSource.prototype, /** @lends OpenSeadragon.ImageTileSource.prototype */{
/**
* Determine if the data and/or url imply the image service is supported by
* this tile source.
* @function
* @param {Object|Array} data
* @param {String} optional - url
*/
supports: function (data, url) {
return data.type && data.type === "image";
},
/**
*
* @function
* @param {Object} options - the options
* @param {String} dataUrl - the url the image was retreived from, if any.
* @return {Object} options - A dictionary of keyword arguments sufficient
* to configure this tile sources constructor.
*/
configure: function (options, dataUrl) {
return options;
},
/**
* Responsible for retrieving, and caching the
* image metadata pertinent to this TileSources implementation.
* @function
* @param {String} url
* @throws {Error}
*/
getImageInfo: function (url) {
var image = this._image = new Image();
var _this = this;
if (this.crossOriginPolicy) {
image.crossOrigin = this.crossOriginPolicy;
}
if (this.ajaxWithCredentials) {
image.useCredentials = this.ajaxWithCredentials;
}
if (this.crossOriginPolicy) {
image.crossOrigin = this.crossOriginPolicy;
}
if (this.ajaxWithCredentials) {
image.useCredentials = this.ajaxWithCredentials;
}
$.addEvent(image, 'load', function () {
_this.width = image.naturalWidth;
_this.height = image.naturalHeight;
_this.aspectRatio = _this.width / _this.height;
_this.dimensions = new $.Point(_this.width, _this.height);
_this._tileWidth = _this.width;
_this._tileHeight = _this.height;
_this.tileOverlap = 0;
_this.minLevel = 0;
_this.image = image;
_this.levels = _this._buildLevels(image);
_this.maxLevel = _this.levels.length - 1;
$.addEvent(image, 'load', function () {
_this.width = image.naturalWidth;
_this.height = image.naturalHeight;
_this.aspectRatio = _this.width / _this.height;
_this.dimensions = new $.Point(_this.width, _this.height);
_this._tileWidth = _this.width;
_this._tileHeight = _this.height;
_this.tileOverlap = 0;
_this.minLevel = 0;
_this.levels = _this._buildLevels();
_this.maxLevel = _this.levels.length - 1;
_this.ready = true;
_this.ready = true;
/**
* Raised when a TileSource is opened and initialized.
*
* @event ready
* @memberof OpenSeadragon.TileSource
* @type {object}
* @property {OpenSeadragon.TileSource} eventSource - A reference
* to the TileSource which raised the event.
* @property {Object} tileSource
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
_this.raiseEvent('ready', {tileSource: _this});
// Note: this event is documented elsewhere, in TileSource
_this.raiseEvent('ready', {tileSource: _this});
});
$.addEvent(image, 'error', function () {
_this.image = null;
// Note: this event is documented elsewhere, in TileSource
_this.raiseEvent('open-failed', {
message: "Error loading image at " + url,
source: url
});
});
$.addEvent(image, 'error', function () {
/***
* Raised when an error occurs loading a TileSource.
*
* @event open-failed
* @memberof OpenSeadragon.TileSource
* @type {object}
* @property {OpenSeadragon.TileSource} eventSource - A reference
* to the TileSource which raised the event.
* @property {String} message
* @property {String} source
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
_this.raiseEvent('open-failed', {
message: "Error loading image at " + url,
source: url
});
});
image.src = url;
}
/**
* @function
* @param {Number} level
*/
getLevelScale(level) {
let levelScale = NaN;
if (level >= this.minLevel && level <= this.maxLevel) {
levelScale =
this.levels[level].width /
this.levels[this.maxLevel].width;
}
return levelScale;
}
/**
* @function
* @param {Number} level
*/
getNumTiles(level) {
if (this.getLevelScale(level)) {
return new $.Point(1, 1);
}
return new $.Point(0, 0);
}
/**
* Retrieves a tile url
* @function
* @param {Number} level Level of the tile
* @param {Number} x x coordinate of the tile
* @param {Number} y y coordinate of the tile
*/
getTileUrl(level, x, y) {
if (level === this.maxLevel) {
return this.url; //for original image, preserve url
}
//make up url by positional args
return `${this.url}?l=${level}&x=${x}&y=${y}`;
}
image.src = url;
},
/**
* @function
* @param {Number} level
*/
getLevelScale: function (level) {
var levelScale = NaN;
if (level >= this.minLevel && level <= this.maxLevel) {
levelScale =
this.levels[level].width /
this.levels[this.maxLevel].width;
}
return levelScale;
},
/**
* @function
* @param {Number} level
*/
getNumTiles: function (level) {
var scale = this.getLevelScale(level);
if (scale) {
return new $.Point(1, 1);
} else {
return new $.Point(0, 0);
}
},
/**
* @function
* @param {Number} level
* @param {OpenSeadragon.Point} point
*/
getTileAtPoint: function (level, point) {
return new $.Point(0, 0);
},
/**
* Retrieves a tile url
* @function
* @param {Number} level Level of the tile
* @param {Number} x x coordinate of the tile
* @param {Number} y y coordinate of the tile
*/
getTileUrl: function (level, x, y) {
var url = null;
if (level >= this.minLevel && level <= this.maxLevel) {
url = this.levels[level].url;
}
return url;
},
/**
* Retrieves a tile context 2D
* @function
* @param {Number} level Level of the tile
* @param {Number} x x coordinate of the tile
* @param {Number} y y coordinate of the tile
*/
getContext2D: function (level, x, y) {
var context = null;
if (level >= this.minLevel && level <= this.maxLevel) {
context = this.levels[level].context2D;
}
return context;
},
/**
* @private Build the differents levels of the pyramid if possible
* (canvas API enabled and no canvas tainting issue)
*/
_buildLevels: function () {
var levels = [{
url: this._image.src,
width: this._image.naturalWidth,
height: this._image.naturalHeight
}];
/**
* Equality comparator
*/
equals(otherSource) {
return this.url === otherSource.url;
}
if (!this.buildPyramid || !$.supportsCanvas || !this.useCanvas) {
// We don't need the image anymore. Allows it to be GC.
delete this._image;
return levels;
}
getTilePostData(level, x, y) {
return {level: level, x: x, y: y};
}
var currentWidth = this._image.naturalWidth;
var currentHeight = this._image.naturalHeight;
/**
* Retrieves a tile context 2D
* @deprecated
*/
getContext2D(level, x, y) {
$.console.error('Using [TiledImage.getContext2D] (for plain images only) is deprecated. ' +
'Use overridden downloadTileStart (https://openseadragon.github.io/examples/advanced-data-model/) instead.');
return this._createContext2D();
}
var bigCanvas = document.createElement("canvas");
var bigContext = bigCanvas.getContext("2d");
downloadTileStart(job) {
const tileData = job.postData;
if (tileData.level === this.maxLevel) {
job.finish(this.image, null, "image");
return;
}
bigCanvas.width = currentWidth;
bigCanvas.height = currentHeight;
bigContext.drawImage(this._image, 0, 0, currentWidth, currentHeight);
// We cache the context of the highest level because the browser
// is a lot faster at downsampling something it already has
// downsampled before.
levels[0].context2D = bigContext;
// We don't need the image anymore. Allows it to be GC.
delete this._image;
if (tileData.level >= this.minLevel && tileData.level <= this.maxLevel) {
const levelData = this.levels[tileData.level];
const context = this._createContext2D(this.image, levelData.width, levelData.height);
job.finish(context, null, "context2d");
return;
}
job.fail(`Invalid level ${tileData.level} for plain image source. Did you forget to set buildPyramid=true?`);
}
if ($.isCanvasTainted(bigCanvas)) {
// If the canvas is tainted, we can't compute the pyramid.
return levels;
}
downloadTileAbort(job) {
//no-op
}
// We build smaller levels until either width or height becomes
// 1 pixel wide.
while (currentWidth >= 2 && currentHeight >= 2) {
currentWidth = Math.floor(currentWidth / 2);
currentHeight = Math.floor(currentHeight / 2);
var smallCanvas = document.createElement("canvas");
var smallContext = smallCanvas.getContext("2d");
smallCanvas.width = currentWidth;
smallCanvas.height = currentHeight;
smallContext.drawImage(bigCanvas, 0, 0, currentWidth, currentHeight);
// private
//
// Builds the different levels of the pyramid if possible
// (i.e. if canvas API enabled and no canvas tainting issue).
_buildLevels(image) {
const levels = [{
url: image.src,
width: image.naturalWidth,
height: image.naturalHeight
}];
levels.splice(0, 0, {
context2D: smallContext,
width: currentWidth,
height: currentHeight
});
bigCanvas = smallCanvas;
bigContext = smallContext;
}
if (!this.buildPyramid || !$.supportsCanvas || !this.useCanvas) {
return levels;
}
});
let currentWidth = image.naturalWidth,
currentHeight = image.naturalHeight;
// We build smaller levels until either width or height becomes
// 2 pixel wide.
while (currentWidth >= 2 && currentHeight >= 2) {
currentWidth = Math.floor(currentWidth / 2);
currentHeight = Math.floor(currentHeight / 2);
levels.push({
width: currentWidth,
height: currentHeight,
});
}
return levels.reverse();
}
_createContext2D(data, w, h) {
const canvas = document.createElement("canvas"),
context = canvas.getContext("2d");
canvas.width = w;
canvas.height = h;
context.drawImage(data, 0, 0, w, h);
return context;
}
};
}(OpenSeadragon));

View file

@ -2,7 +2,7 @@
* OpenSeadragon - LegacyTileSource
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -109,10 +109,10 @@ $.extend( $.LegacyTileSource.prototype, $.TileSource.prototype, /** @lends OpenS
supports: function( data, url ){
return (
data.type &&
"legacy-image-pyramid" == data.type
"legacy-image-pyramid" === data.type
) || (
data.documentElement &&
"legacy-image-pyramid" == data.documentElement.getAttribute('type')
"legacy-image-pyramid" === data.documentElement.getAttribute('type')
);
},
@ -121,11 +121,12 @@ $.extend( $.LegacyTileSource.prototype, $.TileSource.prototype, /** @lends OpenS
*
* @function
* @param {Object|XMLDocument} configuration - the raw configuration
* @param {String} dataUrl - the url the data was retreived from if any.
* @return {Object} options - A dictionary of keyword arguments sufficient
* @param {String} dataUrl - the url the data was retrieved from if any.
* @param {String} postData - HTTP POST data in k=v&k2=v2... form or null
* @returns {Object} options - A dictionary of keyword arguments sufficient
* to configure this tile sources constructor.
*/
configure: function( configuration, dataUrl ){
configure: function( configuration, dataUrl, postData ){
var options;
@ -169,16 +170,6 @@ $.extend( $.LegacyTileSource.prototype, $.TileSource.prototype, /** @lends OpenS
}
},
/**
* @function
* @param {Number} level
* @param {OpenSeadragon.Point} point
*/
getTileAtPoint: function( level, point ) {
return new $.Point( 0, 0 );
},
/**
* This method is not implemented by this class other than to throw an Error
* announcing you have to implement it. Because of the variety of tile
@ -196,11 +187,26 @@ $.extend( $.LegacyTileSource.prototype, $.TileSource.prototype, /** @lends OpenS
url = this.levels[ level ].url;
}
return url;
},
/**
* Equality comparator
*/
equals: function (otherSource) {
if (!otherSource.levels || otherSource.levels.length !== this.levels.length) {
return false;
}
for (let i = this.minLevel; i <= this.maxLevel; i++) {
if (this.levels[i].url !== otherSource.levels[i].url) {
return false;
}
}
return true;
}
} );
/**
* This method removes any files from the Array which dont conform to our
* This method removes any files from the Array which don't conform to our
* basic requirements for a 'level' in the LegacyTileSource.
* @private
* @inner
@ -214,12 +220,7 @@ function filterFiles( files ){
file = files[ i ];
if( file.height &&
file.width &&
file.url && (
file.url.toLowerCase().match(/^.*\.(png|jpg|jpeg|gif)$/) || (
file.mimetype &&
file.mimetype.toLowerCase().match(/^.*\/(png|jpg|jpeg|gif)$/)
)
) ){
file.url ){
//This is sufficient to serve as a level
filtered.push({
url: file.url,
@ -232,7 +233,7 @@ function filterFiles( files ){
}
}
return filtered.sort(function(a,b){
return filtered.sort(function(a, b) {
return a.height - b.height;
});
@ -256,7 +257,7 @@ function configureFromXML( tileSource, xmlDoc ){
level,
i;
if ( rootName == "image" ) {
if ( rootName === "image" ) {
try {
conf = {
@ -268,7 +269,7 @@ function configureFromXML( tileSource, xmlDoc ){
for ( i = 0; i < levels.length; i++ ) {
level = levels[ i ];
conf.levels .push({
conf.levels.push({
url: level.getAttribute( "url" ),
width: parseInt( level.getAttribute( "width" ), 10 ),
height: parseInt( level.getAttribute( "height" ), 10 )
@ -282,9 +283,9 @@ function configureFromXML( tileSource, xmlDoc ){
e :
new Error( 'Unknown error parsing Legacy Image Pyramid XML.' );
}
} else if ( rootName == "collection" ) {
} else if ( rootName === "collection" ) {
throw new Error( 'Legacy Image Pyramid Collections not yet supported.' );
} else if ( rootName == "error" ) {
} else if ( rootName === "error" ) {
throw new Error( 'Error: ' + xmlDoc );
}

209
src/matrix3.js Normal file
View file

@ -0,0 +1,209 @@
/*
* OpenSeadragon - Mat3
*
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of CodePlex Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*
* Portions of this source file are taken from WegGL Fundamentals:
*
* Copyright 2012, Gregg Tavares.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Gregg Tavares. nor the names of his
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
(function( $ ){
// Modified from https://webglfundamentals.org/webgl/lessons/webgl-2d-matrices.html
/**
*
*
* @class Mat3
* @classdesc A left-to-right matrix representation, useful for affine transforms for
* positioning tiles for drawing
*
* @memberof OpenSeadragon
*
* @param {Array} [values] - Initial values for the matrix
*
**/
class Mat3{
constructor(values){
if(!values) {
values = [
0, 0, 0,
0, 0, 0,
0, 0, 0
];
}
this.values = values;
}
/**
* @function makeIdentity
* @memberof OpenSeadragon.Mat3
* @static
* @returns {OpenSeadragon.Mat3} an identity matrix
*/
static makeIdentity(){
return new Mat3([
1, 0, 0,
0, 1, 0,
0, 0, 1
]);
}
/**
* @function makeTranslation
* @memberof OpenSeadragon.Mat3
* @static
* @param {Number} tx The x value of the translation
* @param {Number} ty The y value of the translation
* @returns {OpenSeadragon.Mat3} A translation matrix
*/
static makeTranslation(tx, ty) {
return new Mat3([
1, 0, 0,
0, 1, 0,
tx, ty, 1,
]);
}
/**
* @function makeRotation
* @memberof OpenSeadragon.Mat3
* @static
* @param {Number} angleInRadians The desired rotation angle, in radians
* @returns {OpenSeadragon.Mat3} A rotation matrix
*/
static makeRotation(angleInRadians) {
var c = Math.cos(angleInRadians);
var s = Math.sin(angleInRadians);
return new Mat3([
c, -s, 0,
s, c, 0,
0, 0, 1,
]);
}
/**
* @function makeScaling
* @memberof OpenSeadragon.Mat3
* @static
* @param {Number} sx The x value of the scaling
* @param {Number} sy The y value of the scaling
* @returns {OpenSeadragon.Mat3} A scaling matrix
*/
static makeScaling(sx, sy) {
return new Mat3([
sx, 0, 0,
0, sy, 0,
0, 0, 1,
]);
}
/**
* @alias multiply
* @memberof! OpenSeadragon.Mat3
* @param {OpenSeadragon.Mat3} other the matrix to multiply with
* @returns {OpenSeadragon.Mat3} The result of matrix multiplication
*/
multiply(other) {
let a = this.values;
let b = other.values;
var a00 = a[0 * 3 + 0];
var a01 = a[0 * 3 + 1];
var a02 = a[0 * 3 + 2];
var a10 = a[1 * 3 + 0];
var a11 = a[1 * 3 + 1];
var a12 = a[1 * 3 + 2];
var a20 = a[2 * 3 + 0];
var a21 = a[2 * 3 + 1];
var a22 = a[2 * 3 + 2];
var b00 = b[0 * 3 + 0];
var b01 = b[0 * 3 + 1];
var b02 = b[0 * 3 + 2];
var b10 = b[1 * 3 + 0];
var b11 = b[1 * 3 + 1];
var b12 = b[1 * 3 + 2];
var b20 = b[2 * 3 + 0];
var b21 = b[2 * 3 + 1];
var b22 = b[2 * 3 + 2];
return new Mat3([
b00 * a00 + b01 * a10 + b02 * a20,
b00 * a01 + b01 * a11 + b02 * a21,
b00 * a02 + b01 * a12 + b02 * a22,
b10 * a00 + b11 * a10 + b12 * a20,
b10 * a01 + b11 * a11 + b12 * a21,
b10 * a02 + b11 * a12 + b12 * a22,
b20 * a00 + b21 * a10 + b22 * a20,
b20 * a01 + b21 * a11 + b22 * a21,
b20 * a02 + b21 * a12 + b22 * a22,
]);
}
}
$.Mat3 = Mat3;
}( OpenSeadragon ));

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@
* OpenSeadragon - Navigator
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -45,7 +45,9 @@
* @memberof OpenSeadragon
* @extends OpenSeadragon.Viewer
* @extends OpenSeadragon.EventSource
* @param {Object} options
* @param {Object} options - Navigator options
* @param {Element} [options.element] - An element to use for the navigator.
* @param {String} [options.id] - Id of the element to use for the navigator. However, this is ignored if {@link options.element} is provided.
*/
$.Navigator = function( options ){
@ -55,26 +57,49 @@ $.Navigator = function( options ){
navigatorSize;
//We may need to create a new element and id if they did not
//provide the id for the existing element
if( !options.id ){
//provide the id for the existing element or the element itself
if( options.element || options.id ){
if ( options.element ) {
if ( options.id ){
$.console.warn("Given option.id for Navigator was ignored since option.element was provided and is being used instead.");
}
// Don't overwrite the element's id if it has one already
if ( options.element.id ) {
options.id = options.element.id;
} else {
options.id = 'navigator-' + $.now();
}
this.element = options.element;
} else {
this.element = document.getElementById( options.id );
}
options.controlOptions = {
anchor: $.ControlAnchor.NONE,
attachToViewer: false,
autoFade: false
};
} else {
options.id = 'navigator-' + $.now();
this.element = $.makeNeutralElement( "div" );
options.controlOptions = {
anchor: $.ControlAnchor.TOP_RIGHT,
attachToViewer: true,
autoFade: true
autoFade: options.autoFade
};
if( options.position ){
if( 'BOTTOM_RIGHT' == options.position ){
if( 'BOTTOM_RIGHT' === options.position ){
options.controlOptions.anchor = $.ControlAnchor.BOTTOM_RIGHT;
} else if( 'BOTTOM_LEFT' == options.position ){
} else if( 'BOTTOM_LEFT' === options.position ){
options.controlOptions.anchor = $.ControlAnchor.BOTTOM_LEFT;
} else if( 'TOP_RIGHT' == options.position ){
} else if( 'TOP_RIGHT' === options.position ){
options.controlOptions.anchor = $.ControlAnchor.TOP_RIGHT;
} else if( 'TOP_LEFT' == options.position ){
} else if( 'TOP_LEFT' === options.position ){
options.controlOptions.anchor = $.ControlAnchor.TOP_LEFT;
} else if( 'ABSOLUTE' == options.position ){
} else if( 'ABSOLUTE' === options.position ){
options.controlOptions.anchor = $.ControlAnchor.ABSOLUTE;
options.controlOptions.top = options.top;
options.controlOptions.left = options.left;
@ -82,14 +107,6 @@ $.Navigator = function( options ){
options.controlOptions.width = options.width;
}
}
} else {
this.element = document.getElementById( options.id );
options.controlOptions = {
anchor: $.ControlAnchor.NONE,
attachToViewer: false,
autoFade: false
};
}
this.element.id = options.id;
this.element.className += ' navigator';
@ -107,10 +124,15 @@ $.Navigator = function( options ){
showSequenceControl: false,
immediateRender: true,
blendTime: 0,
animationTime: 0,
autoResize: options.autoResize,
animationTime: options.animationTime,
// disable autoResize since resize behavior is implemented differently by the navigator
autoResize: false,
// prevent resizing the navigator from adding unwanted space around the image
minZoomImageRatio: 1.0
minZoomImageRatio: 1.0,
background: options.background,
opacity: options.opacity,
borderColor: options.borderColor,
displayRegionColor: options.displayRegionColor
});
options.minPixelRatio = this.minPixelRatio = viewer.minPixelRatio;
@ -121,16 +143,16 @@ $.Navigator = function( options ){
//At some browser magnification levels the display regions lines up correctly, but at some there appears to
//be a one pixel gap.
this.fudge = new $.Point(1, 1);
this.totalBorderWidths = new $.Point(this.borderWidth*2, this.borderWidth*2).minus(this.fudge);
this.totalBorderWidths = new $.Point(this.borderWidth * 2, this.borderWidth * 2).minus(this.fudge);
if ( options.controlOptions.anchor != $.ControlAnchor.NONE ) {
if ( options.controlOptions.anchor !== $.ControlAnchor.NONE ) {
(function( style, borderWidth ){
style.margin = '0px';
style.border = borderWidth + 'px solid #555';
style.border = borderWidth + 'px solid ' + options.borderColor;
style.padding = '0px';
style.background = '#000';
style.opacity = 0.8;
style.background = options.background;
style.opacity = options.opacity;
style.overflow = 'hidden';
}( this.element.style, this.borderWidth));
}
@ -145,12 +167,9 @@ $.Navigator = function( options ){
style.left = '0px';
style.fontSize = '0px';
style.overflow = 'hidden';
style.border = borderWidth + 'px solid #900';
style.border = borderWidth + 'px solid ' + options.displayRegionColor;
style.margin = '0px';
style.padding = '0px';
//TODO: IE doesnt like this property being set
//try{ style.outline = '2px auto #909'; }catch(e){/*ignore*/}
style.background = 'transparent';
// We use square bracket notation on the statement below, because float is a keyword.
@ -159,35 +178,37 @@ $.Navigator = function( options ){
style['float'] = 'left'; //Webkit
style.cssFloat = 'left'; //Firefox
style.styleFloat = 'left'; //IE
style.zIndex = 999999999;
style.cursor = 'default';
style.boxSizing = 'content-box';
}( this.displayRegion.style, this.borderWidth ));
$.setElementPointerEventsNone( this.displayRegion );
$.setElementTouchActionNone( this.displayRegion );
this.displayRegionContainer = $.makeNeutralElement("div");
this.displayRegionContainer.id = this.element.id + '-displayregioncontainer';
this.displayRegionContainer.className = "displayregioncontainer";
this.displayRegionContainer.style.width = "100%";
this.displayRegionContainer.style.height = "100%";
$.setElementPointerEventsNone( this.displayRegionContainer );
$.setElementTouchActionNone( this.displayRegionContainer );
viewer.addControl(
this.element,
options.controlOptions
);
this._resizeWithViewer = options.controlOptions.anchor != $.ControlAnchor.ABSOLUTE &&
options.controlOptions.anchor != $.ControlAnchor.NONE;
this._resizeWithViewer = options.controlOptions.anchor !== $.ControlAnchor.ABSOLUTE &&
options.controlOptions.anchor !== $.ControlAnchor.NONE;
if ( this._resizeWithViewer ) {
if ( options.width && options.height ) {
this.element.style.height = typeof ( options.height ) == "number" ? ( options.height + 'px' ) : options.height;
this.element.style.width = typeof ( options.width ) == "number" ? ( options.width + 'px' ) : options.width;
} else {
viewerSize = $.getElementSize( viewer.element );
this.element.style.height = Math.round( viewerSize.y * options.sizeRatio ) + 'px';
this.element.style.width = Math.round( viewerSize.x * options.sizeRatio ) + 'px';
this.oldViewerSize = viewerSize;
}
if (options.width && options.height) {
this.setWidth(options.width);
this.setHeight(options.height);
} else if ( this._resizeWithViewer ) {
viewerSize = $.getElementSize( viewer.element );
this.element.style.height = Math.round( viewerSize.y * options.sizeRatio ) + 'px';
this.element.style.width = Math.round( viewerSize.x * options.sizeRatio ) + 'px';
this.oldViewerSize = viewerSize;
navigatorSize = $.getElementSize( this.element );
this.elementArea = navigatorSize.x * navigatorSize.y;
}
@ -199,29 +220,49 @@ $.Navigator = function( options ){
this.displayRegionContainer.appendChild(this.displayRegion);
this.element.getElementsByTagName('div')[0].appendChild(this.displayRegionContainer);
function rotate(degrees, immediately) {
_setTransformRotate(_this.displayRegionContainer, degrees);
_setTransformRotate(_this.displayRegion, -degrees);
_this.viewport.setRotation(degrees, immediately);
}
if (options.navigatorRotate) {
var degrees = options.viewer.viewport ?
options.viewer.viewport.getRotation() :
options.viewer.degrees || 0;
rotate(degrees, true);
options.viewer.addHandler("rotate", function (args) {
_setTransformRotate(_this.displayRegionContainer, args.degrees);
_setTransformRotate(_this.displayRegion, -args.degrees);
_this.viewport.setRotation(args.degrees);
rotate(args.degrees, args.immediately);
});
}
// Remove the base class' (Viewer's) innerTracker and replace it with our own
this.innerTracker.destroy();
this.innerTracker = new $.MouseTracker({
element: this.element,
userData: 'Navigator.innerTracker',
element: this.element, //this.canvas,
dragHandler: $.delegate( this, onCanvasDrag ),
clickHandler: $.delegate( this, onCanvasClick ),
releaseHandler: $.delegate( this, onCanvasRelease ),
scrollHandler: $.delegate( this, onCanvasScroll )
});
this.addHandler("reset-size", function() {
if (_this.viewport) {
_this.viewport.goHome(true);
scrollHandler: $.delegate( this, onCanvasScroll ),
preProcessEventHandler: function (eventInfo) {
if (eventInfo.eventType === 'wheel') {
//don't scroll the page up and down if the user is scrolling
//in the navigator
eventInfo.preventDefault = true;
}
}
});
this.outerTracker.userData = 'Navigator.outerTracker';
// this.innerTracker is attached to this.element...we need to allow pointer
// events to pass through this Viewer's canvas/container elements so implicit
// pointer capture works on touch devices
//TODO an alternative is to attach the new MouseTracker to this.canvas...not
// sure why it isn't already (see MouseTracker constructor call above)
$.setElementPointerEventsNone( this.canvas );
$.setElementPointerEventsNone( this.container );
this.addHandler("reset-size", function() {
if (_this.viewport) {
@ -230,8 +271,10 @@ $.Navigator = function( options ){
});
viewer.world.addHandler("item-index-change", function(event) {
var item = _this.world.getItemAt(event.previousIndex);
_this.world.setItemIndex(item, event.newIndex);
window.setTimeout(function(){
var item = _this.world.getItemAt(event.previousIndex);
_this.world.setItemIndex(item, event.newIndex);
}, 1);
});
viewer.world.addHandler("remove-item", function(event) {
@ -263,16 +306,55 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
this.viewport.resize( containerSize, true );
this.viewport.goHome(true);
this.oldContainerSize = containerSize;
this.drawer.clear();
this.world.update();
this.world.draw();
this.update(this.viewer.viewport);
}
}
},
/**
* Explicitly sets the width of the navigator, in web coordinates. Disables automatic resizing.
* @param {Number|String} width - the new width, either a number of pixels or a CSS string, such as "100%"
*/
setWidth: function(width) {
this.width = width;
this.element.style.width = typeof (width) === "number" ? (width + 'px') : width;
this._resizeWithViewer = false;
this.updateSize();
},
/**
* Explicitly sets the height of the navigator, in web coordinates. Disables automatic resizing.
* @param {Number|String} height - the new height, either a number of pixels or a CSS string, such as "100%"
*/
setHeight: function(height) {
this.height = height;
this.element.style.height = typeof (height) === "number" ? (height + 'px') : height;
this._resizeWithViewer = false;
this.updateSize();
},
/**
* Flip navigator element
* @param {Boolean} state - Flip state to set.
*/
setFlip: function(state) {
this.viewport.setFlip(state);
this.setDisplayTransform(this.viewer.viewport.getFlip() ? "scale(-1,1)" : "scale(1,1)");
return this;
},
setDisplayTransform: function(rule) {
setElementTransform(this.canvas, rule);
setElementTransform(this.element, rule);
},
/**
* Used to update the navigator minimap's viewport rectangle when a change in the viewer's viewport occurs.
* @function
* @param {OpenSeadragon.Viewport} The viewport this navigator is tracking.
* @param {OpenSeadragon.Viewport} [viewport] The viewport to display. Default: the viewport this navigator is tracking.
*/
update: function( viewport ) {
@ -283,6 +365,10 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
topleft,
bottomright;
if(!viewport){
viewport = this.viewer.viewport;
}
viewerSize = $.getElementSize( this.viewer.element );
if ( this._resizeWithViewer && viewerSize.x && viewerSize.y && !viewerSize.equals( this.oldViewerSize ) ) {
this.oldViewerSize = viewerSize;
@ -305,21 +391,26 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
this.updateSize();
}
if( viewport && this.viewport ) {
bounds = viewport.getBounds( true );
topleft = this.viewport.pixelFromPoint( bounds.getTopLeft(), false );
bottomright = this.viewport.pixelFromPoint( bounds.getBottomRight(), false )
if (viewport && this.viewport) {
bounds = viewport.getBoundsNoRotate(true);
topleft = this.viewport.pixelFromPointNoRotate(bounds.getTopLeft(), false);
bottomright = this.viewport.pixelFromPointNoRotate(bounds.getBottomRight(), false)
.minus( this.totalBorderWidths );
if (!this.navigatorRotate) {
var degrees = viewport.getRotation(true);
_setTransformRotate(this.displayRegion, -degrees);
}
//update style for navigator-box
var style = this.displayRegion.style;
style.display = this.world.getItemCount() ? 'block' : 'none';
style.top = Math.round( topleft.y ) + 'px';
style.left = Math.round( topleft.x ) + 'px';
style.top = topleft.y.toFixed(2) + "px";
style.left = topleft.x.toFixed(2) + "px";
var width = Math.abs( topleft.x - bottomright.x );
var height = Math.abs( topleft.y - bottomright.y );
var width = bottomright.x - topleft.x;
var height = bottomright.y - topleft.y;
// make sure width and height are non-negative so IE doesn't throw
style.width = Math.round( Math.max( width, 0 ) ) + 'px';
style.height = Math.round( Math.max( height, 0 ) ) + 'px';
@ -339,16 +430,35 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
var myItem = event.item;
myItem._originalForNavigator = original;
_this._matchBounds(myItem, original, true);
_this._matchOpacity(myItem, original);
_this._matchCompositeOperation(myItem, original);
original.addHandler('bounds-change', function() {
function matchBounds() {
_this._matchBounds(myItem, original);
});
}
function matchOpacity() {
_this._matchOpacity(myItem, original);
}
function matchCompositeOperation() {
_this._matchCompositeOperation(myItem, original);
}
original.addHandler('bounds-change', matchBounds);
original.addHandler('clip-change', matchBounds);
original.addHandler('opacity-change', matchOpacity);
original.addHandler('composite-operation-change', matchCompositeOperation);
}
});
return $.Viewer.prototype.addTiledImage.apply(this, [optionsClone]);
},
destroy: function() {
return $.Viewer.prototype.destroy.apply(this);
},
// private
_getMatchingItem: function(theirItem) {
var count = this.world.getItemCount();
@ -365,22 +475,74 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
// private
_matchBounds: function(myItem, theirItem, immediately) {
var bounds = theirItem.getBounds();
var bounds = theirItem.getBoundsNoRotate();
myItem.setPosition(bounds.getTopLeft(), immediately);
myItem.setWidth(bounds.width, immediately);
myItem.setRotation(theirItem.getRotation(), immediately);
myItem.setClip(theirItem.getClip());
myItem.setFlip(theirItem.getFlip());
},
// private
_matchOpacity: function(myItem, theirItem) {
myItem.setOpacity(theirItem.opacity);
},
// private
_matchCompositeOperation: function(myItem, theirItem) {
myItem.setCompositeOperation(theirItem.compositeOperation);
}
});
/**
* @private
* @inner
* @function
*/
function onCanvasClick( event ) {
if ( event.quick && this.viewer.viewport ) {
this.viewer.viewport.panTo( this.viewport.pointFromPixel( event.position ).rotate( -this.viewer.viewport.degrees, this.viewer.viewport.getHomeBounds().getCenter() ) );
this.viewer.viewport.applyConstraints();
var canvasClickEventArgs = {
tracker: event.eventSource,
position: event.position,
quick: event.quick,
shift: event.shift,
originalEvent: event.originalEvent,
preventDefaultAction: false
};
/**
* Raised when a click event occurs on the {@link OpenSeadragon.Viewer#navigator} element.
*
* @event navigator-click
* @memberof OpenSeadragon.Viewer
* @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event.
* @property {OpenSeadragon.MouseTracker} tracker - A reference to the MouseTracker which originated this event.
* @property {OpenSeadragon.Point} position - The position of the event relative to the tracked element.
* @property {Boolean} quick - True only if the clickDistThreshold and clickTimeThreshold are both passed. Useful for differentiating between clicks and drags.
* @property {Boolean} shift - True if the shift key was pressed during this event.
* @property {Object} originalEvent - The original DOM event.
* @property {?Object} userData - Arbitrary subscriber-defined object.
* @property {Boolean} preventDefaultAction - Set to true to prevent default click to zoom behaviour. Default: false.
*/
this.viewer.raiseEvent('navigator-click', canvasClickEventArgs);
if ( !canvasClickEventArgs.preventDefaultAction && event.quick && this.viewer.viewport && (this.panVertical || this.panHorizontal)) {
if(this.viewer.viewport.flipped) {
event.position.x = this.viewport.getContainerSize().x - event.position.x;
}
var target = this.viewport.pointFromPixel(event.position);
if (!this.panVertical) {
// perform only horizonal pan
target.y = this.viewer.viewport.getCenter(true).y;
} else if (!this.panHorizontal) {
// perform only vertical pan
target.x = this.viewer.viewport.getCenter(true).x;
}
this.viewer.viewport.panTo(target);
this.viewer.viewport.applyConstraints();
}
}
/**
@ -389,18 +551,55 @@ function onCanvasClick( event ) {
* @function
*/
function onCanvasDrag( event ) {
if ( this.viewer.viewport ) {
if( !this.panHorizontal ){
var canvasDragEventArgs = {
tracker: event.eventSource,
position: event.position,
delta: event.delta,
speed: event.speed,
direction: event.direction,
shift: event.shift,
originalEvent: event.originalEvent,
preventDefaultAction: false
};
/**
* Raised when a drag event occurs on the {@link OpenSeadragon.Viewer#navigator} element.
*
* @event navigator-drag
* @memberof OpenSeadragon.Viewer
* @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event.
* @property {OpenSeadragon.MouseTracker} tracker - A reference to the MouseTracker which originated this event.
* @property {OpenSeadragon.Point} position - The position of the event relative to the tracked element.
* @property {OpenSeadragon.Point} delta - The x,y components of the difference between start drag and end drag.
* @property {Number} speed - Current computed speed, in pixels per second.
* @property {Number} direction - Current computed direction, expressed as an angle counterclockwise relative to the positive X axis (-pi to pi, in radians). Only valid if speed > 0.
* @property {Boolean} shift - True if the shift key was pressed during this event.
* @property {Object} originalEvent - The original DOM event.
* @property {?Object} userData - Arbitrary subscriber-defined object.
* @property {Boolean} preventDefaultAction - Set to true to prevent default drag to pan behaviour. Default: false.
*/
this.viewer.raiseEvent('navigator-drag', canvasDragEventArgs);
if ( !canvasDragEventArgs.preventDefaultAction && this.viewer.viewport ) {
if( !this.panHorizontal ){
event.delta.x = 0;
}
if( !this.panVertical ){
event.delta.y = 0;
}
if(this.viewer.viewport.flipped){
event.delta.x = -event.delta.x;
}
this.viewer.viewport.panBy(
this.viewport.deltaPointsFromPixels(
event.delta
)
);
if( this.viewer.constrainDuringPan ){
this.viewer.viewport.applyConstraints();
}
}
}
@ -423,6 +622,15 @@ function onCanvasRelease( event ) {
* @function
*/
function onCanvasScroll( event ) {
var eventArgs = {
tracker: event.eventSource,
position: event.position,
scroll: event.scroll,
shift: event.shift,
originalEvent: event.originalEvent,
preventDefault: event.preventDefault
};
/**
* Raised when a scroll event occurs on the {@link OpenSeadragon.Viewer#navigator} element (mouse wheel, touch pinch, etc.).
*
@ -435,19 +643,12 @@ function onCanvasScroll( event ) {
* @property {Number} scroll - The scroll delta for the event.
* @property {Boolean} shift - True if the shift key was pressed during this event.
* @property {Object} originalEvent - The original DOM event.
* @property {Boolean} preventDefault - Set to true to prevent the default user-agent's handling of the wheel event.
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
this.viewer.raiseEvent( 'navigator-scroll', {
tracker: event.eventSource,
position: event.position,
scroll: event.scroll,
shift: event.shift,
originalEvent: event.originalEvent
});
this.viewer.raiseEvent( 'navigator-scroll', eventArgs );
//dont scroll the page up and down if the user is scrolling
//in the navigator
return false;
event.preventDefault = eventArgs.preventDefault;
}
/**
@ -456,12 +657,16 @@ function onCanvasScroll( event ) {
* @param {Object} element
* @param {Number} degrees
*/
function _setTransformRotate (element, degrees) {
element.style.webkitTransform = "rotate(" + degrees + "deg)";
element.style.mozTransform = "rotate(" + degrees + "deg)";
element.style.msTransform = "rotate(" + degrees + "deg)";
element.style.oTransform = "rotate(" + degrees + "deg)";
element.style.transform = "rotate(" + degrees + "deg)";
function _setTransformRotate( element, degrees ) {
setElementTransform(element, "rotate(" + degrees + "deg)");
}
function setElementTransform( element, rule ) {
element.style.webkitTransform = rule;
element.style.mozTransform = rule;
element.style.msTransform = rule;
element.style.oTransform = rule;
element.style.transform = rule;
}
}( OpenSeadragon ));

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@
* OpenSeadragon - OsmTileSource
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -113,7 +113,7 @@ $.extend( $.OsmTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
supports: function( data, url ){
return (
data.type &&
"openstreetmaps" == data.type
"openstreetmaps" === data.type
);
},
@ -121,11 +121,12 @@ $.extend( $.OsmTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
*
* @function
* @param {Object} data - the raw configuration
* @param {String} url - the url the data was retreived from if any.
* @return {Object} options - A dictionary of keyword arguments sufficient
* @param {String} url - the url the data was retrieved from if any.
* @param {String} postData - HTTP POST data in k=v&k2=v2... form or null
* @returns {Object} options - A dictionary of keyword arguments sufficient
* to configure this tile sources constructor.
*/
configure: function( data, url ){
configure: function( data, url, postData ){
return data;
},
@ -138,6 +139,13 @@ $.extend( $.OsmTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
*/
getTileUrl: function( level, x, y ) {
return this.tilesUrl + (level - 8) + "/" + x + "/" + y + ".png";
},
/**
* Equality comparator
*/
equals: function(otherSource) {
return this.tilesUrl === otherSource.tilesUrl;
}
});

View file

@ -2,7 +2,7 @@
* OpenSeadragon - Overlay
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -32,14 +32,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function( $ ){
(function($) {
/**
* An enumeration of positions that an overlay may be assigned relative to
* the viewport.
* It is identical to OpenSeadragon.Placement but is kept for backward
* compatibility.
* @member OverlayPlacement
* @memberof OpenSeadragon
* @see OpenSeadragon.Placement
* @static
* @readonly
* @type {Object}
* @property {Number} CENTER
* @property {Number} TOP_LEFT
@ -51,17 +55,26 @@
* @property {Number} BOTTOM_LEFT
* @property {Number} LEFT
*/
$.OverlayPlacement = {
CENTER: 0,
TOP_LEFT: 1,
TOP: 2,
TOP_RIGHT: 3,
RIGHT: 4,
BOTTOM_RIGHT: 5,
BOTTOM: 6,
BOTTOM_LEFT: 7,
LEFT: 8
};
$.OverlayPlacement = $.Placement;
/**
* An enumeration of possible ways to handle overlays rotation
* @member OverlayRotationMode
* @memberOf OpenSeadragon
* @static
* @readonly
* @property {Number} NO_ROTATION The overlay ignore the viewport rotation.
* @property {Number} EXACT The overlay use CSS 3 transforms to rotate with
* the viewport. If the overlay contains text, it will get rotated as well.
* @property {Number} BOUNDING_BOX The overlay adjusts for rotation by
* taking the size of the bounding box of the rotated bounds.
* Only valid for overlays with Rect location and scalable in both directions.
*/
$.OverlayRotationMode = $.freezeObject({
NO_ROTATION: 1,
EXACT: 2,
BOUNDING_BOX: 3
});
/**
* @class Overlay
@ -72,19 +85,27 @@
* @param {Element} options.element
* @param {OpenSeadragon.Point|OpenSeadragon.Rect} options.location - The
* location of the overlay on the image. If a {@link OpenSeadragon.Point}
* is specified, the overlay will keep a constant size independently of the
* zoom. If a {@link OpenSeadragon.Rect} is specified, the overlay size will
* be adjusted when the zoom changes.
* @param {OpenSeadragon.OverlayPlacement} [options.placement=OpenSeadragon.OverlayPlacement.TOP_LEFT]
* Relative position to the viewport.
* Only used if location is a {@link OpenSeadragon.Point}.
* is specified, the overlay will be located at this location with respect
* to the placement option. If a {@link OpenSeadragon.Rect} is specified,
* the overlay will be placed at this location with the corresponding width
* and height and placement TOP_LEFT.
* @param {OpenSeadragon.Placement} [options.placement=OpenSeadragon.Placement.TOP_LEFT]
* Defines what part of the overlay should be at the specified options.location
* @param {OpenSeadragon.Overlay.OnDrawCallback} [options.onDraw]
* @param {Boolean} [options.checkResize=true] Set to false to avoid to
* check the size of the overlay everytime it is drawn when using a
* {@link OpenSeadragon.Point} as options.location. It will improve
* performances but will cause a misalignment if the overlay size changes.
* check the size of the overlay every time it is drawn in the directions
* which are not scaled. It will improve performances but will cause a
* misalignment if the overlay size changes.
* @param {Number} [options.width] The width of the overlay in viewport
* coordinates. If specified, the width of the overlay will be adjusted when
* the zoom changes.
* @param {Number} [options.height] The height of the overlay in viewport
* coordinates. If specified, the height of the overlay will be adjusted when
* the zoom changes.
* @param {Boolean} [options.rotationMode=OpenSeadragon.OverlayRotationMode.EXACT]
* How to handle the rotation of the viewport.
*/
$.Overlay = function( element, location, placement ) {
$.Overlay = function(element, location, placement) {
/**
* onDraw callback signature used by {@link OpenSeadragon.Overlay}.
@ -97,7 +118,7 @@
*/
var options;
if ( $.isPlainObject( element ) ) {
if ($.isPlainObject(element)) {
options = element;
} else {
options = {
@ -107,72 +128,77 @@
};
}
this.element = options.element;
this.scales = options.location instanceof $.Rect;
this.bounds = new $.Rect(
options.location.x,
options.location.y,
options.location.width,
options.location.height
);
this.position = new $.Point(
options.location.x,
options.location.y
);
this.size = new $.Point(
options.location.width,
options.location.height
);
this.style = options.element.style;
// rects are always top-left
this.placement = options.location instanceof $.Point ?
options.placement :
$.OverlayPlacement.TOP_LEFT;
this.onDraw = options.onDraw;
this.checkResize = options.checkResize === undefined ?
true : options.checkResize;
this.elementWrapper = document.createElement('div');
this.element = options.element;
this.elementWrapper.appendChild(this.element);
if (this.element.id) {
this.elementWrapper.id = "overlay-wrapper-" + this.element.id; // Unique ID if element has one
}
// Always add a class for styling & selection
this.elementWrapper.classList.add("openseadragon-overlay-wrapper");
this.style = this.elementWrapper.style;
this._init(options);
};
$.Overlay.prototype = /** @lends OpenSeadragon.Overlay.prototype */{
/** @lends OpenSeadragon.Overlay.prototype */
$.Overlay.prototype = {
// private
_init: function(options) {
this.location = options.location;
this.placement = options.placement === undefined ?
$.Placement.TOP_LEFT : options.placement;
this.onDraw = options.onDraw;
this.checkResize = options.checkResize === undefined ?
true : options.checkResize;
// When this.width is not null, the overlay get scaled horizontally
this.width = options.width === undefined ? null : options.width;
// When this.height is not null, the overlay get scaled vertically
this.height = options.height === undefined ? null : options.height;
this.rotationMode = options.rotationMode || $.OverlayRotationMode.EXACT;
// Having a rect as location is a syntactic sugar
if (this.location instanceof $.Rect) {
this.width = this.location.width;
this.height = this.location.height;
this.location = this.location.getTopLeft();
this.placement = $.Placement.TOP_LEFT;
}
// Deprecated properties kept for backward compatibility.
this.scales = this.width !== null && this.height !== null;
this.bounds = new $.Rect(
this.location.x, this.location.y, this.width, this.height);
this.position = this.location;
},
/**
* Internal function to adjust the position of an overlay
* depending on it size and placement.
* @function
* @param {OpenSeadragon.OverlayPlacement} position
* @param {OpenSeadragon.Point} position
* @param {OpenSeadragon.Point} size
*/
adjust: function( position, size ) {
switch ( this.placement ) {
case $.OverlayPlacement.TOP_LEFT:
break;
case $.OverlayPlacement.TOP:
position.x -= size.x / 2;
break;
case $.OverlayPlacement.TOP_RIGHT:
position.x -= size.x;
break;
case $.OverlayPlacement.RIGHT:
position.x -= size.x;
position.y -= size.y / 2;
break;
case $.OverlayPlacement.BOTTOM_RIGHT:
position.x -= size.x;
position.y -= size.y;
break;
case $.OverlayPlacement.BOTTOM:
position.x -= size.x / 2;
position.y -= size.y;
break;
case $.OverlayPlacement.BOTTOM_LEFT:
position.y -= size.y;
break;
case $.OverlayPlacement.LEFT:
position.y -= size.y / 2;
break;
default:
case $.OverlayPlacement.CENTER:
position.x -= size.x / 2;
position.y -= size.y / 2;
break;
adjust: function(position, size) {
var properties = $.Placement.properties[this.placement];
if (!properties) {
return;
}
if (properties.isHorizontallyCentered) {
position.x -= size.x / 2;
} else if (properties.isRight) {
position.x -= size.x;
}
if (properties.isVerticallyCentered) {
position.y -= size.y / 2;
} else if (properties.isBottom) {
position.y -= size.y;
}
},
@ -180,20 +206,20 @@
* @function
*/
destroy: function() {
var element = this.element,
style = this.style;
var element = this.elementWrapper;
var style = this.style;
if ( element.parentNode ) {
element.parentNode.removeChild( element );
if (element.parentNode) {
element.parentNode.removeChild(element);
//this should allow us to preserve overlays when required between
//pages
if ( element.prevElementParent ) {
if (element.prevElementParent) {
style.display = 'none';
//element.prevElementParent.insertBefore(
// element,
// element.prevNextSibling
//);
document.body.appendChild( element );
document.body.appendChild(element);
}
}
@ -204,115 +230,273 @@
style.left = "";
style.position = "";
if ( this.scales ) {
if (this.width !== null) {
style.width = "";
}
if (this.height !== null) {
style.height = "";
}
var transformOriginProp = $.getCssPropertyWithVendorPrefix(
'transformOrigin');
var transformProp = $.getCssPropertyWithVendorPrefix(
'transform');
if (transformOriginProp && transformProp) {
style[transformOriginProp] = "";
style[transformProp] = "";
}
},
/**
* @function
* @param {Element} container
*/
drawHTML: function( container, viewport ) {
var element = this.element,
style = this.style,
scales = this.scales,
degrees = viewport.degrees,
position = viewport.pixelFromPoint(
this.bounds.getTopLeft(),
true
),
size,
overlayCenter;
if ( element.parentNode != container ) {
drawHTML: function(container, viewport) {
var element = this.elementWrapper;
if (element.parentNode !== container) {
//save the source parent for later if we need it
element.prevElementParent = element.parentNode;
element.prevNextSibling = element.nextSibling;
container.appendChild( element );
this.size = $.getElementSize( element );
element.prevElementParent = element.parentNode;
element.prevNextSibling = element.nextSibling;
container.appendChild(element);
// have to set position before calculating size, fix #1116
this.style.position = "absolute";
// this.size is used by overlays which don't get scaled in at
// least one direction when this.checkResize is set to false.
this.size = $.getElementSize(this.elementWrapper);
}
if ( scales ) {
size = viewport.deltaPixelsFromPoints(
this.bounds.getSize(),
true
);
} else if ( this.checkResize ) {
size = $.getElementSize( element );
} else {
size = this.size;
var positionAndSize = this._getOverlayPositionAndSize(viewport);
var position = positionAndSize.position;
var size = this.size = positionAndSize.size;
var outerScale = "";
if (viewport.overlayPreserveContentDirection) {
outerScale = viewport.flipped ? " scaleX(-1)" : " scaleX(1)";
}
this.position = position;
this.size = size;
this.adjust( position, size );
position = position.apply( Math.round );
size = size.apply( Math.round );
// rotate the position of the overlay
// TODO only rotate overlays if in canvas mode
// TODO replace the size rotation with CSS3 transforms
// TODO add an option to overlays to not rotate with the image
// Currently only rotates position and size
if( degrees !== 0 && this.scales ) {
overlayCenter = new $.Point( size.x / 2, size.y / 2 );
var drawerCenter = new $.Point(
viewport.viewer.drawer.canvas.width / 2,
viewport.viewer.drawer.canvas.height / 2
);
position = position.plus( overlayCenter ).rotate(
degrees,
drawerCenter
).minus( overlayCenter );
size = size.rotate( degrees, new $.Point( 0, 0 ) );
size = new $.Point( Math.abs( size.x ), Math.abs( size.y ) );
}
var rotate = viewport.flipped ? -positionAndSize.rotate : positionAndSize.rotate;
var scale = viewport.flipped ? " scaleX(-1)" : "";
// call the onDraw callback if it exists to allow one to overwrite
// the drawing/positioning/sizing of the overlay
if ( this.onDraw ) {
this.onDraw( position, size, element );
if (this.onDraw) {
this.onDraw(position, size, this.element);
} else {
style.left = position.x + "px";
style.top = position.y + "px";
style.position = "absolute";
if (style.display != 'none') {
style.display = 'block';
var style = this.style;
var innerStyle = this.element.style;
innerStyle.display = "block";
style.left = position.x + "px";
style.top = position.y + "px";
if (this.width !== null) {
innerStyle.width = size.x + "px";
}
if ( scales ) {
style.width = size.x + "px";
style.height = size.y + "px";
if (this.height !== null) {
innerStyle.height = size.y + "px";
}
var transformOriginProp = $.getCssPropertyWithVendorPrefix(
'transformOrigin');
var transformProp = $.getCssPropertyWithVendorPrefix(
'transform');
if (transformOriginProp && transformProp) {
if (rotate && !viewport.flipped) {
innerStyle[transformProp] = "";
style[transformOriginProp] = this._getTransformOrigin();
style[transformProp] = "rotate(" + rotate + "deg)";
} else if (!rotate && viewport.flipped) {
innerStyle[transformProp] = outerScale;
style[transformOriginProp] = this._getTransformOrigin();
style[transformProp] = scale;
} else if (rotate && viewport.flipped){
innerStyle[transformProp] = outerScale;
style[transformOriginProp] = this._getTransformOrigin();
style[transformProp] = "rotate(" + rotate + "deg)" + scale;
} else {
innerStyle[transformProp] = "";
style[transformOriginProp] = "";
style[transformProp] = "";
}
}
style.display = 'flex';
}
},
/**
* @function
* @param {OpenSeadragon.Point|OpenSeadragon.Rect} location
* @param {OpenSeadragon.OverlayPlacement} position
*/
update: function( location, placement ) {
this.scales = location instanceof $.Rect;
this.bounds = new $.Rect(
location.x,
location.y,
location.width,
location.height
);
// rects are always top-left
this.placement = location instanceof $.Point ?
placement :
$.OverlayPlacement.TOP_LEFT;
}
// private
_getOverlayPositionAndSize: function(viewport) {
var position = viewport.pixelFromPoint(this.location, true);
var size = this._getSizeInPixels(viewport);
this.adjust(position, size);
var rotate = 0;
if (viewport.getRotation(true) &&
this.rotationMode !== $.OverlayRotationMode.NO_ROTATION) {
// BOUNDING_BOX is only valid if both directions get scaled.
// Get replaced by EXACT otherwise.
if (this.rotationMode === $.OverlayRotationMode.BOUNDING_BOX &&
this.width !== null && this.height !== null) {
var rect = new $.Rect(position.x, position.y, size.x, size.y);
var boundingBox = this._getBoundingBox(rect, viewport.getRotation(true));
position = boundingBox.getTopLeft();
size = boundingBox.getSize();
} else {
rotate = viewport.getRotation(true);
}
}
if (viewport.flipped) {
position.x = (viewport.getContainerSize().x - position.x);
}
return {
position: position,
size: size,
rotate: rotate
};
},
// private
_getSizeInPixels: function(viewport) {
var width = this.size.x;
var height = this.size.y;
if (this.width !== null || this.height !== null) {
var scaledSize = viewport.deltaPixelsFromPointsNoRotate(
new $.Point(this.width || 0, this.height || 0), true);
if (this.width !== null) {
width = scaledSize.x;
}
if (this.height !== null) {
height = scaledSize.y;
}
}
if (this.checkResize &&
(this.width === null || this.height === null)) {
var eltSize = this.size = $.getElementSize(this.elementWrapper);
if (this.width === null) {
width = eltSize.x;
}
if (this.height === null) {
height = eltSize.y;
}
}
return new $.Point(width, height);
},
// private
_getBoundingBox: function(rect, degrees) {
var refPoint = this._getPlacementPoint(rect);
return rect.rotate(degrees, refPoint).getBoundingBox();
},
// private
_getPlacementPoint: function(rect) {
var result = new $.Point(rect.x, rect.y);
var properties = $.Placement.properties[this.placement];
if (properties) {
if (properties.isHorizontallyCentered) {
result.x += rect.width / 2;
} else if (properties.isRight) {
result.x += rect.width;
}
if (properties.isVerticallyCentered) {
result.y += rect.height / 2;
} else if (properties.isBottom) {
result.y += rect.height;
}
}
return result;
},
// private
_getTransformOrigin: function() {
var result = "";
var properties = $.Placement.properties[this.placement];
if (!properties) {
return result;
}
if (properties.isLeft) {
result = "left";
} else if (properties.isRight) {
result = "right";
}
if (properties.isTop) {
result += " top";
} else if (properties.isBottom) {
result += " bottom";
}
return result;
},
/**
* Changes the overlay settings.
* @function
* @param {OpenSeadragon.Point|OpenSeadragon.Rect|Object} location
* If an object is specified, the options are the same than the constructor
* except for the element which can not be changed.
* @param {OpenSeadragon.Placement} placement
*/
update: function(location, placement) {
var options = $.isPlainObject(location) ? location : {
location: location,
placement: placement
};
this._init({
location: options.location || this.location,
placement: options.placement !== undefined ?
options.placement : this.placement,
onDraw: options.onDraw || this.onDraw,
checkResize: options.checkResize || this.checkResize,
width: options.width !== undefined ? options.width : this.width,
height: options.height !== undefined ? options.height : this.height,
rotationMode: options.rotationMode || this.rotationMode
});
},
/**
* Returns the current bounds of the overlay in viewport coordinates
* @function
* @param {OpenSeadragon.Viewport} viewport the viewport
* @returns {OpenSeadragon.Rect} overlay bounds
*/
getBounds: function(viewport) {
$.console.assert(viewport,
'A viewport must now be passed to Overlay.getBounds.');
var width = this.width;
var height = this.height;
if (width === null || height === null) {
var size = viewport.deltaPointsFromPixelsNoRotate(this.size, true);
if (width === null) {
width = size.x;
}
if (height === null) {
height = size.y;
}
}
var location = this.location.clone();
this.adjust(location, new $.Point(width, height));
return this._adjustBoundsForRotation(
viewport, new $.Rect(location.x, location.y, width, height));
},
// private
_adjustBoundsForRotation: function(viewport, bounds) {
if (!viewport ||
viewport.getRotation(true) === 0 ||
this.rotationMode === $.OverlayRotationMode.EXACT) {
return bounds;
}
if (this.rotationMode === $.OverlayRotationMode.BOUNDING_BOX) {
// If overlay not fully scalable, BOUNDING_BOX falls back to EXACT
if (this.width === null || this.height === null) {
return bounds;
}
// It is easier to just compute the position and size and
// convert to viewport coordinates.
var positionAndSize = this._getOverlayPositionAndSize(viewport);
return viewport.viewerElementToViewportRectangle(new $.Rect(
positionAndSize.position.x,
positionAndSize.position.y,
positionAndSize.size.x,
positionAndSize.size.y));
}
// NO_ROTATION case
return bounds.rotate(-viewport.getRotation(true),
this._getPlacementPoint(bounds));
}
};
}( OpenSeadragon ));
}(OpenSeadragon));

138
src/placement.js Normal file
View file

@ -0,0 +1,138 @@
/*
* OpenSeadragon - Placement
*
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of CodePlex Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function($) {
/**
* An enumeration of positions to anchor an element.
* @member Placement
* @memberOf OpenSeadragon
* @static
* @readonly
* @property {OpenSeadragon.Placement} CENTER
* @property {OpenSeadragon.Placement} TOP_LEFT
* @property {OpenSeadragon.Placement} TOP
* @property {OpenSeadragon.Placement} TOP_RIGHT
* @property {OpenSeadragon.Placement} RIGHT
* @property {OpenSeadragon.Placement} BOTTOM_RIGHT
* @property {OpenSeadragon.Placement} BOTTOM
* @property {OpenSeadragon.Placement} BOTTOM_LEFT
* @property {OpenSeadragon.Placement} LEFT
*/
$.Placement = $.freezeObject({
CENTER: 0,
TOP_LEFT: 1,
TOP: 2,
TOP_RIGHT: 3,
RIGHT: 4,
BOTTOM_RIGHT: 5,
BOTTOM: 6,
BOTTOM_LEFT: 7,
LEFT: 8,
properties: {
0: {
isLeft: false,
isHorizontallyCentered: true,
isRight: false,
isTop: false,
isVerticallyCentered: true,
isBottom: false
},
1: {
isLeft: true,
isHorizontallyCentered: false,
isRight: false,
isTop: true,
isVerticallyCentered: false,
isBottom: false
},
2: {
isLeft: false,
isHorizontallyCentered: true,
isRight: false,
isTop: true,
isVerticallyCentered: false,
isBottom: false
},
3: {
isLeft: false,
isHorizontallyCentered: false,
isRight: true,
isTop: true,
isVerticallyCentered: false,
isBottom: false
},
4: {
isLeft: false,
isHorizontallyCentered: false,
isRight: true,
isTop: false,
isVerticallyCentered: true,
isBottom: false
},
5: {
isLeft: false,
isHorizontallyCentered: false,
isRight: true,
isTop: false,
isVerticallyCentered: false,
isBottom: true
},
6: {
isLeft: false,
isHorizontallyCentered: true,
isRight: false,
isTop: false,
isVerticallyCentered: false,
isBottom: true
},
7: {
isLeft: true,
isHorizontallyCentered: false,
isRight: false,
isTop: false,
isVerticallyCentered: false,
isBottom: true
},
8: {
isLeft: true,
isHorizontallyCentered: false,
isRight: false,
isTop: false,
isVerticallyCentered: true,
isBottom: false
}
}
});
}(OpenSeadragon));

View file

@ -2,7 +2,7 @@
* OpenSeadragon - Point
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -50,16 +50,17 @@ $.Point = function( x, y ) {
* @member {Number} x
* @memberof OpenSeadragon.Point#
*/
this.x = typeof ( x ) == "number" ? x : 0;
this.x = typeof ( x ) === "number" ? x : 0;
/**
* The vector component 'y'.
* @member {Number} y
* @memberof OpenSeadragon.Point#
*/
this.y = typeof ( y ) == "number" ? y : 0;
this.y = typeof ( y ) === "number" ? y : 0;
};
$.Point.prototype = /** @lends OpenSeadragon.Point.prototype */{
/** @lends OpenSeadragon.Point.prototype */
$.Point.prototype = {
/**
* @function
* @returns {OpenSeadragon.Point} a duplicate of this Point
@ -83,10 +84,10 @@ $.Point.prototype = /** @lends OpenSeadragon.Point.prototype */{
},
/**
* Substract another Point to this point and return a new Point.
* Subtract another Point to this point and return a new Point.
* @function
* @param {OpenSeadragon.Point} point The point to substract vector components.
* @returns {OpenSeadragon.Point} A new point representing the substraction of the
* @param {OpenSeadragon.Point} point The point to subtract vector components.
* @returns {OpenSeadragon.Point} A new point representing the subtraction of the
* vector components
*/
minus: function( point ) {
@ -147,6 +148,18 @@ $.Point.prototype = /** @lends OpenSeadragon.Point.prototype */{
);
},
/**
* Compute the squared distance between this point and another point.
* Useful for optimizing things like comparing distances.
* @function
* @param {OpenSeadragon.Point} point The point to compute the squared distance with.
* @returns {Number} The squared distance between the 2 points
*/
squaredDistanceTo: function( point ) {
return Math.pow( this.x - point.x, 2 ) +
Math.pow( this.y - point.y, 2 );
},
/**
* Apply a function to each coordinate of this point and return a new point.
* @function
@ -179,14 +192,43 @@ $.Point.prototype = /** @lends OpenSeadragon.Point.prototype */{
* From http://stackoverflow.com/questions/4465931/rotate-rectangle-around-a-point
* @function
* @param {Number} degress to rotate around the pivot.
* @param {OpenSeadragon.Point} pivot Point about which to rotate.
* @param {OpenSeadragon.Point} [pivot=(0,0)] Point around which to rotate.
* Defaults to the origin.
* @returns {OpenSeadragon.Point}. A new point representing the point rotated around the specified pivot
*/
rotate: function ( degrees, pivot ) {
var angle = degrees * Math.PI / 180.0,
x = Math.cos( angle ) * ( this.x - pivot.x ) - Math.sin( angle ) * ( this.y - pivot.y ) + pivot.x,
y = Math.sin( angle ) * ( this.x - pivot.x ) + Math.cos( angle ) * ( this.y - pivot.y ) + pivot.y;
return new $.Point( x, y );
rotate: function (degrees, pivot) {
pivot = pivot || new $.Point(0, 0);
var cos;
var sin;
// Avoid float computations when possible
if (degrees % 90 === 0) {
var d = $.positiveModulo(degrees, 360);
switch (d) {
case 0:
cos = 1;
sin = 0;
break;
case 90:
cos = 0;
sin = 1;
break;
case 180:
cos = -1;
sin = 0;
break;
case 270:
cos = 0;
sin = -1;
break;
}
} else {
var angle = degrees * Math.PI / 180.0;
cos = Math.cos(angle);
sin = Math.sin(angle);
}
var x = cos * (this.x - pivot.x) - sin * (this.y - pivot.y) + pivot.x;
var y = sin * (this.x - pivot.x) + cos * (this.y - pivot.y) + pivot.y;
return new $.Point(x, y);
},
/**

362
src/priorityqueue.js Normal file
View file

@ -0,0 +1,362 @@
/*
* OpenSeadragon - Queue
*
* Copyright (C) 2024 OpenSeadragon contributors (modified)
* Copyright (C) Google Inc., The Closure Library Authors.
* https://github.com/google/closure-library
*
* SPDX-License-Identifier: Apache-2.0
*/
(function($) {
/**
* @class PriorityQueue
* @classdesc Fast priority queue. Implemented as a Heap.
*/
$.PriorityQueue = class {
/**
* @param {?OpenSeadragon.PriorityQueue} optHeap Optional Heap or
* Object to initialize heap with.
*/
constructor(optHeap = undefined) {
/**
* The nodes of the heap.
*
* This is a densely packed array containing all nodes of the heap, using
* the standard flat representation of a tree as an array (i.e. element [0]
* at the top, with [1] and [2] as the second row, [3] through [6] as the
* third, etc). Thus, the children of element `i` are `2i+1` and `2i+2`, and
* the parent of element `i` is `⌊(i-1)/2⌋`.
*
* The only invariant is that children's keys must be greater than parents'.
*
* @private
*/
this.nodes_ = [];
if (optHeap) {
this.insertAll(optHeap);
}
}
/**
* Insert the given value into the heap with the given key.
* @param {K} key The key.
* @param {V} value The value.
*/
insert(key, value) {
this.insertNode(new Node(key, value));
}
/**
* Insert node item.
* @param node
*/
insertNode(node) {
const nodes = this.nodes_;
node.index = nodes.length;
nodes.push(node);
this.moveUp_(node.index);
}
/**
* Adds multiple key-value pairs from another Heap or Object
* @param {?OpenSeadragon.PriorityQueue} heap Object containing the data to add.
*/
insertAll(heap) {
let keys, values;
if (heap instanceof $.PriorityQueue) {
keys = heap.getKeys();
values = heap.getValues();
// If it is a heap and the current heap is empty, I can rely on the fact
// that the keys/values are in the correct order to put in the underlying
// structure.
if (this.getCount() <= 0) {
const nodes = this.nodes_;
for (let i = 0; i < keys.length; i++) {
const node = new Node(keys[i], values[i]);
node.index = nodes.length;
nodes.push(node);
}
return;
}
} else {
throw "insertAll supports only OpenSeadragon.PriorityQueue object!";
}
for (let i = 0; i < keys.length; i++) {
this.insert(keys[i], values[i]);
}
}
/**
* Retrieves and removes the root value of this heap.
* @return {Node} The root node item removed from the root of the heap. Returns
* undefined if the heap is empty.
*/
remove() {
const nodes = this.nodes_;
const count = nodes.length;
const rootNode = nodes[0];
if (count <= 0) {
return undefined;
} else if (count == 1) { // eslint-disable-line
nodes.length = 0;
} else {
nodes[0] = nodes.pop();
if (nodes[0]) {
nodes[0].index = 0;
}
this.moveDown_(0);
}
if (rootNode) {
delete rootNode.index;
}
return rootNode;
}
/**
* Retrieves but does not remove the root value of this heap.
* @return {V} The value at the root of the heap. Returns
* undefined if the heap is empty.
*/
peek() {
const nodes = this.nodes_;
if (nodes.length == 0) { // eslint-disable-line
return undefined;
}
return nodes[0].value;
}
/**
* Retrieves but does not remove the key of the root node of this heap.
* @return {string} The key at the root of the heap. Returns undefined if the
* heap is empty.
*/
peekKey() {
return this.nodes_[0] && this.nodes_[0].key;
}
/**
* Move the node up in hierarchy
* @param {Node} node the node
* @param {K} key new ley, must be smaller than current key
*/
decreaseKey(node, key) {
if (node.index === undefined) {
node.key = key;
this.insertNode(node);
} else {
node.key = key;
this.moveUp_(node.index);
}
}
/**
* Moves the node at the given index down to its proper place in the heap.
* @param {number} index The index of the node to move down.
* @private
*/
moveDown_(index) {
const nodes = this.nodes_;
const count = nodes.length;
// Save the node being moved down.
const node = nodes[index];
// While the current node has a child.
while (index < (count >> 1)) {
const leftChildIndex = this.getLeftChildIndex_(index);
const rightChildIndex = this.getRightChildIndex_(index);
// Determine the index of the smaller child.
const smallerChildIndex = rightChildIndex < count &&
nodes[rightChildIndex].key < nodes[leftChildIndex].key ?
rightChildIndex :
leftChildIndex;
// If the node being moved down is smaller than its children, the node
// has found the correct index it should be at.
if (nodes[smallerChildIndex].key > node.key) {
break;
}
// If not, then take the smaller child as the current node.
nodes[index] = nodes[smallerChildIndex];
nodes[index].index = index;
index = smallerChildIndex;
}
nodes[index] = node;
if (node) {
node.index = index;
}
}
/**
* Moves the node at the given index up to its proper place in the heap.
* @param {number} index The index of the node to move up.
* @private
*/
moveUp_(index) {
const nodes = this.nodes_;
const node = nodes[index];
// While the node being moved up is not at the root.
while (index > 0) {
// If the parent is greater than the node being moved up, move the parent
// down.
const parentIndex = this.getParentIndex_(index);
if (nodes[parentIndex].key > node.key) {
nodes[index] = nodes[parentIndex];
nodes[index].index = index;
index = parentIndex;
} else {
break;
}
}
nodes[index] = node;
if (node) {
node.index = index;
}
}
/**
* Gets the index of the left child of the node at the given index.
* @param {number} index The index of the node to get the left child for.
* @return {number} The index of the left child.
* @private
*/
getLeftChildIndex_(index) {
return index * 2 + 1;
}
/**
* Gets the index of the right child of the node at the given index.
* @param {number} index The index of the node to get the right child for.
* @return {number} The index of the right child.
* @private
*/
getRightChildIndex_(index) {
return index * 2 + 2;
}
/**
* Gets the index of the parent of the node at the given index.
* @param {number} index The index of the node to get the parent for.
* @return {number} The index of the parent.
* @private
*/
getParentIndex_(index) {
return (index - 1) >> 1;
}
/**
* Gets the values of the heap.
* @return {!Array<*>} The values in the heap.
*/
getValues() {
const nodes = this.nodes_;
const rv = [];
const l = nodes.length;
for (let i = 0; i < l; i++) {
rv.push(nodes[i].value);
}
return rv;
}
/**
* Gets the keys of the heap.
* @return {!Array<string>} The keys in the heap.
*/
getKeys() {
const nodes = this.nodes_;
const rv = [];
const l = nodes.length;
for (let i = 0; i < l; i++) {
rv.push(nodes[i].key);
}
return rv;
}
/**
* Whether the heap contains the given value.
* @param {V} val The value to check for.
* @return {boolean} Whether the heap contains the value.
*/
containsValue(val) {
return this.nodes_.some((node) => node.value == val); // eslint-disable-line
}
/**
* Whether the heap contains the given key.
* @param {string} key The key to check for.
* @return {boolean} Whether the heap contains the key.
*/
containsKey(key) {
return this.nodes_.some((node) => node.value == key); // eslint-disable-line
}
/**
* Clones a heap and returns a new heap
* @return {!OpenSeadragon.PriorityQueue} A new Heap with the same key-value pairs.
*/
clone() {
return new $.PriorityQueue(this);
}
/**
* The number of key-value pairs in the map
* @return {number} The number of pairs.
*/
getCount() {
return this.nodes_.length;
}
/**
* Returns true if this heap contains no elements.
* @return {boolean} Whether this heap contains no elements.
*/
isEmpty() {
return this.nodes_.length === 0;
}
/**
* Removes all elements from the heap.
*/
clear() {
this.nodes_.length = 0;
}
};
$.PriorityQueue.Node = class {
constructor(key, value) {
/**
* The key.
* @type {K}
* @private
*/
this.key = key;
/**
* The value.
* @type {V}
* @private
*/
this.value = value;
/**
* The node index value. Updated in the heap.
* @type {number}
* @private
*/
this.index = 0;
}
clone() {
return new Node(this.key, this.value);
}
};
}(OpenSeadragon));

View file

@ -2,7 +2,7 @@
* OpenSeadragon - Profiler
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -68,7 +68,8 @@ $.Profiler = function() {
this.maxIdleTime = 0;
};
$.Profiler.prototype = /** @lends OpenSeadragon.Profiler.prototype */{
/** @lends OpenSeadragon.Profiler.prototype */
$.Profiler.prototype = {
/**
* @function

View file

@ -2,7 +2,7 @@
* OpenSeadragon - Rect
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -32,55 +32,126 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function( $ ){
(function($) {
/**
* @class Rect
* @classdesc A Rectangle really represents a 2x2 matrix where each row represents a
* 2 dimensional vector component, the first is (x,y) and the second is
* (width, height). The latter component implies the equation of a simple
* plane.
* @classdesc A Rectangle is described by it top left coordinates (x, y), width,
* height and degrees of rotation around (x, y).
* Note that the coordinate system used is the one commonly used with images:
* x increases when going to the right
* y increases when going to the bottom
* degrees increases clockwise with 0 being the horizontal
*
* The constructor normalizes the rectangle to always have 0 <= degrees < 90
*
* @memberof OpenSeadragon
* @param {Number} x The vector component 'x'.
* @param {Number} y The vector component 'y'.
* @param {Number} width The vector component 'height'.
* @param {Number} height The vector component 'width'.
* @param {Number} [x=0] The vector component 'x'.
* @param {Number} [y=0] The vector component 'y'.
* @param {Number} [width=0] The vector component 'width'.
* @param {Number} [height=0] The vector component 'height'.
* @param {Number} [degrees=0] Rotation of the rectangle around (x,y) in degrees.
*/
$.Rect = function( x, y, width, height ) {
$.Rect = function(x, y, width, height, degrees) {
/**
* The vector component 'x'.
* @member {Number} x
* @memberof OpenSeadragon.Rect#
*/
this.x = typeof ( x ) == "number" ? x : 0;
this.x = typeof (x) === "number" ? x : 0;
/**
* The vector component 'y'.
* @member {Number} y
* @memberof OpenSeadragon.Rect#
*/
this.y = typeof ( y ) == "number" ? y : 0;
this.y = typeof (y) === "number" ? y : 0;
/**
* The vector component 'width'.
* @member {Number} width
* @memberof OpenSeadragon.Rect#
*/
this.width = typeof ( width ) == "number" ? width : 0;
this.width = typeof (width) === "number" ? width : 0;
/**
* The vector component 'height'.
* @member {Number} height
* @memberof OpenSeadragon.Rect#
*/
this.height = typeof ( height ) == "number" ? height : 0;
this.height = typeof (height) === "number" ? height : 0;
/**
* The rotation of the rectangle, in degrees.
* @member {Number} degrees
* @memberof OpenSeadragon.Rect#
*/
this.degrees = typeof (degrees) === "number" ? degrees : 0;
// Normalizes the rectangle.
this.degrees = $.positiveModulo(this.degrees, 360);
var newTopLeft, newWidth;
if (this.degrees >= 270) {
newTopLeft = this.getTopRight();
this.x = newTopLeft.x;
this.y = newTopLeft.y;
newWidth = this.height;
this.height = this.width;
this.width = newWidth;
this.degrees -= 270;
} else if (this.degrees >= 180) {
newTopLeft = this.getBottomRight();
this.x = newTopLeft.x;
this.y = newTopLeft.y;
this.degrees -= 180;
} else if (this.degrees >= 90) {
newTopLeft = this.getBottomLeft();
this.x = newTopLeft.x;
this.y = newTopLeft.y;
newWidth = this.height;
this.height = this.width;
this.width = newWidth;
this.degrees -= 90;
}
};
$.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{
/**
* Builds a rectangle having the 3 specified points as summits.
* @static
* @memberof OpenSeadragon.Rect
* @param {OpenSeadragon.Point} topLeft
* @param {OpenSeadragon.Point} topRight
* @param {OpenSeadragon.Point} bottomLeft
* @returns {OpenSeadragon.Rect}
*/
$.Rect.fromSummits = function(topLeft, topRight, bottomLeft) {
var width = topLeft.distanceTo(topRight);
var height = topLeft.distanceTo(bottomLeft);
var diff = topRight.minus(topLeft);
var radians = Math.atan(diff.y / diff.x);
if (diff.x < 0) {
radians += Math.PI;
} else if (diff.y < 0) {
radians += 2 * Math.PI;
}
return new $.Rect(
topLeft.x,
topLeft.y,
width,
height,
radians / Math.PI * 180);
};
/** @lends OpenSeadragon.Rect.prototype */
$.Rect.prototype = {
/**
* @function
* @returns {OpenSeadragon.Rect} a duplicate of this Rect
*/
clone: function() {
return new $.Rect(this.x, this.y, this.width, this.height);
return new $.Rect(
this.x,
this.y,
this.width,
this.height,
this.degrees);
},
/**
@ -114,10 +185,8 @@ $.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{
* the rectangle.
*/
getBottomRight: function() {
return new $.Point(
this.x + this.width,
this.y + this.height
);
return new $.Point(this.x + this.width, this.y + this.height)
.rotate(this.degrees, this.getTopLeft());
},
/**
@ -128,10 +197,8 @@ $.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{
* the rectangle.
*/
getTopRight: function() {
return new $.Point(
this.x + this.width,
this.y
);
return new $.Point(this.x + this.width, this.y)
.rotate(this.degrees, this.getTopLeft());
},
/**
@ -142,10 +209,8 @@ $.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{
* the rectangle.
*/
getBottomLeft: function() {
return new $.Point(
this.x,
this.y + this.height
);
return new $.Point(this.x, this.y + this.height)
.rotate(this.degrees, this.getTopLeft());
},
/**
@ -158,117 +223,323 @@ $.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{
return new $.Point(
this.x + this.width / 2.0,
this.y + this.height / 2.0
);
).rotate(this.degrees, this.getTopLeft());
},
/**
* Returns the width and height component as a vector OpenSeadragon.Point
* @function
* @returns {OpenSeadragon.Point} The 2 dimensional vector representing the
* the width and height of the rectangle.
* width and height of the rectangle.
*/
getSize: function() {
return new $.Point( this.width, this.height );
return new $.Point(this.width, this.height);
},
/**
* Determines if two Rectangles have equivalent components.
* @function
* @param {OpenSeadragon.Rect} rectangle The Rectangle to compare to.
* @return {Boolean} 'true' if all components are equal, otherwise 'false'.
* @returns {Boolean} 'true' if all components are equal, otherwise 'false'.
*/
equals: function( other ) {
return ( other instanceof $.Rect ) &&
( this.x === other.x ) &&
( this.y === other.y ) &&
( this.width === other.width ) &&
( this.height === other.height );
equals: function(other) {
return (other instanceof $.Rect) &&
this.x === other.x &&
this.y === other.y &&
this.width === other.width &&
this.height === other.height &&
this.degrees === other.degrees;
},
/**
* Multiply all dimensions in this Rect by a factor and return a new Rect.
* Multiply all dimensions (except degrees) in this Rect by a factor and
* return a new Rect.
* @function
* @param {Number} factor The factor to multiply vector components.
* @returns {OpenSeadragon.Rect} A new rect representing the multiplication
* of the vector components by the factor
*/
times: function( factor ) {
return new OpenSeadragon.Rect(
times: function(factor) {
return new $.Rect(
this.x * factor,
this.y * factor,
this.width * factor,
this.height * factor
);
this.height * factor,
this.degrees);
},
/**
* Returns the smallest rectangle that will contain this and the given rectangle.
* Translate/move this Rect by a vector and return new Rect.
* @function
* @param {OpenSeadragon.Point} delta The translation vector.
* @returns {OpenSeadragon.Rect} A new rect with altered position
*/
translate: function(delta) {
return new $.Rect(
this.x + delta.x,
this.y + delta.y,
this.width,
this.height,
this.degrees);
},
/**
* Returns the smallest rectangle that will contain this and the given
* rectangle bounding boxes.
* @param {OpenSeadragon.Rect} rect
* @return {OpenSeadragon.Rect} The new rectangle.
* @returns {OpenSeadragon.Rect} The new rectangle.
*/
// ----------
union: function(rect) {
var left = Math.min(this.x, rect.x);
var top = Math.min(this.y, rect.y);
var right = Math.max(this.x + this.width, rect.x + rect.width);
var bottom = Math.max(this.y + this.height, rect.y + rect.height);
var thisBoundingBox = this.getBoundingBox();
var otherBoundingBox = rect.getBoundingBox();
return new OpenSeadragon.Rect(left, top, right - left, bottom - top);
var left = Math.min(thisBoundingBox.x, otherBoundingBox.x);
var top = Math.min(thisBoundingBox.y, otherBoundingBox.y);
var right = Math.max(
thisBoundingBox.x + thisBoundingBox.width,
otherBoundingBox.x + otherBoundingBox.width);
var bottom = Math.max(
thisBoundingBox.y + thisBoundingBox.height,
otherBoundingBox.y + otherBoundingBox.height);
return new $.Rect(
left,
top,
right - left,
bottom - top);
},
/**
* Rotates a rectangle around a point. Currently only 90, 180, and 270
* degrees are supported.
* @function
* @param {Number} degrees The angle in degrees to rotate.
* @param {OpenSeadragon.Point} pivot The point about which to rotate.
* Defaults to the center of the rectangle.
* @return {OpenSeadragon.Rect}
* Returns the bounding box of the intersection of this rectangle with the
* given rectangle.
* @param {OpenSeadragon.Rect} rect
* @returns {OpenSeadragon.Rect} the bounding box of the intersection
* or null if the rectangles don't intersect.
*/
rotate: function( degrees, pivot ) {
// TODO support arbitrary rotation
var width = this.width,
height = this.height,
newTopLeft;
intersection: function(rect) {
// Simplified version of Weiler Atherton clipping algorithm
// https://en.wikipedia.org/wiki/Weiler%E2%80%93Atherton_clipping_algorithm
// Because we just want the bounding box of the intersection,
// we can just compute the bounding box of:
// 1. all the summits of this which are inside rect
// 2. all the summits of rect which are inside this
// 3. all the intersections of rect and this
var EPSILON = 0.0000000001;
degrees = ( degrees + 360 ) % 360;
if (degrees % 90 !== 0) {
throw new Error('Currently only 0, 90, 180, and 270 degrees are supported.');
var intersectionPoints = [];
var thisTopLeft = this.getTopLeft();
if (rect.containsPoint(thisTopLeft, EPSILON)) {
intersectionPoints.push(thisTopLeft);
}
var thisTopRight = this.getTopRight();
if (rect.containsPoint(thisTopRight, EPSILON)) {
intersectionPoints.push(thisTopRight);
}
var thisBottomLeft = this.getBottomLeft();
if (rect.containsPoint(thisBottomLeft, EPSILON)) {
intersectionPoints.push(thisBottomLeft);
}
var thisBottomRight = this.getBottomRight();
if (rect.containsPoint(thisBottomRight, EPSILON)) {
intersectionPoints.push(thisBottomRight);
}
if( degrees === 0 ){
return new $.Rect(
this.x,
this.y,
this.width,
this.height
);
var rectTopLeft = rect.getTopLeft();
if (this.containsPoint(rectTopLeft, EPSILON)) {
intersectionPoints.push(rectTopLeft);
}
var rectTopRight = rect.getTopRight();
if (this.containsPoint(rectTopRight, EPSILON)) {
intersectionPoints.push(rectTopRight);
}
var rectBottomLeft = rect.getBottomLeft();
if (this.containsPoint(rectBottomLeft, EPSILON)) {
intersectionPoints.push(rectBottomLeft);
}
var rectBottomRight = rect.getBottomRight();
if (this.containsPoint(rectBottomRight, EPSILON)) {
intersectionPoints.push(rectBottomRight);
}
var thisSegments = this._getSegments();
var rectSegments = rect._getSegments();
for (var i = 0; i < thisSegments.length; i++) {
var thisSegment = thisSegments[i];
for (var j = 0; j < rectSegments.length; j++) {
var rectSegment = rectSegments[j];
var intersect = getIntersection(thisSegment[0], thisSegment[1],
rectSegment[0], rectSegment[1]);
if (intersect) {
intersectionPoints.push(intersect);
}
}
}
// Get intersection point of segments [a,b] and [c,d]
function getIntersection(a, b, c, d) {
// http://stackoverflow.com/a/1968345/1440403
var abVector = b.minus(a);
var cdVector = d.minus(c);
var denom = -cdVector.x * abVector.y + abVector.x * cdVector.y;
if (denom === 0) {
return null;
}
var s = (abVector.x * (a.y - c.y) - abVector.y * (a.x - c.x)) / denom;
var t = (cdVector.x * (a.y - c.y) - cdVector.y * (a.x - c.x)) / denom;
if (-EPSILON <= s && s <= 1 - EPSILON &&
-EPSILON <= t && t <= 1 - EPSILON) {
return new $.Point(a.x + t * abVector.x, a.y + t * abVector.y);
}
return null;
}
if (intersectionPoints.length === 0) {
return null;
}
var minX = intersectionPoints[0].x;
var maxX = intersectionPoints[0].x;
var minY = intersectionPoints[0].y;
var maxY = intersectionPoints[0].y;
for (var k = 1; k < intersectionPoints.length; k++) {
var point = intersectionPoints[k];
if (point.x < minX) {
minX = point.x;
}
if (point.x > maxX) {
maxX = point.x;
}
if (point.y < minY) {
minY = point.y;
}
if (point.y > maxY) {
maxY = point.y;
}
}
return new $.Rect(minX, minY, maxX - minX, maxY - minY);
},
// private
_getSegments: function() {
var topLeft = this.getTopLeft();
var topRight = this.getTopRight();
var bottomLeft = this.getBottomLeft();
var bottomRight = this.getBottomRight();
return [[topLeft, topRight],
[topRight, bottomRight],
[bottomRight, bottomLeft],
[bottomLeft, topLeft]];
},
/**
* Rotates a rectangle around a point.
* @function
* @param {Number} degrees The angle in degrees to rotate.
* @param {OpenSeadragon.Point} [pivot] The point about which to rotate.
* Defaults to the center of the rectangle.
* @returns {OpenSeadragon.Rect}
*/
rotate: function(degrees, pivot) {
degrees = $.positiveModulo(degrees, 360);
if (degrees === 0) {
return this.clone();
}
pivot = pivot || this.getCenter();
var newTopLeft = this.getTopLeft().rotate(degrees, pivot);
var newTopRight = this.getTopRight().rotate(degrees, pivot);
switch ( degrees ) {
case 90:
newTopLeft = this.getBottomLeft();
width = this.height;
height = this.width;
break;
case 180:
newTopLeft = this.getBottomRight();
break;
case 270:
newTopLeft = this.getTopRight();
width = this.height;
height = this.width;
break;
default:
newTopLeft = this.getTopLeft();
break;
var diff = newTopRight.minus(newTopLeft);
// Handle floating point error
diff = diff.apply(function(x) {
var EPSILON = 1e-15;
return Math.abs(x) < EPSILON ? 0 : x;
});
var radians = Math.atan(diff.y / diff.x);
if (diff.x < 0) {
radians += Math.PI;
} else if (diff.y < 0) {
radians += 2 * Math.PI;
}
return new $.Rect(
newTopLeft.x,
newTopLeft.y,
this.width,
this.height,
radians / Math.PI * 180);
},
newTopLeft = newTopLeft.rotate(degrees, pivot);
/**
* Retrieves the smallest horizontal (degrees=0) rectangle which contains
* this rectangle.
* @returns {OpenSeadragon.Rect}
*/
getBoundingBox: function() {
if (this.degrees === 0) {
return this.clone();
}
var topLeft = this.getTopLeft();
var topRight = this.getTopRight();
var bottomLeft = this.getBottomLeft();
var bottomRight = this.getBottomRight();
var minX = Math.min(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x);
var maxX = Math.max(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x);
var minY = Math.min(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y);
var maxY = Math.max(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y);
return new $.Rect(
minX,
minY,
maxX - minX,
maxY - minY);
},
return new $.Rect(newTopLeft.x, newTopLeft.y, width, height);
/**
* Retrieves the smallest horizontal (degrees=0) rectangle which contains
* this rectangle and has integers x, y, width and height
* @returns {OpenSeadragon.Rect}
*/
getIntegerBoundingBox: function() {
var boundingBox = this.getBoundingBox();
var x = Math.floor(boundingBox.x);
var y = Math.floor(boundingBox.y);
var width = Math.ceil(boundingBox.width + boundingBox.x - x);
var height = Math.ceil(boundingBox.height + boundingBox.y - y);
return new $.Rect(x, y, width, height);
},
/**
* Determines whether a point is inside this rectangle (edge included).
* @function
* @param {OpenSeadragon.Point} point
* @param {Number} [epsilon=0] the margin of error allowed
* @returns {Boolean} true if the point is inside this rectangle, false
* otherwise.
*/
containsPoint: function(point, epsilon) {
epsilon = epsilon || 0;
// See http://stackoverflow.com/a/2752754/1440403 for explanation
var topLeft = this.getTopLeft();
var topRight = this.getTopRight();
var bottomLeft = this.getBottomLeft();
var topDiff = topRight.minus(topLeft);
var leftDiff = bottomLeft.minus(topLeft);
return ((point.x - topLeft.x) * topDiff.x +
(point.y - topLeft.y) * topDiff.y >= -epsilon) &&
((point.x - topRight.x) * topDiff.x +
(point.y - topRight.y) * topDiff.y <= epsilon) &&
((point.x - topLeft.x) * leftDiff.x +
(point.y - topLeft.y) * leftDiff.y >= -epsilon) &&
((point.x - bottomLeft.x) * leftDiff.x +
(point.y - bottomLeft.y) * leftDiff.y <= epsilon);
},
/**
@ -279,13 +550,14 @@ $.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{
*/
toString: function() {
return "[" +
(Math.round(this.x*100) / 100) + "," +
(Math.round(this.y*100) / 100) + "," +
(Math.round(this.width*100) / 100) + "x" +
(Math.round(this.height*100) / 100) +
"]";
(Math.round(this.x * 100) / 100) + ", " +
(Math.round(this.y * 100) / 100) + ", " +
(Math.round(this.width * 100) / 100) + "x" +
(Math.round(this.height * 100) / 100) + ", " +
(Math.round(this.degrees * 100) / 100) + "deg" +
"]";
}
};
}( OpenSeadragon ));
}(OpenSeadragon));

View file

@ -2,7 +2,7 @@
* OpenSeadragon - ReferenceStrip
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -46,14 +46,14 @@ var THIS = {};
*
* This idea is a reexpression of the idea of dzi collections
* which allows a clearer algorithm to reuse the tile sources already
* supported by OpenSeadragon, in heterogenious or homogenious
* supported by OpenSeadragon, in heterogeneous or homogeneous
* sequences just like mixed groups already supported by the viewer
* for the purpose of image sequnces.
*
* TODO: The difficult part of this feature is figuring out how to express
* this functionality as a combination of the functionality already
* provided by Drawer, Viewport, TileSource, and Navigator. It may
* require better abstraction at those points in order to effeciently
* require better abstraction at those points in order to efficiently
* reuse those paradigms.
*/
/**
@ -85,24 +85,19 @@ $.ReferenceStrip = function ( options ) {
scroll: $.DEFAULT_SETTINGS.referenceStripScroll,
clickTimeThreshold: $.DEFAULT_SETTINGS.clickTimeThreshold
}, options, {
//required overrides
element: this.element,
//These need to be overridden to prevent recursion since
//the navigator is a viewer and a viewer has a navigator
showNavigator: false,
mouseNavEnabled: false,
showNavigationControl: false,
showSequenceControl: false
element: this.element
} );
$.extend( this, options );
//Private state properties
THIS[this.id] = {
"animating": false
animating: false
};
this.minPixelRatio = this.viewer.minPixelRatio;
this.element.tabIndex = 0;
style = this.element.style;
style.marginTop = '0px';
style.marginRight = '0px';
@ -119,14 +114,21 @@ $.ReferenceStrip = function ( options ) {
$.setElementOpacity( this.element, 0.8 );
this.viewer = viewer;
this.innerTracker = new $.MouseTracker( {
this.tracker = new $.MouseTracker( {
userData: 'ReferenceStrip.tracker',
element: this.element,
clickHandler: $.delegate( this, onStripClick ),
dragHandler: $.delegate( this, onStripDrag ),
scrollHandler: $.delegate( this, onStripScroll ),
enterHandler: $.delegate( this, onStripEnter ),
exitHandler: $.delegate( this, onStripExit ),
leaveHandler: $.delegate( this, onStripLeave ),
keyDownHandler: $.delegate( this, onKeyDown ),
keyHandler: $.delegate( this, onKeyPress )
keyHandler: $.delegate( this, onKeyPress ),
preProcessEventHandler: function (eventInfo) {
if (eventInfo.eventType === 'wheel') {
eventInfo.preventDefault = true;
}
}
} );
//Controls the position and orientation of the reference strip and sets the
@ -139,7 +141,7 @@ $.ReferenceStrip = function ( options ) {
{ anchor: $.ControlAnchor.BOTTOM_LEFT }
);
} else {
if ( "horizontal" == options.scroll ) {
if ( "horizontal" === options.scroll ) {
this.element.style.width = (
viewerSize.x *
options.sizeRatio *
@ -178,6 +180,7 @@ $.ReferenceStrip = function ( options ) {
this.panelWidth = ( viewerSize.x * this.sizeRatio ) + 8;
this.panelHeight = ( viewerSize.y * this.sizeRatio ) + 8;
this.panels = [];
this.miniViewers = {};
/*jshint loopfunc:true*/
for ( i = 0; i < viewer.tileSources.length; i++ ) {
@ -188,34 +191,11 @@ $.ReferenceStrip = function ( options ) {
element.style.width = _this.panelWidth + 'px';
element.style.height = _this.panelHeight + 'px';
element.style.display = 'inline';
element.style.float = 'left'; //Webkit
element.style['float'] = 'left'; //Webkit
element.style.cssFloat = 'left'; //Firefox
element.style.styleFloat = 'left'; //IE
element.style.padding = '2px';
$.setElementTouchActionNone( element );
element.innerTracker = new $.MouseTracker( {
element: element,
clickTimeThreshold: this.clickTimeThreshold,
clickDistThreshold: this.clickDistThreshold,
pressHandler: function ( event ) {
event.eventSource.dragging = $.now();
},
releaseHandler: function ( event ) {
var tracker = event.eventSource,
id = tracker.element.id,
page = Number( id.split( '-' )[2] ),
now = $.now();
if ( event.insideElementPressed &&
event.insideElementReleased &&
tracker.dragging &&
( now - tracker.dragging ) < tracker.clickTimeThreshold ) {
tracker.dragging = null;
viewer.goToPage( page );
}
}
} );
$.setElementPointerEventsNone( element );
this.element.appendChild( element );
@ -224,18 +204,19 @@ $.ReferenceStrip = function ( options ) {
this.panels.push( element );
}
loadPanels( this, this.scroll == 'vertical' ? viewerSize.y : viewerSize.x, 0 );
loadPanels( this, this.scroll === 'vertical' ? viewerSize.y : viewerSize.x, 0 );
this.setFocus( 0 );
};
$.extend( $.ReferenceStrip.prototype, $.EventSource.prototype, $.Viewer.prototype, /** @lends OpenSeadragon.ReferenceStrip.prototype */{
/** @lends OpenSeadragon.ReferenceStrip.prototype */
$.ReferenceStrip.prototype = {
/**
* @function
*/
setFocus: function ( page ) {
var element = $.getElement( this.element.id + '-' + page ),
var element = this.element.querySelector('#' + this.element.id + '-' + page ),
viewerSize = $.getElementSize( this.viewer.canvas ),
scrollWidth = Number( this.element.style.width.replace( 'px', '' ) ),
scrollHeight = Number( this.element.style.height.replace( 'px', '' ) ),
@ -250,7 +231,7 @@ $.extend( $.ReferenceStrip.prototype, $.EventSource.prototype, $.Viewer.prototyp
this.currentSelected = element;
this.currentSelected.style.background = '#999';
if ( 'horizontal' == this.scroll ) {
if ( 'horizontal' === this.scroll ) {
//right left
offset = ( Number( page ) ) * ( this.panelWidth + 3 );
if ( offset > offsetLeft + viewerSize.x - this.panelWidth ) {
@ -276,8 +257,7 @@ $.extend( $.ReferenceStrip.prototype, $.EventSource.prototype, $.Viewer.prototyp
}
this.currentPage = page;
$.getElement( element.id + '-displayregion' ).focus();
onStripEnter.call( this, { eventSource: this.innerTracker } );
onStripEnter.call( this, { eventSource: this.tracker } );
}
},
@ -286,22 +266,50 @@ $.extend( $.ReferenceStrip.prototype, $.EventSource.prototype, $.Viewer.prototyp
*/
update: function () {
if ( THIS[this.id].animating ) {
$.console.log( 'image reference strip update' );
// $.console.log( 'image reference strip update' );
return true;
}
return false;
},
// Overrides Viewer.destroy
destroy: function() {
if (this.miniViewers) {
for (var key in this.miniViewers) {
this.miniViewers[key].destroy();
}
}
this.tracker.destroy();
if (this.element) {
this.element.parentNode.removeChild(this.element);
this.viewer.removeControl( this.element );
}
}
} );
};
/**
* @private
* @inner
* @function
*/
function onStripClick( event ) {
if ( event.quick ) {
var page;
if ( 'horizontal' === this.scroll ) {
// +4px fix to solve problem with precision on thumbnail selection if there is a lot of them
page = Math.floor(event.position.x / (this.panelWidth + 4));
} else {
page = Math.floor(event.position.y / this.panelHeight);
}
this.viewer.goToPage( page );
}
this.element.focus();
}
/**
@ -311,14 +319,15 @@ $.extend( $.ReferenceStrip.prototype, $.EventSource.prototype, $.Viewer.prototyp
*/
function onStripDrag( event ) {
var offsetLeft = Number( this.element.style.marginLeft.replace( 'px', '' ) ),
this.dragging = true;
if ( this.element ) {
var offsetLeft = Number( this.element.style.marginLeft.replace( 'px', '' ) ),
offsetTop = Number( this.element.style.marginTop.replace( 'px', '' ) ),
scrollWidth = Number( this.element.style.width.replace( 'px', '' ) ),
scrollHeight = Number( this.element.style.height.replace( 'px', '' ) ),
viewerSize = $.getElementSize( this.viewer.canvas );
this.dragging = true;
if ( this.element ) {
if ( 'horizontal' == this.scroll ) {
if ( 'horizontal' === this.scroll ) {
if ( -event.delta.x > 0 ) {
//forward
if ( offsetLeft > -( scrollWidth - viewerSize.x ) ) {
@ -348,7 +357,6 @@ function onStripDrag( event ) {
}
}
}
return false;
}
@ -360,13 +368,14 @@ function onStripDrag( event ) {
* @function
*/
function onStripScroll( event ) {
var offsetLeft = Number( this.element.style.marginLeft.replace( 'px', '' ) ),
if ( this.element ) {
var offsetLeft = Number( this.element.style.marginLeft.replace( 'px', '' ) ),
offsetTop = Number( this.element.style.marginTop.replace( 'px', '' ) ),
scrollWidth = Number( this.element.style.width.replace( 'px', '' ) ),
scrollHeight = Number( this.element.style.height.replace( 'px', '' ) ),
viewerSize = $.getElementSize( this.viewer.canvas );
if ( this.element ) {
if ( 'horizontal' == this.scroll ) {
if ( 'horizontal' === this.scroll ) {
if ( event.scroll > 0 ) {
//forward
if ( offsetLeft > -( scrollWidth - viewerSize.x ) ) {
@ -395,9 +404,9 @@ function onStripScroll( event ) {
}
}
}
event.preventDefault = true;
}
//cancels event
return false;
}
@ -406,10 +415,9 @@ function loadPanels( strip, viewerSize, scroll ) {
activePanelsStart,
activePanelsEnd,
miniViewer,
style,
i,
element;
if ( 'horizontal' == strip.scroll ) {
if ( 'horizontal' === strip.scroll ) {
panelSize = strip.panelWidth;
} else {
panelSize = strip.panelHeight;
@ -422,9 +430,19 @@ function loadPanels( strip, viewerSize, scroll ) {
for ( i = activePanelsStart; i < activePanelsEnd && i < strip.panels.length; i++ ) {
element = strip.panels[i];
if ( !element.activePanel ) {
var miniTileSource;
var originalTileSource = strip.viewer.tileSources[i];
if (originalTileSource.referenceStripThumbnailUrl) {
miniTileSource = {
type: 'image',
url: originalTileSource.referenceStripThumbnailUrl
};
} else {
miniTileSource = originalTileSource;
}
miniViewer = new $.Viewer( {
id: element.id,
tileSources: [strip.viewer.tileSources[i]],
tileSources: [miniTileSource],
element: element,
navigatorSizeRatio: strip.sizeRatio,
showNavigator: false,
@ -433,36 +451,21 @@ function loadPanels( strip, viewerSize, scroll ) {
showSequenceControl: false,
immediateRender: true,
blendTime: 0,
animationTime: 0
animationTime: 0,
loadTilesWithAjax: strip.viewer.loadTilesWithAjax,
ajaxHeaders: strip.viewer.ajaxHeaders,
drawer: 'canvas', //always use canvas for the reference strip
} );
// Allow pointer events to pass through miniViewer's canvas/container
// elements so implicit pointer capture works on touch devices
$.setElementPointerEventsNone( miniViewer.canvas );
$.setElementPointerEventsNone( miniViewer.container );
// We'll use event delegation from the reference strip element instead of
// handling events on every miniViewer
miniViewer.innerTracker.setTracking( false );
miniViewer.outerTracker.setTracking( false );
miniViewer.displayRegion = $.makeNeutralElement( "textarea" );
miniViewer.displayRegion.id = element.id + '-displayregion';
miniViewer.displayRegion.className = 'displayregion';
style = miniViewer.displayRegion.style;
style.position = 'relative';
style.top = '0px';
style.left = '0px';
style.fontSize = '0px';
style.overflow = 'hidden';
style.float = 'left'; //Webkit
style.cssFloat = 'left'; //Firefox
style.styleFloat = 'left'; //IE
style.zIndex = 999999999;
style.cursor = 'default';
style.width = ( strip.panelWidth - 4 ) + 'px';
style.height = ( strip.panelHeight - 4 ) + 'px';
// TODO: What is this for? Future keyboard navigation support?
miniViewer.displayRegion.innerTracker = new $.MouseTracker( {
element: miniViewer.displayRegion,
startDisabled: true
} );
element.getElementsByTagName( 'div' )[0].appendChild(
miniViewer.displayRegion
);
strip.miniViewers[element.id] = miniViewer;
element.activePanel = true;
}
@ -483,7 +486,7 @@ function onStripEnter( event ) {
//element.style.border = '1px solid #555';
//element.style.background = '#000';
if ( 'horizontal' == this.scroll ) {
if ( 'horizontal' === this.scroll ) {
//element.style.paddingTop = "0px";
element.style.marginBottom = "0px";
@ -494,7 +497,6 @@ function onStripEnter( event ) {
element.style.marginLeft = "0px";
}
return false;
}
@ -503,10 +505,10 @@ function onStripEnter( event ) {
* @inner
* @function
*/
function onStripExit( event ) {
function onStripLeave( event ) {
var element = event.eventSource.element;
if ( 'horizontal' == this.scroll ) {
if ( 'horizontal' === this.scroll ) {
//element.style.paddingTop = "10px";
element.style.marginBottom = "-" + ( $.getElementSize( element ).y / 2 ) + "px";
@ -517,7 +519,6 @@ function onStripExit( event ) {
element.style.marginLeft = "-" + ( $.getElementSize( element ).x / 2 ) + "px";
}
return false;
}
@ -529,26 +530,31 @@ function onStripExit( event ) {
function onKeyDown( event ) {
//console.log( event.keyCode );
if ( !event.preventDefaultAction && !event.ctrl && !event.alt && !event.meta ) {
if ( !event.ctrl && !event.alt && !event.meta ) {
switch ( event.keyCode ) {
case 38: //up arrow
onStripScroll.call( this, { eventSource: this.tracker, position: null, scroll: 1, shift: null } );
return false;
event.preventDefault = true;
break;
case 40: //down arrow
onStripScroll.call( this, { eventSource: this.tracker, position: null, scroll: -1, shift: null } );
return false;
event.preventDefault = true;
break;
case 37: //left arrow
onStripScroll.call( this, { eventSource: this.tracker, position: null, scroll: -1, shift: null } );
return false;
event.preventDefault = true;
break;
case 39: //right arrow
onStripScroll.call( this, { eventSource: this.tracker, position: null, scroll: 1, shift: null } );
return false;
event.preventDefault = true;
break;
default:
//console.log( 'navigator keycode %s', event.keyCode );
return true;
event.preventDefault = false;
break;
}
} else {
return true;
event.preventDefault = false;
}
}
@ -561,38 +567,43 @@ function onKeyDown( event ) {
function onKeyPress( event ) {
//console.log( event.keyCode );
if ( !event.preventDefaultAction && !event.ctrl && !event.alt && !event.meta ) {
if ( !event.ctrl && !event.alt && !event.meta ) {
switch ( event.keyCode ) {
case 61: //=|+
onStripScroll.call( this, { eventSource: this.tracker, position: null, scroll: 1, shift: null } );
return false;
event.preventDefault = true;
break;
case 45: //-|_
onStripScroll.call( this, { eventSource: this.tracker, position: null, scroll: -1, shift: null } );
return false;
event.preventDefault = true;
break;
case 48: //0|)
case 119: //w
case 87: //W
onStripScroll.call( this, { eventSource: this.tracker, position: null, scroll: 1, shift: null } );
return false;
event.preventDefault = true;
break;
case 115: //s
case 83: //S
onStripScroll.call( this, { eventSource: this.tracker, position: null, scroll: -1, shift: null } );
return false;
event.preventDefault = true;
break;
case 97: //a
onStripScroll.call( this, { eventSource: this.tracker, position: null, scroll: -1, shift: null } );
return false;
event.preventDefault = true;
break;
case 100: //d
onStripScroll.call( this, { eventSource: this.tracker, position: null, scroll: 1, shift: null } );
return false;
event.preventDefault = true;
break;
default:
//console.log( 'navigator keycode %s', event.keyCode );
return true;
event.preventDefault = false;
break;
}
} else {
return true;
event.preventDefault = false;
}
}
} ( OpenSeadragon ) );
}(OpenSeadragon));

View file

@ -2,7 +2,7 @@
* OpenSeadragon - Spring
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -41,7 +41,7 @@
* @param {Number} options.springStiffness - Spring stiffness. Must be greater than zero.
* The closer to zero, the closer to linear animation.
* @param {Number} options.animationTime - Animation duration per spring, in seconds.
* Must be greater than zero.
* Must be zero or greater.
* @param {Number} [options.initial=0] - Initial value of spring.
* @param {Boolean} [options.exponential=false] - Whether this spring represents
* an exponential scale (such as zoom) and should be animated accordingly. Note that
@ -50,11 +50,11 @@
$.Spring = function( options ) {
var args = arguments;
if( typeof( options ) != 'object' ){
if( typeof ( options ) !== 'object' ){
//allows backward compatible use of ( initialValue, config ) as
//constructor parameters
options = {
initial: args.length && typeof ( args[ 0 ] ) == "number" ?
initial: args.length && typeof ( args[ 0 ] ) === "number" ?
args[ 0 ] :
undefined,
/**
@ -79,8 +79,8 @@ $.Spring = function( options ) {
$.console.assert(typeof options.springStiffness === "number" && options.springStiffness !== 0,
"[OpenSeadragon.Spring] options.springStiffness must be a non-zero number");
$.console.assert(typeof options.animationTime === "number" && options.springStiffness !== 0,
"[OpenSeadragon.Spring] options.animationTime must be a non-zero number");
$.console.assert(typeof options.animationTime === "number" && options.animationTime >= 0,
"[OpenSeadragon.Spring] options.animationTime must be a number greater than or equal to 0");
if (options.exponential) {
this._exponential = true;
@ -96,7 +96,7 @@ $.Spring = function( options ) {
* @property {Number} time
*/
this.current = {
value: typeof ( this.initial ) == "number" ?
value: typeof ( this.initial ) === "number" ?
this.initial :
(this._exponential ? 0 : 1),
time: $.now() // always work in milliseconds
@ -134,7 +134,8 @@ $.Spring = function( options ) {
}
};
$.Spring.prototype = /** @lends OpenSeadragon.Spring.prototype */{
/** @lends OpenSeadragon.Spring.prototype */
$.Spring.prototype = {
/**
* @function
@ -205,11 +206,13 @@ $.Spring.prototype = /** @lends OpenSeadragon.Spring.prototype */{
/**
* @function
* @returns true if the spring is still updating its value, false if it is
* already at the target value.
*/
update: function() {
this.current.time = $.now();
var startValue, targetValue;
let startValue, targetValue;
if (this._exponential) {
startValue = this.start._logValue;
targetValue = this.target._logValue;
@ -218,21 +221,34 @@ $.Spring.prototype = /** @lends OpenSeadragon.Spring.prototype */{
targetValue = this.target.value;
}
var currentValue = (this.current.time >= this.target.time) ?
targetValue :
startValue +
( targetValue - startValue ) *
transform(
this.springStiffness,
( this.current.time - this.start.time ) /
( this.target.time - this.start.time )
);
if (this._exponential) {
this.current.value = Math.exp(currentValue);
if(this.current.time >= this.target.time){
this.current.value = this.target.value;
} else {
this.current.value = currentValue;
let currentValue = startValue +
( targetValue - startValue ) *
transform(
this.springStiffness,
( this.current.time - this.start.time ) /
( this.target.time - this.start.time )
);
if (this._exponential) {
this.current.value = Math.exp(currentValue);
} else {
this.current.value = currentValue;
}
}
return this.current.value !== this.target.value;
},
/**
* Returns whether the spring is at the target value
* @function
* @returns {Boolean} True if at target value, false otherwise
*/
isAtTargetValue: function() {
return this.current.value === this.target.value;
}
};

View file

@ -2,7 +2,7 @@
* OpenSeadragon - getString/setString
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -57,7 +57,8 @@ var I18N = {
NextPage: "Next page",
PreviousPage: "Previous page",
RotateLeft: "Rotate left",
RotateRight: "Rotate right"
RotateRight: "Rotate right",
Flip: "Flip Horizontally"
}
};
@ -75,14 +76,14 @@ $.extend( $, /** @lends OpenSeadragon */{
container = I18N,
i;
for ( i = 0; i < props.length-1; i++ ) {
for (i = 0; i < props.length - 1; i++) {
// in case not a subproperty
container = container[ props[ i ] ] || {};
}
string = container[ props[ i ] ];
if ( typeof( string ) != "string" ) {
$.console.debug( "Untranslated source string:", prop );
if ( typeof ( string ) !== "string" ) {
$.console.error( "Untranslated source string:", prop );
string = ""; // FIXME: this breaks gettext()-style convention, which would return source
}

View file

@ -2,7 +2,7 @@
* OpenSeadragon - Tile
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -40,15 +40,23 @@
* @param {Number} level The zoom level this tile belongs to.
* @param {Number} x The vector component 'x'.
* @param {Number} y The vector component 'y'.
* @param {OpenSeadragon.Point} bounds Where this tile fits, in normalized
* @param {OpenSeadragon.Rect} bounds Where this tile fits, in normalized
* coordinates.
* @param {Boolean} exists Is this tile a part of a sparse image? ( Also has
* this tile failed to load? )
* @param {String} url The URL of this tile's image.
* @param {CanvasRenderingContext2D} context2D The context2D of this tile if it
* is provided directly by the tile source.
* @param {String|Function} url The URL of this tile's image or a function that returns a url.
* @param {CanvasRenderingContext2D} [context2D=undefined] The context2D of this tile if it
* * is provided directly by the tile source. Deprecated: use Tile::addCache(...) instead.
* @param {Boolean} loadWithAjax Whether this tile image should be loaded with an AJAX request .
* @param {Object} ajaxHeaders The headers to send with this tile's AJAX request (if applicable).
* @param {OpenSeadragon.Rect} sourceBounds The portion of the tile to use as the source of the
* drawing operation, in pixels. Note that this only works when drawing with canvas; when drawing
* with HTML the entire tile is always used.
* @param {String} postData HTTP POST data (usually but not necessarily in k=v&k2=v2... form,
* see TileSource::getTilePostData) or null
* @param {String} cacheKey key to act as a tile cache, must be unique for tiles with unique image data
*/
$.Tile = function(level, x, y, bounds, exists, url, context2D) {
$.Tile = function(level, x, y, bounds, exists, url, context2D, loadWithAjax, ajaxHeaders, sourceBounds, postData, cacheKey) {
/**
* The zoom level this tile belongs to.
* @member {Number} level
@ -73,6 +81,19 @@ $.Tile = function(level, x, y, bounds, exists, url, context2D) {
* @memberof OpenSeadragon.Tile#
*/
this.bounds = bounds;
/**
* Where this tile fits, in normalized coordinates, after positioning
* @member {OpenSeadragon.Rect} positionedBounds
* @memberof OpenSeadragon.Tile#
*/
this.positionedBounds = new OpenSeadragon.Rect(bounds.x, bounds.y, bounds.width, bounds.height);
/**
* The portion of the tile to use as the source of the drawing operation, in pixels. Note that
* this only works when drawing with canvas; when drawing with HTML the entire tile is always used.
* @member {OpenSeadragon.Rect} sourceBounds
* @memberof OpenSeadragon.Tile#
*/
this.sourceBounds = sourceBounds;
/**
* Is this tile a part of a sparse image? Also has this tile failed to load?
* @member {Boolean} exists
@ -80,17 +101,52 @@ $.Tile = function(level, x, y, bounds, exists, url, context2D) {
*/
this.exists = exists;
/**
* The URL of this tile's image.
* @member {String} url
* Private property to hold string url or url retriever function.
* Consumers should access via Tile.getUrl()
* @member {String|Function} url
* @memberof OpenSeadragon.Tile#
* @private
*/
this._url = url;
/**
* Post parameters for this tile. For example, it can be an URL-encoded string
* in k1=v1&k2=v2... format, or a JSON, or a FormData instance... or null if no POST request used
* @member {String} postData HTTP POST data (usually but not necessarily in k=v&k2=v2... form,
* see TileSource::getTilePostData) or null
* @memberof OpenSeadragon.Tile#
*/
this.url = url;
this.postData = postData;
/**
* The context2D of this tile if it is provided directly by the tile source.
* @member {CanvasRenderingContext2D} context2D
* @memberOf OpenSeadragon.Tile#
*/
this.context2D = context2D;
if (context2D) {
this.context2D = context2D;
}
/**
* Whether to load this tile's image with an AJAX request.
* @member {Boolean} loadWithAjax
* @memberof OpenSeadragon.Tile#
*/
this.loadWithAjax = loadWithAjax;
/**
* The headers to be used in requesting this tile's image.
* Only used if loadWithAjax is set to true.
* @member {Object} ajaxHeaders
* @memberof OpenSeadragon.Tile#
*/
this.ajaxHeaders = ajaxHeaders;
if (cacheKey === undefined) {
$.console.warn("Tile constructor needs 'cacheKey' variable: creation tile cache" +
" in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used.");
cacheKey = $.TileSource.prototype.getTileHashKey(level, x, y, url, ajaxHeaders, postData);
}
this._cKey = cacheKey || "";
this._ocKey = cacheKey || "";
/**
* Is this tile loaded?
* @member {Boolean} loaded
@ -103,32 +159,6 @@ $.Tile = function(level, x, y, bounds, exists, url, context2D) {
* @memberof OpenSeadragon.Tile#
*/
this.loading = false;
/**
* The HTML div element for this tile
* @member {Element} element
* @memberof OpenSeadragon.Tile#
*/
this.element = null;
/**
* The HTML img element for this tile.
* @member {Element} imgElement
* @memberof OpenSeadragon.Tile#
*/
this.imgElement = null;
/**
* The Image object for this tile.
* @member {Object} image
* @memberof OpenSeadragon.Tile#
*/
this.image = null;
/**
* The alias of this.element.style.
* @member {String} style
* @memberof OpenSeadragon.Tile#
*/
this.style = null;
/**
* This tile's position on screen, in pixels.
* @member {OpenSeadragon.Point} position
@ -141,6 +171,12 @@ $.Tile = function(level, x, y, bounds, exists, url, context2D) {
* @memberof OpenSeadragon.Tile#
*/
this.size = null;
/**
* Whether to flip the tile when rendering.
* @member {Boolean} flipped
* @memberof OpenSeadragon.Tile#
*/
this.flipped = false;
/**
* The start time of this tile's blending.
* @member {Number} blendStart
@ -154,11 +190,13 @@ $.Tile = function(level, x, y, bounds, exists, url, context2D) {
*/
this.opacity = null;
/**
* The distance of this tile to the viewport center.
* @member {Number} distance
* The squared distance of this tile to the viewport center.
* Use for comparing tiles.
* @member {Number} squaredDistance
* @memberof OpenSeadragon.Tile#
* @private
*/
this.distance = null;
this.squaredDistance = null;
/**
* The visibility score of this tile.
* @member {Number} visibility
@ -166,21 +204,70 @@ $.Tile = function(level, x, y, bounds, exists, url, context2D) {
*/
this.visibility = null;
/**
* The transparency indicator of this tile.
* @member {Boolean} hasTransparency true if tile contains transparency for correct rendering
* @memberof OpenSeadragon.Tile#
*/
this.hasTransparency = false;
/**
* Whether this tile is currently being drawn.
* @member {Boolean} beingDrawn
* @memberof OpenSeadragon.Tile#
*/
this.beingDrawn = false;
/**
* Timestamp the tile was last touched.
* @member {Number} lastTouchTime
* @memberof OpenSeadragon.Tile#
*/
this.lastTouchTime = 0;
/**
* Whether this tile is in the right-most column for its level.
* @member {Boolean} isRightMost
* @memberof OpenSeadragon.Tile#
*/
this.isRightMost = false;
/**
* Whether this tile is in the bottom-most row for its level.
* @member {Boolean} isBottomMost
* @memberof OpenSeadragon.Tile#
*/
this.isBottomMost = false;
/**
* Owner of this tile. Do not change this property manually.
* @member {OpenSeadragon.TiledImage}
* @memberof OpenSeadragon.Tile#
*/
this.tiledImage = null;
/**
* Array of cached tile data associated with the tile.
* @member {Object}
* @private
*/
this._caches = {};
/**
* Processing flag, exempt the tile from removal when there are ongoing updates
* @member {Boolean|Number}
* @private
*/
this.processing = false;
/**
* Processing promise, resolves when the tile exits processing, or
* resolves immediatelly if not in the processing state.
* @member {OpenSeadragon.Promise}
* @private
*/
this.processingPromise = $.Promise.resolve();
};
$.Tile.prototype = /** @lends OpenSeadragon.Tile.prototype */{
/** @lends OpenSeadragon.Tile.prototype */
$.Tile.prototype = {
/**
* Provides a string representation of this tiles level and (x,y)
@ -193,142 +280,524 @@ $.Tile.prototype = /** @lends OpenSeadragon.Tile.prototype */{
},
/**
* Renders the tile in an html container.
* @function
* @param {Element} container
* The unique main cache key for this tile. Created automatically
* from the given tiledImage.source.getTileHashKey(...) implementation.
* @member {String} cacheKey
* @memberof OpenSeadragon.Tile#
*/
drawHTML: function( container ) {
if (!this.cacheImageRecord) {
$.console.warn(
'[Tile.drawHTML] attempting to draw tile %s when it\'s not cached',
this.toString());
get cacheKey() {
return this._cKey;
},
set cacheKey(value) {
if (value === this.cacheKey) {
return;
}
if ( !this.loaded ) {
$.console.warn(
"Attempting to draw tile %s when it's not yet loaded.",
this.toString()
);
return;
const cache = this.getCache(value);
if (!cache) {
// It's better to first set cache, then change the key to existing one. Warn if otherwise.
$.console.warn("[Tile.cacheKey] should not be set manually. Use addCache() with setAsMain=true.");
}
//EXPERIMENTAL - trying to figure out how to scale the container
// content during animation of the container size.
if ( !this.element ) {
this.element = $.makeNeutralElement( "div" );
this.imgElement = this.cacheImageRecord.getImage().cloneNode();
this.imgElement.style.msInterpolationMode = "nearest-neighbor";
this.imgElement.style.width = "100%";
this.imgElement.style.height = "100%";
this.style = this.element.style;
this.style.position = "absolute";
}
if ( this.element.parentNode != container ) {
container.appendChild( this.element );
}
if ( this.imgElement.parentNode != this.element ) {
this.element.appendChild( this.imgElement );
}
this.style.top = this.position.y + "px";
this.style.left = this.position.x + "px";
this.style.height = this.size.y + "px";
this.style.width = this.size.x + "px";
$.setElementOpacity( this.element, this.opacity );
this._updateMainCacheKey(value);
},
/**
* Renders the tile in a canvas-based context.
* @function
* @param {Canvas} context
* @param {Function} drawingHandler - Method for firing the drawing event.
* drawingHandler({context, tile, rendered})
* where <code>rendered</code> is the context with the pre-drawn image.
* By default equal to tile.cacheKey, marks a cache associated with this tile
* that holds the cache original data (it was loaded with). In case you
* change the tile data, the tile original data should be left with the cache
* 'originalCacheKey' and the new, modified data should be stored in cache 'cacheKey'.
* This key is used in cache resolution: in case new tile data is requested, if
* this cache key exists in the cache it is loaded.
* @member {String} originalCacheKey
* @memberof OpenSeadragon.Tile#
*/
drawCanvas: function( context, drawingHandler ) {
set originalCacheKey(value) {
throw "Original Cache Key cannot be managed manually!";
},
get originalCacheKey() {
return this._ocKey;
},
var position = this.position,
size = this.size,
rendered;
/**
* The Image object for this tile.
* @member {Object} image
* @memberof OpenSeadragon.Tile#
* @deprecated
* @returns {Image}
*/
get image() {
$.console.error("[Tile.image] property has been deprecated. Use [Tile.getData] instead.");
return this.getImage();
},
if (!this.context2D && !this.cacheImageRecord) {
/**
* The URL of this tile's image.
* @member {String} url
* @memberof OpenSeadragon.Tile#
* @deprecated
* @returns {String}
*/
get url() {
$.console.error("[Tile.url] property has been deprecated. Use [Tile.getUrl] instead.");
return this.getUrl();
},
/**
* The HTML div element for this tile
* @member {Element} element
* @memberof OpenSeadragon.Tile#
* @deprecated
*/
get element() {
$.console.error("Tile::element property is deprecated. Use cache API instead. Moreover, this property might be unstable.");
const cache = this.getCache();
if (!cache || !cache.loaded) {
return null;
}
if (cache.type !== OpenSeadragon.HTMLDrawer.canvasCacheType || cache.type !== OpenSeadragon.HTMLDrawer.imageCacheType) {
$.console.error("Access to HtmlDrawer property via Tile instance: HTMLDrawer must be used!");
return null;
}
return cache.data.element;
},
/**
* The HTML img element for this tile.
* @member {Element} imgElement
* @memberof OpenSeadragon.Tile#
* @deprecated
*/
get imgElement() {
$.console.error("Tile::imgElement property is deprecated. Use cache API instead. Moreover, this property might be unstable.");
const cache = this.getCache();
if (!cache || !cache.loaded) {
return null;
}
if (cache.type !== OpenSeadragon.HTMLDrawer.canvasCacheType || cache.type !== OpenSeadragon.HTMLDrawer.imageCacheType) {
$.console.error("Access to HtmlDrawer property via Tile instance: HTMLDrawer must be used!");
return null;
}
return cache.data.imgElement;
},
/**
* The alias of this.element.style.
* @member {String} style
* @memberof OpenSeadragon.Tile#
* @deprecated
*/
get style() {
$.console.error("Tile::style property is deprecated. Use cache API instead. Moreover, this property might be unstable.");
const cache = this.getCache();
if (!cache || !cache.loaded) {
return null;
}
if (cache.type !== OpenSeadragon.HTMLDrawer.canvasCacheType || cache.type !== OpenSeadragon.HTMLDrawer.imageCacheType) {
$.console.error("Access to HtmlDrawer property via Tile instance: HTMLDrawer must be used!");
return null;
}
return cache.data.style;
},
/**
* Get the Image object for this tile.
* @returns {?Image}
*/
getImage: function() {
$.console.error("[Tile.getImage] property has been deprecated. Use 'tile-invalidated' routine event instead.");
//this method used to ensure the underlying data model conformed to given type - convert instead of getData()
const cache = this.getCache(this.cacheKey);
if (!cache) {
return undefined;
}
cache.transformTo("image");
return cache.data;
},
/**
* Get the url string for this tile.
* @returns {String}
*/
getUrl: function() {
if (typeof this._url === 'function') {
return this._url();
}
return this._url;
},
/**
* Get the CanvasRenderingContext2D instance for tile image data drawn
* onto Canvas if enabled and available
* @returns {CanvasRenderingContext2D|undefined}
*/
getCanvasContext: function() {
$.console.error("[Tile.getCanvasContext] property has been deprecated. Use 'tile-invalidated' routine event instead.");
//this method used to ensure the underlying data model conformed to given type - convert instead of getData()
const cache = this.getCache(this.cacheKey);
if (!cache) {
return undefined;
}
cache.transformTo("context2d");
return cache.data;
},
/**
* The context2D of this tile if it is provided directly by the tile source.
* @deprecated
* @type {CanvasRenderingContext2D}
*/
get context2D() {
$.console.error("[Tile.context2D] property has been deprecated. Use 'tile-invalidated' routine event instead.");
return this.getCanvasContext();
},
/**
* The context2D of this tile if it is provided directly by the tile source.
* @deprecated
*/
set context2D(value) {
$.console.error("[Tile.context2D] property has been deprecated. Use 'tile-invalidated' routine event instead.");
const cache = this._caches[this.cacheKey];
if (cache) {
this.removeCache(this.cacheKey);
}
this.addCache(this.cacheKey, value, 'context2d', true, false);
},
/**
* The default cache for this tile.
* @deprecated
* @type OpenSeadragon.CacheRecord
*/
get cacheImageRecord() {
$.console.error("[Tile.cacheImageRecord] property has been deprecated. Use Tile::getCache.");
return this.getCache(this.cacheKey);
},
/**
* The default cache for this tile.
* @deprecated
*/
set cacheImageRecord(value) {
$.console.error("[Tile.cacheImageRecord] property has been deprecated. Use Tile::addCache.");
const cache = this._caches[this.cacheKey];
if (cache) {
this.removeCache(this.cacheKey);
}
if (value) {
if (value.loaded) {
this.addCache(this.cacheKey, value.data, value.type, true, false);
} else {
value.await().then(x => this.addCache(this.cacheKey, x, value.type, true, false));
}
}
},
/**
* Cache key for main cache that is 'cache-equal', but different from original cache key
* @return {string}
* @private
*/
buildDistinctMainCacheKey: function () {
return this.cacheKey === this.originalCacheKey ? "mod://" + this.originalCacheKey : this.cacheKey;
},
/**
* Read tile cache data object (CacheRecord)
* @param {string} [key=this.cacheKey] cache key to read that belongs to this tile
* @return {OpenSeadragon.CacheRecord}
*/
getCache: function(key = this._cKey) {
const cache = this._caches[key];
if (cache) {
cache.withTileReference(this);
}
return cache;
},
/**
* Create tile cache for given data object.
*
* Using `setAsMain` updates also main tile cache key - the main cache key used to draw this tile.
* In that case, the cache should be ready to be rendered immediatelly (converted to one of the supported formats
* of the currently employed drawer).
*
* NOTE: if the existing cache already exists,
* data parameter is ignored and inherited from the existing cache object.
* WARNING: if you override main tile cache key to point to a different cache, the invalidation routine
* will no longer work. If you need to modify tile main data, prefer to use invalidation routine instead.
*
* @param {string} key cache key, if unique, new cache object is created, else existing cache attached
* @param {*} data this data will be IGNORED if cache already exists; therefore if
* `typeof data === 'function'` holds (both async and normal functions), the data is called to obtain
* the data item: this is an optimization to load data only when necessary.
* @param {string} [type=undefined] data type, will be guessed if not provided (not recommended),
* if data is a callback the type is a mandatory field, not setting it results in undefined behaviour
* @param {boolean} [setAsMain=false] if true, the key will be set as the tile.cacheKey,
* no effect if key === this.cacheKey
* @param [_safely=true] private
* @returns {OpenSeadragon.CacheRecord|null} - The cache record the tile was attached to.
*/
addCache: function(key, data, type = undefined, setAsMain = false, _safely = true) {
const tiledImage = this.tiledImage;
if (!tiledImage) {
return null; //async can access outside its lifetime
}
if (!type) {
if (!this.__typeWarningReported) {
$.console.warn(this, "[Tile.addCache] called without type specification. " +
"Automated deduction is potentially unsafe: prefer specification of data type explicitly.");
this.__typeWarningReported = true;
}
if (typeof data === 'function') {
$.console.error("[TileCache.cacheTile] options.data as a callback requires type argument! Current is " + type);
}
type = $.convertor.guessType(data);
}
const overwritesMainCache = key === this.cacheKey;
if (_safely && (overwritesMainCache || setAsMain)) {
// Need to get the supported type for rendering out of the active drawer.
const supportedTypes = tiledImage.viewer.drawer.getSupportedDataFormats();
const conversion = $.convertor.getConversionPath(type, supportedTypes);
$.console.assert(conversion, "[Tile.addCache] data was set for the default tile cache we are unable" +
`to render. Make sure OpenSeadragon.convertor was taught to convert ${type} to (one of): ${conversion.toString()}`);
}
const cachedItem = tiledImage._tileCache.cacheTile({
data: data,
dataType: type,
tile: this,
cacheKey: key,
cutoff: tiledImage.source.getClosestLevel(),
});
const havingRecord = this._caches[key];
if (havingRecord !== cachedItem) {
this._caches[key] = cachedItem;
if (havingRecord) {
havingRecord.removeTile(this);
tiledImage._tileCache.safeUnloadCache(havingRecord);
}
}
// Update cache key if differs and main requested
if (!overwritesMainCache && setAsMain) {
this._updateMainCacheKey(key);
}
return cachedItem;
},
/**
* Add cache object to the tile
*
* @param {string} key cache key, if unique, new cache object is created, else existing cache attached
* @param {OpenSeadragon.CacheRecord} cache the cache object to attach to this tile
* @param {boolean} [setAsMain=false] if true, the key will be set as the tile.cacheKey,
* no effect if key === this.cacheKey
* @param [_safely=true] private
* @returns {OpenSeadragon.CacheRecord|null} - Returns cache parameter reference if attached.
*/
setCache(key, cache, setAsMain = false, _safely = true) {
const tiledImage = this.tiledImage;
if (!tiledImage) {
return null; //async can access outside its lifetime
}
const overwritesMainCache = key === this.cacheKey;
if (_safely) {
$.console.assert(cache instanceof $.CacheRecord, "[Tile.setCache] cache must be a CacheRecord object!");
if (overwritesMainCache || setAsMain) {
// Need to get the supported type for rendering out of the active drawer.
const supportedTypes = tiledImage.viewer.drawer.getSupportedDataFormats();
const conversion = $.convertor.getConversionPath(cache.type, supportedTypes);
$.console.assert(conversion, "[Tile.setCache] data was set for the default tile cache we are unable" +
`to render. Make sure OpenSeadragon.convertor was taught to convert ${cache.type} to (one of): ${conversion.toString()}`);
}
}
const havingRecord = this._caches[key];
if (havingRecord !== cache) {
this._caches[key] = cache;
cache.addTile(this); // keep reference bidirectional
if (havingRecord) {
havingRecord.removeTile(this);
tiledImage._tileCache.safeUnloadCache(havingRecord);
}
}
// Update cache key if differs and main requested
if (!overwritesMainCache && setAsMain) {
this._updateMainCacheKey(key);
}
return cache;
},
/**
* Sets the main cache key for this tile and
* performs necessary updates
* @param value
* @private
*/
_updateMainCacheKey: function(value) {
let ref = this._caches[this._cKey];
if (ref) {
// make sure we free drawer internal cache if people change cache key externally
ref.destroyInternalCache();
}
this._cKey = value;
},
/**
* Get the number of caches available to this tile
* @returns {number} number of caches
*/
getCacheSize: function() {
return Object.values(this._caches).length;
},
/**
* Free tile cache. Removes by default the cache record if no other tile uses it.
* @param {string} key cache key, required
* @param {boolean} [freeIfUnused=true] set to false if zombie should be created
* @return {OpenSeadragon.CacheRecord|undefined} reference to the cache record if it was removed,
* undefined if removal was refused to perform (e.g. does not exist, it is an original data target etc.)
*/
removeCache: function(key, freeIfUnused = true) {
const deleteTarget = this._caches[key];
if (!deleteTarget) {
// try to erase anyway in case the cache got stuck in memory
this.tiledImage._tileCache.unloadCacheForTile(this, key, freeIfUnused, true);
return undefined;
}
const currentMainKey = this.cacheKey,
originalDataKey = this.originalCacheKey,
sameBuiltinKeys = currentMainKey === originalDataKey;
if (!sameBuiltinKeys && originalDataKey === key) {
$.console.warn("[Tile.removeCache] original data must not be manually deleted: other parts of the code might rely on it!",
"If you want the tile not to preserve the original data, toggle of data perseverance in tile.setData().");
return undefined;
}
if (currentMainKey === key) {
if (!sameBuiltinKeys && this._caches[originalDataKey]) {
// if we have original data let's revert back
this._updateMainCacheKey(originalDataKey);
} else {
$.console.warn("[Tile.removeCache] trying to remove the only cache that can be used to draw the tile!",
"If you want to remove the main cache, first set different cache as main with tile.addCache()");
return undefined;
}
}
if (this.tiledImage._tileCache.unloadCacheForTile(this, key, freeIfUnused, false)) {
//if we managed to free tile from record, we are sure we decreased cache count
delete this._caches[key];
}
return deleteTarget;
},
/**
* Get the ratio between current and original size.
* @function
* @deprecated
* @returns {number}
*/
getScaleForEdgeSmoothing: function() {
// getCanvasContext is deprecated and so should be this method.
$.console.warn("[Tile.getScaleForEdgeSmoothing] is deprecated, the following error is the consequence:");
const context = this.getCanvasContext();
if (!context) {
$.console.warn(
'[Tile.drawCanvas] attempting to draw tile %s when it\'s not cached',
'[Tile.drawCanvas] attempting to get tile scale %s when tile\'s not cached',
this.toString());
return;
return 1;
}
return context.canvas.width / (this.size.x * $.pixelDensityRatio);
},
rendered = this.context2D || this.cacheImageRecord.getRenderedContext();
if ( !this.loaded || !rendered ){
$.console.warn(
"Attempting to draw tile %s when it's not yet loaded.",
this.toString()
);
return;
}
context.save();
context.globalAlpha = this.opacity;
//if we are supposed to be rendering fully opaque rectangle,
//ie its done fading or fading is turned off, and if we are drawing
//an image with an alpha channel, then the only way
//to avoid seeing the tile underneath is to clear the rectangle
if (context.globalAlpha === 1 &&
(this.context2D || this.url.match('.png'))) {
//clearing only the inside of the rectangle occupied
//by the png prevents edge flikering
context.clearRect(
(position.x * $.pixelDensityRatio)+1,
(position.y * $.pixelDensityRatio)+1,
(size.x * $.pixelDensityRatio)-2,
(size.y * $.pixelDensityRatio)-2
);
}
// This gives the application a chance to make image manipulation
// changes as we are rendering the image
drawingHandler({context: context, tile: this, rendered: rendered});
context.drawImage(
rendered.canvas,
0,
0,
rendered.canvas.width,
rendered.canvas.height,
position.x * $.pixelDensityRatio,
position.y * $.pixelDensityRatio,
size.x * $.pixelDensityRatio,
size.y * $.pixelDensityRatio
/**
* Get a translation vector that when applied to the tile position produces integer coordinates.
* Needed to avoid swimming and twitching.
* @function
* @param {Number} [scale=1] - Scale to be applied to position.
* @returns {OpenSeadragon.Point}
*/
getTranslationForEdgeSmoothing: function(scale, canvasSize, sketchCanvasSize) {
// The translation vector must have positive values, otherwise the image goes a bit off
// the sketch canvas to the top and left and we must use negative coordinates to repaint it
// to the main canvas. In that case, some browsers throw:
// INDEX_SIZE_ERR: DOM Exception 1: Index or size was negative, or greater than the allowed value.
const x = Math.max(1, Math.ceil((sketchCanvasSize.x - canvasSize.x) / 2));
const y = Math.max(1, Math.ceil((sketchCanvasSize.y - canvasSize.y) / 2));
return new $.Point(x, y).minus(
this.position
.times($.pixelDensityRatio)
.times(scale || 1)
.apply(function(x) {
return x % 1;
})
);
context.restore();
},
/**
* Removes tile from its container.
* Reflect that a cache object was renamed. Called internally from TileCache.
* Do NOT call manually.
* @function
* @private
*/
unload: function() {
if ( this.imgElement && this.imgElement.parentNode ) {
this.imgElement.parentNode.removeChild( this.imgElement );
reflectCacheRenamed: function (oldKey, newKey) {
let cache = this._caches[oldKey];
if (!cache) {
return; // nothing to fix
}
if ( this.element && this.element.parentNode ) {
this.element.parentNode.removeChild( this.element );
// Do update via private refs, old key no longer exists in cache
if (oldKey === this._ocKey) {
this._ocKey = newKey;
}
if (oldKey === this._cKey) {
this._cKey = newKey;
}
// Working key is never updated, it will be invalidated (but do not dereference cache, just fix the pointers)
this._caches[newKey] = cache;
delete this._caches[oldKey];
},
this.element = null;
this.imgElement = null;
/**
* Check if two tiles are data-equal
* @param {OpenSeadragon.Tile} tile
*/
equals(tile) {
return this._ocKey === tile._ocKey;
},
/**
* Removes tile from the system: it will still be present in the
* OSD memory, but marked as loaded=false, and its data will be erased.
* @param {boolean} [erase=false]
*/
unload: function(erase = false) {
if (!this.loaded) {
return;
}
this.tiledImage._tileCache.unloadTile(this, erase);
},
/**
* this method shall be called only by cache system when the tile is already empty of data
* @private
*/
_unload: function () {
this.tiledImage = null;
this._caches = {};
this._cacheSize = 0;
this.loaded = false;
this.loading = false;
this._cKey = this._ocKey;
}
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@
* OpenSeadragon - TileSource
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -55,16 +55,25 @@
* @param {Object} options
* You can either specify a URL, or literally define the TileSource (by specifying
* width, height, tileSize, tileOverlap, minLevel, and maxLevel). For the former,
* the extending class is expected to implement 'getImageInfo' and 'configure'.
* the extending class is expected to implement 'supports' and 'configure'.
* Note that _in this case, the child class of getImageInfo() is ignored!_
* For the latter, the construction is assumed to occur through
* the extending classes implementation of 'configure'.
* @param {String} [options.url]
* The URL for the data necessary for this TileSource.
* @param {String} [options.referenceStripThumbnailUrl]
* The URL for a thumbnail image to be used by the reference strip
* @param {Function} [options.success]
* A function to be called upon successful creation.
* @param {Boolean} [options.ajaxWithCredentials]
* If this TileSource needs to make an AJAX call, this specifies whether to set
* the XHR's withCredentials (for accessing secure data).
* @param {Object} [options.ajaxHeaders]
* A set of headers to include in AJAX requests.
* @param {Boolean} [options.splitHashDataForPost]
* First occurrence of '#' in the options.url is used to split URL
* and the latter part is treated as POST data (applies to getImageInfo(...))
* Does not work if getImageInfo() is overridden and used (see the options description)
* @param {Number} [options.width]
* Width of the source image at max resolution in pixels.
* @param {Number} [options.height]
@ -109,7 +118,7 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
//by asynchronously fetching their configuration data.
$.EventSource.call( this );
//we allow options to override anything we dont treat as
//we allow options to override anything we don't treat as
//required via idiomatic options or which is functionally
//set depending on the state of the readiness of this tile
//source
@ -132,6 +141,12 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
} );
}
/**
* Retrieve context2D of this tile source
* @memberOf OpenSeadragon.TileSource
* @function getContext2D
*/
/**
* Ratio of width to height
* @member {Number} aspectRatio
@ -163,12 +178,14 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
* @memberof OpenSeadragon.TileSource#
*/
if( 'string' == $.type( arguments[ 0 ] ) ){
// TODO potentially buggy behavior: what if .url is used by child class before it calls super constructor?
// this can happen if old JS class definition is used
if( 'string' === $.type( arguments[ 0 ] ) ){
this.url = arguments[0];
}
if (this.url) {
//in case the getImageInfo method is overriden and/or implies an
//in case the getImageInfo method is overridden and/or implies an
//async mechanism set some safe defaults first
this.aspectRatio = 1;
this.dimensions = new $.Point( 10, 10 );
@ -187,10 +204,10 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
//explicit configuration via positional args in constructor
//or the more idiomatic 'options' object
this.ready = true;
this.aspectRatio = ( options.width && options.height ) ?
( options.width / options.height ) : 1;
this.aspectRatio = (options.width && options.height) ?
(options.width / options.height) : 1;
this.dimensions = new $.Point( options.width, options.height );
if ( this.tileSize ){
this._tileWidth = this._tileHeight = this.tileSize;
delete this.tileSize;
@ -212,7 +229,7 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
this._tileHeight = 0;
}
}
this.tileOverlap = options.tileOverlap ? options.tileOverlap : 0;
this.minLevel = options.minLevel ? options.minLevel : 0;
this.maxLevel = ( undefined !== options.maxLevel && null !== options.maxLevel ) ?
@ -230,17 +247,17 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
};
$.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
/** @lends OpenSeadragon.TileSource.prototype */
$.TileSource.prototype = {
getTileSize: function( level ) {
$.console.error(
"[TileSource.getTileSize] is deprecated." +
"[TileSource.getTileSize] is deprecated. " +
"Use TileSource.getTileWidth() and TileSource.getTileHeight() instead"
);
return this._tileWidth;
},
/**
* Return the tileWidth for a given level.
* Subclasses should override this if tileWidth can be different at different levels
@ -271,12 +288,32 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
return this._tileHeight;
},
/**
* Set the maxLevel to the given level, and perform the memoization of
* getLevelScale with the new maxLevel. This function can be useful if the
* memoization is required before the first call of getLevelScale, or both
* memoized getLevelScale and maxLevel should be changed accordingly.
* @function
* @param {Number} level
*/
setMaxLevel: function( level ) {
this.maxLevel = level;
this._memoizeLevelScale();
},
/**
* @function
* @param {Number} level
*/
getLevelScale: function( level ) {
// if getLevelScale is not memoized, we generate the memoized version
// at the first call and return the result
this._memoizeLevelScale();
return this.getLevelScale( level );
},
// private
_memoizeLevelScale: function() {
// see https://github.com/openseadragon/openseadragon/issues/22
// we use the tilesources implementation of getLevelScale to generate
// a memoized re-implementation
@ -288,7 +325,6 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
this.getLevelScale = function( _level ){
return levelScaleCache[ _level ];
};
return this.getLevelScale( level );
},
/**
@ -309,8 +345,8 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
*/
getPixelRatio: function( level ) {
var imageSizeScaled = this.dimensions.times( this.getLevelScale( level ) ),
rx = 1.0 / imageSizeScaled.x,
ry = 1.0 / imageSizeScaled.y;
rx = 1.0 / imageSizeScaled.x * $.pixelDensityRatio,
ry = 1.0 / imageSizeScaled.y * $.pixelDensityRatio;
return new $.Point(rx, ry);
},
@ -318,25 +354,20 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
/**
* @function
* @param {Number} level
* @returns {Number} The highest level in this tile source that can be contained in a single tile.
*/
getClosestLevel: function( rect ) {
getClosestLevel: function() {
var i,
tilesPerSide,
tiles;
for( i = this.minLevel; i < this.maxLevel; i++ ){
tiles = this.getNumTiles( i );
tilesPerSide = new $.Point(
Math.floor( rect.x / this.getTileWidth(i) ),
Math.floor( rect.y / this.getTileHeight(i) )
);
if( tiles.x + 1 >= tilesPerSide.x && tiles.y + 1 >= tilesPerSide.y ){
for (i = this.minLevel + 1; i <= this.maxLevel; i++){
tiles = this.getNumTiles(i);
if (tiles.x > 1 || tiles.y > 1) {
break;
}
}
return Math.max( 0, i - 1 );
return i - 1;
},
/**
@ -344,12 +375,30 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
* @param {Number} level
* @param {OpenSeadragon.Point} point
*/
getTileAtPoint: function( level, point ) {
var pixel = point.times( this.dimensions.x ).times( this.getLevelScale(level) ),
tx = Math.floor( pixel.x / this.getTileWidth(level) ),
ty = Math.floor( pixel.y / this.getTileHeight(level) );
getTileAtPoint: function(level, point) {
var validPoint = point.x >= 0 && point.x <= 1 &&
point.y >= 0 && point.y <= 1 / this.aspectRatio;
$.console.assert(validPoint, "[TileSource.getTileAtPoint] must be called with a valid point.");
return new $.Point( tx, ty );
var widthScaled = this.dimensions.x * this.getLevelScale(level);
var pixelX = point.x * widthScaled;
var pixelY = point.y * widthScaled;
var x = Math.floor(pixelX / this.getTileWidth(level));
var y = Math.floor(pixelY / this.getTileHeight(level));
// When point.x == 1 or point.y == 1 / this.aspectRatio we want to
// return the last tile of the row/column
if (point.x >= 1) {
x = this.getNumTiles(level).x - 1;
}
var EPSILON = 1e-15;
if (point.y >= 1 / this.aspectRatio - EPSILON) {
y = this.getNumTiles(level).y - 1;
}
return new $.Point(x, y);
},
/**
@ -357,8 +406,12 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
* @param {Number} level
* @param {Number} x
* @param {Number} y
* @param {Boolean} [isSource=false] Whether to return the source bounds of the tile.
* @returns {OpenSeadragon.Rect} Either where this tile fits (in normalized coordinates) or the
* portion of the tile to use as the source of the drawing operation (in pixels), depending on
* the isSource parameter.
*/
getTileBounds: function( level, x, y ) {
getTileBounds: function( level, x, y, isSource ) {
var dimensionsScaled = this.dimensions.times( this.getLevelScale( level ) ),
tileWidth = this.getTileWidth(level),
tileHeight = this.getTileHeight(level),
@ -371,6 +424,10 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
sx = Math.min( sx, dimensionsScaled.x - px );
sy = Math.min( sy, dimensionsScaled.y - py );
if (isSource) {
return new $.Rect(0, 0, sx, sy);
}
return new $.Rect( px * scale, py * scale, sx * scale, sy * scale );
},
@ -378,6 +435,13 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
/**
* Responsible for retrieving, and caching the
* image metadata pertinent to this TileSources implementation.
* There are three scenarios of opening a tile source: providing a parseable string, plain object, or an URL.
* This method is only called by OSD if the TileSource configuration is a non-parseable string (~url).
*
* The string can contain a hash `#` symbol, followed by
* key=value arguments. If this is the case, this method sends this
* data as a POST body.
*
* @function
* @param {String} url
* @throws {Error}
@ -402,8 +466,17 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
}
}
var postData = null;
if (this.splitHashDataForPost) {
var hashIdx = url.indexOf("#");
if (hashIdx !== -1) {
postData = url.substring(hashIdx + 1);
url = url.substr(0, hashIdx);
}
}
callback = function( data ){
if( typeof(data) === "string" ) {
if( typeof (data) === "string" ) {
data = $.parseXml( data );
}
var $TileSource = $.TileSource.determineType( _this, data, url );
@ -423,7 +496,7 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
return;
}
options = $TileSource.prototype.configure.apply( _this, [ data, url ]);
options = $TileSource.prototype.configure.apply( _this, [ data, url, postData ]);
if (options.ajaxWithCredentials === undefined) {
options.ajaxWithCredentials = _this.ajaxWithCredentials;
}
@ -447,7 +520,7 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
//TODO: Its not very flexible to require tile sources to end jsonp
// request for info with a url that ends with '.js' but for
// now it's the only way I see to distinguish uniformly.
callbackName = url.split( '/' ).pop().replace('.js','');
callbackName = url.split('/').pop().replace('.js', '');
$.jsonp({
url: url,
async: false,
@ -458,7 +531,9 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
// request info via xhr asynchronously.
$.makeAjaxRequest( {
url: url,
postData: postData,
withCredentials: this.ajaxWithCredentials,
headers: this.ajaxHeaders,
success: function( xhr ) {
var data = processResponse( xhr );
callback( data );
@ -472,18 +547,20 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
exception rather than the second one raised when we try to access xhr.status
*/
try {
msg = "HTTP " + xhr.status + " attempting to load TileSource";
msg = "HTTP " + xhr.status + " attempting to load TileSource: " + url;
} catch ( e ) {
var formattedExc;
if ( typeof( exc ) == "undefined" || !exc.toString ) {
if ( typeof ( exc ) === "undefined" || !exc.toString ) {
formattedExc = "Unknown error";
} else {
formattedExc = exc.toString();
}
msg = formattedExc + " attempting to load TileSource";
msg = formattedExc + " attempting to load TileSource: " + url;
}
$.console.error(msg);
/***
* Raised when an error occurs loading a TileSource.
*
@ -493,11 +570,14 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
* @property {OpenSeadragon.TileSource} eventSource - A reference to the TileSource which raised the event.
* @property {String} message
* @property {String} source
* @property {String} postData - HTTP POST data (usually but not necessarily in k=v&k2=v2... form,
* see TileSource::getTilePostData) or null
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
_this.raiseEvent( 'open-failed', {
message: msg,
source: url
source: url,
postData: postData
});
}
});
@ -506,23 +586,34 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
},
/**
* Responsible determining if a the particular TileSource supports the
* Responsible for determining if the particular TileSource supports the
* data format ( and allowed to apply logic against the url the data was
* loaded from, if any ). Overriding implementations are expected to do
* something smart with data and / or url to determine support. Also
* understand that iteration order of TileSources is not guarunteed so
* understand that iteration order of TileSources is not guaranteed so
* please make sure your data or url is expressive enough to ensure a simple
* and sufficient mechanisim for clear determination.
* and sufficient mechanism for clear determination.
* @function
* @param {String|Object|Array|Document} data
* @param {String} url - the url the data was loaded
* from if any.
* @return {Boolean}
* @returns {Boolean}
*/
supports: function( data, url ) {
return false;
},
/**
* Check whether two tileSources are equal. This is used for example
* when replacing tile-sources, which turns on the zombie cache before
* old item removal.
* @param {OpenSeadragon.TileSource} otherSource
* @returns {Boolean}
*/
equals: function (otherSource) {
return false;
},
/**
* Responsible for parsing and configuring the
* image metadata pertinent to this TileSources implementation.
@ -534,17 +625,30 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
* @param {String|Object|Array|Document} data
* @param {String} url - the url the data was loaded
* from if any.
* @return {Object} options - A dictionary of keyword arguments sufficient
* to configure this tile sources constructor.
* @param {String} postData - HTTP POST data in k=v&k2=v2... form or null value obtained from
* the protocol URL after '#' sign if flag splitHashDataForPost set to 'true'
* @returns {Object} options - A dictionary of keyword arguments sufficient
* to configure the tile source constructor (include all values you want to
* instantiate the TileSource subclass with - what _options_ object should contain).
* @throws {Error}
*/
configure: function( data, url ) {
configure: function( data, url, postData ) {
throw new Error( "Method not implemented." );
},
/**
* Responsible for retriving the url which will return an image for the
* region speified by the given x, y, and level components.
* Shall this source need to free some objects
* upon unloading, it must be done here. For example, canvas
* size must be set to 0 for safari to free.
* @param {OpenSeadragon.Viewer} viewer
*/
destroy: function ( viewer ) {
//no-op
},
/**
* Responsible for retrieving the url which will return an image for the
* region specified by the given x, y, and level components.
* This method is not implemented by this class other than to throw an Error
* announcing you have to implement it. Because of the variety of tile
* server technologies, and various specifications for building image
@ -553,12 +657,98 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
* @param {Number} level
* @param {Number} x
* @param {Number} y
* @returns {String|Function} url - A string for the url or a function that returns a url string.
* @throws {Error}
*/
getTileUrl: function( level, x, y ) {
throw new Error( "Method not implemented." );
},
/**
* Must use AJAX in order to work, i.e. loadTilesWithAjax = true is set.
* If a value is returned, ajax issues POST request to the tile url.
* If null is returned, ajax issues GET request.
* The return value must comply to the header 'content type'.
*
* Examples (USED HEADER --> getTilePostData CODE):
* 'Content-type': 'application/x-www-form-urlencoded' -->
* return "key1=value=1&key2=value2";
*
* 'Content-type': 'application/x-www-form-urlencoded' -->
* return JSON.stringify({key: "value", number: 5});
*
* 'Content-type': 'multipart/form-data' -->
* let result = new FormData();
* result.append("data", myData);
* return result;
*
* IMPORTANT: in case you move all the logic on image fetching
* to post data, you must re-define 'getTileHashKey(...)' to
* stay unique for different tile images.
*
* @param {Number} level
* @param {Number} x
* @param {Number} y
* @returns {*|null} post data to send with tile configuration request
*/
getTilePostData: function( level, x, y ) {
return null;
},
/**
* Responsible for retrieving the headers which will be attached to the image request for the
* region specified by the given x, y, and level components.
* This option is only relevant if {@link OpenSeadragon.Options}.loadTilesWithAjax is set to true.
* The headers returned here will override headers specified at the Viewer or TiledImage level.
* Specifying a falsy value for a header will clear its existing value set at the Viewer or
* TiledImage level (if any).
*
* Note that the headers of existing tiles don't automatically change when this function
* returns updated headers. To do that, you need to call {@link OpenSeadragon.Viewer#setAjaxHeaders}
* and propagate the changes.
*
* @function
* @param {Number} level
* @param {Number} x
* @param {Number} y
* @returns {Object}
*/
getTileAjaxHeaders: function( level, x, y ) {
return {};
},
/**
* The tile cache object is uniquely determined by this key and used to lookup
* the image data in cache: keys should be different if images are different.
*
* You can return falsey tile cache key, in which case the tile will
* be created without invoking ImageJob --- but with data=null. Then,
* you are responsible for manually creating the cache data. This is useful
* particularly if you want to use empty TiledImage with client-side derived data
* only. The default tile-cache key is then called "" - an empty string.
*
* Note: default behaviour does not take into account post data.
* @param {Number} level tile level it was fetched with
* @param {Number} x x-coordinate in the pyramid level
* @param {Number} y y-coordinate in the pyramid level
* @param {String} url the tile was fetched with
* @param {Object} ajaxHeaders the tile was fetched with
* @param {*} postData data the tile was fetched with (type depends on getTilePostData(..) return type)
* @return {?String} can return the cache key or null, in that case an empty cache is initialized
* without downloading any data for internal use: user has to define the cache contents manually, via
* the cache interface of this class.
*/
getTileHashKey: function(level, x, y, url, ajaxHeaders, postData) {
function withHeaders(hash) {
return ajaxHeaders ? hash + "+" + JSON.stringify(ajaxHeaders) : hash;
}
if (typeof url !== "string") {
return withHeaders(level + "/" + x + "_" + y);
}
return withHeaders(url);
},
/**
* @function
* @param {Number} level
@ -567,12 +757,217 @@ $.TileSource.prototype = /** @lends OpenSeadragon.TileSource.prototype */{
*/
tileExists: function( level, x, y ) {
var numTiles = this.getNumTiles( level );
return level >= this.minLevel &&
level <= this.maxLevel &&
x >= 0 &&
y >= 0 &&
x < numTiles.x &&
y < numTiles.y;
return level >= this.minLevel &&
level <= this.maxLevel &&
x >= 0 &&
y >= 0 &&
x < numTiles.x &&
y < numTiles.y;
},
/**
* Decide whether tiles have transparency: this is crucial for correct images blending.
* Overriden on a tile level by setting tile.hasTransparency = true;
* @param context2D unused, deprecated argument
* @param url tile.getUrl() value for given tile
* @param ajaxHeaders tile.ajaxHeaders value for given tile
* @param post tile.post value for given tile
* @returns {boolean} true if the image has transparency
*/
hasTransparency: function(context2D, url, ajaxHeaders, post) {
return url.match('.png');
},
/**
* Download tile data.
* Note that if you override this function, you should override also downloadTileAbort().
* @param {ImageJob} context job context that you have to call finish(...) on.
* @param {String} [context.src] - URL of image to download.
* @param {String} [context.loadWithAjax] - Whether to load this image with AJAX.
* @param {String} [context.ajaxHeaders] - Headers to add to the image request if using AJAX.
* @param {Boolean} [context.ajaxWithCredentials] - Whether to set withCredentials on AJAX requests.
* @param {String} [context.crossOriginPolicy] - CORS policy to use for downloads
* @param {?String|?Object} [context.postData] - HTTP POST data (usually but not necessarily
* in k=v&k2=v2... form, see TileSource::getTilePostData) or null
* @param {*} [context.userData] - Empty object to attach your own data and helper variables to.
* @param {Function} [context.finish] - Should be called unless abort() was executed upon successful
* data retrieval.
* Usage: context.finish(data, request, dataType=undefined). Pass the downloaded data object
* add also reference to an ajax request if used. Optionally, specify what data type the data is.
* @param {Function} [context.fail] - Should be called unless abort() was executed upon unsuccessful request.
* Usage: context.fail(errMessage, request). Provide error message in case of failure,
* add also reference to an ajax request if used.
* @param {Function} [context.abort] - Called automatically when the job times out.
* Usage: if you decide to abort the request (no fail/finish will be called), call context.abort().
* @param {Function} [context.callback] Private parameter. Called automatically once image has been downloaded
* (triggered by finish).
* @param {Number} [context.timeout] Private parameter. The max number of milliseconds that
* this image job may take to complete.
* @param {string} [context.errorMsg] Private parameter. The final error message, default null (set by finish).
*/
downloadTileStart: function (context) {
const dataStore = context.userData,
image = new Image();
dataStore.image = image;
dataStore.request = null;
const finalize = function(error) {
if (error || !image) {
context.fail(error || "[downloadTileStart] Image load failed: undefined Image instance.",
dataStore.request);
return;
}
image.onload = image.onerror = image.onabort = null;
context.finish(image, dataStore.request, "image");
};
image.onload = function () {
finalize();
};
image.onabort = image.onerror = function() {
finalize("[downloadTileStart] Image load aborted.");
};
// Load the tile with an AJAX request if the loadWithAjax option is
// set. Otherwise load the image by setting the source property of the image object.
if (context.loadWithAjax) {
dataStore.request = $.makeAjaxRequest({
url: context.src,
withCredentials: context.ajaxWithCredentials,
headers: context.ajaxHeaders,
responseType: "arraybuffer",
postData: context.postData,
success: function(request) {
var blb;
// Make the raw data into a blob.
// BlobBuilder fallback adapted from
// http://stackoverflow.com/questions/15293694/blob-constructor-browser-compatibility
try {
blb = new window.Blob([request.response]);
} catch (e) {
const BlobBuilder = (
window.BlobBuilder ||
window.WebKitBlobBuilder ||
window.MozBlobBuilder ||
window.MSBlobBuilder
);
if (e.name === 'TypeError' && BlobBuilder) {
const bb = new BlobBuilder();
bb.append(request.response);
blb = bb.getBlob();
}
}
// If the blob is empty for some reason consider the image load a failure.
if (blb.size === 0) {
finalize("[downloadTileStart] Empty image response.");
} else {
// Create a URL for the blob data and make it the source of the image object.
// This will still trigger Image.onload to indicate a successful tile load.
image.src = (window.URL || window.webkitURL).createObjectURL(blb);
}
},
error: function(request) {
finalize("[downloadTileStart] Image load aborted - XHR error");
}
});
} else {
if (context.crossOriginPolicy !== false) {
image.crossOrigin = context.crossOriginPolicy;
}
image.src = context.src;
}
},
/**
* Provide means of aborting the execution.
* Note that if you override this function, you should override also downloadTileStart().
* Note that calling job.abort() would create an infinite loop!
*
* @param {ImageJob} context job, the same object as with downloadTileStart(..)
* @param {*} [context.userData] - Empty object to attach (and mainly read) your own data.
*/
downloadTileAbort: function (context) {
if (context.userData.request) {
context.userData.request.abort();
}
var image = context.userData.image;
if (context.userData.image) {
image.onload = image.onerror = image.onabort = null;
}
},
/**
* Create cache object from the result of the download process. The
* cacheObject parameter should be used to attach the data to, there are no
* conventions on how it should be stored - all the logic is implemented within *TileCache() functions.
*
* Note that
* - data is cached automatically as cacheObject.data
* - if you override any of *TileCache() functions, you should override all of them.
* - these functions might be called over shared cache object managed by other TileSources simultaneously.
* @param {OpenSeadragon.CacheRecord} cacheObject context cache object
* @param {*} data image data, the data sent to ImageJob.prototype.finish(), by default an Image object
* @param {OpenSeadragon.Tile} tile instance the cache was created with
* @deprecated
*/
createTileCache: function(cacheObject, data, tile) {
$.console.error("[TileSource.createTileCache] has been deprecated. Use cache API of a tile instead.");
//no-op, we create the cache automatically
},
/**
* Cache object destructor, unset all properties you created to allow GC collection.
* Note that if you override any of *TileCache() functions, you should override all of them.
* Note that these functions might be called over shared cache object managed by other TileSources simultaneously.
* Original cache data is cacheObject.data, but do not delete it manually! It is taken care for,
* you might break things.
* @param {OpenSeadragon.CacheRecord} cacheObject context cache object
* @deprecated
*/
destroyTileCache: function (cacheObject) {
$.console.error("[TileSource.destroyTileCache] has been deprecated. Use cache API of a tile instead.");
//no-op, handled internally
},
/**
* Raw data getter, should return anything that is compatible with the system, or undefined
* if the system can handle it.
* @param {OpenSeadragon.CacheRecord} cacheObject context cache object
* @returns {OpenSeadragon.Promise<?>} cache data
* @deprecated
*/
getTileCacheData: function(cacheObject) {
$.console.error("[TileSource.getTileCacheData] has been deprecated. Use cache API of a tile instead.");
return cacheObject.getDataAs(undefined, false);
},
/**
* Compatibility image element getter
* - plugins might need image representation of the data
* - div HTML rendering relies on image element presence
* Note that if you override any of *TileCache() functions, you should override all of them.
* Note that these functions might be called over shared cache object managed by other TileSources simultaneously.
* @param {OpenSeadragon.CacheRecord} cacheObject context cache object
* @returns {Image} cache data as an Image
* @deprecated
*/
getTileCacheDataAsImage: function(cacheObject) {
$.console.error("[TileSource.getTileCacheDataAsImage] has been deprecated. Use cache API of a tile instead.");
return cacheObject.getImage();
},
/**
* Compatibility context 2D getter
* - most heavily used rendering method is a canvas-based approach,
* convert the data to a canvas and return it's 2D context
* Note that if you override any of *TileCache() functions, you should override all of them.
* @param {OpenSeadragon.CacheRecord} cacheObject context cache object
* @returns {CanvasRenderingContext2D} context of the canvas representation of the cache data
* @deprecated
*/
getTileCacheDataAsContext2D: function(cacheObject) {
$.console.error("[TileSource.getTileCacheDataAsContext2D] has been deprecated. Use cache API of a tile instead.");
return cacheObject.getRenderedContext();
}
};
@ -598,13 +993,13 @@ function processResponse( xhr ){
throw new Error( $.getString( "Errors.Security" ) );
} else if ( xhr.status !== 200 && xhr.status !== 0 ) {
status = xhr.status;
statusText = ( status == 404 ) ?
statusText = ( status === 404 ) ?
"Not Found" :
xhr.statusText;
throw new Error( $.getString( "Errors.Status", status, statusText ) );
}
if( responseText.match(/\s*<.*/) ){
if( responseText.match(/^\s*<.*/) ){
try{
data = ( xhr.responseXML && xhr.responseXML.documentElement ) ?
xhr.responseXML :
@ -612,8 +1007,12 @@ function processResponse( xhr ){
} catch (e){
data = xhr.responseText;
}
}else if( responseText.match(/\s*[\{\[].*/) ){
data = $.parseJSON(responseText);
}else if( responseText.match(/\s*[{[].*/) ){
try{
data = $.parseJSON(responseText);
} catch(e){
data = responseText;
}
}else{
data = responseText;
}
@ -644,6 +1043,8 @@ $.TileSource.determineType = function( tileSource, data, url ){
}
$.console.error( "No TileSource was able to open %s %s", url, data );
return null;
};

View file

@ -2,7 +2,7 @@
* OpenSeadragon - TileSourceCollection
*
* Copyright (C) 2009 CodePlex Foundation
* Copyright (C) 2010-2013 OpenSeadragon contributors
* Copyright (C) 2010-2024 OpenSeadragon contributors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -32,11 +32,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function( $ ){
(function($) {
// deprecated
$.TileSourceCollection = function( tileSize, tileSources, rows, layout ) {
$.TileSourceCollection = function(tileSize, tileSources, rows, layout) {
$.console.error('TileSourceCollection is deprecated; use World instead');
};
}( OpenSeadragon ));
}(OpenSeadragon));

Some files were not shown because too many files have changed in this diff Show more