Hello @dale
I used your example to create a slider in the viewport and it work fine but when i switch to one viewport the slider have no effect.
And how we can show the slider in non parallel views only?
Maybe something wrong in Dollyzoom code or Mouseevent?
bool isPerspective() // this have no effect when i used it as condidtion for e.Display
{
bool viewtype = false;
foreach (RhinoView v in RhinoDoc.ActiveDoc.Views.GetViewList(true, false))
{
if (!v.ActiveViewport.IsParallelProjection)
viewtype = true;
}
return viewtype;
}
void DollyZoom(float newLenght)
{
RhinoView activeview = RhinoDoc.ActiveDoc?.Views?.ActiveView;
RhinoViewport vp = activeview.ActiveViewport;
if (!vp.IsParallelProjection)
{
var oldlength = vp.Camera35mmLensLength;
if (newLenght.ToString() != null)
{
var k = newLenght / oldlength;
var loc1 = vp.CameraLocation;
var tar = vp.CameraTarget;
var loc2 = k * loc1 + tar * (1 - k);
vp.SetCameraLocations(tar, loc2);
vp.Camera35mmLensLength = newLenght;
activeview.Redraw();
}
}
}
-------------------------------------
public class MouseEvent : MouseCallback
{
public static float position;
protected override void OnMouseMove(MouseCallbackEventArgs e)
{
if (e.MouseButton == MouseButton.Left)
{
position = e.ViewportPoint.Y;
RhinoDoc.ActiveDoc.Views.Redraw();
//e.View.Redraw(); this didn't work!
}
base.OnMouseMove(e);
}
}