mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 00:46:39 +01:00
Fixes #386. Window can now be dragged inside another Window.
This commit is contained in:
@@ -258,17 +258,28 @@ namespace Terminal.Gui {
|
||||
nx = Math.Max (x, 0);
|
||||
nx = nx + top.Frame.Width > Driver.Cols ? Math.Max (Driver.Cols - top.Frame.Width, 0) : nx;
|
||||
bool m, s;
|
||||
if (SuperView == null || SuperView.GetType () != typeof (Toplevel))
|
||||
if (SuperView == null || SuperView.GetType () != typeof (Toplevel)) {
|
||||
m = Application.Top.MenuBar != null;
|
||||
else
|
||||
} else {
|
||||
m = ((Toplevel)SuperView).MenuBar != null;
|
||||
int l = m ? 1 : 0;
|
||||
}
|
||||
int l;
|
||||
if (SuperView == null || SuperView is Toplevel) {
|
||||
l = m ? 1 : 0;
|
||||
} else {
|
||||
l = 0;
|
||||
}
|
||||
ny = Math.Max (y, l);
|
||||
if (SuperView == null || SuperView.GetType () != typeof (Toplevel))
|
||||
if (SuperView == null || SuperView.GetType () != typeof (Toplevel)) {
|
||||
s = Application.Top.StatusBar != null;
|
||||
else
|
||||
} else {
|
||||
s = ((Toplevel)SuperView).StatusBar != null;
|
||||
l = s ? Driver.Rows - 1 : Driver.Rows;
|
||||
}
|
||||
if (SuperView == null || SuperView is Toplevel) {
|
||||
l = s ? Driver.Rows - 1 : Driver.Rows;
|
||||
} else {
|
||||
l = s ? SuperView.Frame.Height - 1 : SuperView.Frame.Height;
|
||||
}
|
||||
ny = Math.Min (ny, l);
|
||||
ny = ny + top.Frame.Height > l ? Math.Max (l - top.Frame.Height, m ? 1 : 0) : ny;
|
||||
}
|
||||
|
||||
@@ -217,8 +217,8 @@ namespace Terminal.Gui {
|
||||
} else {
|
||||
SuperView.SetNeedsDisplay (Frame);
|
||||
}
|
||||
EnsureVisibleBounds (this, mouseEvent.X + mouseEvent.OfX - start.X,
|
||||
mouseEvent.Y + mouseEvent.OfY, out nx, out ny);
|
||||
EnsureVisibleBounds (this, mouseEvent.X + (SuperView == null ? mouseEvent.OfX - start.X : Frame.X - start.X),
|
||||
mouseEvent.Y + (SuperView == null ? mouseEvent.OfY : Frame.Y), out nx, out ny);
|
||||
|
||||
dragPosition = new Point (nx, ny);
|
||||
Frame = new Rect (nx, ny, Frame.Width, Frame.Height);
|
||||
|
||||
Reference in New Issue
Block a user