Skip to content

Commit

Permalink
Merge branch 'renovate/ol-10.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
francois2metz committed Aug 1, 2024
2 parents a5839b1 + 767da39 commit f56c110
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 45 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset="utf-8" />
<title>Map with indoor=</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://cdn.jsdelivr.net/npm/ol@v9.1.0/dist/ol.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ol@v10.0.0/dist/ol.js"></script>
<script src="./dist/openlayers-indoorequal.umd.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@9.1.0/ol.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@10.0.0/ol.css">
<link href="./openlayers-indoorequal.css" rel="stylesheet" />
<style>
body { margin: 0; padding: 0; }
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"transformIgnorePatterns": []
},
"peerDependencies": {
"ol": ">= 8.0.0 < 10.0.0"
"ol": "^10.0.0"
},
"dependencies": {
"debounce": "^2.0.0"
Expand All @@ -39,7 +39,7 @@
"documentation": "^14.0.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"ol": "^9.1.0",
"ol": "^10.0.0",
"rollup": "^4.14.0"
},
"packageManager": "[email protected]"
Expand Down
5 changes: 3 additions & 2 deletions src/indoorequal.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default class IndoorEqual extends BaseObject {
this.source = await loadSourceFromTileJSON(`${this.url}${urlParams}`);

this.indoorLayer.setSource(this.source);
this.heatmapLayer.setSource(createHeatmapSource(this.source));
this.heatmapLayer.setSource(createHeatmapSource(this.indoorLayer));
this._listenForLevels();
}

Expand All @@ -73,11 +73,12 @@ export default class IndoorEqual extends BaseObject {
}

_listenForLevels() {
const layer = this.indoorLayer;
const source = this.source;

const refreshLevels = debounce(() => {
const extent = this.map.getView().calculateExtent(this.map.getSize());
const features = source.getFeaturesInExtent(extent);
const features = layer.getFeaturesInExtent(extent);
this.set('levels', findAllLevels(features));
}, 1000);

Expand Down
8 changes: 4 additions & 4 deletions src/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ export function getLayer(options) {
});
}

