mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 10:35:16 +01:00
Webapp: Fix screen-pos calculation on click
This commit is contained in:
parent
61f883b134
commit
b3c4f3737d
@ -179,8 +179,8 @@ export class MapViewer {
|
|||||||
handleMapInteraction(screenPosition, data = {}) {
|
handleMapInteraction(screenPosition, data = {}) {
|
||||||
let rootOffset = elementOffset(this.rootElement);
|
let rootOffset = elementOffset(this.rootElement);
|
||||||
let normalizedScreenPos = new Vector2(
|
let normalizedScreenPos = new Vector2(
|
||||||
((screenPosition.x - rootOffset.top) / this.rootElement.clientWidth) * 2 - 1,
|
((screenPosition.x - rootOffset.left) / this.rootElement.clientWidth) * 2 - 1,
|
||||||
-((screenPosition.y - rootOffset.left) / this.rootElement.clientHeight) * 2 + 1
|
-((screenPosition.y - rootOffset.top) / this.rootElement.clientHeight) * 2 + 1
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.map && this.map.isLoaded){
|
if (this.map && this.map.isLoaded){
|
||||||
|
Loading…
Reference in New Issue
Block a user