Jump to content

How to check if GUI element is going to be picked?


lihis
 Share

Recommended Posts

Hey,

with mesh it's possible to do:

let check_for_reselect = function(item) {
    let pickInfo = scene.pick(scene.pointerX, scene.pointerY);
    if (!pickInfo.hit) {
        return false;
    }
    if (pickInfo.hit)
    {
        if (pickInfo.pickedMesh !== item) {
            return false;
        }
        else {
            return true;
        }
    }
};

and run that in scene.onPointerObservable the next time a click happens to see if a mesh was repicked.

I can't quite figure out how to check if a specific GUI element is going to be picked. Is that doable somehow?

The use case would be something like: if GUI element is going to be reselected, do nothing otherwise run some deselect code.

 

-> scene.pick allows you to "click without actually clicking" and see what's below mouse - i would like to do the same with GUI elements.

 

 

Edit:

Another question: is there a way to make onPointerDownObservable / holding mouse button down not block the processing of other observables like onPointerOutObservable?

Example: https://playground.babylonjs.com/#SDJ5S8

If you start holding mousebutton down the hover does not stop even when moving outside the rectangle.

In chrome the hover stops once you release mousebutton (and you are outside the rectangle), but in in Firefox you actually have to move the mouse after releasing the mouse button, otherwise it will keep the hover state forever.

 

 

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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