Skip to content

Commit

Permalink
fix(rhino): reset-margins-of-comment-view (#1866)
Browse files Browse the repository at this point in the history
* Reset margins of rectange of active view

* Minimize all other screens except speckle comment view
  • Loading branch information
oguzhankoral authored Nov 17, 2022
1 parent 2242d3d commit 27c6b32
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,9 @@ public override async Task Open3DView(List<double> viewCoordinates, string viewN
{
// Get bounds from active view
Rectangle bounds = Doc.Views.ActiveView.ScreenRectangle;
// Reset margins
bounds.X = 0;
bounds.Y = 0;
Doc.Views.Add("SpeckleCommentView", DefinedViewportProjection.Perspective, bounds, false);
}

Expand All @@ -1174,13 +1177,23 @@ await Task.Run(() =>
RhinoView speckleCommentView = views.First();
speckleCommentView.ActiveViewport.SetCameraDirection(direction, false);
speckleCommentView.ActiveViewport.SetCameraLocation(cameraLocation, true);
speckleCommentView.Maximized = true;

DisplayModeDescription shaded = DisplayModeDescription.FindByName("Shaded");
if (shaded!= null)
{
speckleCommentView.ActiveViewport.DisplayMode = shaded;
}

// Minimized all maximized views.
IEnumerable<RhinoView> maximizedViews = Doc.Views.Where(v => v.Maximized);
foreach (RhinoView view in maximizedViews)
{
view.Maximized = false;
}

// Maximized speckle comment view.
speckleCommentView.Maximized = true;

if (Doc.Views.ActiveView.ActiveViewport.Name != "SpeckleCommentView")
{
Doc.Views.ActiveView = speckleCommentView;
Expand Down

0 comments on commit 27c6b32

Please sign in to comment.