how to scroll SDL2 canvas smoothly by mouse wheel with Escripten/WASM

How to scroll SDL2 canvas smoothly by mouse wheel with Escripten/WASM, Especially when zoom in on a actor appear stuck, not smooth.

Are you using a VTK-wasm build? I’m not quite following what you are trying to achieve here.

AFAIK, in general, smoothness in the scroll action would depend on the amount of “delta” (amount of change applied to an operation, e.g. camera dolly) assigned to each tick of the scroll event.

Yes. I use vtk-wasm. I guess if the default vtk mouseWheel event callback below matchs with the SDL2(canvas).

void vtkInteractorStyleTrackballCamera::OnMouseWheelBackward()
{
  this->FindPokedRenderer(
    this->Interactor->GetEventPosition()[0], this->Interactor->GetEventPosition()[1]);
  if (this->CurrentRenderer == nullptr)
  {
    return;
  }

  this->GrabFocus(this->EventCallbackCommand);
  this->StartDolly();
  double factor = this->MotionFactor * -0.2 * this->MouseWheelMotionFactor;
  this->Dolly(pow(1.1, factor));
  this->EndDolly();
  this->ReleaseFocus();
}