Skip to content

Commit

Permalink
add type & small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shtyr-maxim committed Oct 25, 2023
1 parent 9558fde commit c8429e0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- BUGS: Please use this template -->
<!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/@mappable-world/mappable-cartesian-projection -->
<!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/mappable-cartesian-projection -->

**@mappable-world/mappable-cartesian-projection Version:** xxxxx

Expand Down
20 changes: 18 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand All @@ -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'];
});
```
Binary file modified projection_scheme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c8429e0

Please sign in to comment.