mirror of https://gitee.com/antv-l7/antv-l7
fix: picking
This commit is contained in:
parent
f938ff950c
commit
e9892a2f7c
|
@ -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),
|
||||
|
|
|
@ -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: [],
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue