]> O.S.I.I.S - jp/crow.git/commitdiff
scroller: scroll in X if scrolly is disabled
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 22 Sep 2021 06:21:20 +0000 (06:21 +0000)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 22 Sep 2021 06:21:20 +0000 (06:21 +0000)
Crow/src/Widgets/Popper.cs
Crow/src/Widgets/Scroller.cs

index 2fe12df4970aa57154858ba00c3692e9f53dc9fc..b1529e4a544ae097d3356a21f4a658708696db41 100644 (file)
@@ -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
        }
 }
index 3a386e2d6b220082766a3e8871ae937caca5ca5b..4e754a3d8fa8014a216d06ed49721e864b976e63 100644 (file)
@@ -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)