Subversion Repositories wimsdev

Rev

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

Rev 16847 Rev 16942
Line 247... Line 247...
247
 };\
247
 };\
248
 return math_fun;\
248
 return math_fun;\
249
};");
249
};");
250
break;
250
break;
251
 
251
 
252
case INTERACTIVE:
252
case INTERACTIVE:/* 1/8/2022 NOTE : getMouse() code should run at maximum speed and not be bothered with all kind of fancy tests !! */
253
 fprintf(js_include_file,"\n/* add mouse support */\
253
 fprintf(js_include_file,"\n/* add mouse support */\
254
var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0));\
254
var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0));\
255
var getMouse = function(e, element){\
255
var getMouse = function(e, element){\
256
   var mx,my;var offsetX = 0,offsetY = 0;\
256
   var mx,my;var offsetX = 0,offsetY = 0;\
257
   while( ( element = element.offsetParent) ){\
257
   while( ( element = element.offsetParent) ){\
Line 262... Line 262...
262
      mx = e.pageX - offsetX; my = e.pageY - offsetY;\
262
      mx = e.pageX - offsetX; my = e.pageY - offsetY;\
263
   }else{\
263
   }else{\
264
      mx = e.clientX - offsetX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft:document.body.scrollLeft);\
264
      mx = e.clientX - offsetX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft:document.body.scrollLeft);\
265
      my = e.clientY - offsetY + (document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop);\
265
      my = e.clientY - offsetY + (document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop);\
266
   };\
266
   };\
-
 
267
   /* 1/8/2022 : latest improvements related to 'reponsiveness' will fatally lockup browsers in the pixel-by-pixel filling...at least in userdraw clickfill...*/
-
 
268
   if( typeof(clickfill) === 'function'){ return {x: mx, y: my};}else{\
267
   /* test if canvas_div is inside a scrollable */\
269
   /* test if canvas_div is inside a scrollable */\
268
   const scroll_parent = canvas_div.closest('.wims_scrollable');\
270
   const scroll_parent = canvas_div.closest('.wims_scrollable');\
269
   if (scroll_parent){\
271
   if (scroll_parent){\
270
      mx = mx + scroll_parent.scrollLeft;\
272
      mx = mx + scroll_parent.scrollLeft;\
271
      my = my + scroll_parent.scrollTop;\
273
      my = my + scroll_parent.scrollTop;\
Line 275... Line 277...
275
   console.log('xsize='+xsize);\
277
   console.log('xsize='+xsize);\
276
   console.log('canvas_div.offsetHeight='+canvas_div.offsetWidth);*/\
278
   console.log('canvas_div.offsetHeight='+canvas_div.offsetWidth);*/\
277
   mx = (mx * xsize / canvas_div.offsetWidth);\
279
   mx = (mx * xsize / canvas_div.offsetWidth);\
278
   /*console.log('mx after='+mx);*/\
280
   /*console.log('mx after='+mx);*/\
279
   my = (my * ysize / canvas_div.offsetHeight);\
281
   my = (my * ysize / canvas_div.offsetHeight);\
280
   return {x: mx, y: my};\
282
   return {x: mx, y: my};};\
281
};");
283
};");
282
break;
284
break;
283
case USERDRAW_AND_ZOOM:
285
case USERDRAW_AND_ZOOM:
284
fprintf(js_include_file,"\n/* add zoom support for multidraw */\
286
fprintf(js_include_file,"\n/* add zoom support for multidraw */\
285
function recalculate_userdraw(xmin0,ymin0,xmax0,ymax0){\
287
function recalculate_userdraw(xmin0,ymin0,xmax0,ymax0){\