Subversion Repositories wimsdev

Rev

Rev 16893 | Rev 17351 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16893 Rev 16900
Line 831... Line 831...
831
/*
831
/*
832
5/2016 changed  to 'setAttribute()' because of trouble on Chromium/Safari/IE
832
5/2016 changed  to 'setAttribute()' because of trouble on Chromium/Safari/IE
833
10/2016 corrected contex-reset-flaw when using "userdraw text,color" and added inputs to the things we can remove
833
10/2016 corrected contex-reset-flaw when using "userdraw text,color" and added inputs to the things we can remove
834
7/2017 added 'userdraw clickfill,color' to removable things...one user_filling per click
834
7/2017 added 'userdraw clickfill,color' to removable things...one user_filling per click
835
 
835
 
-
 
836
7/2022: preserve all div's with html ('<' && '/>') eg mathml,katex,html and all external objects placed with function 'place_image_on_canvas(id)'
836
7/2022: preserve div's with math (katex | wims_mathml)...hope this does not interfere with other things
837
...hope this does not interfere with other things
837
https://wimsedu.info/?topic=geometrie-interactive-avec-canvasdraw
838
https://wimsedu.info/?topic=geometrie-interactive-avec-canvasdraw
838
*/
839
*/
839
fprintf(js_include_file,"\n/* add clear button */\
840
fprintf(js_include_file,"\n/* add clear button */\
840
clear_draw_area%d = function(){\
841
clear_draw_area%d = function(){\
841
 if(typeof(fill_canvas_no) === 'number'){\
842
 if(typeof(fill_canvas_no) === 'number'){\
Line 847... Line 848...
847
  };\
848
  };\
848
 };\
849
 };\
849
 if( typeof(context_userdraw) === 'object' ){\
850
 if( typeof(context_userdraw) === 'object' ){\
850
  if(document.getElementById(canvas_div.lastChild.id).tagName == 'DIV'){\
851
  if(document.getElementById(canvas_div.lastChild.id).tagName == 'DIV'){\
851
   var mathtxt = document.getElementById(canvas_div.lastChild.id).innerHTML;\
852
   var mathtxt = document.getElementById(canvas_div.lastChild.id).innerHTML;\
852
   if(mathtxt.indexOf('katex') == -1 && mathtxt.indexOf('wims_mathml') == -1 || canvas_div.lastChild.id.indexOf('placed') != -1){\
853
   if(mathtxt.indexOf('<') == -1 && mathtxt.indexOf('/>') == -1 || canvas_div.lastChild.id.indexOf('placed') != -1){\
853
    document.getElementById(canvas_div.lastChild.id).innerHTML = null;\
854
    document.getElementById(canvas_div.lastChild.id).innerHTML = null;\
854
    canvas_div.removeChild(document.getElementById(canvas_div.lastChild.id));\
855
    canvas_div.removeChild(document.getElementById(canvas_div.lastChild.id));\
855
   };\
856
   };\
856
  };\
857
  };\
857
  context_userdraw.clearRect(0,0,xsize,ysize);\
858
  context_userdraw.clearRect(0,0,xsize,ysize);\