Skip to content

Commit

Permalink
add a border on all sides when zoomed
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Jul 17, 2020
1 parent ec1aa26 commit 94448aa
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 22 deletions.
57 changes: 35 additions & 22 deletions src/cascadia/TerminalApp/Pane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,21 +840,28 @@ void Pane::_UpdateBorders()
double top = 0, bottom = 0, left = 0, right = 0;

Thickness newBorders{ 0 };
if (WI_IsFlagSet(_borders, Borders::Top))
if (_zoomed)
{
top = PaneBorderSize;
top = bottom = right = left = PaneBorderSize;
}
if (WI_IsFlagSet(_borders, Borders::Bottom))
{
bottom = PaneBorderSize;
}
if (WI_IsFlagSet(_borders, Borders::Left))
{
left = PaneBorderSize;
}
if (WI_IsFlagSet(_borders, Borders::Right))
else
{
right = PaneBorderSize;
if (WI_IsFlagSet(_borders, Borders::Top))
{
top = PaneBorderSize;
}
if (WI_IsFlagSet(_borders, Borders::Bottom))
{
bottom = PaneBorderSize;
}
if (WI_IsFlagSet(_borders, Borders::Left))
{
left = PaneBorderSize;
}
if (WI_IsFlagSet(_borders, Borders::Right))
{
right = PaneBorderSize;
}
}
_border.BorderThickness(ThicknessHelper::FromLengths(left, top, right, bottom));
}
Expand Down Expand Up @@ -1083,6 +1090,11 @@ void Pane::Zoom(std::shared_ptr<Pane> zoomedPane)
// TODO: Can we just do nothing if we're a leaf? is that the equivalent of the above?
if (_IsLeaf())
{
_zoomed = (zoomedPane == shared_from_this());
if (_zoomed)
{
_UpdateBorders();
}
return;
}

Expand All @@ -1092,17 +1104,18 @@ void Pane::Zoom(std::shared_ptr<Pane> zoomedPane)
// easy way: just re-add both:
_root.Children().Clear();
}
else
{
_firstChild->Zoom(zoomedPane);
_secondChild->Zoom(zoomedPane);
}
// else
// {
_firstChild->Zoom(zoomedPane);
_secondChild->Zoom(zoomedPane);
// }
}

void Pane::UnZoom(std::shared_ptr<Pane> zoomedPane)
{
if (_IsLeaf())
{
_zoomed = false;
return;
}

Expand All @@ -1114,11 +1127,11 @@ void Pane::UnZoom(std::shared_ptr<Pane> zoomedPane)
_root.Children().Append(_firstChild->GetRootElement());
_root.Children().Append(_secondChild->GetRootElement());
}
else
{
_firstChild->UnZoom(zoomedPane);
_secondChild->UnZoom(zoomedPane);
}
// else
// {
_firstChild->UnZoom(zoomedPane);
_secondChild->UnZoom(zoomedPane);
// }
}

// Method Description:
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/TerminalApp/Pane.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ class Pane : public std::enable_shared_from_this<Pane>

Borders _borders{ Borders::None };

bool _zoomed{ false };

bool _IsLeaf() const noexcept;
bool _HasFocusedChild() const noexcept;
void _SetupChildCloseHandlers();
Expand Down

1 comment on commit 94448aa

@github-actions

This comment was marked as resolved.

Please sign in to comment.