]> O.S.I.I.S - jp/crow.git/commitdiff
update cursors on layout changes
authorjpbruyere <jp.bruyere@hotmail.com>
Fri, 21 Oct 2016 05:11:34 +0000 (07:11 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Fri, 21 Oct 2016 05:11:34 +0000 (07:11 +0200)
modifié :         src/GraphicObjects/HueSelector.cs
modifié :         src/GraphicObjects/SaturationValueSelector.cs

src/GraphicObjects/HueSelector.cs
src/GraphicObjects/SaturationValueSelector.cs

index b291c4c996fd47f8838d8908b7b8f8c734a84b88..11aee383dae48ba0c5573ecc950fe2e0c307749f 100644 (file)
@@ -108,6 +108,16 @@ namespace Crow
                        ctx.Stroke();
                        ctx.Restore ();
                }
+               public override void OnLayoutChanges (LayoutingType layoutType)
+               {
+                       base.OnLayoutChanges (layoutType);
+
+                       if (Orientation == Orientation.Horizontal) {
+                               if (layoutType == LayoutingType.Width)
+                                       updateMousePosFromHue ();
+                       } else if (layoutType == LayoutingType.Height)
+                               updateMousePosFromHue ();
+               }
                protected override void updateMouseLocalPos (Point mPos)
                {
                        base.updateMouseLocalPos (mPos);
index b8a5bafd32003756d7a298aad1408c7532c79eeb..54a765b8de0a423a77cdc9182e517906dbc1e27b 100644 (file)
@@ -110,6 +110,18 @@ namespace Crow
                        NotifyValueChanged ("S", s);
                        NotifyValueChanged ("V", v);
                }
+               public override void OnLayoutChanges (LayoutingType layoutType)
+               {
+                       base.OnLayoutChanges (layoutType);
+                       switch (layoutType) {
+                       case LayoutingType.Width:
+                               mousePos.X = (int)Math.Floor(s * (double)ClientRectangle.Width);
+                               break;
+                       case LayoutingType.Height:
+                               mousePos.Y = (int)Math.Floor((1.0-v) * (double)ClientRectangle.Height);
+                               break;
+                       }
+               }
        }
 }