Merge pull request #11965 from mike-000/patch-24

Handle view rotation in d3 Integration example
This commit is contained in:
MoonE
2021-01-30 23:32:54 +01:00
committed by GitHub
+4 -1
View File
@@ -50,10 +50,13 @@ class CanvasLayer extends Layer {
const scale = r / frameState.viewState.resolution; const scale = r / frameState.viewState.resolution;
const center = toLonLat(getCenter(frameState.extent), projection); const center = toLonLat(getCenter(frameState.extent), projection);
const angle = (-frameState.viewState.rotation * 180) / Math.PI;
d3Projection d3Projection
.scale(scale) .scale(scale)
.center(center) .center(center)
.translate([width / 2, height / 2]); .translate([width / 2, height / 2])
.angle(angle);
d3Path = d3Path.projection(d3Projection); d3Path = d3Path.projection(d3Projection);
d3Path(this.features); d3Path(this.features);