Closed sebastienjouhans closed 4 years ago
@sebastienjouhans I don't think Widget
exposes the global (x, y) coordinates because it itself doesn't track them. What you can get is the local (x,y) coordinates using the layout measure.
which is
You can also use insetContainer
to get the world bounds of the widget's contents (+ any padding you applied, use contentContainer
for without padding).
via
widget.insetContainer.getBounds()
Hit testing is not done in this project. That's because it uses the interaction events fired on the insetContainer, which is done by PixiJS out-of-the-box.
That worked! thanks
@sebastienjouhans My bad that this repo is in sort of a "dumb frozen" state. The current code has some stuff that is in a transitionary phase so it won't reflect what's published.
The published API uses EventBroker:
which is here:
It has a click manager:
It might work if you fire a mousedown
, mouseup
event manually on the insetContainer
:
insetContainer.fire('mousedown', <your_fake_event>);
Ah, nvm you deleted that comment. I can help you if you're working on something that needs help 👍
I am trying to get the position (x,y) of a ui element (button, text, etc) so i can work out when a virtual pointer collided with it.
I can easily get the width and the height of any ui elements but the x,y do not seem to be exposed.
1) Is there a way to get the x and y coordinate of a ui element? 2) is there a way to perform a hit test?