Skip to content

Commit

Permalink
fix support for OpenLayers 10.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Jan 10, 2025
1 parent 77a5927 commit b741a4f
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 15 deletions.
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ module.exports = {
]
},
transformIgnorePatterns: [
'/node_modules/(?!(ol|txml|geotiff|quick-lru|color-|rbush|earcut|pbf|quickselect))'
'/node_modules/(?!(ol|txml|geotiff|quick-lru|color-|rbush|earcut|pbf|quickselect|node-fetch|data-uri-to-buffer|fetch-blob|formdata-polyfill))'
],
moduleNameMapper: {
'^rlayers$': '<rootDir>/src',
'^rlayers/(.*)$': '<rootDir>/src/$1',
'\\.(css|less)$': '<rootDir>/test/css.js',
'^txml/txml$': '<rootDir>/node_modules/txml/dist/txml'
},
setupFiles: ['jest-canvas-mock'],
setupFiles: ['jest-canvas-mock', 'jsdom-worker'],
setupFilesAfterEnv: ['@testing-library/jest-dom', './test/setup_mocks.ts'],
testRegex: '/test/.*\\.test\\.tsx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
Expand Down
158 changes: 147 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,10 @@
"jest": "^29.4.3",
"jest-canvas-mock": "^2.4.0",
"jest-environment-jsdom": "^29.4.3",
"jsdom-worker": "^0.3.0",
"markdown-loader": "^8.0.0",
"null-loader": "^4.0.1",
"ol": "^10.2.0",
"ol": "^10.3.1",
"ol-mapbox-style": "^12.3.5",
"ol-mbtiles": "^3.2.0",
"prettier": "2.8.8",
Expand Down
2 changes: 1 addition & 1 deletion src/layer/RLayerVectorImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class RLayerVectorImage extends RLayerBaseVector<
Feature,
RLayerBaseVectorProps<Feature>
> {
ol: LayerVectorImage<Feature>;
ol: LayerVectorImage<SourceVector<Feature>>;
source: SourceVector<Feature>;

protected createSource(props: Readonly<RLayerBaseVectorProps<Feature>>): BaseObject[] {
Expand Down
3 changes: 3 additions & 0 deletions test/setup_mocks.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import proj4 from 'proj4';
import {register} from 'ol/proj/proj4';
import {TextEncoder, TextDecoder} from 'util';

import ResizeObserver from 'resize-observer-polyfill';
window.ResizeObserver = ResizeObserver;

Object.assign(global, {TextDecoder, TextEncoder});

proj4.defs(
'EPSG:27700',
'+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 ' +
Expand Down
3 changes: 3 additions & 0 deletions worker.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import WebWorker from 'web-worker';

console.log(WebWorker);

0 comments on commit b741a4f

Please sign in to comment.