Skip to content

[Bug]Incorrect raycast coordinates #3229

Open
@moneyfirst-yh

Description

@moneyfirst-yh

Bug description

Am I doing this correctly? After clicking the button, it triggers this function to change the size of the mounted DOM element and re-render the model. However, the model seems to remain in its original position, as I can still pick up the actor by clicking the previous location.
changeBodyScene() { let scene = document.getElementsByClassName("scene"); console.log("BodyScene", scene); let canvas = scene[0].getElementsByTagName("canvas")[0]; if (this.isHeng) { scene[0].style.width = "calc(50% - 50px)"; scene[0].style.height = "calc(100vh)"; scene[0].style.marginLeft = "calc(50% + 50px)"; const sceneWidth = scene[0].offsetWidth; const sceneHeight = scene[0].offsetHeight; canvas.width = sceneWidth; canvas.height = sceneHeight; this.screenRender.resize(); this.renderer.resetCamera(); this.renderWindow.render(); } else { scene[0].style.height = "calc((100vh + 300px) / 2 - 80px - 150px)"; scene[0].style.marginTop = "calc((100vh - 300px) / 2 + 75px) "; } },

Steps to reproduce

Image

Detailed Behavior

I can still pick up the actor by clicking the previous location.

Expected Behavior

Correct approach to re-rendering the model

Environment

  • vtk.js version:32.6.0
  • Browsers:chrome
  • OS:windows10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions