MCPcopy Create free account
hub / github.com/Kitware/VTK / ProcessEvent

Method ProcessEvent

Rendering/UI/vtkWebAssemblyRenderWindowInteractor.cxx:390–575  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

388
389//------------------------------------------------------------------------------
390void vtkWebAssemblyRenderWindowInteractor::ProcessEvent(int type, const std::uint8_t* event)
391{
392 auto& internals = (*this->Internals);
393 const double dpr = emscripten_get_device_pixel_ratio();
394
395 switch (type)
396 {
397 case EMSCRIPTEN_EVENT_VTK_TIMER:
398 {
399 auto* timerId = reinterpret_cast<const int*>(event);
400 auto iter = internals.VTKToPlatformTimerMap.find(*timerId);
401 if (iter != internals.VTKToPlatformTimerMap.end())
402 {
403 this->InvokeEvent(vtkCommand::TimerEvent, (void*)timerId);
404 int platformTimerId = (*iter).second;
405 // Here we deal with one-shot versus repeating timers
406 if (this->IsOneShotTimer(*timerId))
407 {
408 vtkDestroyTimer(platformTimerId, true);
409 internals.Timers.erase(*timerId);
410 internals.VTKToPlatformTimerMap.erase(iter);
411 }
412 }
413 break;
414 }
415 case EMSCRIPTEN_EVENT_RESIZE:
416 {
417 auto* size = vtkGetParentElementBoundingRectSize(this->CanvasSelector);
418 this->UpdateSize(size[0], size[1]);
419 free(size);
420 this->InvokeEvent(vtkCommand::ConfigureEvent);
421 this->Render();
422 // VTK_DEPRECATED_IN_9_5_0()
423 // Remove this InvokeEvent when removing 9.5.0 deprecations. Interactor
424 // resizing should be observed via ConfigureEvent (generated by the UI
425 // in the vtkRenderWindowInteractor subclasses).
426 this->InvokeEvent(vtkCommand::WindowResizeEvent);
427 break;
428 }
429 case EMSCRIPTEN_EVENT_FOCUS:
430 case EMSCRIPTEN_EVENT_FOCUSIN:
431 case EMSCRIPTEN_EVENT_MOUSEENTER:
432 {
433 this->InvokeEvent(vtkCommand::EnterEvent);
434 break;
435 }
436 case EMSCRIPTEN_EVENT_BLUR:
437 case EMSCRIPTEN_EVENT_FOCUSOUT:
438 case EMSCRIPTEN_EVENT_MOUSELEAVE:
439 {
440 // resets repeat counter when focus is lost while a key is being pressed in order to
441 // prevent overflow.
442 internals.RepeatCounter = 0;
443 this->InvokeEvent(vtkCommand::LeaveEvent);
444 break;
445 }
446 case EMSCRIPTEN_EVENT_KEYPRESS:
447 // EMSCRIPTEN_EVENT_KEYDOWN tracks these

Callers 1

ProcessEventsMethod · 0.95

Calls 10

InvokeEventMethod · 0.80
IsOneShotTimerMethod · 0.80
RenderMethod · 0.65
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
UpdateSizeMethod · 0.45
LeftButtonPressEventMethod · 0.45
MouseMoveEventMethod · 0.45

Tested by

no test coverage detected