・ + ○ □ ■x △
○ ×
○ ×
_x=
_y=
---
o--o
o--
--o
...
○ ×
Alpha=
○ ×
|
19){image_num=0};
}catch(e){
}
}
var DeformingPt_MS=new Array();
DeformingPt_MS.add=function(Ptnum, pointerId){
var lId=new Object;
lId.ptnum=Ptnum;
lId.pointerId=pointerId;
this.push(lId);
}
DeformingPt_MS.remove_by_touch=function(e){
this.remove(e.pointerId);
check_free2Lattice();
}
DeformingPt_MS.remove=function(pointerId){
for(var i=0 ; i < this.length ; i++){
if(this[i].pointerId==pointerId){
this.splice(i,1);
if(this.length==1){
deformingPtNum[0]=this[0].ptnum;
}
}
}
if(this.length==0){
if(getGCstatus()==GSkinds.deforming){
setGCstatus(GSkinds.pop);
showStatusBar();
}
}
}
DeformingPt_MS.getPtnum_from_touch=function(e){
return this.getPtnum_from_pointerId(e.pointerId);
}
DeformingPt_MS.getPtnum_from_pointerId=function(Id){
for(var i=0 ; i < this.length ; i++){
if(this[i].pointerId==Id){
return this[i].ptnum;
}
}
return -1;
}
DeformingPt_MS.add_by_touch=function(e){
var deformingPtNum_k;
for( var k=0 ; k < mouseX.length ; k++){
var min2_dp=100;
deformingPtNum_k=-1;
var dis2;
for(var i=0; i < GCfig.wm.length; i++){
if(GCfig.wm[i].independent==PointIndependentKinds.Deformable){
dx=GCfig.wm[i].x - mouseX[k];
dy=GCfig.wm[i].y - mouseY[k];
dis2=dx * dx+dy * dy;
dis2_dp=dis2/dp;
if(dis2/dp < min2_dp){
deformingPtNum_k=i;
min2_dp=dis2 / dp;
}
}
}
}
this.add(deformingPtNum_k, e.pointerId);
if(this.length==1){
deformingPtNum[0]=deformingPtNum_k;
}
}
DeformingPt_MS.isLastPt=function(e){
if(this[this.length - 1].pointerId==e.pointerId){
return true;
}else{
return false;
}
}
function pointerDownListner(e){
adjustXY(e);
var gGCS=getGCstatus();
if(gGCS==GSkinds.standard){
mouseDownFlag=true;
setGCstatus(GSkinds.deforming);
showStatusBar();
DeformingPt_MS.add_by_touch(e);
if(GE.trace_sw){
addTrace();
}
}
if(gGCS==GSkinds.deforming){
DeformingPt_MS.add_by_touch(e);
if(benchMark_dragSW){
benchMark_ct=0;
}
}
if(gGCS==GSkinds.construct_select || gGCS==GSkinds.edit_select || gGCS==GSkinds.edit2_select || gGCS==GSkinds.edit2_select2 || gGCS==GSkinds.construct_segment_polygon || gGCS==GSkinds.construct_polygon ){
sel_by_mouseXY(mouseX[0], mouseY[0]);
}
if(gGCS==GSkinds.construct_pointAdd_free){
gq(mouseX[0], mouseY[0]);
}
firstMoving=true;
for( var i=0 ; i < mouseX.length; i++){
old_mouseX[i]=mouseX[i];
old_mouseY[i]=mouseY[i];
}
old_mouseX_length=mouseX.length;
}
function pointerUpListner(e){
DeformingPt_MS.remove_by_touch(e);
}
function pointerMoveListner(e){
adjustXY(e);
var Pt_num_MS=DeformingPt_MS.getPtnum_from_touch(e);
if(Pt_num_MS < 0 ){
return;
}
GCfig.wm[Pt_num_MS].x=mouseX[0];
GCfig.wm[Pt_num_MS].y=mouseY[0];
if(GCfig.wm[Pt_num_MS].BoundedKind > 0){
getPBounded_location(GCfig.wm[Pt_num_MS]);
}
if(fnkey_sw==1){
if(fnkey_mode==0){
ProjectPt2NearestObj_MS(Pt_num_MS);
}else{
GCfig.wm[Pt_num_MS].x=Math.floor(mouseX[0]+0.5);
GCfig.wm[Pt_num_MS].y=Math.floor(mouseY[0]+0.5);
}
}else if(fnkey_sw==2){
GCfig.wm[Pt_num_MS].x=Math.floor(mouseX[0]+0.5);
GCfig.wm[Pt_num_MS].y=Math.floor(mouseY[0]+0.5);
}else{
}
if((shiftKey_isPressed || Sbtn_sw || c_shift_sw)==true){
ProjectPt2NearestObj_MS(Pt_num_MS);
}else if((ctrlKey_isPressed || Cbtn_sw || c_ctrl_sw)==true){
GCfig.wm[Pt_num_MS].x=Math.floor(mouseX[0]+0.5);
GCfig.wm[Pt_num_MS].y=Math.floor(mouseY[0]+0.5);
}
switch(GCfig.wm[Pt_num_MS].BoundedKind){
case wg.lattice:
GCfig.wm[Pt_num_MS].x=Math.floor(mouseX[0]+0.5);
GCfig.wm[Pt_num_MS].y=Math.floor(mouseY[0]+0.5);
break;
case wg.nearestObject:
ProjectPt2NearestObj_MS(Pt_num_MS);
break;
case wg.nearestObject2lattice:
ProjectPt2NearestObj_MS(Pt_num_MS);
break;
}
if(GE.trace_sw){
addTrace();
}
clsAnddrawfig();
}
function canvas_touch(e){
if(e.type=="pointerdown"){pointerDownListner(e);}
if(e.type=="pointermove"){pointerMoveListner(e);}
if(e.type=="pointerup"){pointerUpListner(e);}
if(e.type=="MSPointerDown"){pointerDownListner(e);}
if(e.type=="MSPointerMove"){pointerMoveListner(e);}
if(e.type=="MSPointerUp"){pointerUpListner(e);}
}
var l_canvas=ById("tempCanvas");
var ctx_l=l_canvas.getContext('2d');
function set_bgImg(){
ById("bgImg").src=ById("bgImg_src").value+"";
canvas_bgImg.style.display="block";
ById("bgImg").onload=function(){
canvas_bgImg.style.display="block";
draw_bgImg();
ctx_l.width=ById("bgImg").width;
ctx_l.height=ById("bgImg").height;
ctx_l.drawImage(ById("bgImg"), 0, 0);
g();
}
}
function clear_bgImg(){
ById("bgImg").style.display="none";
ById("bgImg_src").value="";
canvas_bgImg.style.display="none";
g();
}
function Data2URL_bgImg(){
try{
var img_png_src=canvas_bgImg.toDataURL();
ById("bgImg_src").value=img_png_src;
bgImg_src2=img_png_src;
}catch(e){
alert("I cannot make dataURL by security error.");
}finally{
}
g();
}
function Data2URL_bgImg2(){
try{
ById("bgImg").src=ById("bgImg_src").value ;
ById("bgImg").onload=function(){
canvas_bgImg.style.display="block";
draw_bgImg();
ctx_l.width=ById("bgImg").width;
ctx_l.height=ById("bgImg").height;
ctx_l.drawImage(ById("bgImg"), 0, 0);
g();
}
}catch(e){
alert("error.");
}finally{
}
g();
}
function draw_bgImg(){
if(canvas_bgImg.style.display=="none" || ById("bgImg").src.length==0){
}else{
var bgImage=ById("bgImg");
var Iw=bgImg.width;
var Ih=bgImg.height;
var Cw=canvas_bgImg.width;
var Ch=canvas_bgImg.height;
var dw=(Iw - Cw)/2 ;
var dh=(Ih - Ch)/2 ;
var m=Math.pow(2, GE.zoom);
if(m>0.9){
try{
ctx_bgImg.drawImage(bgImage, Iw / 2 - Cw /2 / m, Ih / 2 - Ch /2 / m, Cw/m, Ch/m, 0 , 0 ,Cw,Ch)
}catch(e){
try{
ctx_bgImg.drawImage(bgImage, 0 , 0 ,Cw,Ch);
}catch(e){
}
}finally{
}
}else{
ctx_bgImg.clearRect(0,0,Cw, Ch);
var ww=Cw*m;
var hh=Ch*m;
try{
ctx_bgImg.drawImage(bgImage, dw, dh, Cw, Ch, Cw/2 - ww/2, Ch/2 - hh/2 ,ww,hh);
}catch(e){
ctx_bgImg.drawImage(bgImage, 0 , 0 ,Cw,Ch);
}finally{
}
}
}
}
function touchstartListner(e){
if(mouseEventisListened==true){removeMouseEventListners()}
mouseDownListner(e);
}
function touchmoveListner(e){
mouseMoveListner(e);
}
function touchendListner(e){
mouseUpListner(e);
}
function touchcancelListner(e){
mouseOutListner(e);
}
var mouseEventisListened=true;
function removeMouseEventListners(){
if(mouseEventisListened==true){
mouseEventisListened=false;
canvas.removeEventListener("mousedown", mouseDownListner, false);
canvas.removeEventListener("mousemove", mouseMoveListner, false);
canvas.removeEventListener("mouseup", mouseUpListner, false);
canvas.removeEventListener("mouseout", mouseOutListner, false);
}else{
}
}
function init_addEventListener_menu(){
ELc('btn_AddConstruction',b2);
ELc('btn_AddMeasurement',db);
ELc('btn_Edit',hX);
ELc('btn_Option',hL);
ELc('btn_File',hY);
ELc('btn_Read',hZ);
ELc('btn_New',h4);
ELc('btn_Reload',hN);
ELc('btn_Reload0',fC);
ELc('btn_Reload1',fD);
ELc('btn_Reload2',fE);
ELc('btn_Reload3',fF);
ELc('btn_Marker',hK);
ELc('btn_construct_point', b5);
ELc('btn_construct_line', dg);
ELc('btn_construct_segment', bx);
ELc('btn_construct_hline', b4);
ELc('btn_construct_circle',bJ);
ELc('btn_construct_arc',menu_construct_arc);
ELc('btn_construct_point_cross', aL);
ELc('btn_construct_point_centers', aB);
ELc('btn_construct_pointDivide', aM);
ELc('btn_construct_pointAdd', bc);
ELc('btn_measure_distance', bW);
ELc('btn_measure_angle', eJ);
ELc('btn_measure_area', fQ);
ELc('btn_measure_length', dU);
ELc('btn_measure_coordinate', bq);
ELc('btn_measure_express', c0);
ELc('btn_measure_function', bX);
ELc('btn_measure_locus0', menu_implicit_function0);
ELc('btn_measure_locus1', menu_implicit_function1);
ELc('btn_measure_locus2', menu_implicit_function2);
ELc('btn_measure_locus3', menu_implicit_function3);
ELc('btn_measure_locus4', menu_implicit_function4);
ELc('btn_option_digits', e8);
ELc('btn_option_axis', gF);
ELc('btn_option_chr', gZ);
ELc('btn_option_number', fb);
ELc('btn_option_mode', gH);
ELc('btn_option_language', c5);
ELc('option_language_korean', aG);
ELc('option_language_japanese', aA);
ELc('option_language_english', aD);
ELc('btn_option_record',fc);
ELc('btn_option_trace', f6);
ELc('btn_option_graphR', e9);
ELc('btn_optionRecordEnter', set_option_recordsw);
ELc('btn_optionTraceEnter', set_option_autotracesw);
ELc('btn_optionGraphREnter', set_option_graphR_sw);
ELc('btn_edit_point', b9);
ELc('btn_editPointEnter', bP);
ELc('btn_edit_point2', bQ);
ELc('btn_editPoint2kind_free', a7);
ELc('btn_editPoint2kind_point', aZ);
ELc('btn_editPoint2kind_line', a8);
ELc('btn_editPoint2kind_circle',aQ);
ELc('btn_editPoint2kind_lattice', aF);
ELc('btn_editPoint2kind_free2lattice', ah);
ELc('btn_editPoint2kind_nearestObject', ae);
ELc('btn_editPoint2kind_nearestObject2lattice', aa);
ELc('btn_edit_num', d9);
ELc('btn_editValueEnter', bR);
ELc('btn_editNumArrowUp', ej);
ELc('btn_editNumArrowDown', cb);
ELc('btn_editNumEnter', dz);
ELc('btn_edit_line', dv);
ELc('btn_editLineEnter', b8);
ELc('btn_edit_circle', bO);
ELc('btn_editCircleEnter', bA);
ELc('btn_edit_arc', hX_arc_init);
ELc('btn_editArcEnter', hX_arc_enter);
ELc('btn_edit_polygon', bB);
ELc('btn_editPolygonEnter', bp);
ELc('btn_edit_angle', b7);
ELc('btn_editAngleEnter', bN);
ELc('btn_file_iijima_server_save', menu_iijima_server_save);
display_on('btn_file_iijima_server_save');
ELc('btn_file_PC_save', menu_PC_save);
display_on('btn_file_PC_save');
if(window.location.protocol=='http:'){
ELc('btn_file_online_save', gE);
display_on('btn_file_online_save');
}else if(window.location.protocol=='file:'){
display_off('btn_file_online_save');
}else{
}
display_off('notyet');
ELc('btn_file_Storage', fO);
ELc('btn_file_Storage2', fO);
ELc('local_files',loadfile_local);
ELc('local_files_merge'o$ |