Skip to content

Commit

Permalink
Release version 0.0.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
francois2metz committed Oct 3, 2021
1 parent 28065ac commit a2430ce
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
18 changes: 16 additions & 2 deletions dist/openlayers-indoorequal.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var TileGrid = require('ol/tilegrid/TileGrid');
var control = require('ol/control');
var style = require('ol/style');
var BaseObject = require('ol/Object');
var debounce = require('debounce');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

Expand All @@ -20,6 +21,7 @@ var TileJSON__default = /*#__PURE__*/_interopDefaultLegacy(TileJSON);
var MVT__default = /*#__PURE__*/_interopDefaultLegacy(MVT);
var TileGrid__default = /*#__PURE__*/_interopDefaultLegacy(TileGrid);
var BaseObject__default = /*#__PURE__*/_interopDefaultLegacy(BaseObject);
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);

function extentFromTileJSON(tileJSON) {
var bounds = tileJSON.bounds;
Expand Down Expand Up @@ -367,6 +369,8 @@ class IndoorEqual extends BaseObject__default["default"] {
this._changeLayerOnLevelChange();

this._setLayerStyle();

this._resetLevelOnLevelsChange();
}
/**
* Set the style for displayed features. This function takes a feature and resolution and returns an array of styles. If set to null, the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. Call setStyle() without arguments to reset to the default style. See module:ol/style for information on the default style.
Expand All @@ -389,11 +393,13 @@ class IndoorEqual extends BaseObject__default["default"] {
_listenForLevels() {
this.layer.on('change:source', () => {
const source = this.layer.getSource();
source.on('tileloadend', () => {
const refreshLevels = debounce__default["default"](() => {
const extent = this.map.getView().calculateExtent(this.map.getSize());
const features = source.getFeaturesInExtent(extent);
this.set('levels', findAllLevels(features));
});
}, 1000);
source.on('tileloadend', refreshLevels);
this.map.getView().on('change:center', refreshLevels);
});
}

Expand All @@ -411,6 +417,14 @@ class IndoorEqual extends BaseObject__default["default"] {
});
}

_resetLevelOnLevelsChange() {
this.on('change:levels', () => {
if (!this.get('levels').includes(this.get('level'))) {
this.set('level', '0');
}
});
}

}
/**
* Emitted when the list of available levels has been updated
Expand Down
17 changes: 15 additions & 2 deletions dist/openlayers-indoorequal.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import TileGrid from 'ol/tilegrid/TileGrid';
import { Control } from 'ol/control';
import { Style, Stroke, Text, Fill, Icon } from 'ol/style';
import BaseObject from 'ol/Object';
import debounce from 'debounce';

function extentFromTileJSON(tileJSON) {
var bounds = tileJSON.bounds;
Expand Down Expand Up @@ -354,6 +355,8 @@ class IndoorEqual extends BaseObject {
this._changeLayerOnLevelChange();

this._setLayerStyle();

this._resetLevelOnLevelsChange();
}
/**
* Set the style for displayed features. This function takes a feature and resolution and returns an array of styles. If set to null, the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. Call setStyle() without arguments to reset to the default style. See module:ol/style for information on the default style.
Expand All @@ -376,11 +379,13 @@ class IndoorEqual extends BaseObject {
_listenForLevels() {
this.layer.on('change:source', () => {
const source = this.layer.getSource();
source.on('tileloadend', () => {
const refreshLevels = debounce(() => {
const extent = this.map.getView().calculateExtent(this.map.getSize());
const features = source.getFeaturesInExtent(extent);
this.set('levels', findAllLevels(features));
});
}, 1000);
source.on('tileloadend', refreshLevels);
this.map.getView().on('change:center', refreshLevels);
});
}

Expand All @@ -398,6 +403,14 @@ class IndoorEqual extends BaseObject {
});
}

_resetLevelOnLevelsChange() {
this.on('change:levels', () => {
if (!this.get('levels').includes(this.get('level'))) {
this.set('level', '0');
}
});
}

}
/**
* Emitted when the list of available levels has been updated
Expand Down
2 changes: 1 addition & 1 deletion dist/openlayers-indoorequal.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openlayers-indoorequal",
"version": "0.0.4",
"version": "0.0.5",
"description": "Integrate indoor= into your OpenLayers map.",
"repository": "https://github.com/indoorequal/openlayers-indoorequal",
"author": "François de Metz",
Expand Down

0 comments on commit a2430ce

Please sign in to comment.