0

HelixView3D cannot catch MouseWheel event

Anonymous 5 years ago 0
This discussion was imported from CodePlex

Flanfl wrote at 2011-06-17 17:14:

Hi,

I'm doing a project where I have to do a panorama application and I'm using the great sample that you provided. However, I need to handle mouse event and I've issue with the MouseWheel event which is never fired. I tried it in my code and in your sample as follow:

 

<ht:HelixView3D x:Name="view1" ShowViewCube="False" ShowCameraTarget="False" CameraMode="FixedPosition" RotationSensitivity="0.1" 
ShowCoordinateSystem="True" ShowFieldOfView="True" ShowFrameRate="True" MouseWheel="view1_MouseWheel">

 

The code behind is:

 

private void view1_MouseWheel(object sender, MouseWheelEventArgs e) 
{

	int i = 0;
}

 

If I put a break point on the line int i = 0, nothing hapen when I scroll. I've tried another mouse event: MouseMove and it is working fin. MouseWheel is also working fine with other components. I'm guessing that you are handling the MouseEvent (or else it would not be possible to zoom) but I cannot find where. I would like to overload it to continue to use your functionalities and to add mine on it.

Do you have any idea of where I should look at?

Thanks!


objo wrote at 2011-06-19 12:31:

hi Flanfl, you find the mouse wheel handling in the CameraController code. It is setting Handled to true as you noticed.

Do you want to disable mouse wheel zooming? That could be a feature to add!

I suggest adding a MouseWheelAction { None, Zoom } or a EnableMouseWheelZooming property.

Will this work for you?


Flanfl wrote at 2011-06-21 12:38:

Hi, 

Thanks for the answer, I saw the CameraController class but when I created a HelixView3D object, the property CameraController is always null (I tried in the panorama test sample as well) and it is a read only property. 

I think I do not understand something but I don't know what. 

I do not want to disable the zooming function I just want to know how much a user zoom in/out so I can know how "close" he is from the picture, they might be already a property that can tell me that but I didn't find it ^^

So what I'am doing wrong?

Thanks! 


objo wrote at 2011-06-22 10:28:

The CameraController of the HelixView3D is set when the template is applied. HelixView3D is not supporting custom camera controllers (I try to keep it simple), so you are right - it is only gettable.

Did you try calculating the distance from the Camera.LookDirection.Length or Camera.FieldOfView (for 'FixedPosition' camera controller)?


Flanfl wrote at 2011-06-22 16:02:

Hi Objo,

I already tried LookDirection.Length but it was not really useful, but I didn't thought about FieldOfView! That's what I needed :) 

Thanks a lot!