add: var i;  
context: function ondrag(x,y,but,cmd,shift,capslock,option,ctrl){	var borderthing = -1;	if (AllowEdit == 0 || f[front].display == 0)		return;		// TODO: optimize that shit	if (isCurveMode) {		if(SelectedCurve >= 0) {			//option key must have been down when we clicked			var curr, prev;						if ( but == 0 ) {				EditedWithMouse();	// quand c'est delete c'est fait dans onidle()				SelectedCurve = -1;	// si on a relch c'est qu'il n'y a plus de points slectionns.				onidle(x,y, 0);		// tout pareil...				return;			}						if(SelectedCurve >= 1) {				// valid curve index				curr = f[front]["pa"][SelectedCurve];				prev = f[front]["pa"][SelectedCurve-1];				var dy								DisplayCursor(0);								if(prev.y < curr.y)					dy = prevy - y;				else					dy = y - prevy;									if(shift) // option-shift-drag for fine tuning					curr.curve += dy * 0.001;				else					curr.curve += dy * 0.02;								curr.curve = ejies.clip(curr.curve, CURVE_MIN, CURVE_MAX);								if(Math.abs(curr.curve) < 0.001) 					curr.curve = 0.; 				else					calcOneCurve(f[front], SelectedCurve-1, SelectedCurve);									prevy = y;								UpdateDisplay();			}						if (MouseReportState)					outlet(DUMPOUT, "mouse", 	ejies.clip(x2val(f[front], x), f[front].domain[0], f[front].domain[1]),												ejies.clip(y2val(f[front], y), f[front].range[0], f[front].range[1]),												but, SelectedCurve, 1, curr.curve);		}		else		{			var dx;						if ( but == 0 ||  SelectedPoint < 0) {				EditedWithMouse();	// quand c'est delete c'est fait dans onidle()				SelectedPoint = -2;	// si on a relch c'est qu'il n'y a plus de points slectionns.				onidle(x,y, 0);		// tout pareil...	/* 			drawText(); */				return;			}					//	y = yOffset(y); // ne pas le mettre avant sinon onidle ne reoit pas les bons coordonnes y				if (SelectedPoint < f[front].np) {			if (f[front]["pa"][SelectedPoint].fix)				return;							if (Snap2GridState & 1)				x = val2x(f[front], Math.round((x2val(f[front], x) - f[front].domain[0]) / f[front].grid_x) * f[front].grid_x + f[front].domain[0]);			if (Snap2GridState & 2)				y = val2y(f[front], Math.round((y2val(f[front], y) - f[front].range[0]) / f[front].grid_y) * f[front].grid_y + f[front].range[0]);						x = ejies.clip(x, Bordure, BoxWidth - Bordure);			y = ejies.clip(y, Bordure + LegendStateBordure, BoxHeight - Bordure);						if ( BorderSyncState == 1 && f[front].np > 2 && ( SelectedPoint == 0 || SelectedPoint == (f[front].np - 1 ) )) {					SelectedPoint == 0 ? borderthing = (f[front].np - 1) : borderthing = 0;				}					if (f[front]["np"] > 1) {						if (SelectedPoint == 0) {						x = ejies.clip(x, 0, f[front]["pa"][SelectedPoint+1].x );  					} else if (SelectedPoint > 0 && SelectedPoint < (f[front]["np"] - 1)) {						x = ejies.clip(x, f[front]["pa"][SelectedPoint-1].x, f[front]["pa"][SelectedPoint+1].x);					} else if (SelectedPoint == (f[front]["np"] - 1) ) {						x = ejies.clip(x, f[front]["pa"][SelectedPoint-1].x, BoxWidth);					}				}								EditedWithMouse.state++;								if(MoveMode >= 2 && MoveMode <= 6) {								if(SelectedPoint > 0 && x < f[front]["pa"][SelectedPoint-1].x) x = f[front]["pa"][SelectedPoint-1].x;												dx = x2val(f[front], x) - f[front]["pa"][SelectedPoint].valx;										if(MoveMode == 3) {																if(dx > (f[front].domain[1] - f[front]["pa"][f[front].np-1].valx)) {							dx = f[front].domain[1] - f[front]["pa"][f[front].np-1].valx;						}					}								if(dx != 0) {						for(i = SelectedPoint; i < f[front].np; i++) {							if(MoveMode >= 4 && MoveMode <= 6)								f[front]["pa"][i].valx = dx+f[front].pa[i].valx;							else								f[front]["pa"][i].valx = ejies.clip(dx+f[front].pa[i].valx, f[front].domain[0], f[front].domain[1]);														f[front]["pa"][i].x = val2x(f[front], f[front].pa[i].valx);						}					}									} else {					f[front]["pa"][SelectedPoint].x = x;					f[front]["pa"][SelectedPoint].valx = x2val(f[front], x);				}								f[front]["pa"][SelectedPoint].y = y;				f[front]["pa"][SelectedPoint].valy = y2val(f[front], y);								/*				//seems to be a BUG when some points are curves and others are linear????				//really broke this updating to ejies 1.57								if(f[front].np == 1) {					//only one point					//..					;				}				else if(SelectedPoint == 0 						&& f[front]["pa"][SelectedPoint].valx <= f[front]["pa"][SelectedPoint+1].valx) 				{					//first point and it still is					if(MoveMode == 0 || MoveMode == 1)						calcOneCurve(f[front], SelectedPoint, SelectedPoint+1); 		// added - MR					else if(MoveMode == 2 || MoveMode == 3)						offsetNCurves(f[front], SelectedPoint, f[front].np-1, dx);									}				else if(SelectedPoint == (f[front].np-1) 						&& f[front]["pa"][SelectedPoint].valx >= f[front]["pa"][SelectedPoint-1].valx) {					//last point and it still is					calcOneCurve(f[front], SelectedPoint-1, SelectedPoint); // added - MR						}				else if(f[front]["pa"][SelectedPoint].valx >= f[front]["pa"][SelectedPoint-1].valx 						&& f[front]["pa"][SelectedPoint].valx <= f[front]["pa"][SelectedPoint+1].valx)  				{					// no need to sort - the order hasn't changed										if(MoveMode == 0 || MoveMode == 1) {						calcOneCurve(f[front], SelectedPoint-1, SelectedPoint); 		// added - MR						calcOneCurve(f[front], SelectedPoint, SelectedPoint+1); 		// added - MR					}					else if(MoveMode == 2 || MoveMode == 3)					{						calcOneCurve(f[front], SelectedPoint-1, SelectedPoint); 		// added - MR						offsetNCurves(f[front], SelectedPoint+1, f[front].np-1, dx);					}				}				*/								if(MoveMode == 5) MyNormalizeXZoomOut(f[front]);				else if(MoveMode == 6) MyNormalizeX(f[front]);								calcFunctionCurves(f[front]); // need to get the logic above working instead of this								if (borderthing != -1) {					f[front]["pa"][borderthing].y = y;					f[front]["pa"][borderthing].valy = y2val(f[front], y);				}								UpdateDisplay();									}						if (MouseReportState)				outlet(DUMPOUT, "mouse", 	ejies.clip(x2val(f[front], x), f[front].domain[0], f[front].domain[1]),											ejies.clip(y2val(f[front], y), f[front].range[0], f[front].range[1]),											but, SelectedPoint, 0);		}		} else {			if ( but == 0 ||  SelectedPoint < 0) {			EditedWithMouse();	// quand c'est delete c'est fait dans onidle()			SelectedPoint = -2;	// si on a relch c'est qu'il n'y a plus de points slectionns.			onidle(x,y, 0);		// tout pareil...	/* 		drawText(); */			return;		}			/* 	y = yOffset(y); // ne pas le mettre avant sinon onidle ne reoit pas les bons coordonnes y */			if (MouseReportState)			outlet(DUMPOUT, "mouse", 	ejies.clip(x2val(f[front], x), f[front].domain[0], f[front].domain[1]),										ejies.clip(y2val(f[front], y), f[front].range[0], f[front].range[1]),										but, SelectedPoint);			if (SelectedPoint < f[front].np) {			if (f[front]["pa"][SelectedPoint].fix)				return;							if (Snap2GridState & 1)				x = val2x(f[front], Math.round((x2val(f[front], x) - f[front].domain[0]) / f[front].grid_x) * f[front].grid_x + f[front].domain[0]);			if (Snap2GridState & 2)				y = val2y(f[front], Math.round((y2val(f[front], y) - f[front].range[0]) / f[front].grid_y) * f[front].grid_y + f[front].range[0]);						x = ejies.clip(x, Bordure, BoxWidth - Bordure);			y = ejies.clip(y, Bordure + LegendStateBordure, BoxHeight - Bordure);					if ( BorderSyncState == 1 && f[front].np > 2 && ( SelectedPoint == 0 || SelectedPoint == (f[front].np - 1 ) )) {				SelectedPoint == 0 ? borderthing = (f[front].np - 1) : borderthing = 0;			}				if (f[front]["np"] > 1) {					if (SelectedPoint == 0) {					x = ejies.clip(x, 0, f[front]["pa"][SelectedPoint+1].x );  				} else if (SelectedPoint > 0 && SelectedPoint < (f[front]["np"] - 1)) {					x = ejies.clip(x, f[front]["pa"][SelectedPoint-1].x, f[front]["pa"][SelectedPoint+1].x);				} else if (SelectedPoint == (f[front]["np"] - 1) ) {					x = ejies.clip(x, f[front]["pa"][SelectedPoint-1].x, BoxWidth);				}			}						EditedWithMouse.state++;						if(MoveMode >= 2 && MoveMode <= 6) {						if(SelectedPoint > 0 && x < f[front]["pa"][SelectedPoint-1].x) x = f[front]["pa"][SelectedPoint-1].x;										dx = x2val(f[front], x) - f[front]["pa"][SelectedPoint].valx;								if(MoveMode == 3) {														if(dx > (f[front].domain[1] - f[front]["pa"][f[front].np-1].valx)) {						dx = f[front].domain[1] - f[front]["pa"][f[front].np-1].valx;					}				}						if(dx != 0) {					for(i = SelectedPoint; i < f[front].np; i++) {						if(MoveMode >= 4 && MoveMode <= 6)							f[front]["pa"][i].valx = dx+f[front].pa[i].valx;						else							f[front]["pa"][i].valx = ejies.clip(dx+f[front].pa[i].valx, f[front].domain[0], f[front].domain[1]);												f[front]["pa"][i].x = val2x(f[front], f[front].pa[i].valx);					}				}							} else {				f[front]["pa"][SelectedPoint].x = x;				f[front]["pa"][SelectedPoint].valx = x2val(f[front], x);			}						f[front]["pa"][SelectedPoint].y = y;			f[front]["pa"][SelectedPoint].valy = y2val(f[front], y);						if(MoveMode == 5) MyNormalizeXZoomOut(f[front]);			else if(MoveMode == 6) MyNormalizeX(f[front]);						calcFunctionCurves(f[front]); // need to get the logic above working instead of this			if (borderthing != -1) {				f[front]["pa"][borderthing].y = y;				f[front]["pa"][borderthing].valy = y2val(f[front], y);			}						UpdateDisplay();		}	}}
meta: 6421	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/6421/fd3c2db7ec5622784168e75eedd5145b47e8b8b7/ej.function.js/clean/ejies-jsui/ej.function.js