OK In progress...

This commit is contained in:
Kolan Sh 2018-01-21 13:04:02 +03:00
parent 2059f787af
commit 2f0aa310b9
2 changed files with 30 additions and 51 deletions

View File

@ -110,8 +110,7 @@ namespace CairoChart {
return zx1 - zx0; return zx1 - zx0;
} }
set { set {
if (zx0 <= zx0 + value <= _x1) zx1 = zx0 + value;
zx1 = zx0 + value;
} }
} }
@ -123,8 +122,7 @@ namespace CairoChart {
return zy1 - zy0; return zy1 - zy0;
} }
set { set {
if (zy0 <= zy0 + value <= _y1) zy1 = zy0 + value;
zy1 = zy0 + value;
} }
} }
@ -133,6 +131,17 @@ namespace CairoChart {
*/ */
public Area () { } 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. * Constructs a new ``Area`` with absolute coordinates.
* @param x0 left bound. * @param x0 left bound.
@ -161,17 +170,6 @@ namespace CairoChart {
this.height = height; 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``. * Constructs a new ``Area`` by ``Cairo.Rectangle``.
* @param rectangle ``Cairo.Rectangle`` instance. * @param rectangle ``Cairo.Rectangle`` instance.

View File

@ -7,8 +7,16 @@ namespace CairoChart {
double _low = 0; double _low = 0;
double _high = 1; double _high = 1;
double _zlow = 0;
double _zhigh = 1; /**
* Zoomed low bound.
*/
double zlow = 0;
/**
* Zoomed high bound.
*/
double zhigh = 1;
/** /**
* Low bound. * Low bound.
@ -18,7 +26,7 @@ namespace CairoChart {
return _low; return _low;
} }
set { set {
_zlow = _low = value; zlow = _low = value;
} }
} }
@ -30,33 +38,7 @@ namespace CairoChart {
return _high; return _high;
} }
set { set {
_zhigh = _high = value; 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;
} }
} }
@ -68,7 +50,7 @@ namespace CairoChart {
return _high - _low; return _high - _low;
} }
set { set {
_zhigh = _high = _low + value; zhigh = _high = _low + value;
} }
} }
@ -77,11 +59,10 @@ namespace CairoChart {
*/ */
public double zrange { public double zrange {
get { get {
return _zhigh - _zlow; return zhigh - zlow;
} }
set { set {
if (_zlow <= _zlow + value <= _high) zhigh = zlow + value;
_zhigh = _zlow + value;
} }
} }
@ -125,8 +106,8 @@ namespace CairoChart {
* Unzooms ``Range``. * Unzooms ``Range``.
*/ */
public void unzoom () { public void unzoom () {
_zlow = low; zlow = low;
_zhigh = high; zhigh = high;
} }
} }
} }