From: Jean-Philippe Bruyère Date: Wed, 22 Sep 2021 06:21:20 +0000 (+0000) Subject: scroller: scroll in X if scrolly is disabled X-Git-Tag: v0.9.7-beta~3 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=0cc2b90922af9ddb19d7e8a830323fc9c7fb2254;p=jp%2Fcrow.git scroller: scroll in X if scrolly is disabled --- 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 /// Process scrolling vertically, or if shift is down, vertically 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)