From 2f0aa310b9acd7c4dcb0e2887dea16d1db552826 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sun, 21 Jan 2018 13:04:02 +0300 Subject: [PATCH] OK In progress... --- src/Area.vala | 28 +++++++++++++------------- src/Range.vala | 53 ++++++++++++++++---------------------------------- 2 files changed, 30 insertions(+), 51 deletions(-) diff --git a/src/Area.vala b/src/Area.vala index 350fabd..e0048e9 100644 --- a/src/Area.vala +++ b/src/Area.vala @@ -110,8 +110,7 @@ namespace CairoChart { return zx1 - zx0; } set { - if (zx0 <= zx0 + value <= _x1) - zx1 = zx0 + value; + zx1 = zx0 + value; } } @@ -123,8 +122,7 @@ namespace CairoChart { return zy1 - zy0; } set { - if (zy0 <= zy0 + value <= _y1) - zy1 = zy0 + value; + zy1 = zy0 + value; } } @@ -133,6 +131,17 @@ namespace CairoChart { */ public Area () { } + /** + * Constructs a new ``Area`` by other ``Area``. + * @param area ``Area`` instance. + */ + public Area.with_area (Area area) { + this.x0 = area.x0; + this.y0 = area.y0; + this.x1 = area.x1; + this.y1 = area.y1; + } + /** * Constructs a new ``Area`` with absolute coordinates. * @param x0 left bound. @@ -161,17 +170,6 @@ namespace CairoChart { this.height = height; } - /** - * Constructs a new ``Area`` by other ``Area``. - * @param area ``Area`` instance. - */ - public Area.with_area (Area area) { - this.x0 = area.x0; - this.y0 = area.y0; - this.x1 = area.x1; - this.y1 = area.y1; - } - /** * Constructs a new ``Area`` by ``Cairo.Rectangle``. * @param rectangle ``Cairo.Rectangle`` instance. diff --git a/src/Range.vala b/src/Range.vala index 6a5a61e..77e38a4 100644 --- a/src/Range.vala +++ b/src/Range.vala @@ -7,8 +7,16 @@ namespace CairoChart { double _low = 0; double _high = 1; - double _zlow = 0; - double _zhigh = 1; + + /** + * Zoomed low bound. + */ + double zlow = 0; + + /** + * Zoomed high bound. + */ + double zhigh = 1; /** * Low bound. @@ -18,7 +26,7 @@ namespace CairoChart { return _low; } set { - _zlow = _low = value; + zlow = _low = value; } } @@ -30,33 +38,7 @@ namespace CairoChart { return _high; } set { - _zhigh = _high = value; - } - } - - /** - * Zoomed low bound. - */ - double zlow { - get { - return _zlow; - } - set { - if (_low <= value <= _high) - _zlow = value; - } - } - - /** - * Zoomed high bound. - */ - double zhigh { - get { - return _zhigh; - } - set { - if (_low <= value <= _high) - _zhigh = value; + zhigh = _high = value; } } @@ -68,7 +50,7 @@ namespace CairoChart { return _high - _low; } set { - _zhigh = _high = _low + value; + zhigh = _high = _low + value; } } @@ -77,11 +59,10 @@ namespace CairoChart { */ public double zrange { get { - return _zhigh - _zlow; + return zhigh - zlow; } set { - if (_zlow <= _zlow + value <= _high) - _zhigh = _zlow + value; + zhigh = zlow + value; } } @@ -125,8 +106,8 @@ namespace CairoChart { * Unzooms ``Range``. */ public void unzoom () { - _zlow = low; - _zhigh = high; + zlow = low; + zhigh = high; } } }