fix(interaction): 高分屏拾取问题

This commit is contained in:
thinkinggis 2020-07-21 19:00:44 +08:00
parent a5e6da8144
commit 4439310957
1 changed files with 9 additions and 3 deletions

View File

@ -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;