Kitware / itk-vtk-viewer

2D / 3D web image, mesh, and point set viewer using itk-wasm and vtk.js
https://kitware.github.io/itk-vtk-viewer/
BSD 3-Clause "New" or "Revised" License
210 stars 64 forks source link

Pinch event is caught but no change is applied #562

Closed idoRosen25 closed 1 year ago

idoRosen25 commented 2 years ago

im trying to display the viewer on a touch screen. it seems that rotating works perfectly. in the case of pinch (for zoom in/zoom out) it seems that the event listeners get catch the event properly but do not apply any zooming to the volume. (after some consoling i found that it probably happens since some object there is missing the gesture manipulators in an array)

please let me know if and how it can be overcome. i have been trying for a few days and couldn't figure it out myself.

PaulHax commented 2 years ago

No zooming for touch is what I found as well =(. Not sure what to do. Need to setup the camera "interactor" better.

Try the VTK.js examples and see if they have one with the behavior you would like. If so, try to replicate the what the example is doing in the itk-vtk-viewer's itkVtkViewProxy.js code.
https://kitware.github.io/vtk-js/examples/

If you don't find the touch/camera behavior you would like try posting on the forum: https://discourse.vtk.org/c/web/9

idoRosen25 commented 2 years ago

i still cannot find a solution for the pinch event. the data needed for the pinch seems to be fine but no pinch is happening. i noticed that there no gesture manipulators and i suspect this is the reason the pinch is not working. how can i add a gesture manipulator? i couldn't find an answer in the docs.

also i do not have access to the examples sent before on the machine with the touch screen. is there a way perhaps that i can path it by using the mouse wheel scroll events?

PaulHax commented 2 years ago

The examples are also in the vtk.js source code. So could download the vtk.js repo and run on the special machine. Could probably use a phone as well to test for pinch functionally on the examples.

This would be a nice feature to have. Docs are limited but the vtk.js source is all there. I don't know the specifics sadly. Something needs to be happening with the browser pointer or touch events. vtk.js form folks are more familiar with vtk.js internals: https://discourse.vtk.org/c/web/9

idoRosen25 commented 2 years ago

i tried some of the examples on my phone and it works.. i don't understand why its not working for me.. also form the example code it doesn't seem to be calling or using any gesture calls directly. hope the forum folks will have a solution and ill try to add a PR for it if i manage to fix it

idoRosen25 commented 1 year ago

i have reached out to the community and waiting some fix ideas. regardless, it seems that the logic for all gestures is implemented but no gesture manipulators are being added (always an empty array). i tried some work arounds for that but it seems that i cannot add the needed manipulators (which is why the pinch is not working as it should). any thoughts on how or where this might be fixed?

PaulHax commented 1 year ago

So the working examples have gesture manipulators and itk-vtk-viewer's ItkVtkViewProxy.js does not add them? Sounds promising. How does your changes to add manipulators differ from the way the working examples add the manipulators? Fork itk-vtk-viewer and make your changes and share what you tried?

idoRosen25 commented 1 year ago

i saw that only mouse manipulators are being added (in itkVtkViewer.js file). itried coping the mouseWheel events code to the corresponding pinch events and it didnt work. i didnt see any gestures being. manually added in the examples you sent me and pinching still works. there is no mention of gesture manipulators in itkVtkViewProxy.js at all. im trying to look for an answer in the vtk.js docs and community forums

idoRosen25 commented 1 year ago

@PaulHax after a lot of tests i have found the issue regarding the implementation of the gestured pinch. i don't have permissions to create a PR so you can review the fix i want to suggest.. please let me know how i can post it to you so you can maybe add it to master (i tried creating a new branch and push to it but failed)

PaulHax commented 1 year ago

@idoRosen25 Great news!
To get your PR reviewed: anybody can "fork" this repository. Then push your branch with the fix to your forked repository. Can then open a PR from your forked repo's branch pointing to this repo's master branch.

idoRosen25 commented 1 year ago

finally done!! this is the PR for the fix of all gesture features to work on viewer: https://github.com/Kitware/itk-vtk-viewer/pull/614

hope its good enough and will help in the future

PaulHax commented 1 year ago

Closed by #626