72,9 → 72,7 |
exp = exp.replace(reg,function($0){\ |
if(Math.hasOwnProperty($0)){\ |
return \"Math.\"+$0;\ |
}\ |
else\ |
{\ |
} else {\ |
valid = false;\ |
}\ |
}\ |
81,9 → 79,7 |
);\ |
if( !valid ){\ |
alert(\"hmmm \"+exp+\" ?\"); exp = null;\ |
}\ |
else\ |
{\ |
} else {\ |
try{ exp = eval(exp); } catch(e){alert(\"Invalid arithmetic expression\"); exp = null;};\ |
};\ |
return exp;\ |
231,9 → 227,7 |
math_fun = math_fun.replace(new RegExp(small_trick + \"(\\\\d+)\", \"g\"), function(m, d){return tab[d].replace(/(\\w*)\\^(\\w*)/g, out_fun+\"($1,$2)\");});\ |
w_cnt++;if(w_cnt>1000){alert(\"hmmm \"+math_fun+\" ?\\nUse command plot for more complex math functions...\");return null;};\ |
};\ |
}\ |
else\ |
{\ |
} else {\ |
while( math_fun.indexOf(in_fun) != -1 ){\ |
math_fun = math_fun.replace(in_fun,out_fun);\ |
math_fun = math_fun.replace(in_fun,In_Fun);\ |
545,9 → 539,7 |
};\ |
};\ |
};\ |
}\ |
else\ |
{\ |
} else {\ |
selected_image = null;\ |
};\ |
};"); |
596,9 → 588,7 |
var obj;\ |
if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\ |
obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\ |
}\ |
else\ |
{\ |
} else {\ |
obj = create_canvas%d(canvas_type,xsize,ysize);\ |
};\ |
var ctx = obj.getContext(\"2d\");\ |
647,9 → 637,7 |
};\ |
if( use_userdraw ){\ |
grid_fill_pattern = ctx;\ |
}\ |
else\ |
{\ |
} else {\ |
setTimeout(function(){ filltoborder( x0,y0,color,color,canvas_type,true,ctx); },500);};return;\ |
};",canvas_root_id,canvas_root_id); |
break; |
676,9 → 664,7 |
};\ |
if( use_userdraw ){\ |
image_pattern = ctx;\ |
}\ |
else\ |
{\ |
} else {\ |
setTimeout(function(){ filltoborder( x0,y0,'red','red',canvas_type,true,ctx); },500);\ |
};\ |
};\ |
709,9 → 695,7 |
};\ |
if( use_userdraw ){\ |
dot_fill_pattern = ctx;\ |
}\ |
else\ |
{\ |
} else {\ |
setTimeout(function(){ filltoborder( x0,y0,color,color,canvas_type,true,ctx); },500);\ |
};\ |
return;\ |
1064,9 → 1048,7 |
xml_div.style.font = obj.fontfamily;\ |
if( ! obj.rotation_center){obj.rotation_center = [obj.x[0],obj.y[0]];}else{obj.rotation_center=[x2px(obj.rotation_center[0]) ,y2px(obj.rotation_center[1]) ];};\ |
if( obj.use_center == 1 ){if( obj.type == 'image' ){xml_div.addEventListener('load',function(e){centered(xml_div,obj);},true);}else{%s};};\ |
}\ |
else\ |
{\ |
} else {\ |
xml_div = document.getElementById('xml_div'+obj.id );\ |
};\ |
if( typeof(xml_div) === 'undefined' ){console.log('hmmmmm'); return;};\ |
1086,7 → 1068,7 |
canvas_div.addEventListener('touchend' ,function(evt){ evt.preventDefault();dragging = false;xml_div.style.backgroundColor = no_color;dragdrop_reply[obj.object_cnt] = {object_cnt:obj.object_cnt,type:obj.onclick,x:xy[0],y:xy[1],r:0,angle:obj.angle,clicked:0};obj.x[0] = xy[0];obj.y[0] = xy[1];},false);\ |
xml_div.addEventListener('touchstart',function(evt){evt.preventDefault();if(dragging){dragging = false;xml_div.style.backgroundColor = no_color;}else{dragging = true;xml_div.style.backgroundColor = back_color;};},false);\ |
xml_div.addEventListener('touchend' ,function(evt){ evt.preventDefault();dragging = false;xml_div.style.backgroundColor = no_color;dragdrop_reply[obj.object_cnt] = {object_cnt:obj.object_cnt,type:obj.onclick,x:xy[0],y:xy[1],r:0,angle:obj.angle,clicked:0};obj.x[0] = xy[0];obj.y[0] = xy[1];},false);\ |
}else{\ |
} else {\ |
canvas_div.addEventListener('mousemove',function(evt){if(!dragging){return;};mouse = getMouse(evt,xml_div);xy = multisnap_check( mouse.x,mouse.y,obj.use_snap);xml_div.style.left = xy[0] - obj.offset[0] - obj.transform[4] + 'px';xml_div.style.top = xy[1] - obj.offset[1] - obj.transform[5] + 'px';},false);\ |
canvas_div.addEventListener('mouseup',function(evt){dragging = false;xml_div.style.backgroundColor = no_color;dragdrop_reply[obj.object_cnt] = {object_cnt:obj.object_cnt,type:obj.onclick,x:xy[0],y:xy[1],r:0,angle:obj.angle,clicked:0};obj.x[0] = xy[0];obj.y[0] = xy[1];},false);\ |
xml_div.addEventListener('mousedown', function(evt){if(dragging){dragging = false;xml_div.style.backgroundColor = no_color;}else{dragging = true;xml_div.style.backgroundColor = back_color;};},false);\ |
1093,16 → 1075,16 |
};\ |
break;\ |
case 1:\ |
if(isTouch ){\ |
if(isTouch){\ |
xml_div.addEventListener('touchstart', function(e){ e.preventDefault();if(dragdrop_reply[obj.object_cnt].clicked == 0){ dragdrop_reply[obj.object_cnt].clicked = 1;xml_div.style.backgroundColor = back_color;}else{dragdrop_reply[obj.object_cnt].clicked = 0;xml_div.style.backgroundColor = no_color;};} ,false);\ |
}else{\ |
} else {\ |
xml_div.addEventListener('mousedown' , function(evt){if(dragdrop_reply[obj.object_cnt].clicked == 0){ dragdrop_reply[obj.object_cnt].clicked = 1;xml_div.style.backgroundColor = back_color;}else{dragdrop_reply[obj.object_cnt].clicked = 0;xml_div.style.backgroundColor = no_color;};} ,false);\ |
};\ |
break;\ |
case 3:\ |
if(isTouch ){\ |
if(isTouch){\ |
xml_div.addEventListener('touchstart',function(evt){ if(slidergroup[obj.object_cnt] == null ){ slidergroup[obj.object_cnt] = obj;xml_div.style.backgroundColor = back_color;}else{ slidergroup[obj.object_cnt] = null;xml_div.style.backgroundColor = no_color;};} ,false);\ |
}else{\ |
} else {\ |
xml_div.addEventListener('mousedown' ,function(evt){ if(slidergroup[obj.object_cnt] == null ){ slidergroup[obj.object_cnt] = obj;xml_div.style.backgroundColor = back_color;}else{ slidergroup[obj.object_cnt] = null;xml_div.style.backgroundColor = no_color;};} ,false);\ |
};\ |
break;\ |
1141,9 → 1123,7 |
var snor_x;var snor_y;\ |
if( xstart != xmin){\ |
snor_x = 0.1*xsize;\ |
}\ |
else\ |
{\ |
}else{\ |
snor_x = 0;\ |
xstart = xmin;\ |
};\ |
1173,9 → 1153,7 |
if( txtsize > txt_marge ){if( flipflop == 1 ){flipflop = 0;}else{flipflop = 1;};};\ |
if( flipflop == 1){\ |
ctx.fillText(num,x - 0.5*txtsize,zero_y+font_size);\ |
}\ |
else\ |
{\ |
} else {\ |
ctx.fillText(num,x - 0.5*txtsize,zero_y+2*font_size);\ |
};\ |
num = num + xmajor;\ |
1223,9 → 1201,7 |
xmin = xstart - (xmajor*(zero_x+snor_x)/step_x);\ |
if( ystart != ymin){\ |
snor_y = 0.1*ysize;\ |
}\ |
else\ |
{\ |
} else {\ |
snor_y = 0;\ |
ystart = ymin;\ |
};\ |
1293,7 → 1269,7 |
for(var p = 0 ; p < l_length ; p++){\ |
barcolor[p] = legendcolors%d[p];\ |
};\ |
}else{\ |
} else {\ |
if( barcolor.length == 0 ){\ |
for(var p = 0 ; p < l_length ; p++){\ |
barcolor[p] = stroke_color;\ |
1373,9 → 1349,7 |
if( corr > xmajor){ if(flipflop == 0 ){flipflop = 1; off = ybase2;}else{flipflop = 0; off = ybase1;};};\ |
ctx.fillText(x_text,parseInt(x_nums-0.5*corr),off);\ |
};\ |
}\ |
else\ |
{\ |
} else {\ |
for(var p = 0 ; p < len ; p = p+2){\ |
x_nums = x2px(eval(str[p]));\ |
x_text = str[p+1];\ |
1387,9 → 1361,7 |
ctx.restore();\ |
};\ |
}\ |
}\ |
else\ |
{\ |
} else {\ |
var corr;var num;var flipflop = 0;var off = ybase1;\ |
var prec = parseInt(Math.log(precision)/Math.log(10));\ |
for(var p = x0 ; p < x1+xmajor ; p = p+xmajor){\ |
1555,9 → 1527,7 |
ctx.moveTo(x_nums,zero_y - tics_length);\ |
ctx.lineTo(x_nums,zero_y + tics_length);\ |
};\ |
}\ |
else\ |
{\ |
} else {\ |
for(var p = 0 ; p < len ; p = p+2){\ |
var x_nums = x2px(eval(str[p]));\ |
var x_text = str[p+1];\ |
1573,9 → 1543,7 |
};\ |
};\ |
ctx.closePath();\ |
}\ |
else\ |
{\ |
} else {\ |
skip = 1;cnt = px2x(zero_x);\ |
prec = Math.log(precision)/(Math.log(10));\ |
var y_basis;if(f_y == 1){ y_basis = ysize }else{ y_basis = zero_y + 1.4*font_size;};\ |
1585,9 → 1553,7 |
corr = ctx.measureText(disp_cnt).width;\ |
skip = parseInt(1.2*corr/xstep);\ |
ctx.fillText(disp_cnt,p-0.5*corr,y_basis);\ |
}\ |
else\ |
{\ |
} else {\ |
skip--;\ |
};\ |
cnt = cnt + xmajor;\ |
1599,9 → 1565,7 |
corr = ctx.measureText(disp_cnt).width;\ |
skip = parseInt(1.2*corr/xstep);\ |
ctx.fillText(disp_cnt,p-0.5*corr,y_basis);\ |
}\ |
else\ |
{\ |
} else {\ |
skip--;\ |
};\ |
cnt = cnt - xmajor;\ |
1620,9 → 1584,7 |
ctx.lineTo(zero_x + tics_length,y_nums);\ |
};\ |
ctx.closePath();\ |
}\ |
else\ |
{\ |
} else {\ |
if(f_x == 1){ corr = 1.5*tics_length; }\ |
cnt = px2y(zero_y);skip = 1;\ |
for( var p = zero_y ; p < ysize ; p = p+ystep){\ |
1631,9 → 1593,7 |
disp_cnt = cnt.toFixed(prec);\ |
if(f_x == -1 ){ corr = parseInt(zero_x - (2 + tics_length + ctx.measureText(disp_cnt).width));};\ |
ctx.fillText(disp_cnt,parseInt(corr),parseInt(p+(0.4*font_size)));\ |
}\ |
else\ |
{\ |
} else {\ |
skip--;\ |
};\ |
cnt = cnt - ymajor;\ |
1646,9 → 1606,7 |
disp_cnt = cnt.toFixed(prec);\ |
if(f_x == -1 ){corr = parseInt(zero_x - (2 + tics_length + ctx.measureText(disp_cnt).width));};\ |
ctx.fillText(disp_cnt,parseInt(corr),parseInt(p+(0.4*font_size)));\ |
}\ |
else\ |
{\ |
} else {\ |
skip--;\ |
};\ |
cnt = cnt + ymajor;\ |
1670,9 → 1628,7 |
for(var p = 0 ; p < l_length ; p++){\ |
barcolor[p] = legendcolors0[p];\ |
};\ |
}\ |
else\ |
{\ |
} else {\ |
if( barcolor.length == 0 ){\ |
for(var p = 0 ; p < l_length ; p++){\ |
barcolor[p] = stroke_color;\ |
1736,9 → 1692,7 |
var d1 = parseInt(line_name[3]);\ |
var d2 = parseInt(line_name[4]);\ |
if(ctx.setLineDash){ ctx.setLineDash([d1,d2]); } else { ctx.mozDash = [d1,d2];};\ |
}\ |
else\ |
{\ |
} else {\ |
if(ctx.setLineDash){ctx.setLineDash = null;};if(ctx.mozDash){ctx.mozDash = null;}\ |
};\ |
var data_x = new Array();var data_y = new Array();\ |
1771,9 → 1725,7 |
var obj;\ |
if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\ |
obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\ |
}\ |
else\ |
{\ |
} else {\ |
obj = create_canvas%d(canvas_type,xsize,ysize);\ |
};\ |
var center_text = use_offset || 0;\ |
1832,9 → 1784,7 |
ctx.rotate(angles[p]);\ |
ctx.fillText(txt,radius-txt_size,0);\ |
ctx.restore();\ |
}\ |
else\ |
{\ |
} else {\ |
if( x_center + radius + txt_size > xsize ){ x_offset = x_center + radius + txt_size - xsize;} else { x_offset = 0; };\ |
ctx.fillText(txt,x_center + radius - x_offset, y_center - radius + y_offset);\ |
y_offset = parseInt(y_offset + 1.5*font_size);\ |
1876,9 → 1826,7 |
median = data[half];\ |
Q1 = data[q1];\ |
Q3 = data[q3];\ |
}\ |
else\ |
{\ |
} else {\ |
median = (data[half - 1] + data[half] )/2;\ |
Q1 = (data[q1 - 1] + data[q1] )/2;\ |
Q3 = (data[q3 - 1] + data[q3] )/2;\ |
1990,9 → 1938,7 |
var obj;\ |
if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\ |
obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\ |
}\ |
else\ |
{\ |
} else {\ |
obj = create_canvas%d(canvas_type,xsize,ysize);\ |
};\ |
var ctx = obj.getContext(\"2d\");\ |
2014,17 → 1960,13 |
var obj;\ |
if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\ |
obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\ |
}\ |
else\ |
{\ |
} else {\ |
obj = create_canvas%d(canvas_type,xsize,ysize);\ |
};\ |
var ctx = obj.getContext(\"2d\");\ |
if( font_family != 'null' ){\ |
ctx.font = font_family;\ |
}\ |
else\ |
{\ |
} else {\ |
ctx.font = font_size+'px Arial';\ |
};\ |
if( use_offset == 3 ){if(angle2 < 0 ){ y = y + 0.8*font_size; x = x + (Math.cos(angle2))*font_size; }else{y = y - 0.8*font_size; x = x + (Math.sin(angle2))*font_size;};};\ |
2041,9 → 1983,7 |
ctx.rotate((360-angle2)*(Math.PI / 180));\ |
ctx.fillText(text,0,0);\ |
ctx.restore();\ |
}\ |
else\ |
{\ |
} else {\ |
ctx.fillText(text,x,y);\ |
};\ |
return;\ |
2224,9 → 2164,7 |
var obj;\ |
if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\ |
obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\ |
}\ |
else\ |
{\ |
} else {\ |
obj = create_canvas%d(canvas_type,xsize,ysize);\ |
};\ |
var ctx = obj.getContext(\"2d\");\ |
2266,9 → 2204,7 |
var obj;\ |
if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\ |
obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\ |
}\ |
else\ |
{\ |
} else {\ |
obj = create_canvas%d(canvas_type,xsize,ysize);\ |
};\ |
var ctx = obj.getContext(\"2d\");\ |
2366,9 → 2302,7 |
var obj;\ |
if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\ |
obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\ |
}\ |
else\ |
{\ |
} else {\ |
obj = create_canvas%d(canvas_type,xsize,ysize);\ |
};\ |
var ctx = obj.getContext(\"2d\");\ |
2470,9 → 2404,7 |
var obj;\ |
if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\ |
obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\ |
}\ |
else\ |
{\ |
} else {\ |
obj = create_canvas%d(canvas_type,xsize,ysize);\ |
};\ |
var ctx = obj.getContext(\"2d\");\ |