]> O.S.I.I.S - jp/crow.git/commitdiff
change scroller value from double to int, drawings has to be keept aligned on pixel
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 1 Nov 2017 10:34:41 +0000 (11:34 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 1 Nov 2017 11:00:42 +0000 (12:00 +0100)
Crow.csproj
src/GraphicObjects/Scroller.cs

index 29bcd8e0462f46307a31407f86fdf50fd1611a80..f6d78c1aa7b59cf95b76420d0a04758b1c168389 100644 (file)
     <AssemblyOriginatorKeyFile>crow.key</AssemblyOriginatorKeyFile>
     <ProductVersion>8.0.30703</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
+    <ReleaseVersion>0.5</ReleaseVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
-    <DefineConstants>DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE;DEBUG;__linux__;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
+    <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE0;DEBUG;__linux__;MEASURE_TIME0;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
     <Optimize>false</Optimize>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
index 640fcfe83fc90df514c4c867ac8a90c2e402bb56..e38b2205dd2fc7b6e88cbe5d30c04fb3245299bb 100644 (file)
@@ -37,8 +37,8 @@ namespace Crow
                bool _verticalScrolling;
                bool _horizontalScrolling;
                bool _scrollbarVisible;
-               double _scrollX = 0.0;
-               double _scrollY = 0.0;
+               int _scrollX = 0;
+               int _scrollY = 0;
                int scrollSpeed;
 
                public event EventHandler<ScrollingEventArgs> Scrolled;
@@ -60,18 +60,18 @@ namespace Crow
                        get { return _scrollbarVisible; }
                        set { _scrollbarVisible = value; }
                }
-               [XmlAttributeAttribute][DefaultValue(0.0)]
-               public double ScrollX {
+               [XmlAttributeAttribute][DefaultValue(0)]
+               public int ScrollX {
                        get {
                                return _scrollX;
                        }
                        set {
                                if (_scrollX == value)
                                        return;
-                               if (value < 0.0)
-                                       _scrollX = 0.0;
+                               if (value < 0)
+                                       _scrollX = 0;
                                else if (value > Child.Slot.Width - ClientRectangle.Width)
-                                       _scrollX = Math.Max(0.0, Child.Slot.Width - ClientRectangle.Width);
+                                       _scrollX = Math.Max(0, Child.Slot.Width - ClientRectangle.Width);
                                else
                                        _scrollX = value;
                                NotifyValueChanged("ScrollX", _scrollX);
@@ -79,18 +79,18 @@ namespace Crow
                                Scrolled.Raise (this, new ScrollingEventArgs (Orientation.Horizontal));
                        }
                }
-               [XmlAttributeAttribute][DefaultValue(0.0)]
-               public double ScrollY {
+               [XmlAttributeAttribute][DefaultValue(0)]
+               public int ScrollY {
                        get {
                                return _scrollY;
                        }
                        set {
                                if (_scrollY == value)
                                        return;
-                               if (value < 0.0)
-                                       _scrollY = 0.0;
+                               if (value < 0)
+                                       _scrollY = 0;
                                else if (value > Child.Slot.Height - ClientRectangle.Height)
-                                       _scrollY = Math.Max(0.0,Child.Slot.Height - ClientRectangle.Height);
+                                       _scrollY = Math.Max(0,Child.Slot.Height - ClientRectangle.Height);
                                else
                                        _scrollY = value;
                                NotifyValueChanged("ScrollY", _scrollY);
@@ -209,7 +209,7 @@ namespace Crow
                public override void checkHoverWidget (MouseMoveEventArgs e)
                {
                        savedMousePos = e.Position;
-                       Point m = e.Position - new Point ((int)ScrollX, (int)ScrollY);
+                       Point m = e.Position - new Point (ScrollX, ScrollY);
                        base.checkHoverWidget (new MouseMoveEventArgs(m.X,m.Y,e.XDelta,e.YDelta));
                }
                public override void onMouseWheel (object sender, MouseWheelEventArgs e)
@@ -230,7 +230,7 @@ namespace Crow
                }
                public override void RegisterClip (Rectangle clip)
                {
-                       base.RegisterClip (clip - new Point((int)ScrollX,(int)ScrollY));
+                       base.RegisterClip (clip - new Point(ScrollX,ScrollY));
                }
                #endregion