Merge pull request #11190 from mike-000/patch-13
Correct vector layer clipping with rotation
This commit is contained in:
BIN
rendering/cases/layer-vector-extent-rotation/expected.png
Normal file
BIN
rendering/cases/layer-vector-extent-rotation/expected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
26
rendering/cases/layer-vector-extent-rotation/main.js
Normal file
26
rendering/cases/layer-vector-extent-rotation/main.js
Normal 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();
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user