Skip to content

Commit

Permalink
Add doc on sprite.
Browse files Browse the repository at this point in the history
  • Loading branch information
francois2metz committed Oct 2, 2021
1 parent 0196393 commit 7faa2b2
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,54 @@ const control = new LevelControl(indoorEqual);
map.addControl(control);
```

## Loading the default sprite

The default style make uses of a sprite that has to be loaded manually and require an absolute path. The sprite is already builded and available in the `sprite` directory.

To load the sprite, set the `spriteBaseUrl` property option on the constructor with the absolute path to the sprite and its name `/directory-to-change/indoorequal`.

**Usage with [Parcel](https://parceljs.org/)**

Install the
[parcel-plugin-static-files-copy](https://github.com/elwin013/parcel-plugin-static-files-copy)
package and add to your `package.json`:

"staticFiles": {
"staticPath": "node_modules/openlayers-indoorequal/sprite"
},

Then load the sprite:

```javascript
const indoorequal = new IndoorEqual(map, { apiKey: 'myKey', spriteBaseUrl: '/indoorequal' });
```

**Usage with [webpack](https://webpack.js.org/)**

Install the
[copy-webpack-plugin](https://github.com/webpack-contrib/copy-webpack-plugin)
package and add to your webpack config:

```javascript
const CopyPlugin = require('copy-webpack-plugin');

module.exports = {
plugins: [
new CopyPlugin({
patterns: [
{ from: 'node_modules/openlayers-indoorequal/sprite' },
],
}),
],
};
```

Then load the sprite:

```javascript
const indoorequal = new IndoorEqual(map, { apiKey: 'myKey', spriteBaseUrl: '/indoorequal' });
```

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
Expand Down

0 comments on commit 7faa2b2

Please sign in to comment.