Rev 16845 | Rev 16942 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 16845 | Rev 16847 | ||
---|---|---|---|
Line 441... | Line 441... | ||
441 | 441 | ||
442 | case DRAG_EXTERNAL_IMAGE: |
442 | case DRAG_EXTERNAL_IMAGE: |
443 | /* |
443 | /* |
444 | the external_canvas is already created: it needs to be FIRST in order to do some drawing onto it |
444 | the external_canvas is already created: it needs to be FIRST in order to do some drawing onto it |
445 | reply is object{} and identical to reply from dragstuff library for drag&drop&click |
445 | reply is object{} and identical to reply from dragstuff library for drag&drop&click |
446 | reply[object_cnt] = {type:onclick,x:x0,y:y0,r:radius,angle:angle,clicked:0|1}; |
- | |
447 | - | ||
448 | - | ||
449 | img[6]= parseInt(img[6] - img[16]);\ |
- | |
450 | img[7]= parseInt(img[7] - img[17]);\ |
- | |
451 | else{\ |
- | |
452 | img[6]= parseInt(img[6] + img[16]);\ |
- | |
453 | img[7]= parseInt(img[7] + img[17]);\ |
- | |
454 | };\ |
- | |
455 | - | ||
456 | */ |
446 | */ |
457 | fprintf(js_include_file,"\n/* drag external images */\ |
447 | fprintf(js_include_file,"\n/* drag external images */\ |
458 | var external_ctx = external_canvas.getContext(\"2d\");\ |
448 | var external_ctx = external_canvas.getContext(\"2d\");\ |
459 | var external_canvas_rect = external_canvas.getBoundingClientRect();\ |
449 | var external_canvas_rect = external_canvas.getBoundingClientRect();\ |
460 | canvas_div.addEventListener(\"mousedown\",setxy,false);\ |
450 | canvas_div.addEventListener(\"mousedown\",setxy,false);\ |
Line 494... | Line 484... | ||
494 | img[17] = 0.5*img[9];\ |
484 | img[17] = 0.5*img[9];\ |
495 | img[6]= parseInt(img[6] - img[16]);\ |
485 | img[6]= parseInt(img[6] - img[16]);\ |
496 | img[7]= parseInt(img[7] - img[17]);\ |
486 | img[7]= parseInt(img[7] - img[17]);\ |
497 | };\ |
487 | };\ |
498 | external_ctx.drawImage(img[1],img[2],img[3],img[4],img[5],img[6],img[7],img[8],img[9]);\ |
488 | external_ctx.drawImage(img[1],img[2],img[3],img[4],img[5],img[6],img[7],img[8],img[9]);\ |
499 | dragdrop_reply[img[10]] = { |
489 | dragdrop_reply[img[10]] = {type:img[0],object_cnt:img[10],x:x0,y:y0,r:0,angle:0,clicked:img[15]};\ |
500 | ext_drag_images[ext_image_cnt] = img;\ |
490 | ext_drag_images[ext_image_cnt] = img;\ |
501 | ext_image_cnt++;\ |
491 | ext_image_cnt++;\ |
502 | };\ |
492 | };\ |
503 | };\ |
493 | };\ |
504 | function dragstop(evt){\ |
494 | function dragstop(evt){\ |
505 | if(selected_image != null){\ |
495 | if(selected_image != null){\ |
506 | var s_img = ext_drag_images[selected_image];\ |
496 | var s_img = ext_drag_images[selected_image];\ |
507 | dragdrop_reply[s_img[10]] = {type:s_img[0],x:s_img[6]+s_img[16],y:s_img[7]+s_img[17],r:s_img[8],angle:s_img[15],clicked:s_img[15]};\ |
497 | dragdrop_reply[s_img[10]] = {type:s_img[0], object_cnt:s_img[10],x:s_img[6]+s_img[16],y:s_img[7]+s_img[17],r:s_img[8],angle:s_img[15],clicked:s_img[15]};\ |
508 | console.log(dragdrop_reply[s_img[12]]);\ |
- | |
509 | };\ |
498 | };\ |
510 | selected_image = null;return;\ |
499 | selected_image = null;return;\ |
511 | };\ |
500 | };\ |
512 | function dragxy(evt){\ |
501 | function dragxy(evt){\ |
513 | if( selected_image != null ){\ |
502 | if( selected_image != null ){\ |
Line 525... | Line 514... | ||
525 | };\ |
514 | };\ |
526 | };\ |
515 | };\ |
527 | };\ |
516 | };\ |
528 | function setxy(evt){\ |
517 | function setxy(evt){\ |
529 | if( ! selected_image ){\ |
518 | if( ! selected_image ){\ |
530 | console.log(selected_image);\ |
- | |
531 | var mouse = getMouse(evt,external_canvas);\ |
519 | var mouse = getMouse(evt,external_canvas);\ |
532 | var xm = mouse.x;\ |
520 | var xm = mouse.x;\ |
533 | var ym = mouse.y;\ |
521 | var ym = mouse.y;\ |
534 | var img;var xmarge;var ymarge;\ |
522 | var img;var xmarge;var ymarge;\ |
535 | for(var p = 0 ; p < ext_image_cnt ; p++){\ |
523 | for(var p = 0 ; p < ext_image_cnt ; p++){\ |