From 56beb0e41e442c2943557773940ddc5cf50782e0 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Fri, 21 Oct 2016 07:11:34 +0200 Subject: [PATCH] =?utf8?q?update=20cursors=20on=20layout=20changes=20=09mo?= =?utf8?q?difi=C3=A9=C2=A0:=20=20=20=20=20=20=20=20=20src/GraphicObjects/H?= =?utf8?q?ueSelector.cs=20=09modifi=C3=A9=C2=A0:=20=20=20=20=20=20=20=20?= =?utf8?q?=20src/GraphicObjects/SaturationValueSelector.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/GraphicObjects/HueSelector.cs | 10 ++++++++++ src/GraphicObjects/SaturationValueSelector.cs | 12 ++++++++++++ 2 files changed, 22 insertions(+) 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; + } + } } } -- 2.47.3