volmetrics

diff src/main.cc @ 33:3e4eb9a0d999

fixed t1, t2 selection with the mouse
author Eleni Maria Stea <elene.mst@gmail.com>
date Sun, 17 Aug 2014 02:25:01 +0300
parents 6d637706cfaf
children eb87d4a12bd3
line diff
     1.1 --- a/src/main.cc	Thu May 01 19:05:07 2014 +0300
     1.2 +++ b/src/main.cc	Sun Aug 17 02:25:01 2014 +0300
     1.3 @@ -530,15 +530,23 @@
     1.4  		if(state == GLUT_DOWN) {
     1.5  			int width = glutGet(GLUT_WINDOW_WIDTH);
     1.6  			float xpos = (float)x / (float)width;
     1.7 -			if(fabs(xpos - thres) <= fabs(xpos - thres2)) {
     1.8 +			if(fabs(xpos - thres) <= fabs(xpos - thres2) && fabs(xpos - thres) < 0.1) {
     1.9  				select_thres = &thres;
    1.10  			}
    1.11 -			else {
    1.12 +			else if (fabs(xpos - thres2) < 0.1) {
    1.13  				select_thres = &thres2;
    1.14  			}
    1.15 -			prev_select_thres = *select_thres;
    1.16 +			else
    1.17 +				select_thres = 0;
    1.18 +
    1.19 +			if (select_thres)
    1.20 +				prev_select_thres = *select_thres;
    1.21  		}
    1.22  		else {
    1.23 +			if(!prev_select_thres || !select_thres) {
    1.24 +				select_thres = 0;
    1.25 +				return;
    1.26 +			}
    1.27  			if(fabs(*select_thres - prev_select_thres) > 0.001) {
    1.28  				mesh->clear();
    1.29  				ui->sync_live();