Jump to content

Test onPointerObservable


Recommended Posts

Hi :)

i am trying to write some tests to check if the pointerevents are processed correctly,

but i have troubles triggering an onPointerObservable event.


this._scene.onPointerObservable.add(() => {
}, BABYLON.PointerEventTypes.POINTERMOVE);


test doesn't call the soDomething() function:

const pointerevent = new MouseEvent('click', {clientX: 500, clientY: 500});
scene._onPointerMove(pointerevent, new PickingInfo(), PointerEventTypes.POINTERMOVE);


does someone have an idea what i am doing wrong?

For the doSomething() i just need pointerX and pointerY, i do not need the picking info


Link to comment
Share on other sites

thanks for your answers!

the manual interaction with the observable works fine. this.doSomething() is called on every move actually as it seems, i printed some console statements to test that.

I had only troubles with writing automatic tests for the doSomething() code because i could not push an pointerevent into the observable - so it is difficult to write a PG for that.


but i FINALLY found out how to get my mouseevent in there :)

const pointerevent = new MouseEvent('click', {clientX: 500, clientY: 500});


notifyObservers... it was too obvious ^^ .. well..


Thanks again, have a nice day!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...