export function createHeatmapSource(source) {
const tilegrid = source.getTileGrid();
export function createHeatmapSource(indoorLayer) {
const tilegrid = indoorLayer.getSource().getTileGrid();
const vectorSource = new VectorSource({
loader(extent, resolution, projection, success, failure) {
const refresh = () => {
const features = source.getFeaturesInExtent(extent);
const features = indoorLayer.getFeaturesInExtent(extent);
vectorSource.clear(true);
vectorSource.addFeatures(features);
success(features);
}
source.on('tileloadend', refresh);
indoorLayer.getSource().on('tileloadend', refresh);
refresh();
},
loadingstrategy: tile(tilegrid)
Expand Down
12 changes: 6 additions & 6 deletions test/indoorequal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ describe('IndoorEqual', () => {
};
const source = {
on: (_eventName, callback) => callback(),
}
const getLayerReturn = {
on: (_eventName, callback) => callback(),
setStyle: jest.fn(),
setSource: jest.fn(),
setVisible: jest.fn(),
getFeaturesInExtent: () => {
return [
new Feature({ layer: 'area', level: 0 }),
new Feature({ layer: 'area', level: 1 }),
new Feature({ layer: 'area', level: -2 }),
];
}
}
const getLayerReturn = {
on: (_eventName, callback) => callback(),
setStyle: jest.fn(),
setSource: jest.fn(),
setVisible: jest.fn(),
};
getLayer.mockReturnValueOnce(getLayerReturn);
getHeatmapLayer.mockReturnValueOnce(getLayerReturn);
Expand Down
50 changes: 21 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3118,10 +3118,10 @@ __metadata:
languageName: node
linkType: hard

"earcut@npm:^2.2.3":
version: 2.2.4
resolution: "earcut@npm:2.2.4"
checksum: 10c0/01ca51830edd2787819f904ae580087d37351f6048b4565e7add4b3da8a86b7bc19262ab2aa7fdc64129ab03af2d9cec8cccee4d230c82275f97ef285c79aafb
"earcut@npm:^3.0.0":
version: 3.0.0
resolution: "earcut@npm:3.0.0"
checksum: 10c0/20f3d8492f02452648466d2ce98276c9317c4d6980fc2596b1cb119fc3ef2d034724c5721de2af191331fb43610a27995b0f1b611d3386976b770ae9af7b3bbe
languageName: node
linkType: hard

Expand Down Expand Up @@ -3834,13 +3834,6 @@ __metadata:
languageName: node
linkType: hard

"ieee754@npm:^1.1.12":
version: 1.2.1
resolution: "ieee754@npm:1.2.1"
checksum: 10c0/b0782ef5e0935b9f12883a2e2aa37baa75da6e66ce6515c168697b42160807d9330de9a32ec1ed73149aea02e0d822e572bca6f1e22bdcbd2149e13b050b17bb
languageName: node
linkType: hard

"import-local@npm:^3.0.2":
version: 3.2.0
resolution: "import-local@npm:3.2.0"
Expand Down Expand Up @@ -5700,17 +5693,17 @@ __metadata:
languageName: node
linkType: hard

"ol@npm:^9.1.0":
version: 9.2.4
resolution: "ol@npm:9.2.4"
"ol@npm:^10.0.0":
version: 10.0.0
resolution: "ol@npm:10.0.0"
dependencies:
color-rgba: "npm:^3.0.0"
color-space: "npm:^2.0.1"
earcut: "npm:^2.2.3"
earcut: "npm:^3.0.0"
geotiff: "npm:^2.0.7"
pbf: "npm:3.2.1"
rbush: "npm:^3.0.1"
checksum: 10c0/6eb288d03908ef7276760011867836b737b7508c56a966013dbee6184e4c6b54a458c2efd2dfec08aa86b5cffc3d90488746737b64ef2c05b772ad6ee9bbbfd5
pbf: "npm:4.0.1"
rbush: "npm:^4.0.0"
checksum: 10c0/0d9ec40818e63014024dfacf13a156f842e309c908fdff76c125c4a589280279739ecb5ff8abb0f7671d5cb7d9746eb543e3d59a62e13002ee38fb8dd831b498
languageName: node
linkType: hard

Expand Down Expand Up @@ -5748,10 +5741,10 @@ __metadata:
documentation: "npm:^14.0.3"
jest: "npm:^29.7.0"
jest-environment-jsdom: "npm:^29.7.0"
ol: "npm:^9.1.0"
ol: "npm:^10.0.0"
rollup: "npm:^4.14.0"
peerDependencies:
ol: ">= 8.0.0 < 10.0.0"
ol: ^10.0.0
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -5955,15 +5948,14 @@ __metadata:
languageName: node
linkType: hard

"pbf@npm:3.2.1":
version: 3.2.1
resolution: "pbf@npm:3.2.1"
"pbf@npm:4.0.1":
version: 4.0.1
resolution: "pbf@npm:4.0.1"
dependencies:
ieee754: "npm:^1.1.12"
resolve-protobuf-schema: "npm:^2.1.0"
bin:
pbf: bin/pbf
checksum: 10c0/63b4a27749a9b5a3cf4260d75f9d91ad8d8b326bcdd2bfafd9460a94d0a297a80f80c70d5481213d6c4ebf03c027aca0ac9287c7d8217d327a6d0456f23b9d3c
checksum: 10c0/1a95cc3bdc61ee01d4728f4a57a9f1233732d183a8568818b714a747fd8b957d99b63e1c67f0f72dc5623657c42f88a1a7e44e1fbcd06e2fe2ef9a85a964832e
languageName: node
linkType: hard

Expand Down Expand Up @@ -6125,12 +6117,12 @@ __metadata:
languageName: node
linkType: hard

"rbush@npm:^3.0.1":
version: 3.0.1
resolution: "rbush@npm:3.0.1"
"rbush@npm:^4.0.0":
version: 4.0.0
resolution: "rbush@npm:4.0.0"
dependencies:
quickselect: "npm:^2.0.0"
checksum: 10c0/55311586c30cdedaa2220de6f1da45fe1fa806263afbf7b6f4c0078983830c2abc7771187896d68bfc9078cb279079fb4c84971831da4b74384aab2c2c417758
checksum: 10c0/a2d407ea87e11eb0ae7b924acb2094994a60c503a892421313a48d2073aa9f1201fe0413b576e81d2c41954d97e78ee507a9ddbf361cc613f33efcce83a85b0a
languageName: node
linkType: hard

Expand Down

0 comments on commit f56c110

Please sign in to comment.