diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 803cf81..1e98443 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,5 +1,5 @@ - + **@mappable-world/mappable-cartesian-projection Version:** xxxxx diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f9ee4cf..e59436b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,10 +32,10 @@ npm run build After you create a new tag, or just push changes to the server, ci will be launched ```sh -npm version prerelease --preid=beta --no-git-tag-version +npm version patch --no-git-tag-version git add --all git commit -m "New version" -git tag 0.0.1-beta.2 +git tag 0.0.2 git push --tags origin HEAD:main ``` @@ -54,3 +54,19 @@ For it to work, you need to declare two secrets in the GitHub Action: - `APIKEY` - To run autotests on the JS API https://mappable.world/docs/js-api/quickstart.html#get-api-key - `NPM_TOKEN` - To publish your package to npm + +## Development loader + +```js +// Add loader at the beginning of the loader queue +mappable.import.loaders.unshift(async (pkg) => { + // Process only this package + if (!pkg.includes('@mappable-world/mappable-cartesian-projection')) return; + + // Load script directly. You can use another CDN + await mappable.import.script(`/dist/index.js`); + + // Return result object + return window['@mappable-world/mappable-cartesian-projection']; +}); +``` diff --git a/projection_scheme.png b/projection_scheme.png index 9e422ff..c5b8ccf 100644 Binary files a/projection_scheme.png and b/projection_scheme.png differ diff --git a/src/index.ts b/src/index.ts index 6e6c64e..c9ef887 100755 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ function cycleRestrict(value: number, min: number, max: number): number { /** * Creates a projection of a rectangular coordinate area into world coordinates. - * The area size in pixels is always 2*2. + * The area size in world is always 2*2. * * @name Cartesian * @class Cartesian projection of a rectangular area. @@ -16,7 +16,7 @@ function cycleRestrict(value: number, min: number, max: number): number { * @param {Boolean[]} [cycled=[false, false]] An array of signs of map looping by x and y. * @example * ```js - * mappable.ready(async () => { + * mappable.ready.then(async () => { * const {MMaps} = mappable; * // Calculate the size of all tiles at the maximum zoom. * const worldSize = Math.pow(2, MAX_ZOOM) * 256; @@ -44,6 +44,8 @@ export class Cartesian implements Projection { private _yRange!: number; private _worldSize!: number; + type: 'cartesian'; + constructor(bounds: [LngLat, LngLat], cycled: [boolean, boolean] = [false, false]) { this._bounds = bounds; this._cycled = cycled;