diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-09-22 06:21:20 +0000 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-09-22 06:21:20 +0000 |
| commit | 0cc2b90922af9ddb19d7e8a830323fc9c7fb2254 (patch) | |
| tree | 1155b7b19782fc8ab08aaef3d4405cc7c2392f0d | |
| parent | 2f620a95b61fbf9251a98191322a524337673563 (diff) | |
scroller: scroll in X if scrolly is disabled
| -rw-r--r-- | Crow/src/Widgets/Popper.cs | 14 | ||||
| -rw-r--r-- | Crow/src/Widgets/Scroller.cs | 12 |
2 files changed, 13 insertions, 13 deletions
diff --git a/Crow/src/Widgets/Popper.cs b/Crow/src/Widgets/Popper.cs index 2fe12df4..b1529e4a 100644 --- a/Crow/src/Widgets/Popper.cs +++ b/Crow/src/Widgets/Popper.cs @@ -50,8 +50,8 @@ namespace Crow set { if (!_canPop & value) - return; - + return; + if (value == _isPopped) return; @@ -141,7 +141,7 @@ namespace Crow if (r.Right - Content.Slot.Width < tc.ClientRectangle.Left) Content.Left = r.Right; else - Content.Left = r.Right - Content.Slot.Width; + Content.Left = r.Right - Content.Slot.Width; } } else { if (Content.Slot.Width < tc.ClientRectangle.Width) { @@ -186,7 +186,7 @@ namespace Crow base.onMouseLeave (this, e); } public override bool MouseIsIn (Point m) - { + { if (Content?.Parent != null) if (Content.MouseIsIn (m)) return true; @@ -208,7 +208,7 @@ namespace Crow public virtual void onPop(object sender, EventArgs e) { - if (Content != null) { + if (Content != null) { if (Content.Parent == null) IFace.AddWidget (Content); Content.IsVisible = true; @@ -223,7 +223,7 @@ namespace Crow public virtual void onUnpop(object sender, EventArgs e) { if (Content != null) - Content.IsVisible = false; + Content.IsVisible = false; Unpoped.Raise (this, e); ToggleOff.Raise (this, null); } @@ -254,6 +254,6 @@ namespace Crow IsPopped = value; } } - #endregion + #endregion } } diff --git a/Crow/src/Widgets/Scroller.cs b/Crow/src/Widgets/Scroller.cs index 3a386e2d..4e754a3d 100644 --- a/Crow/src/Widgets/Scroller.cs +++ b/Crow/src/Widgets/Scroller.cs @@ -136,12 +136,12 @@ namespace Crow Group g = child as Group; if (g != null) g.ChildrenCleared -= onChildListCleared; - + base.SetChild (_child); g = _child as Group; if (g != null) - g.ChildrenCleared += onChildListCleared; + g.ChildrenCleared += onChildListCleared; } public override void OnChildLayoutChanges (object sender, LayoutingEventArgs arg) { @@ -187,7 +187,7 @@ namespace Crow Background.SetAsSource (IFace, gr, rBack); CairoHelpers.CairoRectangle(gr,rBack, CornerRadius); gr.Fill (); - + gr.Save (); if (ClipToClientRect) { @@ -200,7 +200,7 @@ namespace Crow if (child != null) child.Paint (gr); - + //gr.Translate (ScrollX, ScrollY); gr.Restore (); @@ -210,7 +210,7 @@ namespace Crow /// <summary> Process scrolling vertically, or if shift is down, vertically </summary> public override void onMouseWheel (object sender, MouseWheelEventArgs e) { - if (IFace.Shift) + if (IFace.Shift || maxScrollY == 0) ScrollX += e.Delta * ScrollSpeed; else ScrollY -= e.Delta * ScrollSpeed; @@ -264,7 +264,7 @@ namespace Crow if (lt == LayoutingType.Height) { MaxScrollY = child.Slot.Height - cb.Height; if (child.Slot.Height > 0) - NotifyValueChanged ("ChildHeightRatio", (double)Slot.Height / child.Slot.Height); + NotifyValueChanged ("ChildHeightRatio", (double)Slot.Height / child.Slot.Height); } else if (lt == LayoutingType.Width) { MaxScrollX = child.Slot.Width - cb.Width; if (child.Slot.Width > 0) |