Skip to content

Commit 52401a7

Browse files
authored
fix support for OpenLayers 10.3.1 (#347)
* fix support for OpenLayers 10.3.1 * update changelog
1 parent f4a01a8 commit 52401a7

File tree

7 files changed

+162
-15
lines changed

7 files changed

+162
-15
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
### [3.3.1] 2025-01-10
9+
10+
- Fix `RLayerVectorImage` in OpenLayers 10.3.1
11+
812
## [3.3.0] 2025-01-09
913

1014
- OpenLayers 10.3.1 support

jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ module.exports = {
1919
]
2020
},
2121
transformIgnorePatterns: [
22-
'/node_modules/(?!(ol|txml|geotiff|quick-lru|color-|rbush|earcut|pbf|quickselect))'
22+
'/node_modules/(?!(ol|txml|geotiff|quick-lru|color-|rbush|earcut|pbf|quickselect|node-fetch|data-uri-to-buffer|fetch-blob|formdata-polyfill))'
2323
],
2424
moduleNameMapper: {
2525
'^rlayers$': '<rootDir>/src',
2626
'^rlayers/(.*)$': '<rootDir>/src/$1',
2727
'\\.(css|less)$': '<rootDir>/test/css.js',
2828
'^txml/txml$': '<rootDir>/node_modules/txml/dist/txml'
2929
},
30-
setupFiles: ['jest-canvas-mock'],
30+
setupFiles: ['jest-canvas-mock', 'jsdom-worker'],
3131
setupFilesAfterEnv: ['@testing-library/jest-dom', './test/setup_mocks.ts'],
3232
testRegex: '/test/.*\\.test\\.tsx?$',
3333
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],

package-lock.json

Lines changed: 147 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,10 @@
136136
"jest": "^29.4.3",
137137
"jest-canvas-mock": "^2.4.0",
138138
"jest-environment-jsdom": "^29.4.3",
139+
"jsdom-worker": "^0.3.0",
139140
"markdown-loader": "^8.0.0",
140141
"null-loader": "^4.0.1",
141-
"ol": "^10.2.0",
142+
"ol": "^10.3.1",
142143
"ol-mapbox-style": "^12.3.5",
143144
"ol-mbtiles": "^3.2.0",
144145
"prettier": "2.8.8",

src/layer/RLayerVectorImage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default class RLayerVectorImage extends RLayerBaseVector<
2424
Feature,
2525
RLayerBaseVectorProps<Feature>
2626
> {
27-
ol: LayerVectorImage<Feature>;
27+
ol: LayerVectorImage<SourceVector<Feature>>;
2828
source: SourceVector<Feature>;
2929

3030
protected createSource(props: Readonly<RLayerBaseVectorProps<Feature>>): BaseObject[] {

test/setup_mocks.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import proj4 from 'proj4';
22
import {register} from 'ol/proj/proj4';
3+
import {TextEncoder, TextDecoder} from 'util';
34

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

8+
Object.assign(global, {TextDecoder, TextEncoder});
9+
710
proj4.defs(
811
'EPSG:27700',
912
'+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 ' +

worker.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import WebWorker from 'web-worker';
2+
3+
console.log(WebWorker);

0 commit comments

Comments
 (0)