Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shtyr-maxim committed Oct 23, 2023
1 parent f0a4786 commit 97e5a00
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# @mappable-world/mappable-cartesian-projection package

---

Mappable JS API package

[![npm version](https://badge.fury.io/js/@mappable-world%2Fmappable-cartesian-projection.svg)](https://badge.fury.io/js/@mappable-world%2Fmappable-cartesian-projection)
[![npm](https://img.shields.io/npm/dm/@mappable-world/mappable-cartesian-projection.svg)](https://www.npmjs.com/package/@mappable-world/mappable-cartesian-projection)
[![Build Status](https://github.com/mappable-world/mappable-cartesian-projection/workflows/Run%20tests/badge.svg)](https://github.com/mappable-world/mappable-cartesian-projection/actions/workflows/tests.yml)

This package will project your cartesian dimensions to Mappable JS API world representation (see scheme of work below). Then you can use it as `MMap` `location` property, in `MMapListener` handlers, etc.

![projection scheme](https://github.com/mappable-world/mappable-tiles-generator/blob/main/projection_scheme.png?raw=true)

## Install

Install Cartesian projection package to be used in your project with
Expand Down Expand Up @@ -44,21 +46,19 @@ console.log(projection.fromWorldCoordinates({x: 0.5, y: 0})) // [200, 0]
console.log(projection.fromWorldCoordinates({x: 0, y: -0.125})) // [0, -75]
```

![projection scheme]( https://github.com/mappable-world/mappable-tiles-generator/blob/main/projection_scheme.png?raw=true)


### Usage without npm

You can use CDN with module loading handler in JS API on your page.

Just use `mappable.import`:
You can use `mappable.import`:

```js
const pkg = await mappable.import('@mappable-world/mappable-cartesian-projection')
const pkg = await mappable.import('@mappable-world/mappable-cartesian-projection');
```

By default `mappable.import` can load self modules.
If you want also load your package, should add `loader`:
**_NOTE:_**
By default `mappable.import` can load self modules, scripts or style.
To make the code above work, you should add a loader:

```js
// Add loader at start loaders array
Expand Down
4 changes: 1 addition & 3 deletions example/common.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
mappable.import.loaders.unshift(async (pkg) => {
if (!pkg.includes('@mappable-world/mappable-cartesian-projection')) {
return;
}
if (!pkg.includes('@mappable-world/mappable-cartesian-projection')) return;

if (location.href.includes('localhost')) {
await mappable.import.script(`/dist/index.js`);
Expand Down
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.

0 comments on commit 97e5a00

Please sign in to comment.