Skip to content
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

added setTransformRequest to map to allow dynamically setting the transformRequestFn #159

Merged
merged 3 commits into from
Jun 5, 2021

Conversation

thaddmt
Copy link
Contributor

@thaddmt thaddmt commented May 25, 2021

Description

  • Added api for setting a transformRequest instead of only being set in the constructor
    • This allows the map object to be created (without setting style so no rendering) and for the transformRequest to be dynamically set after the map object's instantiation
    • EX:
var map = new Map({
     container: "map",
     center: [-123.1187, 49.2819],
     zoom: 10,
   });
map.setTransformRequest((url: string, resourceType: string) => {});
map.setStyle(style);

Launch Checklist

  • confirm your changes do not include backports from Mapbox projects (unless with compliant license)
  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs

Copy link
Member

@lseelenbinder lseelenbinder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. Thanks @thaddmt!

@github-actions
Copy link
Contributor

github-actions bot commented May 26, 2021

Bundle size report:

Size Change: +24 B
Total Size Before: 205 kB
Total Size After: 205 kB

Output file Before After Change
maplibre-gl.js 196 kB 196 kB +24 B
maplibre-gl.css 8.87 kB 8.87 kB 0 B
ℹ️ View Details
Source file Before After Change
src/ui/map.js 6.51 kB 6.52 kB +16 B
src/util/mapbox.js 3.05 kB 3.07 kB +16 B
src/style-spec/expression/definitions/step.js 835 B 836 B +1 B
src/style-spec/expression/definitions/interpolate.js 1.36 kB 1.36 kB +1 B
src/style-spec/expression/definitions/index.js 1.69 kB 1.69 kB +1 B
src/data/array_types.js 2.75 kB 2.75 kB +1 B
src/symbol/anchor.js 322 B 323 B +1 B
src/symbol/symbol_layout.js 4.6 kB 4.6 kB +1 B
src/geo/lng_lat.js 632 B 633 B +1 B
src/symbol/symbol_size.js 614 B 613 B -1 B
src/util/browser.js 517 B 516 B -1 B
src/style-spec/expression/definitions/length.js 386 B 385 B -1 B
src/source/tile.js 2.05 kB 2.04 kB -1 B
src/util/image.js 750 B 749 B -1 B

@lseelenbinder
Copy link
Member

@nyurik it appears we have an unrelated CI test failure (test-browser) across a few MRs now. Should we merge regardless or do you want to fix that before we proceed with these merges?

@thaddmt
Copy link
Contributor Author

thaddmt commented Jun 4, 2021

@nyurik it appears we have an unrelated CI test failure (test-browser) across a few MRs now. Should we merge regardless or do you want to fix that before we proceed with these merges?

@lseelenbinder is there anything I can do to help here?

@wipfli
Copy link
Contributor

wipfli commented Jun 4, 2021

We updated the CI recently. Maybe you can fetch upstream and merge it into your branch?

@wipfli wipfli merged commit 89a5c3a into maplibre:main Jun 5, 2021
@wipfli
Copy link
Contributor

wipfli commented Jun 5, 2021

Thanks for contributing 🐟

@wipfli
Copy link
Contributor

wipfli commented Jun 5, 2021

Uh we forgot the changelog. Can you add an entry?

@thaddmt
Copy link
Contributor Author

thaddmt commented Jun 7, 2021

Sorry about that will add

@blq
Copy link

blq commented Jun 16, 2021

I know this is merged, but did you consider an API method like maybe map.registerTransformRequest(xfrm), that would push xfrms in a queue and applied in a first-match style? I.e if an xfrm returns undefined the next one is tested until one returns an url-object.
You could of course implement such functionality by injecting it in this setTransformRequest, but thought I'd bring it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants