diff --git a/packages/core/src/services/interaction/PickingService.ts b/packages/core/src/services/interaction/PickingService.ts index 795dc3d841..c3f44056c3 100644 --- a/packages/core/src/services/interaction/PickingService.ts +++ b/packages/core/src/services/interaction/PickingService.ts @@ -110,7 +110,7 @@ export default class PickingService implements IPickingService { const { enableHighlight, enableSelect } = layer.getLayerConfig(); const xInDevicePixel = x * window.devicePixelRatio; - const yInDevicePixel = (height - (y + 1)) * window.devicePixelRatio; + const yInDevicePixel = y * window.devicePixelRatio; if ( xInDevicePixel > width || xInDevicePixel < 0 || @@ -123,7 +123,7 @@ export default class PickingService implements IPickingService { pickedColors = readPixels({ x: Math.floor(xInDevicePixel / PICKSCALE), // 视口坐标系原点在左上,而 WebGL 在左下,需要翻转 Y 轴 - y: Math.floor(yInDevicePixel / PICKSCALE), + y: Math.floor((height - (y + 1) * window.devicePixelRatio) / PICKSCALE), width: 1, height: 1, data: new Uint8Array(1 * 1 * 4), diff --git a/stories/Draw/Components/DrawCircle.tsx b/stories/Draw/Components/DrawCircle.tsx index 12b8e530b5..8bfaeb0420 100644 --- a/stories/Draw/Components/DrawCircle.tsx +++ b/stories/Draw/Components/DrawCircle.tsx @@ -1,7 +1,7 @@ import { LineLayer, PointLayer, PolygonLayer, Popup, Scene } from '@antv/l7'; import { GaodeMap, Mapbox } from '@antv/l7-maps'; import { lnglatDistance } from '@antv/l7-utils'; -import turfCircle from '@turf/circle'; +// import turfCircle from '@turf/circle'; import * as React from 'react'; const createGeoJSONCircle = ( center: [number, number], @@ -9,13 +9,13 @@ const createGeoJSONCircle = ( points: number = 64, ) => { const options = { steps: 64 }; - const circle = turfCircle(center, radiusInKm, options); + // const circle = turfCircle(center, radiusInKm, options); return { type: 'geojson', data: { type: 'FeatureCollection', - features: [circle], + features: [], }, }; }; diff --git a/stories/React/components/world.tsx b/stories/React/components/world.tsx index bff67e4417..f581dcd193 100644 --- a/stories/React/components/world.tsx +++ b/stories/React/components/world.tsx @@ -1,4 +1,4 @@ -import { LineLayer, MapboxScene, PolygonLayer } from '@antv/l7-react'; +import { LineLayer, MapboxScene, PolygonLayer, Popup } from '@antv/l7-react'; import * as React from 'react'; export default React.memo(function Map() {