Scroll View onPointerDownObservable doesn't fire when scrollbar is clicked

Scroll View onPointerDownObservable doesn’t fire when scrollbar is clicked.
Help me understand why.

ping @PolygonalSun

I can take a look and see what’s going on

2 Likes

Okay, so here’s what I’ve found. The input is being received by everything but when _onPointerDown/Up is getting handled at the ScrollBar level (child of ScrollViewer), the isPointerBlocking flag is set to true (inherited from BaseSlider). This flag prevents any event handling from bubbling upwards through the object heirarchy so the onPointerDown/UpObservable will never fire for any of the parents (like ScrollViewer). This isn’t the case with the text box because that flag isn’t true by default. It looks like this may be a change in behavior but may be by design. What do you think @RaananW and @carolhmj?

Yep, isPointerBlock should block events on parents

Is there a way to scroll but not move the camera view, Or a way to determine that the click was on the scrollbar?

I guess so. I believe both could use the same method. Altough the detection from the click of the scrollbar (as per the above) would need a little trick. In your case, since it’s ADT for mesh you could simply detect the click on the plane and if it is not the textBlock and is a control well… then it has to be the sv bar.

I know, not very sexy :smirk:, but I believe it would work. For the camera I would likely use a 2 cam approach (but that’s just me). Others might have a different or better solution. Else you can also freeze the camera, or make a transition/animation or use the billboard mode to always face your plane when interacting with it. I suppose it all depends on your use case.

Anyways, here’s the rev PG showing this:

Hope this can help,
Meanwhile, have a great day :sunglasses:

1 Like

Yes, I understand, thanks!

Found another way - typeName will be equal to “Scrollbar” if you click on the scroll bar

text_Texture.onControlPickedObservable.add(e => {
        console.log (e.typeName);
    });
2 Likes

Oh, nice. See, we just need to be creative. There’s enough space in this framework for that :grin:

1 Like