my-openlayer 2.5.1 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/map/MapTools.js +7 -4
- package/package.json +1 -1
package/core/map/MapTools.js
CHANGED
|
@@ -5,6 +5,7 @@ import { ErrorHandler, ErrorType } from "../../utils/ErrorHandler";
|
|
|
5
5
|
import ValidationUtils from "../../utils/ValidationUtils";
|
|
6
6
|
import ProjectionUtils from "../../utils/ProjectionUtils";
|
|
7
7
|
import { createEmpty, extend, isEmpty } from "ol/extent";
|
|
8
|
+
import { multiply as multiplyTransform } from "ol/transform";
|
|
8
9
|
/**
|
|
9
10
|
* 地图工具类
|
|
10
11
|
* 提供地图的基础操作功能
|
|
@@ -75,10 +76,12 @@ class MapTools {
|
|
|
75
76
|
const features = new GeoJSON().readFeatures(data);
|
|
76
77
|
baseLayer.on("prerender", (event) => {
|
|
77
78
|
const ctx = event.context;
|
|
78
|
-
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
const transform = event.
|
|
79
|
+
/** *********************高分屏坐标转换*********************/
|
|
80
|
+
// coordinateToPixelTransform 得到的是地图视口 CSS 像素;
|
|
81
|
+
// inversePixelTransform 会继续转换到当前图层 canvas 的真实渲染像素。
|
|
82
|
+
const transform = event.inversePixelTransform
|
|
83
|
+
? multiplyTransform(event.inversePixelTransform.slice(), event.frameState.coordinateToPixelTransform)
|
|
84
|
+
: event.frameState.coordinateToPixelTransform;
|
|
82
85
|
ctx.save();
|
|
83
86
|
ctx.beginPath();
|
|
84
87
|
features.forEach((feature) => {
|