From 44393109576ffd6933b7ab4131a778ebfeaf7703 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Tue, 21 Jul 2020 19:00:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(interaction):=20=E9=AB=98=E5=88=86=E5=B1=8F?= =?UTF-8?q?=E6=8B=BE=E5=8F=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/src/services/interaction/PickingService.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/core/src/services/interaction/PickingService.ts b/packages/core/src/services/interaction/PickingService.ts index 459293de29..21004e0c18 100644 --- a/packages/core/src/services/interaction/PickingService.ts +++ b/packages/core/src/services/interaction/PickingService.ts @@ -48,10 +48,12 @@ export default class PickingService implements IPickingService { getViewportSize, getContainer, } = this.rendererService; - const { + let { width, height, } = (getContainer() as HTMLElement).getBoundingClientRect(); + width *= window.devicePixelRatio; + height *= window.devicePixelRatio; this.pickBufferScale = this.configService.getSceneConfig(id).pickBufferScale || 1; // 创建 picking framebuffer,后续实时 resize @@ -86,10 +88,12 @@ export default class PickingService implements IPickingService { clear, getContainer, } = this.rendererService; - const { + let { width, height, } = (getContainer() as HTMLElement).getBoundingClientRect(); + width *= window.devicePixelRatio; + height *= window.devicePixelRatio; if (this.width !== width || this.height !== height) { this.pickingFBO.resize({ width: Math.round(width / this.pickBufferScale), @@ -125,10 +129,12 @@ export default class PickingService implements IPickingService { ) => { let isPicked = false; const { getViewportSize, readPixels, getContainer } = this.rendererService; - const { + let { width, height, } = (getContainer() as HTMLElement).getBoundingClientRect(); + width *= window.devicePixelRatio; + height *= window.devicePixelRatio; const { enableHighlight, enableSelect } = layer.getLayerConfig(); const xInDevicePixel = x * window.devicePixelRatio;