add Image source imageSmoothing option

Add Image smoothing checkbox to example

Test imageSmoothing option
This commit is contained in:
mike-000
2020-05-06 21:56:11 +01:00
parent 24c453c6b8
commit 9a8b9d8ade
16 changed files with 130 additions and 20 deletions
+1
View File
@@ -7,3 +7,4 @@ docs: >
tags: "reprojection, projection, proj4js, image, imagestatic"
---
<div id="map" class="map"></div>
<div><input type="checkbox" id="imageSmoothing" checked />Image smoothing</div>
+20 -10
View File
@@ -18,22 +18,14 @@ proj4.defs(
register(proj4);
const imageExtent = [0, 0, 700000, 1300000];
const imageLayer = new ImageLayer();
const map = new Map({
layers: [
new TileLayer({
source: new OSM(),
}),
new ImageLayer({
source: new Static({
url:
'https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/' +
'British_National_Grid.svg/2000px-British_National_Grid.svg.png',
crossOrigin: '',
projection: 'EPSG:27700',
imageExtent: imageExtent,
}),
}),
imageLayer,
],
target: 'map',
view: new View({
@@ -41,3 +33,21 @@ const map = new Map({
zoom: 4,
}),
});
const imageSmoothing = document.getElementById('imageSmoothing');
function setSource() {
const source = new Static({
url:
'https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/' +
'British_National_Grid.svg/2000px-British_National_Grid.svg.png',
crossOrigin: '',
projection: 'EPSG:27700',
imageExtent: imageExtent,
imageSmoothing: imageSmoothing.checked,
});
imageLayer.setSource(source);
}
setSource();
imageSmoothing.addEventListener('change', setSource);