Fix bg not handling windows not aligned to top left of screen
This commit is contained in:
parent
3c9b66ea3f
commit
6ec4c5d32d
1 changed files with 1 additions and 1 deletions
|
@ -31,7 +31,7 @@ const cols = computed(() => Math.ceil(sizes.width.value / 304));
|
||||||
const mousePos = ref(new Vector2(Infinity, Infinity));
|
const mousePos = ref(new Vector2(Infinity, Infinity));
|
||||||
function updateMousePos(event: MouseEvent) {
|
function updateMousePos(event: MouseEvent) {
|
||||||
const {x, y, height} = renderer.value.domElement.getBoundingClientRect();
|
const {x, y, height} = renderer.value.domElement.getBoundingClientRect();
|
||||||
mousePos.value = new Vector2(event.screenX - x, height + y + (window.outerHeight - window.innerHeight) - event.screenY);
|
mousePos.value = new Vector2(event.x - x, height + y - event.y);
|
||||||
if (groupRef.value) {
|
if (groupRef.value) {
|
||||||
groupRef.value.children.forEach(child => {
|
groupRef.value.children.forEach(child => {
|
||||||
child.material.uniforms.uMouse.value = mousePos.value;
|
child.material.uniforms.uMouse.value = mousePos.value;
|
||||||
|
|
Loading…
Reference in a new issue