0

How to Enable Touch?

Anonymous 5 years ago 0
This discussion was imported from CodePlex

cmouritsen wrote at 2014-01-29 16:14:

Hello.

Is there an example for enabling Touch? Is all I need to do set IsManipulationEnabled to true on the Helix3DViewPort?

Thanks!

objo wrote at 2014-01-29 19:44:

Touch should be enabled by default. The CameraController class sets IsManipulationEnabled = true

cmouritsen wrote at 2014-01-29 19:50:

OK. It didn't seem to be for me. Here's my code:
<StackPanel Name="previewPanel" Margin="450,0,0,0" Width="430" Height="580">
     <HelixToolkit:HelixViewport3D x:Name="modelPreview" Width="430" Height="580" ZoomExtentsWhenLoaded="True" ModelUpDirection="0,1,0">
                        <HelixToolkit:HelixViewport3D.Camera>
                            <PerspectiveCamera LookDirection="0,0,-1" UpDirection="0,1,0"/>
                        </HelixToolkit:HelixViewport3D.Camera>
                        <HelixToolkit:DefaultLights />
                        <ModelVisual3D x:Name="model3D"/>                                                
     </HelixToolkit:HelixViewport3D>
</StackPanel>
This didn't respond to Touch at all. Then I tried setting IsManipulationEnabled="True" on the HelixViewport3D and that caused it to have some response to Touch, but it still wasn't usable. I'm sure I'm doing something wrong, but I have no idea what. I'm testing the Touch on a Windows 8.1 Touchscreen laptop.

objo wrote at 2014-01-29 19:59:

Is touch event handling working in the examples? Try the "SimpleDemo".
The examples are working with touch events on my Windows 8.1 machine (one finger to rotate, two fingers to pan and pinch to zoom).
Your code looks ok. Are you loading a really big model? Try to replace the ModelVisual3D with a simple cube visual.

cmouritsen wrote at 2014-01-29 20:07:

I will try the SimpleDemo and replacing the ModelVisual3D. In this case it is a fairly big model. Will it not work with big models?

cmouritsen wrote at 2014-01-29 21:54:

I replaced my ModelVisual3D with a Teapot and the Touch worked great. Will Touch not work on bigger models?

objo wrote at 2014-02-02 12:14:

I have seen similar behaviour, but don't know what causes this.
The ManipulationStarted and ManipulationDelta events are used the same way as MouseDown and MouseMove.