Merge pull request #11190 from mike-000/patch-13

Correct vector layer clipping with rotation
This commit is contained in:
Tim Schaub
2020-06-16 23:00:55 -06:00
committed by GitHub
3 changed files with 27 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@@ -0,0 +1,26 @@
import GeoJSON from '../../../src/ol/format/GeoJSON.js';
import Map from '../../../src/ol/Map.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import View from '../../../src/ol/View.js';
import {transformExtent} from '../../../src/ol/proj.js';
new Map({
target: 'map',
view: new View({
center: [0, 0],
zoom: 1,
rotation: Math.PI / 4,
}),
layers: [
new VectorLayer({
extent: transformExtent([-50, -45, 50, 45], 'EPSG:4326', 'EPSG:3857'),
source: new VectorSource({
url: '/data/countries.json',
format: new GeoJSON(),
}),
}),
],
});
render();

View File

@@ -204,7 +204,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
!containsExtent(layerExtent, frameState.extent) &&
intersectsExtent(layerExtent, frameState.extent);
if (clipped) {
this.clip(context, frameState, layerExtent);
this.clipUnrotated(context, frameState, layerExtent);
}
}