We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

registerOnClick question

Home Forums General Questions registerOnClick question

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #28336
    dragosburian
    Customer

    Hello Verge Team,

    registerOnClick function works fine locally, but in our use case which has varying unconventional resolutions it seems that the “clickable” area is mapped in a wrong place, so that clicking around the object we want to click triggers the registerOnClick event. Is there a way to trigger the calculation of the clickable area after the scene is loaded?

    Dragos

    • This topic was modified 1 year, 4 months ago by dragosburian.
    #28348

    Hi,

    Can you share an example or a test case? Also, does that issue happen on mobile or desktop?

    Co-founder and lead developer at Soft8Soft.

    #28375
    dragosburian
    Customer

    Hello,

    It happens across all platforms, but it would be extremely tricky to produce an example, my question would be whether there is a function maybe that can trigger a re-calculation of the clickable zone, if that is how the click function works.

    Kind regards,
    Dragos

    #28394

    There’s no special function for that. The calculations are quite straight-forward: when you click somewhere in the scene, the code obtains the current mouse/touch coordinates and casts a ray from that point inside the scene to check if there’s any intersections with the scene’s objects.

    This scheme works most of the time, but in some unusual cases related to canvas positioning, offsets or css 2d/3d transformations there can be issues with obtaining mouse/touch coordinates.

    I can reproduce the behavior similar to what you described here only if I rotate the canvas element via css transforms (e.g. transform: rotate(45deg);) and it happens only on mobile.

    It can look like this:
    https://www.soft8soft.com/wp-content/uploads/2020/06/rotated_canvas.png
    – the clickable area in such case can be a bit wider than it should be, i.e. misplaced or stretched.

    So, your issue may be a bug or may happen due to some tricky case that we just didn’t bother to support when we implemented this feature.

    Attachments:
    You must be logged in to view attached files.

    Co-founder and lead developer at Soft8Soft.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.