-
Notifications
You must be signed in to change notification settings - Fork 358
Added custom fetchOptions management for overlays, added a proxyUrl parameter #1336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
5ccd24a
c5d7d80
ea57b15
18602ee
371bb6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -961,7 +961,8 @@ export class ImageOverlayPlugin { | |
| _initOverlay( overlay ) { | ||
|
|
||
| const { tiles } = this; | ||
| overlay.imageSource.fetchOptions = tiles.fetchOptions; | ||
| overlay.imageSource.fetchOptions = overlay.fetchOptions; | ||
|
|
||
SoftwareMechanic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if ( ! overlay.isInitialized ) { | ||
|
|
||
| overlay.imageSource.fetchData = ( ...args ) => tiles | ||
|
|
@@ -1407,8 +1408,12 @@ class ImageOverlay { | |
| opacity = 1, | ||
| color = 0xffffff, | ||
| frame = null, | ||
| fetchOptions = {}, | ||
| preprocessURL = null, | ||
| } = options; | ||
| this.imageSource = null; | ||
| this.fetchOptions = fetchOptions; | ||
|
||
| this.preprocessURL = preprocessURL; | ||
| this.opacity = opacity; | ||
| this.color = new Color( color ); | ||
| this.frame = frame !== null ? frame.clone() : null; | ||
|
|
@@ -1428,9 +1433,17 @@ class ImageOverlay { | |
|
|
||
| } | ||
|
|
||
| fetch( ...args ) { | ||
| // Apply proxy prefix and merge options | ||
| fetch( url, options = {} ) { | ||
|
|
||
| if ( this.preprocessURL ) { | ||
|
|
||
| url = this.preprocessURL( url ); | ||
|
|
||
| } | ||
|
|
||
| return fetch( ...args ); | ||
| const finalOptions = { ...this.fetchOptions, ...options }; | ||
SoftwareMechanic marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return fetch( url, finalOptions ); | ||
|
|
||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.