From: jpbruyere Date: Fri, 21 Oct 2016 05:11:34 +0000 (+0200) Subject: update cursors on layout changes X-Git-Tag: v0.9.5-beta~259^2~15 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=56beb0e41e442c2943557773940ddc5cf50782e0;p=jp%2Fcrow.git update cursors on layout changes modifié : src/GraphicObjects/HueSelector.cs modifié : src/GraphicObjects/SaturationValueSelector.cs --- diff --git a/src/GraphicObjects/HueSelector.cs b/src/GraphicObjects/HueSelector.cs index b291c4c9..11aee383 100644 --- a/src/GraphicObjects/HueSelector.cs +++ b/src/GraphicObjects/HueSelector.cs @@ -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); diff --git a/src/GraphicObjects/SaturationValueSelector.cs b/src/GraphicObjects/SaturationValueSelector.cs index b8a5bafd..54a765b8 100644 --- a/src/GraphicObjects/SaturationValueSelector.cs +++ b/src/GraphicObjects/SaturationValueSelector.cs @@ -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; + } + } } }