In progress...

This commit is contained in:
Kolan Sh 2018-01-19 11:44:02 +03:00
parent 9004e4e835
commit 6b0013eb8e
1 changed files with 4 additions and 6 deletions

View File

@ -190,15 +190,13 @@ namespace CairoChart {
* @param rect selected zoom area. * @param rect selected zoom area.
*/ */
public virtual void zoom_in (Cairo.Rectangle rect) { public virtual void zoom_in (Cairo.Rectangle rect) {
var x1 = rect.x + rect.width;
var y1 = rect.y + rect.height;
for (var si = 0, max_i = series.length; si < max_i; ++si) { for (var si = 0, max_i = series.length; si < max_i; ++si) {
var s = series[si]; var s = series[si];
if (!s.zoom_show) continue; if (!s.zoom_show) continue;
var real_x0 = s.get_real_x (rect.x); var real_x0 = s.get_real_x (rect.x);
var real_x1 = s.get_real_x (x1); var real_x1 = s.get_real_x (rect.x + rect.width);
var real_y0 = s.get_real_y (rect.y); var real_y0 = s.get_real_y (rect.y);
var real_y1 = s.get_real_y (y1); var real_y1 = s.get_real_y (rect.y + rect.height);
// if selected square does not intersect with the series's square // if selected square does not intersect with the series's square
if ( real_x1 <= s.axis_x.zoom_min || real_x0 >= s.axis_x.zoom_max if ( real_x1 <= s.axis_x.zoom_min || real_x0 >= s.axis_x.zoom_max
|| real_y0 <= s.axis_y.zoom_min || real_y1 >= s.axis_y.zoom_max) { || real_y0 <= s.axis_y.zoom_min || real_y1 >= s.axis_y.zoom_max) {
@ -240,10 +238,10 @@ namespace CairoChart {
var new_zoom = zoom; var new_zoom = zoom;
// TODO // TODO
new_zoom.x += (rect.x - plarea.x) / plarea.width * zoom.width; new_zoom.x += (rect.x - plarea.x) / plarea.width * zoom.width;
var x_max = zoom.x + (x1 - plarea.x) / plarea.width * zoom.width; var x_max = zoom.x + (rect.x + rect.width - plarea.x) / plarea.width * zoom.width;
new_zoom.width = x_max - new_zoom.x; new_zoom.width = x_max - new_zoom.x;
new_zoom.y += (rect.y - plarea.y) / plarea.height * zoom.height; new_zoom.y += (rect.y - plarea.y) / plarea.height * zoom.height;
var y_max = zoom.y + (y1 - plarea.y) / plarea.height * zoom.height; var y_max = zoom.y + (rect.y + rect.height - plarea.y) / plarea.height * zoom.height;
new_zoom.height = y_max - new_zoom.y; new_zoom.height = y_max - new_zoom.y;
zoom = new_zoom; zoom = new_zoom;
} }