diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-07-21 16:55:02 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-07-21 16:55:02 +0200 |
| commit | 61f1561d972d077eed8df7e911038f8564f8ef17 (patch) | |
| tree | 9a00f5bb6b7a44a485a2fc1fa77d06f96cbcef6b /src/GraphicObjects | |
| parent | d98ba07849fa453de8bf0573c35711152d00724b (diff) | |
debug mouse hangling and focus
Diffstat (limited to 'src/GraphicObjects')
| -rw-r--r-- | src/GraphicObjects/Window.cs | 114 |
1 files changed, 66 insertions, 48 deletions
diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs index a36019e3..1866b467 100644 --- a/src/GraphicObjects/Window.cs +++ b/src/GraphicObjects/Window.cs @@ -97,60 +97,78 @@ namespace Crow if (!hoverBorder) { currentDirection = Direction.None; Interface.CurrentInterface.MouseCursor = XCursor.Default; + Debug.WriteLine ("not hover border"); return; } - - if (e.Mouse.IsButtonDown (MouseButton.Left)) { - int currentLeft = this.Left; - int currentTop = this.Top; + if (this.HasFocus) { + + if (e.Mouse.IsButtonDown (MouseButton.Left)) { - if (currentLeft == 0) - currentLeft = this.Slot.Left; - if (currentTop == 0) - currentTop = this.Slot.Top; + int currentLeft = this.Left; + int currentTop = this.Top; + int currentWidth, currentHeight; - switch (currentDirection) { - case Direction.None: - this.Left = currentLeft + e.XDelta; - this.Top = currentTop + e.YDelta; - break; - case Direction.N: - this.Top = currentTop + e.YDelta; - this.Height -= e.YDelta; - break; - case Direction.S: - this.Height += e.YDelta; - break; - case Direction.W: - this.Left = currentLeft + e.XDelta; - this.Width -= e.XDelta; - break; - case Direction.E: - this.Width += e.XDelta; - break; - case Direction.NW: - this.Left = currentLeft + e.XDelta; - this.Top = currentTop + e.YDelta; - this.Width -= e.XDelta; - this.Height -= e.YDelta; - break; - case Direction.NE: - this.Width += e.XDelta; - this.Top = currentTop + e.YDelta; - this.Height -= e.YDelta; - break; - case Direction.SW: - this.Left = currentLeft + e.XDelta; - this.Width -= e.XDelta; - this.Height += e.YDelta; - break; - case Direction.SE: - this.Width += e.XDelta; - this.Height += e.YDelta; - break; + if (currentLeft == 0) { + currentLeft = this.Slot.Left; + //this.Left = currentLeft; + } + if (currentTop == 0) { + currentTop = this.Slot.Top; + //this.Top = currentTop; + } + if (this.Width.IsFixed) + currentWidth = this.Width; + else + currentWidth = this.Slot.Width; + + if (this.Height.IsFixed) + currentHeight = this.Height; + else + currentHeight = this.Slot.Height; + + switch (currentDirection) { + case Direction.None: + this.Left = currentLeft + e.XDelta; + this.Top = currentTop + e.YDelta; + break; + case Direction.N: + this.Top = currentTop + e.YDelta; + this.Height = currentHeight - e.YDelta; + break; + case Direction.S: + this.Height = currentHeight + e.YDelta; + break; + case Direction.W: + this.Left = currentLeft + e.XDelta; + this.Width = currentWidth - e.XDelta; + break; + case Direction.E: + this.Width = currentWidth + e.XDelta; + break; + case Direction.NW: + this.Left = currentLeft + e.XDelta; + this.Top = currentTop + e.YDelta; + this.Width = currentWidth - e.XDelta; + this.Height = currentHeight - e.YDelta; + break; + case Direction.NE: + this.Width = currentWidth + e.XDelta; + this.Top = currentTop + e.YDelta; + this.Height = currentHeight - e.YDelta; + break; + case Direction.SW: + this.Left = currentLeft + e.XDelta; + this.Width = currentWidth - e.XDelta; + this.Height = currentHeight + e.YDelta; + break; + case Direction.SE: + this.Width = currentWidth + e.XDelta; + this.Height = currentHeight + e.YDelta; + break; + } + return; } - return; } // GraphicObject firstFocusableAncestor = otkgw.hoverWidget; // while (firstFocusableAncestor != this) { |