Viewer Origo Issue

Hello everyone,

I have encountered an issue where the rotation and zoom center of my loaded viewer is offset.

In the attached image, the red circle represents the cursor position, while the blue one represents the origin.

The amount of offset matches the values of the header and the side menu.

Is it possible to manually adjust the origin position?

Thank you in advance for your help!

Hi @Gircsi117

What version of the viewer library are you using? I remember we’ve fixed an issue that looks similar at some point.

Additionally, can you reproduce the issue in a simple stackblitz example (or otherwise) ?

Cheers

I use the “@speckle/viewer”: “^2.23.6”, version

The version should be good. Can you provide a way to reproduce the issue?

There must be some specific html/css scenarios that trigger this, however I am unable to reproduce

Cheers

The problem appeared after the version change, but it actually occurs completely at random.
It happens from one point of the model, but not from another.

viewer.createExtension(CameraController);

We want to help you @Gircsi117, but we’re just shooting in the dark without more context. Right now, @alex has shared the working code, and without a clear way to reproduce the issue or provide further details from your side, we can’t diagnose what might be going wrong.

If the issue happens randomly, it might not be an API problem but rather something environmental in your code. Can you provide:

  1. A minimal example that demonstrates the issue you describe (e.g., a StackBlitz or CodeSandbox project, even a GitHub, etc).
  2. Any console errors or unusual camera behavior you notice when the offset happens.
  3. Steps that reliably trigger the problem.

That way, we can actually troubleshoot rather than guessing. Let us know!

In the following video, I tried to illustrate the problem:
https://youtu.be/rQl93QEf2l8

Unfortunately, the repo is private and does not belong to me, so I cannot share it.


The rest of the program either performs basic setup or extracts elements. Those parts shouldn’t have any impact on the movement.

From what I see in your video, it seems you’re having issues with the orbiting around cursor feature which is turned on by default.

We’ve added orbiting around cursor relatively recently. Since it’s giving you trouble, I suggest you just turn the feature off

const controller = viewer.createExtension(CameraController);
controller.options = {
  orbitAroundCursor: false,
  showOrbitPoint: false
}

Orbiting around cursor properly works only when you’re dealing with meshes. Lines and points are not supported yet. I can’t tell what your scene consists of just by looking at it, but there are things resembling lines in there. So the easy solution is just to turn off the feature like I show above

Cheers

2 Likes

Thank you!
This solved the problem.

1 Like