Merge pull request #517 from antvis/fix_ie_event

fix: 修复IE事件问题
This commit is contained in:
@thinkinggis 2020-09-10 21:05:23 +08:00 committed by GitHub
commit 663f179c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 9 deletions

View File

@ -151,14 +151,15 @@ export default class InteractionService extends EventEmitter
return { x: clientX, y: clientY, lngLat, type };
}
private onHover = (event: MouseEvent) => {
let { x, y } = event;
const { clientX, clientY } = event;
let x = clientX;
let y = clientY;
const type = event.type;
const $containter = this.mapService.getMapContainer();
if ($containter) {
const { top, left } = $containter.getBoundingClientRect();
x -= left;
y -= top;
x = x - left - $containter.clientLeft;
y = y - top - $containter.clientTop;
}
const lngLat = this.mapService.containerToLngLat([x, y]);

View File

@ -11,10 +11,10 @@
}
#map {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
top: 100px;
left: 50px;
width:500px;
height:400px;
}
</style>
<link

View File

@ -16,7 +16,9 @@ export function rgb2arr(str: string) {
}
export function decodePickingColor(color: Uint8Array): number {
const [i1, i2, i3] = color;
const i1 = color && color[0];
const i2 = color && color[1];
const i3 = color && color[2];
// 1 was added to seperate from no selection
const index = i1 + i2 * 256 + i3 * 65536 - 1;
return index;