whiteboard-demo icon indicating copy to clipboard operation
whiteboard-demo copied to clipboard

Whiteboard camera scaling issue

Open Sumon-TWeb opened this issue 2 years ago • 2 comments

I want to to use whiteboard with fixed width and height. So I can take screenshot in fixed size always. Here I can use cameraBound option when joining the room and it is working fine. But issue happening when I am scaling down (Zoom out) the camera using moveCamera method, then it allows more space on both sides. After that when zoom in again, we cant access that space, drag tool also not able to scroll to that space. So, Without zoom out user will not able to know what is drawn on that space. Please suggest what should I do ?

Sumon-TWeb avatar Oct 21 '22 11:10 Sumon-TWeb

It works as expected here: cameraBound is used to limit user actions, while moveCamera is triggered by developer's code, which always succeeds.

If you want to control the camera more precisely, then you should make use of these functions:

  • moveCamera({ centerX, centerY, scale })
  • moveCameraToContain({ originX, originY, width, height })
  • callbacks.on("onRoomStateChanged", state => handle(state.cameraState))

For example, you can add a "restore camera" button that simply does moveCamera(remembered_camera) where remembered_camera is read from the onRoomStateChanged callback.

hyrious avatar Oct 21 '22 11:10 hyrious

The above mentioned points I understood. But the issue happening when performing zoom in from < 1 (.4) camera scale in a cameraBound whiteboard.

Sumon-TWeb avatar Oct 21 '22 12:10 Sumon-TWeb