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

Expose buildModuleUrl as part of the Cesium API #8923

Merged
merged 3 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Improved `MaterialProperty` JSDoc and TypeScript type definitions, which were missing the ability to take primitive types in addition to Property instances in their constructor. [#8904](https://github.com/CesiumGS/cesium/pull/8904)
- Fixed `EllipsoidGeodesic` JSDoc and TypeScript type definitions which incorrectly listed `result` as required. [#8904](https://github.com/CesiumGS/cesium/pull/8904)
- Fixed a bug with handling of PixelFormat's flipY. [#8893](https://github.com/CesiumGS/cesium/pull/8893)
- Fixed JSDoc and TypeScript for `buildModuleUrl`, which was accidentally excluded from the official CesiumJS API.
- Fixed JSDoc and TypeScript type definitions for all `ImageryProvider` types, which were missing `defaultNightAlpha` and `defaultDayAlpha` properties. [#8908](https://github.com/CesiumGS/cesium/pull/8908)
- Fixed JSDoc and TypeScript type definitions for `EllipsoidTangentPlane.fromPoints`, which takes an array of `Cartesian3`, not a single instance. [#8928](https://github.com/CesiumGS/cesium/pull/8928)
- Fixed JSDoc and TypeScript type definitions for `EntityCollection.getById` and `CompositeEntityCollection.getById`, which can both return undefined. [#8928](https://github.com/CesiumGS/cesium/pull/8928)
Expand Down
19 changes: 13 additions & 6 deletions Source/Core/buildModuleUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,20 @@ function buildModuleUrlFromBaseUrl(moduleID) {
var implementation;

/**
* Given a non-relative moduleID, returns an absolute URL to the file represented by that module ID,
* using, in order of preference, require.toUrl, the value of a global CESIUM_BASE_URL, or
* the base URL of the Cesium.js script.
* Given a relative URL under the Cesium base URL, returns an absolute URL.
* @function
*
* @private
* @param {String} relativeUrl The relative path.
*
* @example
* var viewer = new Cesium.Viewer("cesiumContainer", {
* imageryProvider: new Cesium.TileMapServiceImageryProvider({
* url: Cesium.buildModuleUrl("Assets/Textures/NaturalEarthII"),
* }),
* baseLayerPicker: false,
* });
*/
function buildModuleUrl(moduleID) {
function buildModuleUrl(relativeUrl) {
if (!defined(implementation)) {
//select implementation
if (
Expand All @@ -111,7 +118,7 @@ function buildModuleUrl(moduleID) {
}
}

var url = implementation(moduleID);
var url = implementation(relativeUrl);
return url;
}

Expand Down