在
uj5u.com熱心網友回復:
OpenLayers 可能在畫布上有一個變換集,具體取決于設備像素比。您可以嘗試兩種選擇:
選項 1pixelRatio: 1,在選項中
指定ol.Map以覆寫設備像素比,因此不需要轉換。
選項 2
在繪制影像之前重置變換,但使用save()和包圍呼叫restore()
const mapCtx = mapCnv.getContext("2d")
mapCtx.save();
mapCtx.resetTransform()
mapCtx
.drawImage(
mapLegend,
mapCnv.width - mapLegend.width,
0,
mapLegend.width,
mapLegend.height
);
mapCtx.restore();
請注意,OpenLayers 版本 6 和 7 沒有單個地圖畫布,您的方法可能不起作用。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/516266.html
