View3D SurfaceGridSeries3D zoom - always zoom to center

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

Greg9504
Posts: 38
Joined: Fri Dec 06, 2013 4:51 pm

View3D SurfaceGridSeries3D zoom - always zoom to center

Post by Greg9504 » Tue Jan 19, 2016 7:32 pm

Hello,

Using View3D with a SurfaceGridSeries3D with mouse wheel zooming. When the mouse wheel is used to zoom, the zoom is always done relative to the center. Is there any option to allow the zoom to be done at the mouse location?

In the screen shot below, I would like to zoom in on the area circled in red, however I can not seem to, zooming is done to the center, as shown in second screen shot.
Thanks
lcView3d_zoom1.jpg
lcView3d_zoom1.jpg (176.55 KiB) Viewed 5892 times
lcView3d_zoom2.jpg
lcView3d_zoom2.jpg (168.36 KiB) Viewed 5892 times

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: View3D SurfaceGridSeries3D zoom - always zoom to center

Post by ArctionPasi » Wed Jan 20, 2016 4:53 pm

Hi,

the mouse wheel zoom is using View3D.Camera.Target as center point. Obviously if you change the Target, it will not just change the zooming center, but center the view in that as well.
LightningChart Support Team, PT

Greg9504
Posts: 38
Joined: Fri Dec 06, 2013 4:51 pm

Re: View3D SurfaceGridSeries3D zoom - always zoom to center

Post by Greg9504 » Wed Jan 20, 2016 8:53 pm

Hi,

Is there an event that gets fired for the zoom? So that I can set the camera target before the zoom is done?

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: View3D SurfaceGridSeries3D zoom - always zoom to center

Post by ArctionPasi » Thu Jan 21, 2016 3:47 pm

I think you can use m_chart.View3D.CameraViewChanged:



Code: Select all

  void View3D_CameraViewChanged(Camera3D newCameraViewPoint, View3D view, LightningChartUltimate chart)
        {
            m_chart.BeginUpdate();
            
            m_chart.View3D.CameraViewChanged -= View3D_CameraViewChanged;
            
            PointDouble3D p = m_chart.View3D.ConvertSeriesValueTo3DWorldCoord(m_surface, m_mouseTrackLabel.TargetAxisValues.X, m_mouseTrackLabel.TargetAxisValues.Y, m_mouseTrackLabel.TargetAxisValues.Z);
            m_chart.View3D.Camera.Target.SetValues((float)p.X, (float)p.Y, (float)p.Z);
            
            m_chart.View3D.CameraViewChanged += View3D_CameraViewChanged;
            
            m_chart.EndUpdate();

            Cursor.Position = m_chart.PointToScreen(new Point(m_chart.ClientSize.Width / 2, m_chart.ClientSize.Height / 2)); 
            

        }
Then the camera target to latest tracked point in the surface (stored here in m_mouseTrackLabel.TargetAxis.Values). It looks a little bit awkward because it really jumps there, and also updates the mouse cursor position on the screen.
LightningChart Support Team, PT