Subversion Repositories wimsdev

Rev

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

Rev 16972 Rev 17351
Line 187... Line 187...
187
        type = get_token(infile);
187
        type = get_token(infile);
188
        done = FALSE;
188
        done = FALSE;
189
        /*
189
        /*
190
        @ canvasdraw
190
        @ canvasdraw
191
        @ Canvasdraw will try use the same basic syntax structure as flydraw
191
        @ Canvasdraw will try use the same basic syntax structure as flydraw
192
        @ General syntax <ul><li>The transparency of all objects can be controlled by command <a href="#opacity">opacity [0-255],[0,255]</a></li><li>line width of any object can be controlled by command <a href="#linewidth">linewidth int</a></li><li>any may be dashed by using keyword <a href="#dashed">dashed</a> before the object command.<br /> the dashing type can be controled by command <a href="#dashtype">dashtype int,int</a>please note: dashing may have different spacing depending on the angle of the line<br />see https://wimsedu.info/?topic=dashed-arrows-not-dashed-in-canvasdraw</li><li>a fillable object can be set fillable by starting the object command with an ''f`` (like ''frect``,''fcircle``,''ftriangle`` ...) or by using the keyword <a href="#filled">filled</a> before the object command.<br />The fill colour of ''non_userdraw`` objects will be the stroke colour...(flydraw harmonization 19/10/2013)<br />    non-solid filling (grid,hatch,diamond,dot,text) is provided using command <a href="#fillpattern">fillpattern a_pattern</a><br />note: do not use a <b>f</b> with this non-solid pattern filling !<br />for <a href="#filltoborder">filltoborder x0,y0,color</a> or <a href="#filltoborder">fill x0,y0,color</a> type filling (eg fill a region around x0,y0 with color until a border is encountered),<br />there are non-solid pattern fill analogues:<ul><li><a href="#gridfill">gridfill x,y,dx,dy,color</a></li><li><a href="#hatchfill">hatchfill x,y,dx,dy,color</a></li><li><a href="#diamondfill">diamondfill x,y,dx,dy,color</a></li><li><a href="#dotfill">dotfill x,y,dx,dy,color</a></li><li><a href="#textfill">textfill x,y,color,sometext_or_char</a></li></ul></li><li>all draggable objects may have a <a href="#slider">slider</a> for translation / rotation; several objects may be translated / rotated by a single slider</li> <li> a draggable object can be set draggable by a preceding command <a href="#drag">drag x/y/xy</a><br />The translation can be read by javascript:read_dragdrop();The replyformat is: object_number : x-orig : y-orig : x-drag : y-drag<br />The x-orig/y-orig will be returned in maximum precision (javascript float)...<br />the x-drag/y-drag will be returned in defined ''precision`` number of decimals<br />Multiple objects may be set draggable / clickable (no limit)<br />not all flydraw objects may be dragged / clicked<br />Only draggable / clickable objects will be scaled on <a href="#zoom">zoom</a> and will be translated in case of panning.</li><li> a ''onclick object`` can be set ''clickable`` by the preceding keyword <a href="#onclick">onclick</a><br />not all flydraw objects can be set clickable</li><li><b>remarks using a '';`` as command separator</b>. Commands with only numeric or colour arguments may be using a '';`` as command separator (instead of a new line). Commands with a string argument may not use a '';`` as command separator !<br />these exceptions are not really straight forward... so keep this in mind.</li><li>almost every <a href="#userdraw">userdraw object,color</a> or <a href="#multidraw">multidraw</a> command ''family`` may be combined with keywords <a href="#snaptogrid">"snaptogrid | xsnaptogrid | ysnaptogrid | snaptofunction</a> or command <code>snaptopoints x1,y1,x2,y2,...</code></li><li>every draggable | onclick object may be combined with keywords <a href="#snaptogrid">snaptogrid | xsnaptogrid | ysnaptogrid | snaptofunction</a> or command <code>snaptopoints x1,y1,x2,y2,...</code></li><li>almost every command for a single object has a multiple objects counterpart:<br /><ul>general syntax rule:<li><code>object x1,y1,...,color</code></li><li><code>objects color,x1,y1,...</code></li></ul><li>All inputfields or textareas generated, can be styled individually using command <a href="#css">css some_css</a><br/>the fontsize used for labeling these elements can be controlled by command <a href="#fontsize">fontsize int</a> <br />command <code>fontfamily</code> is <b>not</b> active for these elements</li></ul>
192
        @ General syntax <ul><li>The transparency of all objects can be controlled by command <a href="#opacity">opacity [0-255],[0,255]</a></li><li>line width of any object can be controlled by command <a href="#linewidth">linewidth int</a></li><li>any may be dashed by using keyword <a href="#dashed">dashed</a> before the object command.<br> the dashing type can be controled by command <a href="#dashtype">dashtype int,int</a>please note: dashing may have different spacing depending on the angle of the line<br>see https://wimsedu.info/?topic=dashed-arrows-not-dashed-in-canvasdraw</li><li>a fillable object can be set fillable by starting the object command with an ''f`` (like ''frect``,''fcircle``,''ftriangle`` ...) or by using the keyword <a href="#filled">filled</a> before the object command.<br>The fill colour of ''non_userdraw`` objects will be the stroke colour...(flydraw harmonization 19/10/2013)<br>    non-solid filling (grid,hatch,diamond,dot,text) is provided using command <a href="#fillpattern">fillpattern a_pattern</a><br>note: do not use a <b>f</b> with this non-solid pattern filling !<br>for <a href="#filltoborder">filltoborder x0,y0,color</a> or <a href="#filltoborder">fill x0,y0,color</a> type filling (eg fill a region around x0,y0 with color until a border is encountered),<br>there are non-solid pattern fill analogues:<ul><li><a href="#gridfill">gridfill x,y,dx,dy,color</a></li><li><a href="#hatchfill">hatchfill x,y,dx,dy,color</a></li><li><a href="#diamondfill">diamondfill x,y,dx,dy,color</a></li><li><a href="#dotfill">dotfill x,y,dx,dy,color</a></li><li><a href="#textfill">textfill x,y,color,sometext_or_char</a></li></ul></li><li>all draggable objects may have a <a href="#slider">slider</a> for translation / rotation; several objects may be translated / rotated by a single slider</li> <li> a draggable object can be set draggable by a preceding command <a href="#drag">drag x/y/xy</a><br>The translation can be read by javascript:read_dragdrop();The replyformat is: object_number : x-orig : y-orig : x-drag : y-drag<br>The x-orig/y-orig will be returned in maximum precision (javascript float)...<br>the x-drag/y-drag will be returned in defined ''precision`` number of decimals<br>Multiple objects may be set draggable / clickable (no limit)<br>not all flydraw objects may be dragged / clicked<br>Only draggable / clickable objects will be scaled on <a href="#zoom">zoom</a> and will be translated in case of panning.</li><li> a ''onclick object`` can be set ''clickable`` by the preceding keyword <a href="#onclick">onclick</a><br>not all flydraw objects can be set clickable</li><li><b>remarks using a '';`` as command separator</b>. Commands with only numeric or colour arguments may be using a '';`` as command separator (instead of a new line). Commands with a string argument may not use a '';`` as command separator !<br>these exceptions are not really straight forward... so keep this in mind.</li><li>almost every <a href="#userdraw">userdraw object,color</a> or <a href="#multidraw">multidraw</a> command ''family`` may be combined with keywords <a href="#snaptogrid">"snaptogrid | xsnaptogrid | ysnaptogrid | snaptofunction</a> or command <code>snaptopoints x1,y1,x2,y2,...</code></li><li>every draggable | onclick object may be combined with keywords <a href="#snaptogrid">snaptogrid | xsnaptogrid | ysnaptogrid | snaptofunction</a> or command <code>snaptopoints x1,y1,x2,y2,...</code></li><li>almost every command for a single object has a multiple objects counterpart:<br><ul>general syntax rule:<li><code>object x1,y1,...,color</code></li><li><code>objects color,x1,y1,...</code></li></ul><li>All inputfields or textareas generated, can be styled individually using command <a href="#css">css some_css</a><br/>the fontsize used for labeling these elements can be controlled by command <a href="#fontsize">fontsize int</a> <br>command <code>fontfamily</code> is <b>not</b> active for these elements</li></ul>
193
        @ If needed multiple interactive scripts (*) may be used in a single webpage.<br />A function <code>read_canvas()</code> and / or <code>read_dragdrop()</code> can read all interactive userdata from these images.<br />The global array <code>canvas_scripts</code>will contain all unique random "canvas_root_id" of the included scripts.<br />The included local javascript "read" functions ''read_canvas%d()`` and ''read_dragdrop%d()`` will have this ''%d = canvas_root_id``<br />e.g. canvas_scripts[0] will be the random id of the first script in the page and will thus provide a function<br /><code>fun = eval("read_canvas"+canvas_scripts[0])</code> to read user based drawings / inputfield in this first image.<br />The read_dragdrop is analogue.<br />If the default reply formatting is not suitable, use command <a href='#replyformat'>replyformat</a> to format the replies for an individual canvas script,<br />To read all user interactions from all included canvas scripts, use something like:<br /><code>function read_all_canvas_images(){<br />&nbsp;var script_len = canvas_scripts.length;<br />&nbsp;var draw_reply = "";<br />&nbsp;var found_result = false;<br />&nbsp;for(var p = 0 ; p < script_len ; p++){<br />&nbsp;&nbsp;var fun = eval("read_canvas"+canvas_scripts[p]);<br />&nbsp;&nbsp;if( typeof fun === 'function'){<br />&nbsp;&nbsp;&nbsp;var result = fun();<br />&nbsp;&nbsp;&nbsp;if( result&nbsp;&nbsp;&& result.length != 0){<br />&nbsp;&nbsp;&nbsp;&nbsp;if(script_len == 1 ){.return result;};<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;found_result = true;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;draw_reply = draw_reply + result + "newline";<br />&nbsp;&nbsp;&nbsp;&nbsp;};<br />&nbsp;&nbsp;&nbsp;};<br />&nbsp;&nbsp;};<br />&nbsp;if( found_result ){return draw_reply;}else{return null;};<br />};</code> <br />(*) Note: the speed advantage over <em>canvas-do-it-all</em> libraries is reduced to zero, when multiple canvasdraw scripts are present in a single page...<br />For example a typical canvasdraw script is between 5 and 40 kB...a large library like JSXgraph is approx 600 kB<br />In these cases it would be much faster to load a static general HTML5 canvas javascript draw library and parse it multiple raw fly instructions !<br />
193
        @ If needed multiple interactive scripts (*) may be used in a single webpage.<br>A function <code>read_canvas()</code> and / or <code>read_dragdrop()</code> can read all interactive userdata from these images.<br>The global array <code>canvas_scripts</code>will contain all unique random "canvas_root_id" of the included scripts.<br>The included local javascript "read" functions ''read_canvas%d()`` and ''read_dragdrop%d()`` will have this ''%d = canvas_root_id``<br>e.g. canvas_scripts[0] will be the random id of the first script in the page and will thus provide a function<br><code>fun = eval("read_canvas"+canvas_scripts[0])</code> to read user based drawings / inputfield in this first image.<br>The read_dragdrop is analogue.<br>If the default reply formatting is not suitable, use command <a href='#replyformat'>replyformat</a> to format the replies for an individual canvas script,<br>To read all user interactions from all included canvas scripts, use something like:<br><code>function read_all_canvas_images(){<br>&nbsp;var script_len = canvas_scripts.length;<br>&nbsp;var draw_reply = "";<br>&nbsp;var found_result = false;<br>&nbsp;for(var p = 0 ; p < script_len ; p++){<br>&nbsp;&nbsp;var fun = eval("read_canvas"+canvas_scripts[p]);<br>&nbsp;&nbsp;if( typeof fun === 'function'){<br>&nbsp;&nbsp;&nbsp;var result = fun();<br>&nbsp;&nbsp;&nbsp;if( result&nbsp;&nbsp;&& result.length != 0){<br>&nbsp;&nbsp;&nbsp;&nbsp;if(script_len == 1 ){.return result;};<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;found_result = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;draw_reply = draw_reply + result + "newline";<br>&nbsp;&nbsp;&nbsp;&nbsp;};<br>&nbsp;&nbsp;&nbsp;};<br>&nbsp;&nbsp;};<br>&nbsp;if( found_result ){return draw_reply;}else{return null;};<br>};</code> <br>(*) Note: the speed advantage over <em>canvas-do-it-all</em> libraries is reduced to zero, when multiple canvasdraw scripts are present in a single page...<br>For example a typical canvasdraw script is between 5 and 40 kB...a large library like JSXgraph is approx 600 kB<br>In these cases it would be much faster to load a static general HTML5 canvas javascript draw library and parse it multiple raw fly instructions !<br>
194
  @ Canvasdraw can be used to paint a html5 bitmap image<br />by generating a tailor-made javascript include file: providing only the js-functionality needed to perform the job.<br />thus ensuring a minimal strain on the client browser <br />(unlike some popular ''canvas-do-it-all`` libraries, who have proven to be not suitable for low-end computers found in schools...)
194
  @ Canvasdraw can be used to paint a html5 bitmap image<br>by generating a tailor-made javascript include file: providing only the js-functionality needed to perform the job.<br>thus ensuring a minimal strain on the client browser <br>(unlike some popular ''canvas-do-it-all`` libraries, who have proven to be not suitable for low-end computers found in schools...)
195
        @ You can check the javascript reply format in the wims tool <a href="http://localhost/wims/wims.cgi?lang=en&module=tool/directexec">direct exec</a>
195
        @ You can check the javascript reply format in the wims tool <a href="http://localhost/wims/wims.cgi?lang=en&module=tool/directexec">direct exec</a>
196
        @ For usage within OEF (without anstype ''draw``), something like this (a popup function plotter) will work:<br /><code>\\text{popup_grapher=wims(exec canvasdraw <br />popup<br />size 400,400<br />xrange -10,10<br />yrange -10,10<br />axis<br />axisnumbering<br />opacity 100,100<br />grid 2,2,grey,2,2,6,black<br />snaptogrid<br />linewidth 2<br />jsplot red,5*sin(1/x)<br />strokecolor green<br />functionlabel f(x)=<br />userinput function<br />mouse blue,22<br />)<br />}<br />\\statement{<br />\\popup_grapher<br />}</code>.
196
        @ For usage within OEF (without anstype ''draw``), something like this (a popup function plotter) will work:<br><code>\\text{popup_grapher=wims(exec canvasdraw <br>popup<br>size 400,400<br>xrange -10,10<br>yrange -10,10<br>axis<br>axisnumbering<br>opacity 100,100<br>grid 2,2,grey,2,2,6,black<br>snaptogrid<br>linewidth 2<br>jsplot red,5*sin(1/x)<br>strokecolor green<br>functionlabel f(x)=<br>userinput function<br>mouse blue,22<br>)<br>}<br>\\statement{<br>\\popup_grapher<br>}</code>.
197
        @ Be aware that older browsers will probably not work correctly<br />no effort has been undertaken to add glue code for older browsers !! <br />in any case it is not wise to use older browsers...not just for canvasdraw.
197
        @ Be aware that older browsers will probably not work correctly<br>no effort has been undertaken to add glue code for older browsers !! <br>in any case it is not wise to use older browsers...not just for canvasdraw.
198
        @ Be aware that combining several different objects and interactivity may lead to problems.
198
        @ Be aware that combining several different objects and interactivity may lead to problems.
199
        @ If you find flaws, errors or other incompatibilities -not those mentioned in this document- send <a href='mailto:jm.evers-at-schaersvoorde.nl'>me</a> an email with screenshots and the generated javascript include file.
199
        @ If you find flaws, errors or other incompatibilities -not those mentioned in this document- send <a href='mailto:jm.evers-at-schaersvoorde.nl'>me</a> an email with screenshots and the generated javascript include file.
200
        @ There is limited support for touch devices: touchstart, touchmove and touchend in commands <a href="#userdraw">userdraw primitives </a>, <a href="#multidraw">multidraw primitives </a>, <a href="#protractor">protractor</a>, <a href="#ruler">ruler</a> and probably a few others... <br />Only single finger gestures are supported (for now).<br />The use of a special pen is advised for interactive drawing on touch devices.<br />For more accurate user-interaction (numeric, eg keyboard driven drawings) with canvasdraw on touch devices: use the command family <a href="#userinput_xy">userinput</a>.
200
        @ There is limited support for touch devices: touchstart, touchmove and touchend in commands <a href="#userdraw">userdraw primitives </a>, <a href="#multidraw">multidraw primitives </a>, <a href="#protractor">protractor</a>, <a href="#ruler">ruler</a> and probably a few others... <br>Only single finger gestures are supported (for now).<br>The use of a special pen is advised for interactive drawing on touch devices.<br>For more accurate user-interaction (numeric, eg keyboard driven drawings) with canvasdraw on touch devices: use the command family <a href="#userinput_xy">userinput</a>.
201
        */
201
        */
202
        switch(type){
202
        switch(type){
203
        case END:finished = 1;done = TRUE;break;
203
        case END:finished = 1;done = TRUE;break;
204
        case 0:sync_input(infile);break;
204
        case 0:sync_input(infile);break;
205
        case AFFINE:
205
        case AFFINE:
Line 285... Line 285...
285
        case ANIMATE:
285
        case ANIMATE:
286
        /*
286
        /*
287
         @ animate
287
         @ animate
288
         @ keyword
288
         @ keyword
289
         @ if set, it will animate a point on a curve
289
         @ if set, it will animate a point on a curve
290
         @ all other canvas object or group of objects (like lines,circles,rects,points...images,svg,latex,mathml etc)<br />may be animated using command <a href='#slider'>slider</a> with keyword 'anim'
290
         @ all other canvas object or group of objects (like lines,circles,rects,points...images,svg,latex,mathml etc)<br>may be animated using command <a href='#slider'>slider</a> with keyword 'anim'
291
         @ the animated point is a filled rectangle ; adjust colour with command <code>fillcolor colorname/hexnumber</code>
291
         @ the animated point is a filled rectangle ; adjust colour with command <code>fillcolor colorname/hexnumber</code>
292
         @ use linewidth to adjust size of the points
292
         @ use linewidth to adjust size of the points
293
         @ will animate a point on -only- the next <a href='#jsplot'>jsplot/jscurve command</a>. Only a single call to <code>animate</code> is allowed...in case of multiple <code>animate</code> keywords, only the last one is valid
293
         @ will animate a point on -only- the next <a href='#jsplot'>jsplot/jscurve command</a>. Only a single call to <code>animate</code> is allowed...in case of multiple <code>animate</code> keywords, only the last one is valid
294
         @ only usable in combination with command <a href='#jsplot'>jsplot</a> (normal functions or parametric)
294
         @ only usable in combination with command <a href='#jsplot'>jsplot</a> (normal functions or parametric)
295
         @ moves repeatedly from <a href='#xrange'>xmin to xmax</a> or in case of a parametric function from <a href='#trange'>tmin to tmax</a>
295
         @ moves repeatedly from <a href='#xrange'>xmin to xmax</a> or in case of a parametric function from <a href='#trange'>tmin to tmax</a>
296
         @ use commands <a href='#multilinewidth'>multilinewidth</a>, <a href='#multistrokecolor'>multistrokecolor</a> etc in case of multiple animated functions.<br />use multiple functions as argument in a single call to <a href='#jsplot'>jsplot color,fun1,fun2,fun3...fun_n</a>
296
         @ use commands <a href='#multilinewidth'>multilinewidth</a>, <a href='#multistrokecolor'>multistrokecolor</a> etc in case of multiple animated functions.<br>use multiple functions as argument in a single call to <a href='#jsplot'>jsplot color,fun1,fun2,fun3...fun_n</a>
297
         @%animate_1%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 1%grid 2,2,grey,2,2,5,grey%precision 100%linewidth 4%fillcolor red%animate%trange -2*pi,2*pi%linewidth 1%opacity 255,50%canvastype 100%fill 1.2,1.2,red%canvastype 101%fill -1.2,-1.2,blue%jsplot blue,7*cos(x),5*sin(2*x)
297
         @%animate_1%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 1%grid 2,2,grey,2,2,5,grey%precision 100%linewidth 4%fillcolor red%animate%trange -2*pi,2*pi%linewidth 1%opacity 255,50%canvastype 100%fill 1.2,1.2,red%canvastype 101%fill -1.2,-1.2,blue%jsplot blue,7*cos(x),5*sin(2*x)
298
         @%animate_2%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 1%grid 2,2,grey,2,2,5,grey%precision 100%linewidth 4%fillcolor red%animate%trange -2*pi,2*pi%linewidth 1%opacity 255,50%canvastype 100%fill 1.2,1.2,red%canvastype 101%fill -1.2,-1.2,blue%multistrokecolors blue,blue,green,green,orange,orange%multilinewidth 2,2,3,3,1,1%jsplot blue,7*cos(x),5*sin(2*x),9*sin(x),5*cos(x),x^2,x
298
         @%animate_2%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 1%grid 2,2,grey,2,2,5,grey%precision 100%linewidth 4%fillcolor red%animate%trange -2*pi,2*pi%linewidth 1%opacity 255,50%canvastype 100%fill 1.2,1.2,red%canvastype 101%fill -1.2,-1.2,blue%multistrokecolors blue,blue,green,green,orange,orange%multilinewidth 2,2,3,3,1,1%jsplot blue,7*cos(x),5*sin(2*x),9*sin(x),5*cos(x),x^2,x
299
        */
299
        */
300
            use_animate++;
300
            use_animate++;
301
            if( use_animate == 1 ){
301
            if( use_animate == 1 ){
Line 318... Line 318...
318
             if(anim_pos >= animation_steps){anim_pos = 0;};\
318
             if(anim_pos >= animation_steps){anim_pos = 0;};\
319
             };",canvas_root_id,ANIMATE_CANVAS,fill_color,fill_opacity,stroke_color,stroke_opacity,line_width,line_width,line_width,2*line_width,2*line_width);
319
             };",canvas_root_id,ANIMATE_CANVAS,fill_color,fill_opacity,stroke_color,stroke_opacity,line_width,line_width,line_width,2*line_width,2*line_width);
320
            }
320
            }
321
            else
321
            else
322
            {
322
            {
323
                canvas_error("animate can only be used once<br />multiple curves may be animated using something like:<br />jsplot red,sin(x),cos(x),x^2,sin(2*x)");
323
                canvas_error("animate can only be used once<br>multiple curves may be animated using something like:<br>jsplot red,sin(x),cos(x),x^2,sin(2*x)");
324
            }
324
            }
325
            break;
325
            break;
326
 
326
 
327
        case ARC:
327
        case ARC:
328
        /*
328
        /*
Line 372... Line 372...
372
        case ARCARROW:
372
        case ARCARROW:
373
        /*
373
        /*
374
         @ arrowarc xc,yc,x-width,y-height,start_angle,end_angle,color,type
374
         @ arrowarc xc,yc,x-width,y-height,start_angle,end_angle,color,type
375
         @ alternative: arcarrow
375
         @ alternative: arcarrow
376
         @ uses same syntax as <a href='#arc'>arc</a>
376
         @ uses same syntax as <a href='#arc'>arc</a>
377
         @ for arrow hat: type = 1 : right<br />type = 2 : left<br />type = 3 : left&amp;right
377
         @ for arrow hat: type = 1 : right<br>type = 2 : left<br>type = 3 : left&amp;right
378
         @ if the default arrow hat/head is not satisfactory , the size of the arrow may be set with command <a href='#arrowhead'>arrowhead</a>
378
         @ if the default arrow hat/head is not satisfactory , the size of the arrow may be set with command <a href='#arrowhead'>arrowhead</a>
379
         @ no other arrow types are implemented...yet
379
         @ no other arrow types are implemented...yet
380
         @ may be set draggable or onclick
380
         @ may be set draggable or onclick
381
         @ attention: when width ad height are very different, the arrow hat is not drawn correctly. This is a flaw and not a feature...(for now: too much calculations to correct)
381
         @ attention: when width ad height are very different, the arrow hat is not drawn correctly. This is a flaw and not a feature...(for now: too much calculations to correct)
382
         @%arcarrow%size 400,400%xrange -10,10%yrange -10,10%noreset%onclick%arcarrow 0,0,7,7,50,275,blue,3%arcarrow 0,0,8,8,50,275,red,2%arcarrow 0,0,9,9,50,275,green,1
382
         @%arcarrow%size 400,400%xrange -10,10%yrange -10,10%noreset%onclick%arcarrow 0,0,7,7,50,275,blue,3%arcarrow 0,0,8,8,50,275,red,2%arcarrow 0,0,9,9,50,275,green,1
Line 419... Line 419...
419
            break;
419
            break;
420
        case ARROW:
420
        case ARROW:
421
        /*
421
        /*
422
        @ arrow x1,y1,x2,y2,h,color
422
        @ arrow x1,y1,x2,y2,h,color
423
        @ alternative: vector
423
        @ alternative: vector
424
        @ draw a single headed arrow / vector from (x1:y1) to (x2:y2)<br />with arrowhead size h in px and in color ''color``
424
        @ draw a single headed arrow / vector from (x1:y1) to (x2:y2)<br>with arrowhead size h in px and in color ''color``
425
        @ use command <code>linewidth int</code> to adjust thickness of the arrow
425
        @ use command <code>linewidth int</code> to adjust thickness of the arrow
426
        @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
426
        @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
427
        @%arrow_drag%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 2%drag xy%arrow 0,0,4,3,8,blue%drag xy%arrow 0,0,-4,3,8,green%drag xy%arrow 0,0,4,-3,8,orange%drag xy%arrow 0,0,-4,-3,8,cyan
427
        @%arrow_drag%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 2%drag xy%arrow 0,0,4,3,8,blue%drag xy%arrow 0,0,-4,3,8,green%drag xy%arrow 0,0,4,-3,8,orange%drag xy%arrow 0,0,-4,-3,8,cyan
428
        @%arrow_click%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%%onclick%arrow 0,0,4,4,8,blue%onclick%arrow 0,0,-4,5,8,green%onclick%arrow 0,0,4,-6,8,orange%onclick%arrow 0,0,-4,-2,8,cyan
428
        @%arrow_click%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%%onclick%arrow 0,0,4,4,8,blue%onclick%arrow 0,0,-4,5,8,green%onclick%arrow 0,0,4,-6,8,orange%onclick%arrow 0,0,-4,-2,8,cyan
429
        */
429
        */
Line 495... Line 495...
495
            break;
495
            break;
496
 
496
 
497
        case ARROW2:
497
        case ARROW2:
498
        /*
498
        /*
499
        @ arrow2 x1,y1,x2,y2,h,color
499
        @ arrow2 x1,y1,x2,y2,h,color
500
        @ draw a double headed arrow/vector from (x1:y1) to (x2:y2)<br />with arrowhead size h in px and in color ''color``
500
        @ draw a double headed arrow/vector from (x1:y1) to (x2:y2)<br>with arrowhead size h in px and in color ''color``
501
        @ use command <code>arrowhead int</code> to adjust the arrow head size
501
        @ use command <code>arrowhead int</code> to adjust the arrow head size
502
        @ use command <code>linewidth int</code> to adjust thickness of the arrow
502
        @ use command <code>linewidth int</code> to adjust thickness of the arrow
503
        @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
503
        @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
504
        @%arrow2%size 400,400%xrange -10,10%yrange -10,10%drag xy%arrow2 0,0,4,3,8,blue%
504
        @%arrow2%size 400,400%xrange -10,10%yrange -10,10%drag xy%arrow2 0,0,4,3,8,blue%
505
        */
505
        */
Line 583... Line 583...
583
        @ loop: 0 or 1 ( 1 = loop audio fragment)
583
        @ loop: 0 or 1 ( 1 = loop audio fragment)
584
        @ visible: 0 or 1 (1 = show controls)
584
        @ visible: 0 or 1 (1 = show controls)
585
        @ audio format may be in *.mp3 or *.ogg
585
        @ audio format may be in *.mp3 or *.ogg
586
        @ If you are using *.mp3: be aware that FireFox will not (never) play this ! (Pattented format)
586
        @ If you are using *.mp3: be aware that FireFox will not (never) play this ! (Pattented format)
587
        @ if you are using *.ogg: be aware that Microsoft based systems not support it natively
587
        @ if you are using *.ogg: be aware that Microsoft based systems not support it natively
588
        @ To avoid problems supply both types (mp3 and ogg) of audiofiles.<br />the program will use both as source tag
588
        @ To avoid problems supply both types (mp3 and ogg) of audiofiles.<br>the program will use both as source tag
589
        */
589
        */
590
            js_function[DRAW_AUDIO] = 1;
590
            js_function[DRAW_AUDIO] = 1;
591
            for(i=0;i<7;i++){
591
            for(i=0;i<7;i++){
592
                switch(i){
592
                switch(i){
593
                    case 0: int_data[0] = x2px(get_real(infile,0)); break; /* x in x/y-range coord system -> pixel */
593
                    case 0: int_data[0] = x2px(get_real(infile,0)); break; /* x in x/y-range coord system -> pixel */
Line 723... Line 723...
723
            break;
723
            break;
724
 
724
 
725
        case BOXPLOT:
725
        case BOXPLOT:
726
        /*
726
        /*
727
        @ boxplot x_or_y,box-height_or_box-width,position,min,Q1,median,Q3,max
727
        @ boxplot x_or_y,box-height_or_box-width,position,min,Q1,median,Q3,max
728
        @ example:<br /><code>xrange 0,300<br />yrange 0,10<br />boxplot x,4,8,120,160,170,220,245</code><br />meaning: create a boxplot in x-direction, with height 4 (in yrange) and centered around line y=8
728
        @ example:<br><code>xrange 0,300<br>yrange 0,10<br>boxplot x,4,8,120,160,170,220,245</code><br>meaning: create a boxplot in x-direction, with height 4 (in yrange) and centered around line y=8
729
        @ example:<br /><code>xrange 0,10<br />yrange 0,300<br />boxplot y,4,8,120,160,170,220,245</code><br />meaning: create a boxplot in y-direction, with width 4 (in xrange) and centered around line x=8
729
        @ example:<br><code>xrange 0,10<br>yrange 0,300<br>boxplot y,4,8,120,160,170,220,245</code><br>meaning: create a boxplot in y-direction, with width 4 (in xrange) and centered around line x=8
730
        @ use command <a href='#filled'>filled</a> to fill the box<br /><b>note:</b> the strokecolor is used for filling Q1, the fillcolor is used for filling Q3
730
        @ use command <a href='#filled'>filled</a> to fill the box<br><b>note:</b> the strokecolor is used for filling Q1, the fillcolor is used for filling Q3
731
        @ use command <a href='#fillpattern'>fillpattern some_pattern</a> to use a (diamond for Q1, hatch for Q3) pattern.
731
        @ use command <a href='#fillpattern'>fillpattern some_pattern</a> to use a (diamond for Q1, hatch for Q3) pattern.
732
        @ use command <a href='#opacity'>opacity</a> to adjust fill_opacity of stroke and fill colours
732
        @ use command <a href='#opacity'>opacity</a> to adjust fill_opacity of stroke and fill colours
733
        @ use command <a href='#legend'>legend</a> to automatically create a legend <br />unicode allowed in legend<br />use command <a href='#fontfamily'>fontfamily</a> to set the font of the legend.
733
        @ use command <a href='#legend'>legend</a> to automatically create a legend <br>unicode allowed in legend<br>use command <a href='#fontfamily'>fontfamily</a> to set the font of the legend.
734
        @ there is no limit to the number of boxplots used.
734
        @ there is no limit to the number of boxplots used.
735
        @ can <b>not</b> be set draggable and <a href='#onclick'>onclick</a> is not ready yet
735
        @ can <b>not</b> be set draggable and <a href='#onclick'>onclick</a> is not ready yet
736
        @ use keyword <a href="#userboxplot">userboxplot</a> before command boxplot, if a pupil must draw a boxplot (using his own min,Q1,median,Q3,max data)
736
        @ use keyword <a href="#userboxplot">userboxplot</a> before command boxplot, if a pupil must draw a boxplot (using his own min,Q1,median,Q3,max data)
737
        @ use keyword <a href="#userboxplotdata">userboxplotdata</a> before command boxplot, if a pupil must generate the data by some means.
737
        @ use keyword <a href="#userboxplotdata">userboxplotdata</a> before command boxplot, if a pupil must generate the data by some means.
738
        @ use command <a href="#boxplotdata">boxplotdata</a> when the boxplot should be drawn from wims-generated raw statistical date
738
        @ use command <a href="#boxplotdata">boxplotdata</a> when the boxplot should be drawn from wims-generated raw statistical date
Line 784... Line 784...
784
        case BOXPLOTDATA:
784
        case BOXPLOTDATA:
785
        /*
785
        /*
786
        @ boxplotdata some_data
786
        @ boxplotdata some_data
787
        @ 'some_data' are a list of numbers separated by a comma "," (items)
787
        @ 'some_data' are a list of numbers separated by a comma "," (items)
788
        @ only be used before command <code>boxplot</code>: the command <a href="#boxplot">boxplot</a> will provide the boxplot drawing of the data.
788
        @ only be used before command <code>boxplot</code>: the command <a href="#boxplot">boxplot</a> will provide the boxplot drawing of the data.
789
        @ xrange 0,100<br />yrange 0,10<br />boxplotdata 11,22,13,15,23,43,12,12,14,2,45,32,44,13,21,24,13,19,35,21,24,23<br />boxplot x,4,5
789
        @ xrange 0,100<br>yrange 0,10<br>boxplotdata 11,22,13,15,23,43,12,12,14,2,45,32,44,13,21,24,13,19,35,21,24,23<br>boxplot x,4,5
790
        @ note: wims will not check your data input | format. use js-error console to debug any problems.
790
        @ note: wims will not check your data input | format. use js-error console to debug any problems.
791
        @ a javascript function <code>statistics()</code> will parse the data and calculate the values [min,Q1,median,Q3,max] and hand them to the boxplot draw function.
791
        @ a javascript function <code>statistics()</code> will parse the data and calculate the values [min,Q1,median,Q3,max] and hand them to the boxplot draw function.
792
        @ only a single call to <code>boxplotdata</code> can be made. If multiple boxplots should be present in a single canvas, then use multiple calls to command <a href='#boxplot'>boxplot</a>
792
        @ only a single call to <code>boxplotdata</code> can be made. If multiple boxplots should be present in a single canvas, then use multiple calls to command <a href='#boxplot'>boxplot</a>
793
        @%boxplotdata%size 400,400%xrange 0,100%yrange 0,10%strokecolor orange%fillpattern hatch%linewidth 3%strokecolor green%boxplotdata 11,22,13,15,23,43,12,12,14,2,45,32,44,13,21,24,13,19,35,21,24,23%boxplot x,2,2%mouse red,16
793
        @%boxplotdata%size 400,400%xrange 0,100%yrange 0,10%strokecolor orange%fillpattern hatch%linewidth 3%strokecolor green%boxplotdata 11,22,13,15,23,43,12,12,14,2,45,32,44,13,21,24,13,19,35,21,24,23%boxplot x,2,2%mouse red,16
794
        */
794
        */
Line 800... Line 800...
800
 
800
 
801
        case CANVASTYPE:
801
        case CANVASTYPE:
802
         canvas_type = (int) (get_real(infile,1));
802
         canvas_type = (int) (get_real(infile,1));
803
        /*
803
        /*
804
        @ canvastype TYPE
804
        @ canvastype TYPE
805
        @ for now only useful before commands filltoborder / floodfill / clickfill etc operations<br />Only the images of this TYPE will be scanned and filled
805
        @ for now only useful before commands filltoborder / floodfill / clickfill etc operations<br>Only the images of this TYPE will be scanned and filled
806
        @ default value of TYPE is DRAG_CANVAS e.g. 5 (all clickable / draggable object are in this canvas)
806
        @ default value of TYPE is DRAG_CANVAS e.g. 5 (all clickable / draggable object are in this canvas)
807
        @ use another TYPE, if you know what you are doing...
807
        @ use another TYPE, if you know what you are doing...
808
        @ other possible canvasses (e.g. transparent PNG pictures, xsize &times; ysize on top of each other)<ul><li> EXTERNAL_IMAGE_CANVAS 0</li><li> BG_CANVAS         1</li><li> STATIC_CANVAS        2</li><li> MOUSE_CANVAS 3</li><li> GRID_CANVAS  4</li><li> DRAG_CANVAS  5</li><li> DRAW_CANVAS  6</li><li> TEXT_CANVAS  7</li><li> CLOCK_CANVAS 8</li><li> ANIMATE_CANVAS       9</li><li> TRACE_CANVAS 10</li><li>BOXPLOT_CANVAS 11</li><li> JSPLOT_CANVAS     100, will increase with every call</li><li> FILL_CANVAS 200, will increase with every call</li><li> USERDRAW_JSPLOT 300, will increase with every call</li><li>CLICKFILL_CANVAS 400, will increase with every call/click</li><li>BOXPLOT_CANVAS 500, will increase with every call</li></ul>
808
        @ other possible canvasses (e.g. transparent PNG pictures, xsize &times; ysize on top of each other)<ul><li> EXTERNAL_IMAGE_CANVAS 0</li><li> BG_CANVAS         1</li><li> STATIC_CANVAS        2</li><li> MOUSE_CANVAS 3</li><li> GRID_CANVAS  4</li><li> DRAG_CANVAS  5</li><li> DRAW_CANVAS  6</li><li> TEXT_CANVAS  7</li><li> CLOCK_CANVAS 8</li><li> ANIMATE_CANVAS       9</li><li> TRACE_CANVAS 10</li><li>BOXPLOT_CANVAS 11</li><li> JSPLOT_CANVAS     100, will increase with every call</li><li> FILL_CANVAS 200, will increase with every call</li><li> USERDRAW_JSPLOT 300, will increase with every call</li><li>CLICKFILL_CANVAS 400, will increase with every call/click</li><li>BOXPLOT_CANVAS 500, will increase with every call</li></ul>
809
        */
809
        */
810
        break;
810
        break;
Line 943... Line 943...
943
         @ clearbutton value
943
         @ clearbutton value
944
         @ alternative: delete
944
         @ alternative: delete
945
         @ alternative: erase
945
         @ alternative: erase
946
         @ adds a button to clear the <a href="#userdraw">userdraw</a> canvas with text ''value``
946
         @ adds a button to clear the <a href="#userdraw">userdraw</a> canvas with text ''value``
947
         @ <b>attention</b> command <code>clearbutton</code> is incompatible with <a href="#multidraw">multidraw</a> based drawings<br/>(in <code>multidraw</code> there is always a remove_object_button for every draw primitive)
947
         @ <b>attention</b> command <code>clearbutton</code> is incompatible with <a href="#multidraw">multidraw</a> based drawings<br/>(in <code>multidraw</code> there is always a remove_object_button for every draw primitive)
948
         @ normally <a href="#userdraw">userdraw</a> primitives have the option to use middle/right mouse button on<br /> a point of the object to remove this specific object...this clear button will remove all drawings
948
         @ normally <a href="#userdraw">userdraw</a> primitives have the option to use middle/right mouse button on<br> a point of the object to remove this specific object...this clear button will remove all drawings
949
         @ uses the tooltip placeholder div element: may not be used with command <code>intooltip</code>
949
         @ uses the tooltip placeholder div element: may not be used with command <code>intooltip</code>
950
         @ use command <a href="#css">css</a> to style the button...
950
         @ use command <a href="#css">css</a> to style the button...
951
         @ the clearbutton will have id="canvas_scripts[%d]" ; starting with %d=0 for the first script<br />to change the style of all ''clearbutton`` of all included canvasdraw scripts, use something like<br /><code>if(document.getElementById("clearbutton"+canvas_scripts[0])){<br />&nbsp;var p = 0;<br />&nbsp;while(document.getElementById("clearbutton"+canvas_scripts[p])){<br />&nbsp;&nbsp;document.getElementById("clearbutton"+canvas_scripts[p]).className="some_class_name";<br />&nbsp;&nbsp;&lt;!&minus;&minus;</code> or <code>document.getElementById("clearbutton"+canvas_scripts[p]).setAttribute("style","some_style"); &minus;&minus;&gt;<br />&nbsp;&nbsp;p++;<br />&nbsp;};<br />};</code>
951
         @ the clearbutton will have id="canvas_scripts[%d]" ; starting with %d=0 for the first script<br>to change the style of all ''clearbutton`` of all included canvasdraw scripts, use something like<br><code>if(document.getElementById("clearbutton"+canvas_scripts[0])){<br>&nbsp;var p = 0;<br>&nbsp;while(document.getElementById("clearbutton"+canvas_scripts[p])){<br>&nbsp;&nbsp;document.getElementById("clearbutton"+canvas_scripts[p]).className="some_class_name";<br>&nbsp;&nbsp;&lt;!&minus;&minus;</code> or <code>document.getElementById("clearbutton"+canvas_scripts[p]).setAttribute("style","some_style"); &minus;&minus;&gt;<br>&nbsp;&nbsp;p++;<br>&nbsp;};<br>};</code>
952
         @%clearbutton%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 255,50%userdraw circles,red%clearbutton Remove All
952
         @%clearbutton%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 255,50%userdraw circles,red%clearbutton Remove All
953
        */
953
        */
954
        if(reply_format == 29){/* eg multidraw is selected */
954
        if(reply_format == 29){/* eg multidraw is selected */
955
        // canvas_error("command clearbutton incompatible with multidraw...only suitable for userdraw");
955
        // canvas_error("command clearbutton incompatible with multidraw...only suitable for userdraw");
956
        }
956
        }
Line 959... Line 959...
959
 
959
 
960
        case CLOCK:
960
        case CLOCK:
961
        /*
961
        /*
962
        @ clock x,y,r(px),H,M,S,type hourglass,interactive [ ,H_color,M_color,S_color,background_color,foreground_color ]
962
        @ clock x,y,r(px),H,M,S,type hourglass,interactive [ ,H_color,M_color,S_color,background_color,foreground_color ]
963
        @ use command <code>opacity stroke-opacity,fill-opacity</code> to adjust foreground (stroke) and background (fill) transparency
963
        @ use command <code>opacity stroke-opacity,fill-opacity</code> to adjust foreground (stroke) and background (fill) transparency
964
        @ type hourglass:<br />type = 0: only segments<br />type = 1: only numbers<br />type = 2: numbers and segments
964
        @ type hourglass:<br>type = 0: only segments<br>type = 1: only numbers<br>type = 2: numbers and segments
965
        @ colors are optional: if not defined, default values will be used<br />default colours: clock 0,0,60,4,35,45,1,2<br />custom colours: clock 0,0,60,4,35,45,1,2,,,,yellow,red<br />custom colours: clock 0,0,60,4,35,45,1,2,white,green,blue,black,yellow
965
        @ colors are optional: if not defined, default values will be used<br>default colours: clock 0,0,60,4,35,45,1,2<br>custom colours: clock 0,0,60,4,35,45,1,2,,,,yellow,red<br>custom colours: clock 0,0,60,4,35,45,1,2,white,green,blue,black,yellow
966
        @ if you don't want a seconds hand (or minutes...), just make it invisible by using the background color of the hourglass...
966
        @ if you don't want a seconds hand (or minutes...), just make it invisible by using the background color of the hourglass...
967
        @ interactive <ul><li>0: not interactive, just clock(s)</li><li>1: function read_canvas() will read all active clocks in H:M:S format<br />The active clock(s) can be adjusted by pupils</li><li>2: function read_canvas() will return the clicked clock <br />(like multiplechoice; first clock in script in nr. 0 )</li><li>3: no prefab buttons...create your own buttons (or other means) to make the clock(s) adjustable by javascript function set_clock(num,type,diff)<br />wherein: num = clock id (starts with 0) ; type = 1 (hours) ; type = 2 (minutes) ; type = 3 (seconds) <br />and diff = the increment of 'type' (positive or negative)</li></ul>
967
        @ interactive <ul><li>0: not interactive, just clock(s)</li><li>1: function read_canvas() will read all active clocks in H:M:S format<br>The active clock(s) can be adjusted by pupils</li><li>2: function read_canvas() will return the clicked clock <br>(like multiplechoice; first clock in script in nr. 0 )</li><li>3: no prefab buttons...create your own buttons (or other means) to make the clock(s) adjustable by javascript function set_clock(num,type,diff)<br>wherein: num = clock id (starts with 0) ; type = 1 (hours) ; type = 2 (minutes) ; type = 3 (seconds) <br>and diff = the increment of 'type' (positive or negative)</li></ul>
968
        @ canvasdraw will not check validity of colornames...the javascript console is your best friend
968
        @ canvasdraw will not check validity of colornames...the javascript console is your best friend
969
        @ no combinations with other reply_types allowed, for now
969
        @ no combinations with other reply_types allowed, for now
970
        @ if interactive is set to ''1``, 6 buttons per clock will be displayed for adjusting a clock (H+ M+ S+ H- M- S-)<br /> set_clock(clock_id,type,incr) <br />first clock has clock_id=0 ; type: H=1,M=2,S=3 ; incr: increment integer
970
        @ if interactive is set to ''1``, 6 buttons per clock will be displayed for adjusting a clock (H+ M+ S+ H- M- S-)<br> set_clock(clock_id,type,incr) <br>first clock has clock_id=0 ; type: H=1,M=2,S=3 ; incr: increment integer
971
        @ note: if you need multiple -interactive- clocks on a webpage, use multiple ''clock`` commands in a single script !<br />and <i>not multiple canvas scripts</i> in a single page
971
        @ note: if you need multiple -interactive- clocks on a webpage, use multiple ''clock`` commands in a single script !<br>and <i>not multiple canvas scripts</i> in a single page
972
        @ note: clocks will not zoom or pan, when using command <a href='#zoom'>zoom</a>
972
        @ note: clocks will not zoom or pan, when using command <a href='#zoom'>zoom</a>
973
        @%clock_1%size 400,400%xrange -10,10%yrange -10,10%clock 0,0,120,4,35,45,0,0,red,green,blue,lightgrey,black
973
        @%clock_1%size 400,400%xrange -10,10%yrange -10,10%clock 0,0,120,4,35,45,0,0,red,green,blue,lightgrey,black
974
        @%clock_2%size 400,400%xrange -10,10%yrange -10,10%clock 0,0,120,4,35,45,1,1,red,green,blue,lightgrey,black
974
        @%clock_2%size 400,400%xrange -10,10%yrange -10,10%clock 0,0,120,4,35,45,1,1,red,green,blue,lightgrey,black
975
        @%clock_3%size 400,400%xrange -10,10%yrange -10,10%clock -5,0,80,4,35,45,2,2,red,green,blue,lightgrey,black%clock 5,0,80,3,15,65,2,2,red,green,blue,lightgrey,black
975
        @%clock_3%size 400,400%xrange -10,10%yrange -10,10%clock -5,0,80,4,35,45,2,2,red,green,blue,lightgrey,black%clock 5,0,80,3,15,65,2,2,red,green,blue,lightgrey,black
976
        @%clock_4%size 400,400%xrange -10,10%yrange -10,10%clock 0,0,120,4,35,45,0,0,red,green,blue,lightgrey,black
976
        @%clock_4%size 400,400%xrange -10,10%yrange -10,10%clock 0,0,120,4,35,45,0,0,red,green,blue,lightgrey,black
Line 1007... Line 1007...
1007
                           else
1007
                           else
1008
                           {
1008
                           {
1009
                            canvas_error("interactive clock may not be used together with other reply_types...");
1009
                            canvas_error("interactive clock may not be used together with other reply_types...");
1010
                           }
1010
                           }
1011
                          }
1011
                          }
1012
                          fprintf(stdout,"<p style=\"text-align:center\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,1,1)\" value=\"H+\" /><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,2,1)\" value=\"M+\" /><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,3,1)\" value=\"S+\" /><br /><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,1,-1)\" value=\"H&minus;\" /><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,2,-1)\" value=\"M&minus;\" /><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,3,-1)\" value=\"S&minus;\" /></p>",css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt);
1012
                          fprintf(stdout,"<p style=\"text-align:center\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,1,1)\" value=\"H+\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,2,1)\" value=\"M+\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,3,1)\" value=\"S+\"><br><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,1,-1)\" value=\"H&minus;\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,2,-1)\" value=\"M&minus;\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,3,-1)\" value=\"S&minus;\"></p>",css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt);
1013
                    break;
1013
                    break;
1014
                    case 3:if(clock_cnt == 0){
1014
                    case 3:if(clock_cnt == 0){
1015
                            if( reply_format == 0 ){
1015
                            if( reply_format == 0 ){
1016
                             reply_format = 18; /* user sets clock */
1016
                             reply_format = 18; /* user sets clock */
1017
                             fprintf(js_include_file,"set_clock = function(num,type,diff){if(wims_status == \"done\"){return;};var name = eval(\"clocks\"+num);switch(type){case 1:name.H = parseInt(name.H+diff);break;case 2:name.M = parseInt(name.M+diff);break;case 3:name.S = parseInt(name.S+diff);break;default: break;};name = new clock(name.xc,name.yc,name.radius,name.H,name.M,name.S,name.type,1,name.H_color,name.M_color,name.S_color,name.bg_color,name.fg_color);};\n");
1017
                             fprintf(js_include_file,"set_clock = function(num,type,diff){if(wims_status == \"done\"){return;};var name = eval(\"clocks\"+num);switch(type){case 1:name.H = parseInt(name.H+diff);break;case 2:name.M = parseInt(name.M+diff);break;case 3:name.S = parseInt(name.S+diff);break;default: break;};name = new clock(name.xc,name.yc,name.radius,name.H,name.M,name.S,name.type,1,name.H_color,name.M_color,name.S_color,name.bg_color,name.fg_color);};\n");
Line 1020... Line 1020...
1020
                            {
1020
                            {
1021
                             canvas_error("interactive clock may not be used together with other reply_types...");
1021
                             canvas_error("interactive clock may not be used together with other reply_types...");
1022
                            }
1022
                            }
1023
                           }
1023
                           }
1024
                            /*
1024
                            /*
1025
                            fprintf(stdout,"<p style=\"text-align:center\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,1,1)\" value=\"H+\" /><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,2,1)\" value=\"M+\" /><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,3,1)\" value=\"S+\" /><br /><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,1,-1)\" value=\"H&minus;\" /><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,2,-1)\" value=\"M&minus;\" /><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,3,-1)\" value=\"S&minus;\" /></p>",css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt);
1025
                            fprintf(stdout,"<p style=\"text-align:center\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,1,1)\" value=\"H+\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,2,1)\" value=\"M+\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,3,1)\" value=\"S+\"><br><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,1,-1)\" value=\"H&minus;\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,2,-1)\" value=\"M&minus;\"><input class=\"%s\" type=\"button\" onclick=\"javascript:set_clock(%d,3,-1)\" value=\"S&minus;\"></p>",css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt,css_class,clock_cnt);
1026
                           */
1026
                           */
1027
                    break;
1027
                    break;
1028
                    case 2:if( reply_format == 0 ){
1028
                    case 2:if( reply_format == 0 ){
1029
                                reply_format = 19; /* "onclick */
1029
                                reply_format = 19; /* "onclick */
1030
                                js_function[INTERACTIVE] = 1;
1030
                                js_function[INTERACTIVE] = 1;
Line 1064... Line 1064...
1064
 
1064
 
1065
        case COLORPALETTE:
1065
        case COLORPALETTE:
1066
        /*
1066
        /*
1067
         @ colorpalette color_name_1,color_name_2,...,color_name_8
1067
         @ colorpalette color_name_1,color_name_2,...,color_name_8
1068
         @ opacity will be the same for all colors and is set by command <a href="#opacity">opacity [0-255],[0-255]</a>
1068
         @ opacity will be the same for all colors and is set by command <a href="#opacity">opacity [0-255],[0-255]</a>
1069
         @ can be used with command <a href='#userdraw'>userdraw clickfill,color</a> when more than one fillcolor is wanted.<br />in that case use for example <a href='#replyformat'>replyformat 10</a> ... reply=x1:y1:color1,x2:y2:color2...<br />the pupil can choose from the given colors by clicking small coloured buttons.<br /> the click coordinates and corresponding fillcolor will be stored in read_canvas()...when using the appropriate replyformat.<br />the first color of the palette is color=0
1069
         @ can be used with command <a href='#userdraw'>userdraw clickfill,color</a> when more than one fillcolor is wanted.<br>in that case use for example <a href='#replyformat'>replyformat 10</a> ... reply=x1:y1:color1,x2:y2:color2...<br>the pupil can choose from the given colors by clicking small coloured buttons.<br> the click coordinates and corresponding fillcolor will be stored in read_canvas()...when using the appropriate replyformat.<br>the first color of the palette is color=0
1070
         @ make sure to include the ''remove button`` by using command <a href='#clearbutton'>clearbutton some_text</a>
1070
         @ make sure to include the ''remove button`` by using command <a href='#clearbutton'>clearbutton some_text</a>
1071
        */
1071
        */
1072
            if( use_tooltip == 1 ){canvas_error("command 'colorpalette' is incompatible with command 'intooltip tip_text'");}
1072
            if( use_tooltip == 1 ){canvas_error("command 'colorpalette' is incompatible with command 'intooltip tip_text'");}
1073
            fprintf(js_include_file,"var multifillcolors = [];var palettecolors = [");
1073
            fprintf(js_include_file,"var multifillcolors = [];var palettecolors = [");
1074
            while( ! done ){
1074
            while( ! done ){
Line 1091... Line 1091...
1091
        @ Insert the region from (x1,y1) to (x2,y2) (in pixels) of [filename] to (x,y) in x/y-range
1091
        @ Insert the region from (x1,y1) to (x2,y2) (in pixels) of [filename] to (x,y) in x/y-range
1092
        @ If x1=y1=x2=y2=-1, the whole [filename URL] is copied.
1092
        @ If x1=y1=x2=y2=-1, the whole [filename URL] is copied.
1093
        @ [filename] is the URL of the image
1093
        @ [filename] is the URL of the image
1094
        @ <em>TODO:move special image functions to generic 'dragstuff' library</em>
1094
        @ <em>TODO:move special image functions to generic 'dragstuff' library</em>
1095
        @ URL is normal URL of network reachable image file location
1095
        @ URL is normal URL of network reachable image file location
1096
        @ if command <a href="#drag">drag x/y/xy</a> is set before command ''copy``, the images will be draggable<br />javascript function read_canvas(); will return the x/y coordinate data in xrange/yrange of all -including non draggable- images<br />the command drag is only valid for the next image<br />draggable / non-draggable images may be mixed<br />may be used together with preceding keywords ''snaptogrid``, ''xsnaptogrid``, ''ysnaptogrid`` or <code>snaptopoints x1,y1,x2,y2...</code>.
1096
        @ if command <a href="#drag">drag x/y/xy</a> is set before command ''copy``, the images will be draggable<br>javascript function read_canvas(); will return the x/y coordinate data in xrange/yrange of all -including non draggable- images<br>the command drag is only valid for the next image<br>draggable / non-draggable images may be mixed<br>may be used together with preceding keywords ''snaptogrid``, ''xsnaptogrid``, ''ysnaptogrid`` or <code>snaptopoints x1,y1,x2,y2...</code>.
1097
        @ if keyword <a href="#onclick">onclick</a> is set before command ''copy`` the image(s) is clickable (marked with a green rectangle around the image)<br />use 'read_dragdrop' to get the number of the clicked image(s)<br />use command 'clearbutton some_text' to reset the reply/click array.<br />example: 4 images; student clicked on image 2 and 3: reply = 0,1,1,0<br />after clicking the clear button: reply = 0,0,0,0<br />May be mixed with commands ''drag x|y|xy`` (use javascript read_canvas to get the new coordinates
1097
        @ if keyword <a href="#onclick">onclick</a> is set before command ''copy`` the image(s) is clickable (marked with a green rectangle around the image)<br>use 'read_dragdrop' to get the number of the clicked image(s)<br>use command 'clearbutton some_text' to reset the reply/click array.<br>example: 4 images; student clicked on image 2 and 3: reply = 0,1,1,0<br>after clicking the clear button: reply = 0,0,0,0<br>May be mixed with commands ''drag x|y|xy`` (use javascript read_canvas to get the new coordinates
1098
        @ ''onclick`` for external images may be mixed with canvas generated stuff (like lines,curves, embeded XML etc)
1098
        @ ''onclick`` for external images may be mixed with canvas generated stuff (like lines,curves, embeded XML etc)
1099
        @ you may draw / userdraw / drag other stuff on top of an "imported" image
1099
        @ you may draw / userdraw / drag other stuff on top of an "imported" image
1100
        @ the use of a slider is not possible: if needed, use command <a href='#html'>html x,y,&lt;img src=my_image.svg /&gt; </a>
1100
        @ the use of a slider is not possible: if needed, use command <a href='#html'>html x,y,&lt;img src=my_image.svg /&gt; </a>
1101
        @ use keyword <a href='#centered'>centered</a> before command ''copy`` to place image center at given coordinates.
1101
        @ use keyword <a href='#centered'>centered</a> before command ''copy`` to place image center at given coordinates.
1102
        @%copy_onclick%size 400,400%xrange -10,10%yrange -10,10%onclick%copy -5,5,-1,-1,-1,-1,gifs/fr.gif%onclick%copy 5,5,-1,-1,-1,-1,gifs/en.gif%onclick%copy 5,-5,-1,-1,-1,-1,gifs/it.gif%onclick%copy -5,-5,-1,-1,-1,-1,gifs/cn.gif
1102
        @%copy_onclick%size 400,400%xrange -10,10%yrange -10,10%onclick%copy -5,5,-1,-1,-1,-1,gifs/fr.gif%onclick%copy 5,5,-1,-1,-1,-1,gifs/en.gif%onclick%copy 5,-5,-1,-1,-1,-1,gifs/it.gif%onclick%copy -5,-5,-1,-1,-1,-1,gifs/cn.gif
Line 1157... Line 1157...
1157
*/
1157
*/
1158
        case COPYRESIZED:
1158
        case COPYRESIZED:
1159
        /*
1159
        /*
1160
        @ copyresized x1,y2,x2,y2,dx1,dy1,dx2,dy2,image_file_url
1160
        @ copyresized x1,y2,x2,y2,dx1,dy1,dx2,dy2,image_file_url
1161
        @ The image may be any "bitmap" or "SVG"
1161
        @ The image may be any "bitmap" or "SVG"
1162
        @ Insert the region from (x1,y1) to (x2,y2) (in pixels) of [ filename], <br />possibly resized,<br />to the region of (dx1,dy1) to (dx2,dy2) in x/y-range
1162
        @ Insert the region from (x1,y1) to (x2,y2) (in pixels) of [ filename], <br>possibly resized,<br>to the region of (dx1,dy1) to (dx2,dy2) in x/y-range
1163
        @ (dx1:dy1) must be left top corner; (dx2:dy2) must be right bottom corner of inserted image
1163
        @ (dx1:dy1) must be left top corner; (dx2:dy2) must be right bottom corner of inserted image
1164
        @ If x1=y1=x2=y2=-1, the whole [filename / URL ] is copied and resized.
1164
        @ If x1=y1=x2=y2=-1, the whole [filename / URL ] is copied and resized.
1165
        @ URL is normal URL of network reachable image file location<br />(as seen from public_html-root or network reachable 'http://some_server/my_images/test.gif'<br />(eg no special wims paths are searched !!)
1165
        @ URL is normal URL of network reachable image file location<br>(as seen from public_html-root or network reachable 'http://some_server/my_images/test.gif'<br>(eg no special wims paths are searched !!)
1166
        @ if command <a href="#drag">drag x/y/xy</a> is set before command ''copy``, the images will be draggable<br />javascript function read_canvas(); will return the x/y coordinate data in xrange/yrange of all -including non draggable- images<br />the command drag is only valid for the next image<br />draggable / non-draggable images may be mixed<br />may be used together with preceding keywords ''snaptogrid``,''xsnaptogrid``,''ysnaptogrid`` or <code>snaptopoints x1,y1,x2,y2...</code>
1166
        @ if command <a href="#drag">drag x/y/xy</a> is set before command ''copy``, the images will be draggable<br>javascript function read_canvas(); will return the x/y coordinate data in xrange/yrange of all -including non draggable- images<br>the command drag is only valid for the next image<br>draggable / non-draggable images may be mixed<br>may be used together with preceding keywords ''snaptogrid``,''xsnaptogrid``,''ysnaptogrid`` or <code>snaptopoints x1,y1,x2,y2...</code>
1167
        @ if keyword <a href="#onclick">onclick</a> is set before command ''copy`` the image(s) is clickable (marked with a green rectangle around the image)<br />use ''read_dragdrop`` to get the number of the clicked image(s)<br />use command 'clearbutton some_text' to reset the reply/click array.<br />example: 4 images; student clicked on image 2 and 3: reply = 0,1,1,0<br />after clicking the clear button: reply = 0,0,0,0<br />May be mixed with commands ''drag x|y|xy`` (use javascript read_canvas to get the new coordinates
1167
        @ if keyword <a href="#onclick">onclick</a> is set before command ''copy`` the image(s) is clickable (marked with a green rectangle around the image)<br>use ''read_dragdrop`` to get the number of the clicked image(s)<br>use command 'clearbutton some_text' to reset the reply/click array.<br>example: 4 images; student clicked on image 2 and 3: reply = 0,1,1,0<br>after clicking the clear button: reply = 0,0,0,0<br>May be mixed with commands ''drag x|y|xy`` (use javascript read_canvas to get the new coordinates
1168
        @ ''onclick`` for external images may be mixed with canvas generated stuff (like lines,curves etc)
1168
        @ ''onclick`` for external images may be mixed with canvas generated stuff (like lines,curves etc)
1169
        @ you may draw / userdraw / drag stuff on top of an "imported" image
1169
        @ you may draw / userdraw / drag stuff on top of an "imported" image
1170
        @ when set draggable, there will be special function 'read_canvas_images()'<br />now dragging external images may be combined with 'read_canvas()' from <a href='#userdraw'>userdraw</a> or <a href='#multidraw'>multidraw</a><br />set command <a href='#precision'>precision</a> before command ''copy``
1170
        @ when set draggable, there will be special function 'read_canvas_images()'<br>now dragging external images may be combined with 'read_canvas()' from <a href='#userdraw'>userdraw</a> or <a href='#multidraw'>multidraw</a><br>set command <a href='#precision'>precision</a> before command ''copy``
1171
        @ use keyword <a href='#centered'>centered</a> before command 'copyresized' to place image center at given coordinates.
1171
        @ use keyword <a href='#centered'>centered</a> before command 'copyresized' to place image center at given coordinates.
1172
        @ <em>TODO:move special image functions to generic 'dragstuff' library</em>
1172
        @ <em>TODO:move special image functions to generic 'dragstuff' library</em>
1173
        */
1173
        */
1174
            for(i = 0 ; i<9;i++){
1174
            for(i = 0 ; i<9;i++){
1175
                switch(i){
1175
                switch(i){
Line 1183... Line 1183...
1183
                    case 7: int_data[7] = y2px(get_real(infile,0));break;/* dy2 */
1183
                    case 7: int_data[7] = y2px(get_real(infile,0));break;/* dy2 */
1184
                    case 8: URL = get_string(infile,1);
1184
                    case 8: URL = get_string(infile,1);
1185
                            if( int_data[1] == -1 ){ int_data[10] = 1; }else{int_data[10] = 0; }/* resized / not resized */
1185
                            if( int_data[1] == -1 ){ int_data[10] = 1; }else{int_data[10] = 0; }/* resized / not resized */
1186
                            /* flag error when wrong diagonal:  copyresized -1,-1,-1,-1,0,0,7,7,testfig.gif */
1186
                            /* flag error when wrong diagonal:  copyresized -1,-1,-1,-1,0,0,7,7,testfig.gif */
1187
                            if( int_data[7] < int_data[5] || int_data[6] < int_data[4]){
1187
                            if( int_data[7] < int_data[5] || int_data[6] < int_data[4]){
1188
                                canvas_error("in copyresized,  use:<br />left top corner (dx1:dy1) and right bottom corner (dx2:dy2) ! ");
1188
                                canvas_error("in copyresized,  use:<br>left top corner (dx1:dy1) and right bottom corner (dx2:dy2) ! ");
1189
                            }
1189
                            }
1190
                            int_data[2] = abs(int_data[2] - int_data[0]);/* swidth */
1190
                            int_data[2] = abs(int_data[2] - int_data[0]);/* swidth */
1191
                            int_data[3] = abs(int_data[3] - int_data[1]);/* sheight */
1191
                            int_data[3] = abs(int_data[3] - int_data[1]);/* sheight */
1192
                            int_data[6] = abs(int_data[6] - int_data[4]);/* width */
1192
                            int_data[6] = abs(int_data[6] - int_data[4]);/* width */
1193
                            int_data[7] = abs(int_data[7] - int_data[5]);/* height */
1193
                            int_data[7] = abs(int_data[7] - int_data[5]);/* height */
Line 1307... Line 1307...
1307
        case CURSOR:
1307
        case CURSOR:
1308
        /*
1308
        /*
1309
        @ cursor some CSS cursor_style
1309
        @ cursor some CSS cursor_style
1310
        @ alternative: pointer
1310
        @ alternative: pointer
1311
        @ style can be any valid CSS property value
1311
        @ style can be any valid CSS property value
1312
        @ choose from these types:<br />alias,all-scroll,auto,cell,context-menu,col-resize,copy,crosshair,default,e-resize,<br />ew-resize,grab,grabbing,help,move,n-resize,ne-resize,nesw-resize,ns-resize,nw-resize,<br />nwse-resize,no-drop,none,not-allowed,pointer,progress,row-resize,s-resize,se-resize,<br />sw-resize,text,url(myBall.cur),auto,vertical-text,w-resize,wait,zoom-in,zoom-out,initial
1312
        @ choose from these types:<br>alias,all-scroll,auto,cell,context-menu,col-resize,copy,crosshair,default,e-resize,<br>ew-resize,grab,grabbing,help,move,n-resize,ne-resize,nesw-resize,ns-resize,nw-resize,<br>nwse-resize,no-drop,none,not-allowed,pointer,progress,row-resize,s-resize,se-resize,<br>sw-resize,text,url(myBall.cur),auto,vertical-text,w-resize,wait,zoom-in,zoom-out,initial
1313
        @ note: wims will not check the validity of your cursor declaration
1313
        @ note: wims will not check the validity of your cursor declaration
1314
        @%cursor_css%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 3%drag xy%opacity 200,75%fcircles blue,-5,5,3,-4,-2,6,0,0,5,3,4,2,4,-5,4
1314
        @%cursor_css%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 3%drag xy%opacity 200,75%fcircles blue,-5,5,3,-4,-2,6,0,0,5,3,4,2,4,-5,4
1315
        */
1315
        */
1316
            fprintf(js_include_file,"canvas_div%d.style.cursor = \"%s\";",canvas_root_id,get_string(infile,1));
1316
            fprintf(js_include_file,"canvas_div%d.style.cursor = \"%s\";",canvas_root_id,get_string(infile,1));
1317
            break;
1317
            break;
1318
 
1318
 
1319
        case CURVE:
1319
        case CURVE:
1320
        /*
1320
        /*
1321
         @ curve color,formula(x)
1321
         @ curve color,formula(x)
1322
         @ alternative: plot
1322
         @ alternative: plot
1323
         @ use command <a href="#trange">trange</a> in parametric functions before <b>every</b> command curve / plot <code>trange -pi,pi<br />curve color,formula1(t),formula2(t)</code><br />A next parametric curve will only be correctly plot when trange is set again !<br/>this is a design flaw and not a feature...
1323
         @ use command <a href="#trange">trange</a> in parametric functions before <b>every</b> command curve / plot <code>trange -pi,pi<br>curve color,formula1(t),formula2(t)</code><br>A next parametric curve will only be correctly plot when trange is set again !<br/>this is a design flaw and not a feature...
1324
         @ use command <a href="#precision">precision</a> to increase the number of digits of the plotted points
1324
         @ use command <a href="#precision">precision</a> to increase the number of digits of the plotted points
1325
         @ use command <a href="#plotsteps">plotsteps</a> to increase / decrease the amount of plotted points (default 150)
1325
         @ use command <a href="#plotsteps">plotsteps</a> to increase / decrease the amount of plotted points (default 150)
1326
         @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
1326
         @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
1327
         @ if you need a plot beyond xrange / yrange, use <a href="#jsplot">jsplot</a> (command ''curve`` will only calculate points within the xrange)
1327
         @ if you need a plot beyond xrange / yrange, use <a href="#jsplot">jsplot</a> (command ''curve`` will only calculate points within the xrange)
1328
         @%curve%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%xlabel x-axis%ylabel y-axis%precision 1%grid 2,2,grey,2,2,6,grey%precision 1000%curve red,4*sqrt(x)%curve green,2*sqrt(abs(x)%curve blue,3*1/sqrt(x)%curve orange,4*sin(4/x)%dashed%curve red,4*cos(x)
1328
         @%curve%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%xlabel x-axis%ylabel y-axis%precision 1%grid 2,2,grey,2,2,6,grey%precision 1000%curve red,4*sqrt(x)%curve green,2*sqrt(abs(x)%curve blue,3*1/sqrt(x)%curve orange,4*sin(4/x)%dashed%curve red,4*cos(x)
Line 1357... Line 1357...
1357
            break;
1357
            break;
1358
 
1358
 
1359
    case CURVEDARROW:
1359
    case CURVEDARROW:
1360
    /*
1360
    /*
1361
    @ curvedarrow x1,y1,xc,yc,x2,y2,color
1361
    @ curvedarrow x1,y1,xc,yc,x2,y2,color
1362
    @ draw a single headed curved arrow from (x1:y1) in direction of (xc:yc) to point (x2:y2)<br /> note: the curve will <b>not go through</b> point (xc:yc)
1362
    @ draw a single headed curved arrow from (x1:y1) in direction of (xc:yc) to point (x2:y2)<br> note: the curve will <b>not go through</b> point (xc:yc)
1363
    @ use command <a href='#arrowhead'>arrowhead</a> to set the size of the arrow head.
1363
    @ use command <a href='#arrowhead'>arrowhead</a> to set the size of the arrow head.
1364
    @ use command <code>linewidth int</code> to adjust thickness of the arrow
1364
    @ use command <code>linewidth int</code> to adjust thickness of the arrow
1365
    @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
1365
    @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
1366
    @%curvedarrow_drag%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 2%drag xy%curvedarrow -5,0,0,10,5,0,blue
1366
    @%curvedarrow_drag%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 2%drag xy%curvedarrow -5,0,0,10,5,0,blue
1367
    @%curvedarrow_click%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%%onclick%curvedarrow -5,0,0,-10,5,0,blue%onclick%curvedarrow -8,0,0,5,8,3,green
1367
    @%curvedarrow_click%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%%onclick%curvedarrow -5,0,0,-10,5,0,blue%onclick%curvedarrow -8,0,0,5,8,3,green
Line 1397... Line 1397...
1397
        break;
1397
        break;
1398
 
1398
 
1399
    case CURVEDARROW2:
1399
    case CURVEDARROW2:
1400
    /*
1400
    /*
1401
    @ curvedarrow2 x1,y1,xc,yc,x2,y2,color
1401
    @ curvedarrow2 x1,y1,xc,yc,x2,y2,color
1402
    @ draw a double headed curved arrow from (x1:y1) in direction of (xc:yc) to point (x2:y2)<br /> note: the curve will <b>not go through</b> point (xc:yc)
1402
    @ draw a double headed curved arrow from (x1:y1) in direction of (xc:yc) to point (x2:y2)<br> note: the curve will <b>not go through</b> point (xc:yc)
1403
    @ use command <a href='#arrowhead'>arrowhead</a> to set the size of the arrow head.
1403
    @ use command <a href='#arrowhead'>arrowhead</a> to set the size of the arrow head.
1404
    @ use command <code>linewidth int</code> to adjust thickness of the arrow
1404
    @ use command <code>linewidth int</code> to adjust thickness of the arrow
1405
    @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
1405
    @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
1406
    @%curvedarrow_drag%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 2%drag xy%curvedarrow2 -5,0,0,10,5,0,blue
1406
    @%curvedarrow_drag%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 2%drag xy%curvedarrow2 -5,0,0,10,5,0,blue
1407
    @%curvedarrow_click%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%%onclick%cuvedarrow2 -5,0,0,-10,5,0,blue%onclick%curvedarrow -8,0,0,5,8,3,green
1407
    @%curvedarrow_click%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%%onclick%cuvedarrow2 -5,0,0,-10,5,0,blue%onclick%curvedarrow -8,0,0,5,8,3,green
Line 1436... Line 1436...
1436
        }
1436
        }
1437
        break;
1437
        break;
1438
    case CURVEDARROWS:
1438
    case CURVEDARROWS:
1439
    /*
1439
    /*
1440
    @ curvedarrows color,x1,y1,xc,yc,x2,y2,...,x_(n-1),y_(n-1),xc,yc,x_n,y_n
1440
    @ curvedarrows color,x1,y1,xc,yc,x2,y2,...,x_(n-1),y_(n-1),xc,yc,x_n,y_n
1441
    @ draw curved arrows from (x1:y1) in direction of (xc:yc) to point (x2:y2), etc<br /> note: the curve will <b>not go through</b> point (xc:yc)
1441
    @ draw curved arrows from (x1:y1) in direction of (xc:yc) to point (x2:y2), etc<br> note: the curve will <b>not go through</b> point (xc:yc)
1442
    @ use command <a href='#arrowhead'>arrowhead</a> to set the size of the arrow head.
1442
    @ use command <a href='#arrowhead'>arrowhead</a> to set the size of the arrow head.
1443
    @ use command <code>linewidth int</code> to adjust thickness of the arrow
1443
    @ use command <code>linewidth int</code> to adjust thickness of the arrow
1444
    @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
1444
    @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
1445
    @%curvedarrows_drag%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 2%drag xy%curvedarrows red,-8,0,0,8,8,0,-5,5,0,-10,6,3
1445
    @%curvedarrows_drag%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 2%drag xy%curvedarrows red,-8,0,0,8,8,0,-5,5,0,-10,6,3
1446
    @%curvedarrows_click%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%%onclick%curvedarrows red,-8,0,0,8,8,0,-5,5,0,-10,6,3
1446
    @%curvedarrows_click%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%%onclick%curvedarrows red,-8,0,0,8,8,0,-5,5,0,-10,6,3
Line 1476... Line 1476...
1476
        break;
1476
        break;
1477
 
1477
 
1478
    case CURVEDARROWS2:
1478
    case CURVEDARROWS2:
1479
    /*
1479
    /*
1480
    @ curvedarrows2 color,x1,y1,xc,yc,x2,y2,...x_(n-1),y_(n-1),xc,yc,x_n,y_n
1480
    @ curvedarrows2 color,x1,y1,xc,yc,x2,y2,...x_(n-1),y_(n-1),xc,yc,x_n,y_n
1481
    @ draw double headed curved arrows from (x1:y1) in direction of (xc:yc) to point (x2:y2), etc. <br /> note: the curve will <b>not go through</b> point (xc:yc)
1481
    @ draw double headed curved arrows from (x1:y1) in direction of (xc:yc) to point (x2:y2), etc. <br> note: the curve will <b>not go through</b> point (xc:yc)
1482
    @ use command <a href='#arrowhead'>arrowhead</a> to set the size of the arrow head.
1482
    @ use command <a href='#arrowhead'>arrowhead</a> to set the size of the arrow head.
1483
    @ use command <code>linewidth int</code> to adjust thickness of the arrow
1483
    @ use command <code>linewidth int</code> to adjust thickness of the arrow
1484
    @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
1484
    @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
1485
    @%curvedarrows2_drag%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 2%drag xy%curvedarrows2 red,-8,0,0,8,8,0,-5,5,0,-10,6,3
1485
    @%curvedarrows2_drag%size 400,400%xrange -10,10%yrange -10,10%cursor move%linewidth 2%drag xy%curvedarrows2 red,-8,0,0,8,8,0,-5,5,0,-10,6,3
1486
    @%curvedarrows2_click%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%%onclick%curvedarrow -5,0,0,-10,5,0,blue%onclick%curvedarrows2 red,-8,0,0,8,8,0,-5,5,0,-10,6,3
1486
    @%curvedarrows2_click%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%%onclick%curvedarrow -5,0,0,-10,5,0,blue%onclick%curvedarrows2 red,-8,0,0,8,8,0,-5,5,0,-10,6,3
Line 1619... Line 1619...
1619
        case DRAG:
1619
        case DRAG:
1620
        /*
1620
        /*
1621
         @ drag [x][y][xy]
1621
         @ drag [x][y][xy]
1622
         @ the next object will be draggable in x / y / xy direction
1622
         @ the next object will be draggable in x / y / xy direction
1623
         @ the displacement can be read by <code>javascript:read_dragdrop();</code>
1623
         @ the displacement can be read by <code>javascript:read_dragdrop();</code>
1624
         @ the precision (default 2 decimals) in the student reply may be set with command <a href="#precision">precision</a>.<br />Use this 'precision' command before this command 'drag x|y|xy' !
1624
         @ the precision (default 2 decimals) in the student reply may be set with command <a href="#precision">precision</a>.<br>Use this 'precision' command before this command 'drag x|y|xy' !
1625
         @ <a href='#onclick'>onclick</a> and ''drag x|y|xy`` may be combined (for different objects: a single object can either be onclick or drag, not both )
1625
         @ <a href='#onclick'>onclick</a> and ''drag x|y|xy`` may be combined (for different objects: a single object can either be onclick or drag, not both )
1626
         @ ''multi_objects`` will be numbered in the given x/y-sequence (example: points red,0,0,1,1,2,2,3,3: point (0:0) is object_number 1)
1626
         @ ''multi_objects`` will be numbered in the given x/y-sequence (example: points red,0,0,1,1,2,2,3,3: point (0:0) is object_number 1)
1627
         @ <b>attention</b>: static objects and ''onclick/drag`` objects of the same type (like point,circle,etc) with the same coordinates (e.g. objects that overlap) will give problems in the ''recognition algorithm``) in this example<br /> <code>linewidth 4<br />point 0,0,red<br />drag xy<br />point 0,0,blue</code><br />the red point will not be recognised as draggable ! in the example<br /><code>linewidth 4<br />drag xy<br />point 0,0,red<br />drag xy<br />point 0,0,blue</code><br />both points will be recognised
1627
         @ <b>attention</b>: static objects and ''onclick/drag`` objects of the same type (like point,circle,etc) with the same coordinates (e.g. objects that overlap) will give problems in the ''recognition algorithm``) in this example<br> <code>linewidth 4<br>point 0,0,red<br>drag xy<br>point 0,0,blue</code><br>the red point will not be recognised as draggable ! in the example<br><code>linewidth 4<br>drag xy<br>point 0,0,red<br>drag xy<br>point 0,0,blue</code><br>both points will be recognised
1628
         @ the answer is: drag_or_onclick_object_number : Xorg : Yorg : Xnew : Ynew<br />wherein object_number is the sequence number of the draggable &amp; onclick objects in your script.<br />Only draggable & onclick objects will have an object_number (e.g things like point,crosshair,line,segment,circle,rect,triangle...etc)
1628
         @ the answer is: drag_or_onclick_object_number : Xorg : Yorg : Xnew : Ynew<br>wherein object_number is the sequence number of the draggable &amp; onclick objects in your script.<br>Only draggable & onclick objects will have an object_number (e.g things like point,crosshair,line,segment,circle,rect,triangle...etc)
1629
         @ use keyword <a href='#snaptogrid'>snaptogrid</a>, <a href='#xsnaptogrid'>xsnaptogrid</a>, <a href='#ysnaptogrid'>ysnaptogrid</a> or command <a href='#snaptopoints'>snaptopoints x1,y1,x2,y2,...</a> to switch from free to discrete movement
1629
         @ use keyword <a href='#snaptogrid'>snaptogrid</a>, <a href='#xsnaptogrid'>xsnaptogrid</a>, <a href='#ysnaptogrid'>ysnaptogrid</a> or command <a href='#snaptopoints'>snaptopoints x1,y1,x2,y2,...</a> to switch from free to discrete movement
1630
         @ in case of external images (commands copy / copyresized) the external image can be set draggable ; always xy. <br />The function javascript;read_canvas() will return the xy-coordinates of all images.
1630
         @ in case of external images (commands copy / copyresized) the external image can be set draggable ; always xy. <br>The function javascript;read_canvas() will return the xy-coordinates of all images.
1631
         @%drag_x%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 200,40%drag x%linewidth 2%circles blue,-5,0,3,0,0,2,5,0,4,0,4,3,0,-3,4
1631
         @%drag_x%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 200,40%drag x%linewidth 2%circles blue,-5,0,3,0,0,2,5,0,4,0,4,3,0,-3,4
1632
         @%drag_y%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 200,40%drag y%linewidth 2%circles blue,-5,0,3,0,0,2,5,0,4,0,4,3,0,-3,4
1632
         @%drag_y%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 200,40%drag y%linewidth 2%circles blue,-5,0,3,0,0,2,5,0,4,0,4,3,0,-3,4
1633
         @%drag_xy%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 200,40%drag xy%linewidth 2%circles blue,-5,0,3,0,0,2,5,0,4,0,4,3,0,-3,4
1633
         @%drag_xy%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 200,40%drag xy%linewidth 2%circles blue,-5,0,3,0,0,2,5,0,4,0,4,3,0,-3,4
1634
        */
1634
        */
1635
            temp = get_string(infile,1);
1635
            temp = get_string(infile,1);
Line 1735... Line 1735...
1735
        @ fill all region containing points (x1:y1),(x2:y2)...(x_n:y_n) with color 'color'
1735
        @ fill all region containing points (x1:y1),(x2:y2)...(x_n:y_n) with color 'color'
1736
        @ any other colors (objects) in the <a href="#canvastype">canvastype</a> will act as border to the bucket fill
1736
        @ any other colors (objects) in the <a href="#canvastype">canvastype</a> will act as border to the bucket fill
1737
        @ use this command after all boundary objects are declared.
1737
        @ use this command after all boundary objects are declared.
1738
        @ Use command 'userdraw clickfill,color' for user click driven flood fill.
1738
        @ Use command 'userdraw clickfill,color' for user click driven flood fill.
1739
        @ use command <a href="#canvastype">canvastype </a> to fill another canvas (default should be fine: DRAG_CANVAS = 5)
1739
        @ use command <a href="#canvastype">canvastype </a> to fill another canvas (default should be fine: DRAG_CANVAS = 5)
1740
        @ note: the fill-family of commands are very (client) cpu intensive operations!<br />filling is done pixel by pixel e.g. image size of 400x400 uses 160000 pixels: each pixel contains 4 data (R,G,B,Opacity) = 640000 data.<br />on every data a few operations / comparisons are done...<br />So have pity on your students CPU..
1740
        @ note: the fill-family of commands are very (client) cpu intensive operations!<br>filling is done pixel by pixel e.g. image size of 400x400 uses 160000 pixels: each pixel contains 4 data (R,G,B,Opacity) = 640000 data.<br>on every data a few operations / comparisons are done...<br>So have pity on your students CPU..
1741
        @%fillall%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%vlines black,-5,0,-5,0,-4,0,-4,0,3,0,3,0%hlines black,-5,0,-5,0,-5,4,-5,4,-5,-2,-5,-2%circles green,0,0,2,3,3,5,-5,-5,3%opacity 240,50%fillall blue,1,1,8,8,-8,-8
1741
        @%fillall%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%vlines black,-5,0,-5,0,-4,0,-4,0,3,0,3,0%hlines black,-5,0,-5,0,-5,4,-5,4,-5,-2,-5,-2%circles green,0,0,2,3,3,5,-5,-5,3%opacity 240,50%fillall blue,1,1,8,8,-8,-8
1742
        */
1742
        */
1743
            decimals = find_number_of_digits(precision);
1743
            decimals = find_number_of_digits(precision);
1744
            fill_color=get_color(infile,0); /* how nice: now the color comes first...*/
1744
            fill_color=get_color(infile,0); /* how nice: now the color comes first...*/
1745
            i=0;
1745
            i=0;
Line 1771... Line 1771...
1771
        @ keyword (no arguments required)
1771
        @ keyword (no arguments required)
1772
        @ the next ''fillable`` object (only the next !) will be filled
1772
        @ the next ''fillable`` object (only the next !) will be filled
1773
        @ use command <a href="#fillcolor">fillcolor color</a> to set fillcolor
1773
        @ use command <a href="#fillcolor">fillcolor color</a> to set fillcolor
1774
        @ use <a href="#fillpattern">fillpattern</a> for non-solid color filling.
1774
        @ use <a href="#fillpattern">fillpattern</a> for non-solid color filling.
1775
        @ use command <code>opacity 0-255,0-255</code> to set stroke and fill-opacity
1775
        @ use command <code>opacity 0-255,0-255</code> to set stroke and fill-opacity
1776
        @ use command <a href='#fill'>fill x,y,color</a> or <a href="#floodfill">floodfill x,y,color</a> to fill the space around (x;y) with color <br />pixel operation implemented in javascript: use with care !
1776
        @ use command <a href='#fill'>fill x,y,color</a> or <a href="#floodfill">floodfill x,y,color</a> to fill the space around (x;y) with color <br>pixel operation implemented in javascript: use with care !
1777
        */
1777
        */
1778
            use_filled = 1;
1778
            use_filled = 1;
1779
            break;
1779
            break;
1780
 
1780
 
1781
        case FILLCOLOR:
1781
        case FILLCOLOR:
Line 1793... Line 1793...
1793
        @ fillpattern grid | hatch | diamond | dot | image_url
1793
        @ fillpattern grid | hatch | diamond | dot | image_url
1794
        @ alternative: settile image_url
1794
        @ alternative: settile image_url
1795
        @ use a pattern as fillstyle
1795
        @ use a pattern as fillstyle
1796
        @ suitable for all fillable object including the <a href="#userdraw">userdraw objects' family</a>
1796
        @ suitable for all fillable object including the <a href="#userdraw">userdraw objects' family</a>
1797
        @ note: do not use the ''f`` for a fillable object : this is used exclusively for solid colour filling.
1797
        @ note: do not use the ''f`` for a fillable object : this is used exclusively for solid colour filling.
1798
        @ the fillcolor is set by the object command, for example:<br /><code>size 370,370<br />xrange -5,5<br />yrange -5,5<br />opacity 165,150<br />fillpattern grid<br />fcircle -6,3,160,blue<br />fillpattern dot<br />fcircle -3,-3,160,red<br />fillpattern hatch<br />fcircle 0,3,160,green<br />filpattern diamond<br />fcircle 3,-3,160,cyan<br />userdraw dotfill,blue<br />zoom red</code>
1798
        @ the fillcolor is set by the object command, for example:<br><code>size 370,370<br>xrange -5,5<br>yrange -5,5<br>opacity 165,150<br>fillpattern grid<br>fcircle -6,3,160,blue<br>fillpattern dot<br>fcircle -3,-3,160,red<br>fillpattern hatch<br>fcircle 0,3,160,green<br>filpattern diamond<br>fcircle 3,-3,160,cyan<br>userdraw dotfill,blue<br>zoom red</code>
1799
        @ the pattern dimensions are hardcoded (linewidth, radius,dx,dy are fixed)
1799
        @ the pattern dimensions are hardcoded (linewidth, radius,dx,dy are fixed)
1800
        @ the pattern color is set by command <a href='#fillcolor'>fillcolor</a> and <a href='#opacity'>opacity</a>
1800
        @ the pattern color is set by command <a href='#fillcolor'>fillcolor</a> and <a href='#opacity'>opacity</a>
1801
        @ see <a href="#fillcolor">fillcolor</a> for solid color filling.
1801
        @ see <a href="#fillcolor">fillcolor</a> for solid color filling.
1802
        @ when using an image-url, make sure it contains an ''/`` in the filename...''fillpattern &#36;module_dir/gifs/test.jpg`` will fill the next fillable object with this image.|<br />the argument to html5 canvas routine 'createPattern(img,argument)' is set to ''repeat`` e.g. if the image is smaller then the canvas, multiple copies will be used to fill the area ( e.g. ctx.fillStyle() = pattern)<br />for example:<br /><code>size 150,150<br />xrange -5,5<br />yrange -5,5<br />drag xy<br />fillpattern gifs/en.gif<br />fcircle 0,0,100,red<br />fillpattern gifs/nl.gif<br />drag xy<br />fcircle -3,2,100,green<br />fillpattern gifs/cn.gif<br />drag xy<br />fcircle 3,2,100,green</code>
1802
        @ when using an image-url, make sure it contains an ''/`` in the filename...''fillpattern &#36;module_dir/gifs/test.jpg`` will fill the next fillable object with this image.|<br>the argument to html5 canvas routine 'createPattern(img,argument)' is set to ''repeat`` e.g. if the image is smaller then the canvas, multiple copies will be used to fill the area ( e.g. ctx.fillStyle() = pattern)<br>for example:<br><code>size 150,150<br>xrange -5,5<br>yrange -5,5<br>drag xy<br>fillpattern gifs/en.gif<br>fcircle 0,0,100,red<br>fillpattern gifs/nl.gif<br>drag xy<br>fcircle -3,2,100,green<br>fillpattern gifs/cn.gif<br>drag xy<br>fcircle 3,2,100,green</code>
1803
        @ fillpattern is also active for <a href="#userdraw">userdraw object,color</a>...<br />the userdraw family a has also ''clickfill type`` (e.g. an object gets filled between boundaries, when clicked) commands like:<br />'userdraw dotfill,color'<br />'userdraw hatchfill,color' etc
1803
        @ fillpattern is also active for <a href="#userdraw">userdraw object,color</a>...<br>the userdraw family a has also ''clickfill type`` (e.g. an object gets filled between boundaries, when clicked) commands like:<br>'userdraw dotfill,color'<br>'userdraw hatchfill,color' etc
1804
        @%fillpattern_1%size 400,400%xrange -5,5%yrange -5,5%opacity 165,150%fillpattern grid%circle -6,3,160,blue%fillpattern dot%circle -3,-3,160,red%fillpattern hatch%circle 0,3,160,green%filpattern diamond%circle 3,-3,160,cyan%zoom red
1804
        @%fillpattern_1%size 400,400%xrange -5,5%yrange -5,5%opacity 165,150%fillpattern grid%circle -6,3,160,blue%fillpattern dot%circle -3,-3,160,red%fillpattern hatch%circle 0,3,160,green%filpattern diamond%circle 3,-3,160,cyan%zoom red
1805
        @%fillpattern_2%size 400,400%xrange -10,10%yrange -10,10%linewidth 3%fillcolor green%fillpattern hatch%#fillpattern dot,diamond,grid,imageurl%userdraw circle,red
1805
        @%fillpattern_2%size 400,400%xrange -10,10%yrange -10,10%linewidth 3%fillcolor green%fillpattern hatch%#fillpattern dot,diamond,grid,imageurl%userdraw circle,red
1806
        */
1806
        */
1807
            temp = get_string(infile,1);
1807
            temp = get_string(infile,1);
1808
            use_filled = 0;
1808
            use_filled = 0;
Line 1834... Line 1834...
1834
        @ filltoborder x,y,bordercolor,color
1834
        @ filltoborder x,y,bordercolor,color
1835
        @ fill the region of point (x:y) with color 'color'
1835
        @ fill the region of point (x:y) with color 'color'
1836
        @ any other color will not act as border to the bucket fill
1836
        @ any other color will not act as border to the bucket fill
1837
        @ use this command after all boundary objects are declared.
1837
        @ use this command after all boundary objects are declared.
1838
        @ use command <a href="#canvastype">canvastype </a> to fill another canvas (default should be fine: DRAG_CANVAS = 5)
1838
        @ use command <a href="#canvastype">canvastype </a> to fill another canvas (default should be fine: DRAG_CANVAS = 5)
1839
        @ note: filltoborder is a very (client) cpu intensive operation!<br />filling is done pixel by pixel e.g. image size of 400x400 uses 160000 pixels: each pixel contains 4 data (R,G,B,Opacity) = 640000 data.<br />on every data a few operations / comparisons are done...<br />So have pity on your students CPU..
1839
        @ note: filltoborder is a very (client) cpu intensive operation!<br>filling is done pixel by pixel e.g. image size of 400x400 uses 160000 pixels: each pixel contains 4 data (R,G,B,Opacity) = 640000 data.<br>on every data a few operations / comparisons are done...<br>So have pity on your students CPU..
1840
        @ maybe used together with command <a href="#userdraw">userdraw clickfill,color</a>
1840
        @ maybe used together with command <a href="#userdraw">userdraw clickfill,color</a>
1841
        @%filltoborder%size 400,400%xrange -10,10%yrange -10,10%canvastype 100%linewidth 2%precision 1000%jsplot blue,5*sin(x)%opacity 200,50%filltoborder 6,6,blue,blue%filltoborder 6,-6,blue,red
1841
        @%filltoborder%size 400,400%xrange -10,10%yrange -10,10%canvastype 100%linewidth 2%precision 1000%jsplot blue,5*sin(x)%opacity 200,50%filltoborder 6,6,blue,blue%filltoborder 6,-6,blue,red
1842
        */
1842
        */
1843
            for(i=0 ;i < 4 ; i++){
1843
            for(i=0 ;i < 4 ; i++){
1844
                switch(i){
1844
                switch(i){
Line 1870... Line 1870...
1870
        @ fill the region of point (x:y) with color 'color'
1870
        @ fill the region of point (x:y) with color 'color'
1871
        @ any other color or size of picture (borders of picture) will act as border to the bucket fill
1871
        @ any other color or size of picture (borders of picture) will act as border to the bucket fill
1872
        @ use this command after all boundary objects are declared.
1872
        @ use this command after all boundary objects are declared.
1873
        @ Use command <code>userdraw clickfill,color</code> for user click driven flood fill.
1873
        @ Use command <code>userdraw clickfill,color</code> for user click driven flood fill.
1874
        @ use command <a href="#canvastype">canvastype </a> to fill another canvas (default should be fine: DRAG_CANVAS = 5)
1874
        @ use command <a href="#canvastype">canvastype </a> to fill another canvas (default should be fine: DRAG_CANVAS = 5)
1875
        @ note: floodfill is a very (client) cpu intensive operation!<br />filling is done pixel by pixel e.g. image size of 400x400 uses 160000 pixels: each pixel contains 4 data (R,G,B,Opacity) = 640000 data.<br />on every data a few operations / comparisons are done...<br />So have pity on your students CPU..
1875
        @ note: floodfill is a very (client) cpu intensive operation!<br>filling is done pixel by pixel e.g. image size of 400x400 uses 160000 pixels: each pixel contains 4 data (R,G,B,Opacity) = 640000 data.<br>on every data a few operations / comparisons are done...<br>So have pity on your students CPU..
1876
        @%floodfill%size 400,400%xrange -10,10%yrange -10,10%canvastype 100%linewidth 2%precision 1000%jsplot blue,5*sin(x)%opacity 200,50%floodfill 6,6,blue%floodfill 6,-6,red
1876
        @%floodfill%size 400,400%xrange -10,10%yrange -10,10%canvastype 100%linewidth 2%precision 1000%jsplot blue,5*sin(x)%opacity 200,50%floodfill 6,6,blue%floodfill 6,-6,red
1877
        */
1877
        */
1878
            for(i=0 ;i < 4 ; i++){
1878
            for(i=0 ;i < 4 ; i++){
1879
                switch(i){
1879
                switch(i){
1880
                    case 0:double_data[0] = get_real(infile,0);break;
1880
                    case 0:double_data[0] = get_real(infile,0);break;
Line 1923... Line 1923...
1923
 
1923
 
1924
        case FONTSIZE:
1924
        case FONTSIZE:
1925
        /*
1925
        /*
1926
         @ fontsize font_size
1926
         @ fontsize font_size
1927
         @ default value 12
1927
         @ default value 12
1928
         @ note: for some macros (like ''grid | legend | xaxistext | xlabel`` etc) sometimes command <a href="#fontfamily">fontfamily</a> can be used for some specific font-setting<br />this is however not always very straight forward... so just try and see what happens
1928
         @ note: for some macros (like ''grid | legend | xaxistext | xlabel`` etc) sometimes command <a href="#fontfamily">fontfamily</a> can be used for some specific font-setting<br>this is however not always very straight forward... so just try and see what happens
1929
        */
1929
        */
1930
            font_size = (int) (get_real(infile,1));
1930
            font_size = (int) (get_real(infile,1));
1931
            break;
1931
            break;
1932
 
1932
 
1933
        case FUNCTION_LABEL:
1933
        case FUNCTION_LABEL:
Line 2033... Line 2033...
2033
        case GROUP:
2033
        case GROUP:
2034
        /*
2034
        /*
2035
         @ group
2035
         @ group
2036
         @ keyword
2036
         @ keyword
2037
         @ work in 'progress'
2037
         @ work in 'progress'
2038
         @ all objects(*) after the command and until <a href="#kill">kill group</a> or <a href="#killslider">killslider</a> may be moved together with mouse moverments<br /> (*) for now all real canvas objects and latex / xml ; but no images (work in progress)
2038
         @ all objects(*) after the command and until <a href="#kill">kill group</a> or <a href="#killslider">killslider</a> may be moved together with mouse moverments<br> (*) for now all real canvas objects and latex / xml ; but no images (work in progress)
2039
         @ may be combined with slider driven movements or drag & drop
2039
         @ may be combined with slider driven movements or drag & drop
2040
         @%group%%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 1%grid 2,2,grey,2,2,5,grey%precision 100%linewidth 4%rotationcenter 0,0%slider -2*pi,2*pi,300,40,angle active,rotate%snaptogrid%ftriangle 0,-4,-2,-2,4,--5,blue%fillcolor red%fcircle -4.4,4.4,40,blue%kill slider%slider -20,20,300,40,x active,x-slide%ftriangle -2,0,0,4,2,0,green%fcircle 4.4,4.5,40,red%kill slider%slider -20,20,300,40,y active,y-slide%fcircle 4,-4,40,green%linewidth 4%fcircle -4,-4,40,orange%kill slider%group%fcircle -4.4,4.5,10,blue%fcircle -5.4,4.5,10,blue%fcircle -6.4,4.5,10,blue%fcircle -4.4,8,16,green%fcircle -5.4,8,16,green%fcircle -6.4,8,16,green%mouse red,22%zoom red
2040
         @%group%%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 1%grid 2,2,grey,2,2,5,grey%precision 100%linewidth 4%rotationcenter 0,0%slider -2*pi,2*pi,300,40,angle active,rotate%snaptogrid%ftriangle 0,-4,-2,-2,4,--5,blue%fillcolor red%fcircle -4.4,4.4,40,blue%kill slider%slider -20,20,300,40,x active,x-slide%ftriangle -2,0,0,4,2,0,green%fcircle 4.4,4.5,40,red%kill slider%slider -20,20,300,40,y active,y-slide%fcircle 4,-4,40,green%linewidth 4%fcircle -4,-4,40,orange%kill slider%group%fcircle -4.4,4.5,10,blue%fcircle -5.4,4.5,10,blue%fcircle -6.4,4.5,10,blue%fcircle -4.4,8,16,green%fcircle -5.4,8,16,green%fcircle -6.4,8,16,green%mouse red,22%zoom red
2041
        */
2041
        */
2042
            use_slider++;
2042
            use_slider++;
2043
            add_slider(2);
2043
            add_slider(2);
Line 2344... Line 2344...
2344
         @ command <a href='#rotate'>rotate</a> will rotate the object
2344
         @ command <a href='#rotate'>rotate</a> will rotate the object
2345
         @ use keyword <a href='#centered'>centered</a> to center the html object on (x1:y1)
2345
         @ use keyword <a href='#centered'>centered</a> to center the html object on (x1:y1)
2346
         @ note: using drag&amp;drop for all external P,SPAN,DIV,IMG,SVG-images onto a canvasdraw element, use ''onclick=javascript:place_image_on_canvas(this.id)``
2346
         @ note: using drag&amp;drop for all external P,SPAN,DIV,IMG,SVG-images onto a canvasdraw element, use ''onclick=javascript:place_image_on_canvas(this.id)``
2347
         @ note: sub &amp; sup are supported in command family <a href='#string'>string</a>, e.g. real internal canvas objects !
2347
         @ note: sub &amp; sup are supported in command family <a href='#string'>string</a>, e.g. real internal canvas objects !
2348
         @%html-text%size 500,500%xrange -10,10%yrange -10,10%drag xy%centered%fillcolor lightblue%html 2,2,<h1 style='color:red'>DRAG ME</h1> %opacity 200,50%drag xy%fcircle 0,0,100,green
2348
         @%html-text%size 500,500%xrange -10,10%yrange -10,10%drag xy%centered%fillcolor lightblue%html 2,2,<h1 style='color:red'>DRAG ME</h1> %opacity 200,50%drag xy%fcircle 0,0,100,green
2349
         @%html-image-slider%size 500,500%xrange -10,10%yrange -10,10%fontsize 42%rotationcenter 0,0%centered%html 0,0,<img src="http://85.148.206.56/gifs/can1.gif" />%slider 0,pi,400,40,angle active degree, %centered%html 0,0,<img src="http://85.148.206.56/gifs/can2.gif" />
2349
         @%html-image-slider%size 500,500%xrange -10,10%yrange -10,10%fontsize 42%rotationcenter 0,0%centered%html 0,0,<img src="http://85.148.206.56/gifs/can1.gif">%slider 0,pi,400,40,angle active degree, %centered%html 0,0,<img src="http://85.148.206.56/gifs/can2.gif">
2350
        */
2350
        */
2351
            js_function[DRAW_XML] = 1;
2351
            js_function[DRAW_XML] = 1;
2352
            for(i=0;i<5;i++){
2352
            for(i=0;i<5;i++){
2353
                switch(i){
2353
                switch(i){
2354
                    case 0: double_data[0] = get_real(infile,0);break;
2354
                    case 0: double_data[0] = get_real(infile,0);break;
Line 2427... Line 2427...
2427
        /*
2427
        /*
2428
         @ input x,y,size,editable,value
2428
         @ input x,y,size,editable,value
2429
         @ to set inputfield "readonly", use editable = 0
2429
         @ to set inputfield "readonly", use editable = 0
2430
         @ if no preset 'value' is needed...use a 'space' as last item argument
2430
         @ if no preset 'value' is needed...use a 'space' as last item argument
2431
         @ only active inputfields (editable = 1) will be read with read_canvas();
2431
         @ only active inputfields (editable = 1) will be read with read_canvas();
2432
         @ if ''&#36;status=done`` (e.g. in answer.phtml) the inputfield will be cleared and set readonly<br />override this by keyword <a href="#status">status</a>
2432
         @ if ''&#36;status=done`` (e.g. in answer.phtml) the inputfield will be cleared and set readonly<br>override this by keyword <a href="#status">status</a>
2433
         @ may be further controlled by <a href="#css">css</a>
2433
         @ may be further controlled by <a href="#css">css</a>
2434
         @ if mathml inputfields are present and / or some userdraw is performed, these data will <b>not</b> be send as well (javascript:read_canvas();)
2434
         @ if mathml inputfields are present and / or some userdraw is performed, these data will <b>not</b> be send as well (javascript:read_canvas();)
2435
         @ use keyword <a href='#xoffset'>xoffset | centered</a> if the inputfield should be centered on (x:y)<br /> default is the left top corner is (x:y)
2435
         @ use keyword <a href='#xoffset'>xoffset | centered</a> if the inputfield should be centered on (x:y)<br> default is the left top corner is (x:y)
2436
         @ if the student must place an inputfield(s) somewhere on the canvas, use command <a href="#userdraw">userdraw input,color</a> or make use of a command like <a href="#userdraw">userdraw text,color</a>
2436
         @ if the student must place an inputfield(s) somewhere on the canvas, use command <a href="#userdraw">userdraw input,color</a> or make use of a command like <a href="#userdraw">userdraw text,color</a>
2437
         @%input%size 400,400%xrange -10,10%yrange -10,10%linewidth 6%point 1,2,red%input 1,2,5,1, ?%point -5,5,red%input -5,5,5,1, ?%point 6,-5,red%input 6,-5,5,1, ?%point -5,-8,red%input -5,-8,5,1, ?
2437
         @%input%size 400,400%xrange -10,10%yrange -10,10%linewidth 6%point 1,2,red%input 1,2,5,1, ?%point -5,5,red%input -5,5,5,1, ?%point 6,-5,red%input 6,-5,5,1, ?%point -5,-8,red%input -5,-8,5,1, ?
2438
        */
2438
        */
2439
        js_function[DRAW_INPUTS] = 1;
2439
        js_function[DRAW_INPUTS] = 1;
2440
            for(i = 0 ; i<5;i++){
2440
            for(i = 0 ; i<5;i++){
Line 2462... Line 2462...
2462
            @ link_text is a single line (span-element)
2462
            @ link_text is a single line (span-element)
2463
            @ link_text may also be an image URL ''http://some_server/images/my_image.png`` or ''&#36;module_dir/gifs/my_image.jpg``
2463
            @ link_text may also be an image URL ''http://some_server/images/my_image.png`` or ''&#36;module_dir/gifs/my_image.jpg``
2464
            @ link_text may contain HTML markup
2464
            @ link_text may contain HTML markup
2465
            @ the canvas will be displayed in a tooltip on ''link_text``
2465
            @ the canvas will be displayed in a tooltip on ''link_text``
2466
            @ the canvas is default transparent: use command <a href="#bgcolor">bgcolor color</a> to adjust background-color, the link text will also be shown with this 'bgcolor'.
2466
            @ the canvas is default transparent: use command <a href="#bgcolor">bgcolor color</a> to adjust background-color, the link text will also be shown with this 'bgcolor'.
2467
            @ many ''userinput stuff`` will use the tooltip_placeholder_div element...only one is defined in the wims-page<br />and are therefore these commands are mutually exclusive.<br />keep this in mind...
2467
            @ many ''userinput stuff`` will use the tooltip_placeholder_div element...only one is defined in the wims-page<br>and are therefore these commands are mutually exclusive.<br>keep this in mind...
2468
            @%intooltip%size 400,400%xrange -10,10%yrange -10,10%fontfamily Bold 42pt Courier%string black,0,0,Hello World%intooltip <span style="background-color:black;color:white;font-style:bold;font-size:48pt;">CLICK <br />HERE</span>
2468
            @%intooltip%size 400,400%xrange -10,10%yrange -10,10%fontfamily Bold 42pt Courier%string black,0,0,Hello World%intooltip <span style="background-color:black;color:white;font-style:bold;font-size:48pt;">CLICK <br>HERE</span>
2469
            */
2469
            */
2470
            if(use_input_xy != FALSE ){canvas_error("intooltip can not be combined with userinput_xy or other commands using the tooltip-div...see documentation");}
2470
            if(use_input_xy != FALSE ){canvas_error("intooltip can not be combined with userinput_xy or other commands using the tooltip-div...see documentation");}
2471
            if( use_tooltip == 1 ){ canvas_error("command 'intooltip' cannot be combined with command 'popup'...");}
2471
            if( use_tooltip == 1 ){ canvas_error("command 'intooltip' cannot be combined with command 'popup'...");}
2472
            tooltip_text = get_string(infile,1);
2472
            tooltip_text = get_string(infile,1);
2473
            if(strstr(tooltip_text,"\"") != 0 ){ tooltip_text = str_replace(tooltip_text,"\"","'"); }
2473
            if(strstr(tooltip_text,"\"") != 0 ){ tooltip_text = str_replace(tooltip_text,"\"","'"); }
Line 2477... Line 2477...
2477
        case JSCURVE:
2477
        case JSCURVE:
2478
        /*
2478
        /*
2479
         @ jscurve color,formula1(x),formula2(x),formula3(x),...
2479
         @ jscurve color,formula1(x),formula2(x),formula3(x),...
2480
         @ alternative: jsplot
2480
         @ alternative: jsplot
2481
         @ your function will be plotted by the javascript engine of the client browser
2481
         @ your function will be plotted by the javascript engine of the client browser
2482
         @ if <a href='trange'>trange</a> is defined, the two functions will be plotted parametric<br /><b>note</b>: use <i>x</i> as variable...and not <i>t</i>. Use keyword <a href='#animate'>animate</a> to animate a point on the curve
2482
         @ if <a href='trange'>trange</a> is defined, the two functions will be plotted parametric<br><b>note</b>: use <i>x</i> as variable...and not <i>t</i>. Use keyword <a href='#animate'>animate</a> to animate a point on the curve
2483
         @ use only basic math in your curve: <code>sqrt,^,asin,acos,atan,log,pi,abs,sin,cos,tan,e</code>
2483
         @ use only basic math in your curve: <code>sqrt,^,asin,acos,atan,log,pi,abs,sin,cos,tan,e</code>
2484
         @ use parenthesis and rawmath: use 2*x instead of 2x ; use 2^(sin(x))...etc etc (use error console to debug any errors...)
2484
         @ use parenthesis and rawmath: use 2*x instead of 2x ; use 2^(sin(x))...etc etc (use error console to debug any errors...)
2485
         @ <b>attention</b>: last ''precision`` command in the canvasdraw script determines the calculation precision of the javascript curve plot !
2485
         @ <b>attention</b>: last ''precision`` command in the canvasdraw script determines the calculation precision of the javascript curve plot !
2486
         @ no validity check is done by wims.
2486
         @ no validity check is done by wims.
2487
         @ zooming & panning are implemented:<br />use command ''zoom color`` for mouse driven zooming<br />or use keyword 'setlimits' for inputfields setting xmin/xmax, ymin/ymax
2487
         @ zooming & panning are implemented:<br>use command ''zoom color`` for mouse driven zooming<br>or use keyword 'setlimits' for inputfields setting xmin/xmax, ymin/ymax
2488
         @ zooming & panning is better than for curves produced by command <a href="#curve">curve color,formula</a> because for avery change in x/y-range the curve is recalculated in javascript
2488
         @ zooming & panning is better than for curves produced by command <a href="#curve">curve color,formula</a> because for avery change in x/y-range the curve is recalculated in javascript
2489
         @ zooming & panning in case of userbased functionplot: reclick the OK button to re-plot curve onto the resized grid
2489
         @ zooming & panning in case of userbased functionplot: reclick the OK button to re-plot curve onto the resized grid
2490
         @ use keyword <a href='animate'>animate</a> for animating a point on the curve
2490
         @ use keyword <a href='animate'>animate</a> for animating a point on the curve
2491
         @ use command ''trace_jscurve formula(x)`` for tracing
2491
         @ use command ''trace_jscurve formula(x)`` for tracing
2492
         @ use command ''jsmath formula(x)`` for calculating and displaying indiviual points on the curve
2492
         @ use command ''jsmath formula(x)`` for calculating and displaying indiviual points on the curve
Line 2516... Line 2516...
2516
        /*
2516
        /*
2517
            @ jsmath some_math_function
2517
            @ jsmath some_math_function
2518
            @ will calculate an y-value from a userinput x-value and draws a crosshair on these coordinates.
2518
            @ will calculate an y-value from a userinput x-value and draws a crosshair on these coordinates.
2519
            @ default labels ''x`` and ''y``; the commands ''xlabel some_x_axis_name`` and ''ylabel some_y_axis_name`` will set the label for the input fields
2519
            @ default labels ''x`` and ''y``; the commands ''xlabel some_x_axis_name`` and ''ylabel some_y_axis_name`` will set the label for the input fields
2520
            @ use command 'css some_css' for styling the display fields. Use command 'fontsize int' to size the labels ''x`` and ''y``
2520
            @ use command 'css some_css' for styling the display fields. Use command 'fontsize int' to size the labels ''x`` and ''y``
2521
            @ the client browser will convert your math function to javascript math.<br />use parenthesis and rawmath: use 2*x instead of 2x etc etc<br />no check is done on the validity of your function and/or syntax<br />use error console to debug any errors...
2521
            @ the client browser will convert your math function to javascript math.<br>use parenthesis and rawmath: use 2*x instead of 2x etc etc<br>no check is done on the validity of your function and/or syntax<br>use error console to debug any errors...
2522
            @ be aware that the formula's of the plotted function(s) can be found in the page javascript source
2522
            @ be aware that the formula's of the plotted function(s) can be found in the page javascript source
2523
            @%jsmath%size 400,400%xrange -10,10%yrange -10,10%jsplot blue,sin(x^2)%jsmath sin(x^2)
2523
            @%jsmath%size 400,400%xrange -10,10%yrange -10,10%jsplot blue,sin(x^2)%jsmath sin(x^2)
2524
        */
2524
        */
2525
            js_function[DRAW_CROSSHAIRS] = 1;
2525
            js_function[DRAW_CROSSHAIRS] = 1;
2526
            js_function[JS_MATH] = 1;
2526
            js_function[JS_MATH] = 1;
Line 2608... Line 2608...
2608
 
2608
 
2609
        case LATEX:
2609
        case LATEX:
2610
        /*
2610
        /*
2611
         @ latex x,y,tex string
2611
         @ latex x,y,tex string
2612
         @ alternative: math
2612
         @ alternative: math
2613
         @ note: <b>for a single greek letter</b> ,please be smart and use a command like <a href='#string'>string</a> along with <b>unicode</b> !! <br />possibly together with command <a href="#xyoffset">xoffset, yoffset or xyoffset</a><br/> See <a target='new' href='https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode'>https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode</a><br/> See <a target='new' href='https://en.wikipedia.org/wiki/Greek_script_in_Unicode'>https://en.wikipedia.org/wiki/Greek_script_in_Unicode</a>
2613
         @ note: <b>for a single greek letter</b> ,please be smart and use a command like <a href='#string'>string</a> along with <b>unicode</b> !! <br>possibly together with command <a href="#xyoffset">xoffset, yoffset or xyoffset</a><br/> See <a target='new' href='https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode'>https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode</a><br/> See <a target='new' href='https://en.wikipedia.org/wiki/Greek_script_in_Unicode'>https://en.wikipedia.org/wiki/Greek_script_in_Unicode</a>
2614
         @ you may also use command <a href="#mathml">mathml</a> for xml strings generated with wims commmand ''mathmlmath`` (will not work on KaTeX enabled WIMS)
2614
         @ you may also use command <a href="#mathml">mathml</a> for xml strings generated with wims commmand ''mathmlmath`` (will not work on KaTeX enabled WIMS)
2615
         @ transformation commands <a href='#affine'>affine</a>, <a href='#translation'>translation</a> and <a href='#rotate'>rotate</a> are supported.(onclick and drag will work)
2615
         @ transformation commands <a href='#affine'>affine</a>, <a href='#translation'>translation</a> and <a href='#rotate'>rotate</a> are supported.(onclick and drag will work)
2616
         @ can be set onclick: <code>javascript:read_dragdrop();</code> will return click numbers of mathml-objects<br />if 4 clickable object are drawn, the reply could be 1,0,1,0 ... meaning clicked on the first and third object
2616
         @ can be set onclick: <code>javascript:read_dragdrop();</code> will return click numbers of mathml-objects<br>if 4 clickable object are drawn, the reply could be 1,0,1,0 ... meaning clicked on the first and third object
2617
         @ can be set draggable:<code>javascript:read_dragdrop();</code> will return all coordinates in the same order as the canvas script: unmoved object will have their original coordinates...
2617
         @ can be set draggable:<code>javascript:read_dragdrop();</code> will return all coordinates in the same order as the canvas script: unmoved object will have their original coordinates...
2618
         @ can be moved/rotated with command <a href='#slider'>slider</a>
2618
         @ can be moved/rotated with command <a href='#slider'>slider</a>
2619
         @ snaptogrid is supported
2619
         @ snaptogrid is supported
2620
         @ when clicked, the colour of the 'div background' of the 'mathobject' will be determined by the <a href="#fillcolor">fillcolor</a> and <a href="#opacity">opacity</a> settings
2620
         @ when clicked, the colour of the 'div background' of the 'mathobject' will be determined by the <a href="#fillcolor">fillcolor</a> and <a href="#opacity">opacity</a> settings
2621
         @ userdraw may be combined with 'latex' ; the js-function 'read_canvas()' will contain the coordinates of the drawing.
2621
         @ userdraw may be combined with 'latex' ; the js-function 'read_canvas()' will contain the coordinates of the drawing.
2622
         @ userdraw may be combined; the read_canvas() will contain the drawing.
2622
         @ userdraw may be combined; the read_canvas() will contain the drawing.
2623
         @ draggable or onclick 'external images' from command <a href='#copyresized'>copy or copyresized</a> and all objects from commands <a href='#html'>html</a> or <a href='#obabel'>obabel</a> can be combined with drag and/or onclick mathml
2623
         @ draggable or onclick 'external images' from command <a href='#copyresized'>copy or copyresized</a> and all objects from commands <a href='#html'>html</a> or <a href='#obabel'>obabel</a> can be combined with drag and/or onclick mathml
2624
         @ other drag objects (circles/rects etc) are supported, but read_dragdrop() will probably be difficult to interpret...
2624
         @ other drag objects (circles/rects etc) are supported, but read_dragdrop() will probably be difficult to interpret...
2625
         @ if inputfields are incorporated in mathml (with id's: id='mathml0',id='mathml1',...id='mathml_n')<br />the user_input values will be read by <code>javascript:read_mathml();</code>. <b>attention</b>: if after this mathml-input object other user-interactions are included, these will read mathml too using "read_canvas();"
2625
         @ if inputfields are incorporated in mathml (with id's: id='mathml0',id='mathml1',...id='mathml_n')<br>the user_input values will be read by <code>javascript:read_mathml();</code>. <b>attention</b>: if after this mathml-input object other user-interactions are included, these will read mathml too using "read_canvas();"
2626
         @ If other inputfields (command input / command textarea) or userdraw are performed, the function read_canvas() will not read mathml. Use some generic function to read it....
2626
         @ If other inputfields (command input / command textarea) or userdraw are performed, the function read_canvas() will not read mathml. Use some generic function to read it....
2627
         @ use keyword <a href='#centered'>centered</a> to center the katex div object on (x1:y1) <br />this may not work as expected for MathJaX [TO BE TESTED]
2627
         @ use keyword <a href='#centered'>centered</a> to center the katex div object on (x1:y1) <br>this may not work as expected for MathJaX [TO BE TESTED]
2628
         @ note: if you want to include external TeX via drag&amp;drop onto a canvasdraw element, use \\mmlid{integer} in the tex-command:''!insmath \\mmlid{1}\\frac{1}{\pi}``<br /> (if your wims_mathml does not support it...use <a href="http://85.148.206.56/wims/download/Mathml.tar.gz">this version...</a>)
2628
         @ note: if you want to include external TeX via drag&amp;drop onto a canvasdraw element, use \\mmlid{integer} in the tex-command:''!insmath \\mmlid{1}\\frac{1}{\pi}``<br> (if your wims_mathml does not support it...use <a href="http://85.148.206.56/wims/download/Mathml.tar.gz">this version...</a>)
2629
         @ note: the same is true for all external P,SPAN,DIV,IMG,SVG-images via drag&amp;drop onto a canvasdraw element, use ''onclick=javascript:place_image_on_canvas(this.id)``
2629
         @ note: the same is true for all external P,SPAN,DIV,IMG,SVG-images via drag&amp;drop onto a canvasdraw element, use ''onclick=javascript:place_image_on_canvas(this.id)``
2630
         @%latex_drag%size 400,400%xrange -10,10%yrange -10,10%grid 2,2,grey%strokecolor red%drag xy%centered%latex -6,5,\\frac{1}{2}+ \\frac{\\pi}{2}%strokecolor blue%drag xy%centered%latex -3,5,\\frac{1}{3}+ \\frac{\\pi}{3}%strokecolor green%drag xy%centered%latex 0,5,\\frac{1}{4}+ \\frac{\\pi}{4}%strokecolor orange%drag xy%fontfamily 26px Times%centered%latex 3,5,\\frac{1}{5}+ \\frac{\\pi}{6}
2630
         @%latex_drag%size 400,400%xrange -10,10%yrange -10,10%grid 2,2,grey%strokecolor red%drag xy%centered%latex -6,5,\\frac{1}{2}+ \\frac{\\pi}{2}%strokecolor blue%drag xy%centered%latex -3,5,\\frac{1}{3}+ \\frac{\\pi}{3}%strokecolor green%drag xy%centered%latex 0,5,\\frac{1}{4}+ \\frac{\\pi}{4}%strokecolor orange%drag xy%fontfamily 26px Times%centered%latex 3,5,\\frac{1}{5}+ \\frac{\\pi}{6}
2631
         @%latex%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 3%vline 0,0,green%hline 0,0,green%fontfamily 16px Arial%fillcolor orange%strokecolor blue%linewidth 2%slider 0,4*pi,400,40,angle degree active, %centered%latex 0,0,\\frac{12345}{23456} \\times \\frac{12345}{23456}%translate 4,4%centered%rotate 180%drag xy%html 0,0,<table><tr><th>HTML TABLE</th></tr><tr><th><a href="https://wimsedu.info/">WIMS EDU </a> </th></tr><tr><td><img src="gifs/en.gif" /></tr><tr><td><img src="gifs/nl.gif" /></tr><tr><td><img src="gifs/fr.gif" /></tr><tr><td><img src="gifs/cn.gif" /></tr><tr><td><img src="gifs/it.gif" /></tr></table>%userdraw arrow2,red
2631
         @%latex%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 3%vline 0,0,green%hline 0,0,green%fontfamily 16px Arial%fillcolor orange%strokecolor blue%linewidth 2%slider 0,4*pi,400,40,angle degree active, %centered%latex 0,0,\\frac{12345}{23456} \\times \\frac{12345}{23456}%translate 4,4%centered%rotate 180%drag xy%html 0,0,<table><tr><th>HTML TABLE</th></tr><tr><th><a href="https://wimsedu.info/">WIMS EDU </a> </th></tr><tr><td><img src="gifs/en.gif"></tr><tr><td><img src="gifs/nl.gif"></tr><tr><td><img src="gifs/fr.gif"></tr><tr><td><img src="gifs/cn.gif"></tr><tr><td><img src="gifs/it.gif"></tr></table>%userdraw arrow2,red
2632
        */
2632
        */
2633
            js_function[DRAW_XML] = 1;
2633
            js_function[DRAW_XML] = 1;
2634
            for(i=0;i<3;i++){
2634
            for(i=0;i<3;i++){
2635
                switch(i){
2635
                switch(i){
2636
                    case 0: double_data[0]=get_real(infile,0);break; /* x in x/y-range coord system -> pixel width */
2636
                    case 0: double_data[0]=get_real(infile,0);break; /* x in x/y-range coord system -> pixel width */
Line 2786... Line 2786...
2786
 
2786
 
2787
        case LINES:
2787
        case LINES:
2788
        /*
2788
        /*
2789
        @ lines color,x1,y1,x2,y2...x_n-1,y_n-1,x_n,y_n
2789
        @ lines color,x1,y1,x2,y2...x_n-1,y_n-1,x_n,y_n
2790
        @ draw multiple lines through points (x1:y1)--(x2:y2) ...(x_n-1:y_n-1)--(x_n:y_n) in color 'color'
2790
        @ draw multiple lines through points (x1:y1)--(x2:y2) ...(x_n-1:y_n-1)--(x_n:y_n) in color 'color'
2791
        @ or use multiple commands ''curve color,formula`` or ''jscurve color,formule`` to draw the line <br />(uses more points to draw the line; is however better draggable)
2791
        @ or use multiple commands ''curve color,formula`` or ''jscurve color,formule`` to draw the line <br>(uses more points to draw the line; is however better draggable)
2792
        @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
2792
        @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
2793
        @ <b>attention</b>: the flydraw command ''lines`` is equivalent to canvasdraw command <a href="#polyline">polyline</a>
2793
        @ <b>attention</b>: the flydraw command ''lines`` is equivalent to canvasdraw command <a href="#polyline">polyline</a>
2794
        @%lines%size 400,400%xrange -10,10%yrange -10,10%lines green,0,1,1,3,0,0,1,3,0,0,-2,1
2794
        @%lines%size 400,400%xrange -10,10%yrange -10,10%lines green,0,1,1,3,0,0,1,3,0,0,-2,1
2795
        */
2795
        */
2796
            stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/
2796
            stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/
Line 2862... Line 2862...
2862
 
2862
 
2863
        case LEVELCURVE:
2863
        case LEVELCURVE:
2864
        /*
2864
        /*
2865
        @ levelcurve color,expression in x/y,l1,l2,...
2865
        @ levelcurve color,expression in x/y,l1,l2,...
2866
        @ draws very primitive level curves for expression, with levels l1,l2,l3,...,l_n
2866
        @ draws very primitive level curves for expression, with levels l1,l2,l3,...,l_n
2867
        @ the quality is <b>not to be compared</b> with the Flydraw levelcurve. <br />(choose flydraw if you want quality...)
2867
        @ the quality is <b>not to be compared</b> with the Flydraw levelcurve. <br>(choose flydraw if you want quality...)
2868
        @ every individual level curve may be set 'onclick / drag xy' <br />e.g. every single level curve (l1,l2,l3...l_n) has a unique identifier
2868
        @ every individual level curve may be set 'onclick / drag xy' <br>e.g. every single level curve (l1,l2,l3...l_n) has a unique identifier
2869
        @ note: the arrays for holding the javascript data are limited in size
2869
        @ note: the arrays for holding the javascript data are limited in size
2870
        @ note: reduce image size if javascript data arrays get overloaded<br />(command 'plotsteps int' will not control the data size of the plot...)
2870
        @ note: reduce image size if javascript data arrays get overloaded<br>(command 'plotsteps int' will not control the data size of the plot...)
2871
        @%levelcurve%size 400,400%xrange -10,10%yrange -10,10%levelcurve red,x*y,1,2,3,4
2871
        @%levelcurve%size 400,400%xrange -10,10%yrange -10,10%levelcurve red,x*y,1,2,3,4
2872
        */
2872
        */
2873
            fill_color = get_color(infile,0);
2873
            fill_color = get_color(infile,0);
2874
            char *fun1 = get_string_argument(infile,0);
2874
            char *fun1 = get_string_argument(infile,0);
2875
            if( strlen(fun1) == 0 ){canvas_error("function is NOT OK !");}
2875
            if( strlen(fun1) == 0 ){canvas_error("function is NOT OK !");}
Line 2910... Line 2910...
2910
            break;
2910
            break;
2911
 
2911
 
2912
        case LEGENDCOLORS:
2912
        case LEGENDCOLORS:
2913
        /*
2913
        /*
2914
        @ legendcolors color1:color2:color3:...:color_n
2914
        @ legendcolors color1:color2:color3:...:color_n
2915
        @ will be used to color a legend: use this command after the legend command ! e.g. <code>legend test1:test2:test3<br />legendcolors blue:red:orange</code>.
2915
        @ will be used to color a legend: use this command after the legend command ! e.g. <code>legend test1:test2:test3<br>legendcolors blue:red:orange</code>.
2916
        @ make sure the number of colors match the number of legend items
2916
        @ make sure the number of colors match the number of legend items
2917
        @ command ''legend`` in case of ''piechart`` and ''barchart`` will use these colours per default (no need to specify ''legendcolors``)
2917
        @ command ''legend`` in case of ''piechart`` and ''barchart`` will use these colours per default (no need to specify ''legendcolors``)
2918
        @%legendcolors%size 400,400%xrange -10,10%yrange -10,10%fontsize 18%legend legend 1:legend 2:legend 3%legendcolors red:green:blue%grid 1,1,grey
2918
        @%legendcolors%size 400,400%xrange -10,10%yrange -10,10%fontsize 18%legend legend 1:legend 2:legend 3%legendcolors red:green:blue%grid 1,1,grey
2919
        */
2919
        */
2920
            if(legend_cnt == -1){canvas_error("use command \"legend\" before command \"legendcolors\" ! ");}
2920
            if(legend_cnt == -1){canvas_error("use command \"legend\" before command \"legendcolors\" ! ");}
Line 2946... Line 2946...
2946
        case MATHML:
2946
        case MATHML:
2947
        /*
2947
        /*
2948
        @ mathml x1,y1,mathml_string
2948
        @ mathml x1,y1,mathml_string
2949
        @ this command is special for GECKO browsers, and it makes use of Native Mathml
2949
        @ this command is special for GECKO browsers, and it makes use of Native Mathml
2950
        @ For general use with all browsers, use command <a href='#latex'>latex</a>
2950
        @ For general use with all browsers, use command <a href='#latex'>latex</a>
2951
        @ can be set <a href='onclick'>onclick</a>  and <a href='drag'>drag&amp;drop</a> <br />Note: dragging is fairly primitive dragging of the div-element, and is not done using the <em>dragstuff library</em>
2951
        @ can be set <a href='onclick'>onclick</a>  and <a href='drag'>drag&amp;drop</a> <br>Note: dragging is fairly primitive dragging of the div-element, and is not done using the <em>dragstuff library</em>
2952
        @ command <a href='#affine'>affine</a> will produce CSS3 matrix transformations
2952
        @ command <a href='#affine'>affine</a> will produce CSS3 matrix transformations
2953
        @ command <a href='#rotate'>rotate</a> will rotate the object
2953
        @ command <a href='#rotate'>rotate</a> will rotate the object
2954
        @ the mathml object is centered at (x1:y1)
2954
        @ the mathml object is centered at (x1:y1)
2955
        @ the ''mathml_string`` can be produced using WIMS commands like ''texmath`` followed by ''mathmlmath``... or write correct TeX and use only ''mathmlmath``
2955
        @ the ''mathml_string`` can be produced using WIMS commands like ''texmath`` followed by ''mathmlmath``... or write correct TeX and use only ''mathmlmath``
2956
        @ mathml will be displayed in a rectangle left top (x1:y1)
2956
        @ mathml will be displayed in a rectangle left top (x1:y1)
Line 2959... Line 2959...
2959
        @ snaptogrid is supported...snaptopoints will work, but use with care... due to the primitive dragging. Technically: the dragstuff library is not used... the mathml is embedded in a new div element and not in the html5-canvas.
2959
        @ snaptogrid is supported...snaptopoints will work, but use with care... due to the primitive dragging. Technically: the dragstuff library is not used... the mathml is embedded in a new div element and not in the html5-canvas.
2960
        @ when clicked, the mathml object will be drawn in red color; the div background color will be determined by the <a href="#fillcolor">fillcolor</a> and <a href="#opacity">opacity</a> settings.
2960
        @ when clicked, the mathml object will be drawn in red color; the div background color will be determined by the <a href="#fillcolor">fillcolor</a> and <a href="#opacity">opacity</a> settings.
2961
        @ userdraw may be combined with 'mathml' ; the read_canvas() will contain the drawing.
2961
        @ userdraw may be combined with 'mathml' ; the read_canvas() will contain the drawing.
2962
        @ draggable or onclick 'external images' from command <a href='#copyresized'>copy or copyresized</a> can be combined with drag and/or onclick mathml
2962
        @ draggable or onclick 'external images' from command <a href='#copyresized'>copy or copyresized</a> can be combined with drag and/or onclick mathml
2963
        @ other drag objects (circles/rects etc) are supported, but read_dragdrop() will probably be difficult to interpret...
2963
        @ other drag objects (circles/rects etc) are supported, but read_dragdrop() will probably be difficult to interpret...
2964
        @ if inputfields are incorporated in mathml (with id's: id='mathml0',id='mathml1',...id='mathml_n')<br />the user_input values will be read by javascript:read_mathml();<br /><b>attention</b>: if after this mathml-input object other user-interactions are included, these will read mathml too using "read_canvas();"
2964
        @ if inputfields are incorporated in mathml (with id's: id='mathml0',id='mathml1',...id='mathml_n')<br>the user_input values will be read by javascript:read_mathml();<br><b>attention</b>: if after this mathml-input object other user-interactions are included, these will read mathml too using "read_canvas();"
2965
        @ If other inputfields (command input / command textarea) or userdraw is performed, the function read_canvas() will not read mathml. Use some generic function to read it....
2965
        @ If other inputfields (command input / command textarea) or userdraw is performed, the function read_canvas() will not read mathml. Use some generic function to read it....
2966
        @ use keyword <a href='#centered'>centered</a> to center the mathml/xml object on (x1:y1)
2966
        @ use keyword <a href='#centered'>centered</a> to center the mathml/xml object on (x1:y1)
2967
        @%mathml_onclick%size 400,400%xrange -10,10%yrange -10,10%onclick%strokecolor red%mathml -5,5,<span style="font-size:1em;"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mstyle id="wims_mathml366290"><mrow><mo stretchy="true">[</mo><mtable rowspacing="0.5ex" columnalign=" left " columnlines=" none " rowlines=" none " ><mtr><mtd><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mstyle displaystyle="true"><mfrac><mn>1</mn><mn>2</mn></mfrac></mstyle><mo>&sdot;</mo><msup><mi>x</mi> <mn>2</mn></msup></mtd></mtr> <mtr><mtd><mi>g</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><msqrt><mstyle displaystyle="true"><mfrac><mn>1</mn><mrow><msup><mi>x</mi> <mn>2</mn></msup></mrow></mfrac></mstyle></msqrt></mtd></mtr></mtable><mo stretchy="true">]</mo></mrow></mstyle></math></span>%onclick%strokecolor blue%mathml 5,5,<span style="font-size:1em;"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mstyle id="wims_mathml580175" ><mrow><mo stretchy="true">[</mo><mtable rowspacing="0.5ex" columnalign=" left " columnlines=" none " rowlines="none"><mtr><mtd><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mstyle displaystyle="true"><mfrac><mn>1</mn><mrow><mi>sin</mi><mrow><mo stretchy="true">(</mo><msup><mi>x</mi> <mn>2</mn></msup><mo stretchy="true">)</mo></mrow></mrow></mfrac></mstyle></mtd></mtr> <mtr><mtd><mi>g</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><msqrt><mrow><mi>sin</mi><mrow><mo stretchy="true">(</mo><msup><mi>x</mi> <mn>2</mn></msup><mo stretchy="true">)</mo></mrow></mrow></msqrt></mtd></mtr></mtable><mo stretchy="true">]</mo></mrow></mstyle></math></span>
2967
        @%mathml_onclick%size 400,400%xrange -10,10%yrange -10,10%onclick%strokecolor red%mathml -5,5,<span style="font-size:1em;"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mstyle id="wims_mathml366290"><mrow><mo stretchy="true">[</mo><mtable rowspacing="0.5ex" columnalign=" left " columnlines=" none " rowlines=" none " ><mtr><mtd><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mstyle displaystyle="true"><mfrac><mn>1</mn><mn>2</mn></mfrac></mstyle><mo>&sdot;</mo><msup><mi>x</mi> <mn>2</mn></msup></mtd></mtr> <mtr><mtd><mi>g</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><msqrt><mstyle displaystyle="true"><mfrac><mn>1</mn><mrow><msup><mi>x</mi> <mn>2</mn></msup></mrow></mfrac></mstyle></msqrt></mtd></mtr></mtable><mo stretchy="true">]</mo></mrow></mstyle></math></span>%onclick%strokecolor blue%mathml 5,5,<span style="font-size:1em;"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mstyle id="wims_mathml580175" ><mrow><mo stretchy="true">[</mo><mtable rowspacing="0.5ex" columnalign=" left " columnlines=" none " rowlines="none"><mtr><mtd><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mstyle displaystyle="true"><mfrac><mn>1</mn><mrow><mi>sin</mi><mrow><mo stretchy="true">(</mo><msup><mi>x</mi> <mn>2</mn></msup><mo stretchy="true">)</mo></mrow></mrow></mfrac></mstyle></mtd></mtr> <mtr><mtd><mi>g</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><msqrt><mrow><mi>sin</mi><mrow><mo stretchy="true">(</mo><msup><mi>x</mi> <mn>2</mn></msup><mo stretchy="true">)</mo></mrow></mrow></msqrt></mtd></mtr></mtable><mo stretchy="true">]</mo></mrow></mstyle></math></span>
2968
        @%mathml_drag%size 400,400%xrange -10,10%yrange -10,10%drag xy%strokecolor red%mathml -5,5,<span style="font-size:1em;"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mstyle id="wims_mathml366290"><mrow><mo stretchy="true">[</mo><mtable rowspacing="0.5ex" columnalign=" left " columnlines=" none " rowlines=" none "><mtr><mtd><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mstyle displaystyle="true"><mfrac><mn>1</mn><mn>2</mn></mfrac></mstyle><mo>&sdot;</mo><msup><mi>x</mi> <mn>2</mn></msup></mtd></mtr> <mtr><mtd><mi>g</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><msqrt><mstyle displaystyle="true"><mfrac><mn>1</mn><mrow><msup><mi>x</mi> <mn>2</mn></msup></mrow></mfrac></mstyle></msqrt></mtd></mtr></mtable><mo stretchy="true">]</mo></mrow></mstyle></math></span>%drag xy%strokecolor blue%mathml 5,5,<span style="font-size:1em;"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mstyle id="wims_mathml580175" ><mrow><mo stretchy="true">[</mo><mtable rowspacing="0.5ex" columnalign=" left " columnlines=" none " rowlines=" none "><mtr><mtd><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mstyle displaystyle="true"><mfrac><mn>1</mn><mrow><mi>sin</mi><mrow><mo stretchy="true">(</mo><msup><mi>x</mi> <mn>2</mn></msup><mo stretchy="true">)</mo></mrow></mrow></mfrac></mstyle></mtd></mtr> <mtr><mtd><mi>g</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><msqrt><mrow><mi>sin</mi><mrow><mo stretchy="true">(</mo><msup><mi>x</mi> <mn>2</mn></msup><mo stretchy="true">)</mo></mrow></mrow></msqrt></mtd></mtr></mtable><mo stretchy="true">]</mo></mrow></mstyle></math></span>%#click left top corner...then drag...
2968
        @%mathml_drag%size 400,400%xrange -10,10%yrange -10,10%drag xy%strokecolor red%mathml -5,5,<span style="font-size:1em;"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mstyle id="wims_mathml366290"><mrow><mo stretchy="true">[</mo><mtable rowspacing="0.5ex" columnalign=" left " columnlines=" none " rowlines=" none "><mtr><mtd><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mstyle displaystyle="true"><mfrac><mn>1</mn><mn>2</mn></mfrac></mstyle><mo>&sdot;</mo><msup><mi>x</mi> <mn>2</mn></msup></mtd></mtr> <mtr><mtd><mi>g</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><msqrt><mstyle displaystyle="true"><mfrac><mn>1</mn><mrow><msup><mi>x</mi> <mn>2</mn></msup></mrow></mfrac></mstyle></msqrt></mtd></mtr></mtable><mo stretchy="true">]</mo></mrow></mstyle></math></span>%drag xy%strokecolor blue%mathml 5,5,<span style="font-size:1em;"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mstyle id="wims_mathml580175" ><mrow><mo stretchy="true">[</mo><mtable rowspacing="0.5ex" columnalign=" left " columnlines=" none " rowlines=" none "><mtr><mtd><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mstyle displaystyle="true"><mfrac><mn>1</mn><mrow><mi>sin</mi><mrow><mo stretchy="true">(</mo><msup><mi>x</mi> <mn>2</mn></msup><mo stretchy="true">)</mo></mrow></mrow></mfrac></mstyle></mtd></mtr> <mtr><mtd><mi>g</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><msqrt><mrow><mi>sin</mi><mrow><mo stretchy="true">(</mo><msup><mi>x</mi> <mn>2</mn></msup><mo stretchy="true">)</mo></mrow></mrow></msqrt></mtd></mtr></mtable><mo stretchy="true">]</mo></mrow></mstyle></math></span>%#click left top corner...then drag...
2969
        */
2969
        */
Line 3019... Line 3019...
3019
 
3019
 
3020
 
3020
 
3021
        case MOUSE_DEGREE:
3021
        case MOUSE_DEGREE:
3022
        /*
3022
        /*
3023
         @ mouse_degree color,fontsize
3023
         @ mouse_degree color,fontsize
3024
         @ will display the angle in degrees between x-axis, (0:0) and the cursor (x:y) in 'color' and 'font size'<br /> using a fontfamily Arial
3024
         @ will display the angle in degrees between x-axis, (0:0) and the cursor (x:y) in 'color' and 'font size'<br> using a fontfamily Arial
3025
         @ The angle is positive in QI and QIII and the angle value is negative in QII and QIV
3025
         @ The angle is positive in QI and QIII and the angle value is negative in QII and QIV
3026
         @ note: use command 'mouse' at the end of your script code (the same is true for command 'zoom')
3026
         @ note: use command 'mouse' at the end of your script code (the same is true for command 'zoom')
3027
         @%mouse_degree%size 400,400%xrange -10,10%yrange -10,10%userdraw arc,blue%precision 100000%mouse_degree red,22
3027
         @%mouse_degree%size 400,400%xrange -10,10%yrange -10,10%userdraw arc,blue%precision 100000%mouse_degree red,22
3028
        */
3028
        */
3029
            stroke_color = get_color(infile,0);
3029
            stroke_color = get_color(infile,0);
Line 3129... Line 3129...
3129
        /*
3129
        /*
3130
         @ multidash 0,1,1
3130
         @ multidash 0,1,1
3131
         @ meaning draw objects no. 2 (circle) and 3 (segments), in the list of command like <code>multifill points,circle,segments</code>, are dashed
3131
         @ meaning draw objects no. 2 (circle) and 3 (segments), in the list of command like <code>multifill points,circle,segments</code>, are dashed
3132
         @ use before command <a href='#multidraw'>multidraw</a>
3132
         @ use before command <a href='#multidraw'>multidraw</a>
3133
         @ if not set all objects will be set ''not dashed``... unless a generic keyword ''dashed`` was given before command ''multidraw``
3133
         @ if not set all objects will be set ''not dashed``... unless a generic keyword ''dashed`` was given before command ''multidraw``
3134
         @ the dash-type is not -yet- adjustable <br />(e.g. command <code>dashtype line_px,space_px</code> will give no control over multidraw objects)
3134
         @ the dash-type is not -yet- adjustable <br>(e.g. command <code>dashtype line_px,space_px</code> will give no control over multidraw objects)
3135
         @ wims will <b>not</b> check if the number of 0 or 1's matches the amount of draw primitives...
3135
         @ wims will <b>not</b> check if the number of 0 or 1's matches the amount of draw primitives...
3136
         @ always use the same sequence as is used for ''multidraw``
3136
         @ always use the same sequence as is used for ''multidraw``
3137
        */
3137
        */
3138
            if( use_tooltip == 1 ){canvas_error("command 'multidraw' is incompatible with command 'intooltip tip_text'");}
3138
            if( use_tooltip == 1 ){canvas_error("command 'multidraw' is incompatible with command 'intooltip tip_text'");}
3139
            temp = get_string(infile,1);
3139
            temp = get_string(infile,1);
Line 3144... Line 3144...
3144
 
3144
 
3145
        case MULTIDRAW:
3145
        case MULTIDRAW:
3146
        /*
3146
        /*
3147
         @ multidraw obj_type_1,obj_type_2...obj_type_11
3147
         @ multidraw obj_type_1,obj_type_2...obj_type_11
3148
         @ for simple single object user drawings you could also use command <a href="#userdraw">userdraw</a>
3148
         @ for simple single object user drawings you could also use command <a href="#userdraw">userdraw</a>
3149
         @ implemented obj_types:<ul><li>point | points</li><li>circle | circles</li><li>line | lines</li><li>segment | segments</li><li>arrow | arrows (use command 'arrowhead int' for size (default value 8 pixels))</li><li>curvedarrow | curvedarrows</li><li>rect | rects</li><li>closedpoly<br /><b>only one</b> closedpolygon may be drawn.The number of ''corner points`` is not preset (e.g. not limited, freestyle), the polygon is closed when clicking on the first point again..(+/- 10px)</li><li>triangle | triangles</li><li>parallelogram | parallelograms</li><li>poly[3-9] | polys[3-9] draw 3...9 point polygone(s): polys3 is of course triangles</li><li>images</li><li>crosshair | crosshairs</li><li>function <br/>for more function user input fields, use it multiple times<br />for 4 inputfields use : multidraw function,function,function,function</li></ul>
3149
         @ implemented obj_types:<ul><li>point | points</li><li>circle | circles</li><li>line | lines</li><li>segment | segments</li><li>arrow | arrows (use command 'arrowhead int' for size (default value 8 pixels))</li><li>curvedarrow | curvedarrows</li><li>rect | rects</li><li>closedpoly<br><b>only one</b> closedpolygon may be drawn.The number of ''corner points`` is not preset (e.g. not limited, freestyle), the polygon is closed when clicking on the first point again..(+/- 10px)</li><li>triangle | triangles</li><li>parallelogram | parallelograms</li><li>poly[3-9] | polys[3-9] draw 3...9 point polygone(s): polys3 is of course triangles</li><li>images</li><li>crosshair | crosshairs</li><li>function <br/>for more function user input fields, use it multiple times<br>for 4 inputfields use : multidraw function,function,function,function</li></ul>
3150
         @ additionally objects may be user labelled, using obj_type ''text``...<br />in this case allways a text input field and if <a href='#multiuserinput'> multiuserinput=1 </a> also (x:y) inputfields will be added to the page.<br />use commands ''fontfamily`` and ''fontcolor`` to adjust (command ''multistrokeopacity`` may be set to adjust text opacity)<br />note: text is always centered on the mouse-click or user-input coordinates !<br />note: no keyboard listeners are used
3150
         @ additionally objects may be user labelled, using obj_type ''text``...<br>in this case allways a text input field and if <a href='#multiuserinput'> multiuserinput=1 </a> also (x:y) inputfields will be added to the page.<br>use commands ''fontfamily`` and ''fontcolor`` to adjust (command ''multistrokeopacity`` may be set to adjust text opacity)<br>note: text is always centered on the mouse-click or user-input coordinates !<br>note: no keyboard listeners are used
3151
         @ it makes no sense using something like ''multidraw point,points`` ... <br />something like "multidraw polys4,polys7" will only result in drawing a ''4 point polygone`` and not a ''7 point polygone``: this is a design flaw and not a feature...
3151
         @ it makes no sense using something like ''multidraw point,points`` ... <br>something like "multidraw polys4,polys7" will only result in drawing a ''4 point polygone`` and not a ''7 point polygone``: this is a design flaw and not a feature...
3152
         @ note: mouselisteners are only active if "&#36;status != done " (eg only drawing in an active/non-finished exercise) <br /> to overrule use command/keyword "status" (no arguments required)
3152
         @ note: mouselisteners are only active if "&#36;status != done " (eg only drawing in an active/non-finished exercise) <br> to overrule use command/keyword "status" (no arguments required)
3153
         @ buttons for changing the obj_type (and in case of ''multiuserinput``, some inputfields and buttons) <br />will be present in the reserved div ''tooltip_div`` and can be styled using command 'css some_css'
3153
         @ buttons for changing the obj_type (and in case of ''multiuserinput``, some inputfields and buttons) <br>will be present in the reserved div ''tooltip_div`` and can be styled using command 'css some_css'
3154
         @ the button label will be default the ''object primitive name`` (like ''point``, ''circles``).<br />If you want a different label (e.g. an other language), use command ''multilabel``<br />for example in dutch: <br /><code>multilabel cirkel,lijnstuk,punten,STOP<br />multidraw circle,segment,points</code><br />(see command <a href='#multilabel'>multilabel</a> for more details)
3154
         @ the button label will be default the ''object primitive name`` (like ''point``, ''circles``).<br>If you want a different label (e.g. an other language), use command ''multilabel``<br>for example in dutch: <br><code>multilabel cirkel,lijnstuk,punten,STOP<br>multidraw circle,segment,points</code><br>(see command <a href='#multilabel'>multilabel</a> for more details)
3155
         @ a right mouse button click will remove the last drawn object of the selected drawing type. All other type of objects are not removed
3155
         @ a right mouse button click will remove the last drawn object of the selected drawing type. All other type of objects are not removed
3156
         @ multidraw is incompatible with command ''tooltip`` (the reserved div_area is used for the multidraw control buttons)
3156
         @ multidraw is incompatible with command ''tooltip`` (the reserved div_area is used for the multidraw control buttons)
3157
         @ all ''multidraw`` drawings will scale on zooming.<br />this in contrast to the command <a href="#userdraw">userdraw</a>.
3157
         @ all ''multidraw`` drawings will scale on zooming.<br>this in contrast to the command <a href="#userdraw">userdraw</a>.
3158
         @ wims will <b>not</b> check the amount or validity of your command arguments ! <br />( use javascript console to debug any typo's )
3158
         @ wims will <b>not</b> check the amount or validity of your command arguments ! <br>( use javascript console to debug any typo's )
3159
         @ a local function <code>read_canvas%d</code> will read all userbased drawings.<br />The output is always a 16 lines string with fixed sequence.<br/>line 1 = points_x+";"+points_y+"\\n"<br/>line 2 = circles_x+";"+circles_y+";"+multi_radius+"\\n"<br/>line 3 = segments_x+";"+segments_y+"\\n"<br/>line 4 = arrows_x+";"+arrows_y+"\\n"<br/>line 5 = lines_x+";"+lines_y+"\\n"<br/>line 6 = triangles_x+";"+triangles_y+"\\n"<br/>line 7 = polys[3-9]_x+";"+polys[3-9]_y+"\\n"<br/>line 8 = rects_x +";"+rects_y+"\\n"<br />line 9 = closedpoly_x+";"+closedpoly_y+"\\n"<br/>line 10 = parallelogram_x+";"+parallelogram_y"\\n"<br/>line 11 = text_x+";"+text_y+";"+text"\\n"<br />line 12 = image_x+";"+image_y+";"+image_id<br />line 13 = curvedarrows_x +";"+ curvedarrows_y +"\\n"<br />line 14 = curvedarrows2_x +";"+ curvedarrows2_y +"\\n"<br />line 15 = crosshairs_x +";"+ crosshairs_y +"\\n"<br />line 16 = userdraw_x +";"+userdraw_y + "\\n" note: this is for single ''userdraw object,color`` and ''replyformat 29``<br/>line 17 = userdraw_x +";"+userdraw_y +";"+userdraw_radius + "\\n" note: this is for single ''userdraw object,color`` and ''replyformat 29``<br/>The x/y-data are in x/y-coordinate system and display precision may be set by a previous command ''precision 0 | 10 | 100 | 1000...``<br />In case of circles the radius is -for the time being- rounded to pixels<br /><b>use the wims "direct exec" tool to see the format of the reply</b>
3159
         @ a local function <code>read_canvas%d</code> will read all userbased drawings.<br>The output is always a 16 lines string with fixed sequence.<br/>line 1 = points_x+";"+points_y+"\\n"<br/>line 2 = circles_x+";"+circles_y+";"+multi_radius+"\\n"<br/>line 3 = segments_x+";"+segments_y+"\\n"<br/>line 4 = arrows_x+";"+arrows_y+"\\n"<br/>line 5 = lines_x+";"+lines_y+"\\n"<br/>line 6 = triangles_x+";"+triangles_y+"\\n"<br/>line 7 = polys[3-9]_x+";"+polys[3-9]_y+"\\n"<br/>line 8 = rects_x +";"+rects_y+"\\n"<br>line 9 = closedpoly_x+";"+closedpoly_y+"\\n"<br/>line 10 = parallelogram_x+";"+parallelogram_y"\\n"<br/>line 11 = text_x+";"+text_y+";"+text"\\n"<br>line 12 = image_x+";"+image_y+";"+image_id<br>line 13 = curvedarrows_x +";"+ curvedarrows_y +"\\n"<br>line 14 = curvedarrows2_x +";"+ curvedarrows2_y +"\\n"<br>line 15 = crosshairs_x +";"+ crosshairs_y +"\\n"<br>line 16 = userdraw_x +";"+userdraw_y + "\\n" note: this is for single ''userdraw object,color`` and ''replyformat 29``<br/>line 17 = userdraw_x +";"+userdraw_y +";"+userdraw_radius + "\\n" note: this is for single ''userdraw object,color`` and ''replyformat 29``<br/>The x/y-data are in x/y-coordinate system and display precision may be set by a previous command ''precision 0 | 10 | 100 | 1000...``<br>In case of circles the radius is -for the time being- rounded to pixels<br><b>use the wims "direct exec" tool to see the format of the reply</b>
3160
         @ It is best to prepare / format the student reply in clientside javascript.<br />However in ''wims`` language you could use something like this<br />for example you are interested in the polys5 drawings of a pupil (the pupil may draw multiple poly5 objects...)<br />note: the reply for 2 poly5's is: x11,x12,x13,x14,x15,x21,x22,x23,x24,x25 ; y11,y12,y13,y14,y15,y21,y22,y23,y24,y25<br />rep = !line 7 of reply <br />rep = !translate ';' to '\\n' in &#36;rep <br />pts = 5 # 5 points for polygon <br />x_rep = !line 1 of &#36;rep <br />y_rep = !line 2 of &#36;rep <br />tot = !itemcnt &#36;x_rep <br />num_poly = &#36;[&#36;tot/&#36;pts] <br />idx = 0 <br />!for p=1 to &#36;num_poly <br />&nbsp;!for s=1 to &#36;pts <br />&nbsp;&nbsp;!increase idx <br />&nbsp;&nbsp;X = !item &#36;idx of &#36;x_rep <br />&nbsp;&nbsp;Y = !item &#36;idx of &#36;y_rep <br />&nbsp;&nbsp;# do some checking <br />&nbsp;!next s <br />!next p <br />
3160
         @ It is best to prepare / format the student reply in clientside javascript.<br>However in ''wims`` language you could use something like this<br>for example you are interested in the polys5 drawings of a pupil (the pupil may draw multiple poly5 objects...)<br>note: the reply for 2 poly5's is: x11,x12,x13,x14,x15,x21,x22,x23,x24,x25 ; y11,y12,y13,y14,y15,y21,y22,y23,y24,y25<br>rep = !line 7 of reply <br>rep = !translate ';' to '\\n' in &#36;rep <br>pts = 5 # 5 points for polygon <br>x_rep = !line 1 of &#36;rep <br>y_rep = !line 2 of &#36;rep <br>tot = !itemcnt &#36;x_rep <br>num_poly = &#36;[&#36;tot/&#36;pts] <br>idx = 0 <br>!for p=1 to &#36;num_poly <br>&nbsp;!for s=1 to &#36;pts <br>&nbsp;&nbsp;!increase idx <br>&nbsp;&nbsp;X = !item &#36;idx of &#36;x_rep <br>&nbsp;&nbsp;Y = !item &#36;idx of &#36;y_rep <br>&nbsp;&nbsp;# do some checking <br>&nbsp;!next s <br>!next p <br>
3161
         @ <b>attention</b>: for command argument ''closedpoly``, only one polygone can be drawn. The last point (e.g. the point clicked near the first point) of the array is removed.
3161
         @ <b>attention</b>: for command argument ''closedpoly``, only one polygone can be drawn. The last point (e.g. the point clicked near the first point) of the array is removed.
3162
         @ technical: all 10 ''draw primitives`` + ''text`` will have their own -transparent- PNG bitmap canvas. <br />So for example there can be a points_canvas entirely separated from a line_canvas.<br />This to avoid the need for a complete redraw when something is drawn to the canvas...(eg only the object_type_canvas is redrawn), this in contrast too many very slow do-it-all HTML5 canvas javascript libraries.<br />The mouselisteners are attached to the canvas-div element.
3162
         @ technical: all 10 ''draw primitives`` + ''text`` will have their own -transparent- PNG bitmap canvas. <br>So for example there can be a points_canvas entirely separated from a line_canvas.<br>This to avoid the need for a complete redraw when something is drawn to the canvas...(eg only the object_type_canvas is redrawn), this in contrast too many very slow do-it-all HTML5 canvas javascript libraries.<br>The mouselisteners are attached to the canvas-div element.
3163
         @ a special object type is ''images``.<br />if used together with <a href='#imagepalette'>imagepalette</a> a image table will be integrated in the 'control section' of multidraw (set <code>multiuserinput 1</code> for ''images``) if not used with <a href='#imagepalette'>imagepalette</a>, provide the images or div's (&lt;img&gt; tag with bitmap or SVG or anything in a div element) somewhere on the html exercise page, with an onclick handler like:<br /><code>&lt;img src='gifs/images/dog.svg' onclick='javascript:place_image_on_canvas(this.id);' id="ext_image_1" /&gt;<br />&lt;img src='gifs/fish.png' onclick='javascript:place_image_on_canvas(this.id);' id="another" /&gt;</code><br />etc ... when activating the multidraw ''image`` button, the images can be selected<br /> (left mouse button/onclick) and placed on the canvas...left mouse click.<br />using div's will enable you -amongst other content- to add math typesetting from the exercise page onto the canvas.
3163
         @ a special object type is ''images``.<br>if used together with <a href='#imagepalette'>imagepalette</a> a image table will be integrated in the 'control section' of multidraw (set <code>multiuserinput 1</code> for ''images``) if not used with <a href='#imagepalette'>imagepalette</a>, provide the images or div's (&lt;img&gt; tag with bitmap or SVG or anything in a div element) somewhere on the html exercise page, with an onclick handler like:<br><code>&lt;img src='gifs/images/dog.svg' onclick='javascript:place_image_on_canvas(this.id);' id="ext_image_1" /&gt;<br>&lt;img src='gifs/fish.png' onclick='javascript:place_image_on_canvas(this.id);' id="another" /&gt;</code><br>etc ... when activating the multidraw ''image`` button, the images can be selected<br> (left mouse button/onclick) and placed on the canvas...left mouse click.<br>using div's will enable you -amongst other content- to add math typesetting from the exercise page onto the canvas.
3164
         @ When you are not content with the default ''multidraw control panel``, you can create your own interface, using a few javascript functions to call the drawprimitives, delete things and ''stop drawing`` in case you also want to drag&drop stuff...</br>To activate this feature, use <a href='#multilabel'>multilabel NOCONTROLS</a><br />The object types are internally represented by the following numbers (making typos will render your exercise null and void)<br/>point = 0<br />points =1<br />circle = 2<br />circles = 3<br />line = 4<br />lines = 5<br />segment = 6<br />segments = 7<br />arrow = 8<br />arrows = 9<br />triangle = 10<br />triangles = 11<br />closedspoly = 12<br />text = 13<br />rect = 14<br />rects = 15<br />poly[3-9] = 16<br />polys[3-9] = 17<br />parallelogram = 18<br />parallelograms = 19<br />images       = 20<br />curvedarrow = 21<br />curvedarrows = 22<br />curvedarrow2 = 23<br />curvedarrows2 = 24<br />crosshair = 25<br />crosshairs = 26 <br />controls for example:<br /><code>&lt;input type='button' onclick='javascript:userdraw_primitive=null' value='STOP DRAWING' /&gt;<br />&lt;input type='button' onclick='javascript:userdraw_primitive=24;multidraw_object_cnt = 0;' value='start drawing curvedarrows2' /&gt; <br />&lt;input type='button' onclick='javascript:var fun=eval("clear_draw_area"+canvas_scripts[0]);fun(24,0);' value='REMOVE LAST CURVEDARROW ' /&gt; </code><br/> If using multiple canvas scripts in a single page, loop through the canvas_scripts[n] <br />note: if using NOCONTROLS and just a single draw primitive (for example, just: 'multidraw circles'), the object may be drawn directly. (analogue to 'userdraw circles,color')<br />And since a right mouse button click will always remove the last drawn object of the current object type, there is no need for a special "remove button"
3164
         @ When you are not content with the default ''multidraw control panel``, you can create your own interface, using a few javascript functions to call the drawprimitives, delete things and ''stop drawing`` in case you also want to drag&drop stuff...</br>To activate this feature, use <a href='#multilabel'>multilabel NOCONTROLS</a><br>The object types are internally represented by the following numbers (making typos will render your exercise null and void)<br/>point = 0<br>points =1<br>circle = 2<br>circles = 3<br>line = 4<br>lines = 5<br>segment = 6<br>segments = 7<br>arrow = 8<br>arrows = 9<br>triangle = 10<br>triangles = 11<br>closedspoly = 12<br>text = 13<br>rect = 14<br>rects = 15<br>poly[3-9] = 16<br>polys[3-9] = 17<br>parallelogram = 18<br>parallelograms = 19<br>images = 20<br>curvedarrow = 21<br>curvedarrows = 22<br>curvedarrow2 = 23<br>curvedarrows2 = 24<br>crosshair = 25<br>crosshairs = 26 <br>controls for example:<br><code>&lt;input type='button' onclick='javascript:userdraw_primitive=null' value='STOP DRAWING' /&gt;<br>&lt;input type='button' onclick='javascript:userdraw_primitive=24;multidraw_object_cnt = 0;' value='start drawing curvedarrows2' /&gt; <br>&lt;input type='button' onclick='javascript:var fun=eval("clear_draw_area"+canvas_scripts[0]);fun(24,0);' value='REMOVE LAST CURVEDARROW ' /&gt; </code><br/> If using multiple canvas scripts in a single page, loop through the canvas_scripts[n] <br>note: if using NOCONTROLS and just a single draw primitive (for example, just: 'multidraw circles'), the object may be drawn directly. (analogue to 'userdraw circles,color')<br>And since a right mouse button click will always remove the last drawn object of the current object type, there is no need for a special "remove button"
3165
         @%multidraw_function%size 400,400%xrange -10,10%yrange -10,10%fontfamily Italic 22px Helvetica%axis%axisnumbering%precision 0%grid 2,2,grey,1,1,5,black%multicolors red,green,blue%fontcolor orange%multilinewidth 1,2,3%multidraw text,function,function,function,line
3165
         @%multidraw_function%size 400,400%xrange -10,10%yrange -10,10%fontfamily Italic 22px Helvetica%axis%axisnumbering%precision 0%grid 2,2,grey,1,1,5,black%multicolors red,green,blue%fontcolor orange%multilinewidth 1,2,3%multidraw text,function,function,function,line
3166
         @%multidraw%size 400,400%xrange -10,10%yrange -10,10%multidash 1,0%multilinewidth 1,2%multistrokecolors red,blue%multisnaptogrid 1,1%multilabel LINES,CIRCLES,STOP DRAWING%multidraw lines,circles
3166
         @%multidraw%size 400,400%xrange -10,10%yrange -10,10%multidash 1,0%multilinewidth 1,2%multistrokecolors red,blue%multisnaptogrid 1,1%multilabel LINES,CIRCLES,STOP DRAWING%multidraw lines,circles
3167
         @%multidraw_images%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%drag xy%# use special function to read the drag coordinates%copy 0,0,-1,-1,-1,-1,gifs/images/skull_and_crossbones50.png%fontcolor green%fontfamily Bold 42pt Arial%imagepalette gifs/ca.gif,gifs/en.gif,gifs/nl.gif,gifs/fr.gif,gifs/cn.gif,gifs/de.gif,gifs/kh.gif,gifs/it.gif%multiuserinput 0,0,1%css color:blue;%multisnaptogrid 1,1,1%multilinewidth 0,4,0%# attention: use unicode text input without the slash %# \u222D ---> u222D at least will sometimes work%# otherwise cut&past unicode symbols into inputfield...%multilabel TEXT,REACTION ARROW,FLAGS,STOP DRAWING%multidraw text,arrow,images
3167
         @%multidraw_images%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%drag xy%# use special function to read the drag coordinates%copy 0,0,-1,-1,-1,-1,gifs/images/skull_and_crossbones50.png%fontcolor green%fontfamily Bold 42pt Arial%imagepalette gifs/ca.gif,gifs/en.gif,gifs/nl.gif,gifs/fr.gif,gifs/cn.gif,gifs/de.gif,gifs/kh.gif,gifs/it.gif%multiuserinput 0,0,1%css color:blue;%multisnaptogrid 1,1,1%multilinewidth 0,4,0%# attention: use unicode text input without the slash %# \u222D ---> u222D at least will sometimes work%# otherwise cut&past unicode symbols into inputfield...%multilabel TEXT,REACTION ARROW,FLAGS,STOP DRAWING%multidraw text,arrow,images
3168
         @%multidraw_demo%size 800,800%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 1%grid 2,2,grey,2,2,5,grey%css color:blue;%fontfamily Italic 42pt Arial%precision 1%opacity 200,50%snaptogrid%linewidth 3%filled%multistrokecolors red,green,blue,orange,yellow,purple,black,cyan,red,green,blue,orange,green,purple,black,cyan%multifillcolors red,green,blue,orange,yellow,purple,black,cyan,red,green,blue,orange,brown,purple%imagepalette gifs/ca.gif,gifs/en.gif,gifs/nl.gif,gifs/fr.gif,gifs/cn.gif,gifs/de.gif,gifs/kh.gif,gifs/it.gif%multidraw closedpoly,segments,rect,parallelogram,triangles,poly5,points,lines,arrows,circles,text,curvedarrows,curvedarrows2,images
3168
         @%multidraw_demo%size 800,800%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 1%grid 2,2,grey,2,2,5,grey%css color:blue;%fontfamily Italic 42pt Arial%precision 1%opacity 200,50%snaptogrid%linewidth 3%filled%multistrokecolors red,green,blue,orange,yellow,purple,black,cyan,red,green,blue,orange,green,purple,black,cyan%multifillcolors red,green,blue,orange,yellow,purple,black,cyan,red,green,blue,orange,brown,purple%imagepalette gifs/ca.gif,gifs/en.gif,gifs/nl.gif,gifs/fr.gif,gifs/cn.gif,gifs/de.gif,gifs/kh.gif,gifs/it.gif%multidraw closedpoly,segments,rect,parallelogram,triangles,poly5,points,lines,arrows,circles,text,curvedarrows,curvedarrows2,images
3169
         @%multidraw_NOCONTROLS%size 400,400%xrange -10,10%yrange -10,10%grid 2,2,grey%linewidth 3%strokecolor green%fillcolor blue%filled%opacity 255,60%multilabel NOCONTROLS%multidraw circles%# RIGHT MOUSE CLICK REMOVES LAST OBJECT
3169
         @%multidraw_NOCONTROLS%size 400,400%xrange -10,10%yrange -10,10%grid 2,2,grey%linewidth 3%strokecolor green%fillcolor blue%filled%opacity 255,60%multilabel NOCONTROLS%multidraw circles%# RIGHT MOUSE CLICK REMOVES LAST OBJECT
Line 3226... Line 3226...
3226
        case MULTILABEL:
3226
        case MULTILABEL:
3227
        /*
3227
        /*
3228
         @ multilabel button_label_1,button_label_2,...,button_label_8,'stop drawing text'
3228
         @ multilabel button_label_1,button_label_2,...,button_label_8,'stop drawing text'
3229
         @ use before command <a href='#multidraw'>multidraw</a>
3229
         @ use before command <a href='#multidraw'>multidraw</a>
3230
         @ if not set all labels (e.g. the value of input type 'button') will be set by the english names for the draw_primitives (like 'point','circle'...)
3230
         @ if not set all labels (e.g. the value of input type 'button') will be set by the english names for the draw_primitives (like 'point','circle'...)
3231
         @ the ''stop drawing`` button text <b>must</b> be the last item on the ''multilabel`` -list <br />for example:<br /><code>multilabel punten,lijnen,Stop met Tekenen<br />multidraw points,lines</code>
3231
         @ the ''stop drawing`` button text <b>must</b> be the last item on the ''multilabel`` -list <br>for example:<br><code>multilabel punten,lijnen,Stop met Tekenen<br>multidraw points,lines</code>
3232
         @ all buttons can be ''styled`` by using command <code>css</code><br /><b>note:</b>If you want to add some CSS style to the buttons...<br />the id's of the ''draw buttons`` are their english command argument<br />(e.g. id="canvasdraw_points" for the draw points button).<br />the id of the ''stop drawing`` button is "canvasdraw_stop_drawing".<br />the id of the "OK" button is ''canvasdraw_ok_button``
3232
         @ all buttons can be ''styled`` by using command <code>css</code><br><b>note:</b>If you want to add some CSS style to the buttons...<br>the id's of the ''draw buttons`` are their english command argument<br>(e.g. id="canvasdraw_points" for the draw points button).<br>the id of the ''stop drawing`` button is "canvasdraw_stop_drawing".<br>the id of the "OK" button is ''canvasdraw_ok_button``
3233
         @ wims will not check the amount or validity of your input
3233
         @ wims will not check the amount or validity of your input
3234
         @ always use the same sequence as is used for ''multidraw``
3234
         @ always use the same sequence as is used for ''multidraw``
3235
         @ if you don't want the controls, and want to write your own interface, set <code>multilabel NOCONTROLS</code>
3235
         @ if you don't want the controls, and want to write your own interface, set <code>multilabel NOCONTROLS</code>
3236
        */
3236
        */
3237
            if( use_tooltip == 1 ){canvas_error("command 'multidraw' is incompatible with command 'intooltip tip_text'");}
3237
            if( use_tooltip == 1 ){canvas_error("command 'multidraw' is incompatible with command 'intooltip tip_text'");}
Line 3263... Line 3263...
3263
            break;
3263
            break;
3264
        case MULTIFILL:
3264
        case MULTIFILL:
3265
        /*
3265
        /*
3266
         @ multifill 0,0,1,0,1,0,0
3266
         @ multifill 0,0,1,0,1,0,0
3267
         @ meaning draw objects no. 3 and 5, in the list of command ''multifill``, are filled (if the object is fillable...and not a line,segment,arrow or point...)
3267
         @ meaning draw objects no. 3 and 5, in the list of command ''multifill``, are filled (if the object is fillable...and not a line,segment,arrow or point...)
3268
         @ using a fillpattern: multifill 0,1,2,5,3,4<br />meaning: first object is not filled...second object is solid color filled...2=grid | 3=hatch | 4=diamond | 5=dot
3268
         @ using a fillpattern: multifill 0,1,2,5,3,4<br>meaning: first object is not filled...second object is solid color filled...2=grid | 3=hatch | 4=diamond | 5=dot
3269
         @ use before command <a href='#multidraw'>multidraw</a>
3269
         @ use before command <a href='#multidraw'>multidraw</a>
3270
         @ if not set all objects -except point|points- will be set ''not filled``... unless a command <code>filled</code> was given before command <code>multifill</code>
3270
         @ if not set all objects -except point|points- will be set ''not filled``... unless a command <code>filled</code> was given before command <code>multifill</code>
3271
         @ only suitable for draw_primitives like ''circle | circles``, ''triangle | triangles``, ''rect | rects``, ''poly[3-9] | polys[3-9]`` and ''polygon``
3271
         @ only suitable for draw_primitives like ''circle | circles``, ''triangle | triangles``, ''rect | rects``, ''poly[3-9] | polys[3-9]`` and ''polygon``
3272
         @ wims will <b>not</b> check if the number of 0 or 1's matches the amount of draw primitives...
3272
         @ wims will <b>not</b> check if the number of 0 or 1's matches the amount of draw primitives...
3273
         @ always use the same sequence as is used for ''multidraw``
3273
         @ always use the same sequence as is used for ''multidraw``
Line 3290... Line 3290...
3290
         @ use before command <a href='#multidraw'>multidraw</a>
3290
         @ use before command <a href='#multidraw'>multidraw</a>
3291
         @ if not set all fillcolors (for circle | triangle | poly[3-9] | closedpoly ) will be ''stroke_color``, ''fill_opacity``
3291
         @ if not set all fillcolors (for circle | triangle | poly[3-9] | closedpoly ) will be ''stroke_color``, ''fill_opacity``
3292
         @ use these up to 6 colors for the draw primitives used by command <code>multidraw obj_type_1,obj_type_2...obj_type_n</code>
3292
         @ use these up to 6 colors for the draw primitives used by command <code>multidraw obj_type_1,obj_type_2...obj_type_n</code>
3293
         @ wims will <b>not</b> check if the number of colours matches the amount of draw primitives...
3293
         @ wims will <b>not</b> check if the number of colours matches the amount of draw primitives...
3294
         @ always use the same sequence as is used for ''multidraw``
3294
         @ always use the same sequence as is used for ''multidraw``
3295
         @ can also be used with command <a href='#userdraw'>userdraw clickfill,color</a> when more than one fillcolor is wanted.<br />in that case use for example <a href='#replyformat'>replyformat 10</a> ... reply=x1:y1:color1,x2:y2:color2...<br />the colors will restart at the first color, when there are more fill-clicks than multi-fill-colors<br />if more control over the used colours is wanted, see command <a href='#colorpalette'>colorpalette color1,color2...</a>
3295
         @ can also be used with command <a href='#userdraw'>userdraw clickfill,color</a> when more than one fillcolor is wanted.<br>in that case use for example <a href='#replyformat'>replyformat 10</a> ... reply=x1:y1:color1,x2:y2:color2...<br>the colors will restart at the first color, when there are more fill-clicks than multi-fill-colors<br>if more control over the used colours is wanted, see command <a href='#colorpalette'>colorpalette color1,color2...</a>
3296
        */
3296
        */
3297
            if( use_tooltip == 1 ){canvas_error("command 'multidraw' is incompatible with command 'intooltip tip_text'");}
3297
            if( use_tooltip == 1 ){canvas_error("command 'multidraw' is incompatible with command 'intooltip tip_text'");}
3298
            fprintf(js_include_file,"var multifillcolors = [");
3298
            fprintf(js_include_file,"var multifillcolors = [");
3299
            while( ! done ){
3299
            while( ! done ){
3300
                temp = get_color(infile,1);
3300
                temp = get_color(infile,1);
Line 3325... Line 3325...
3325
         @ meaning draw objects no. 2 (circle) and 3 (segments), in the list of command like <code>multifill points,circle,segments</code>, will snap to the xy-grid (default 1 in x/y-coordinate system: see command <a href='#snaptogrid'>snaptogrid</a>)
3325
         @ meaning draw objects no. 2 (circle) and 3 (segments), in the list of command like <code>multifill points,circle,segments</code>, will snap to the xy-grid (default 1 in x/y-coordinate system: see command <a href='#snaptogrid'>snaptogrid</a>)
3326
         @ freehand drawing...specify precision for reply: all objects snap to grid <code>multisnaptogrid 1,1,1,...</code>
3326
         @ freehand drawing...specify precision for reply: all objects snap to grid <code>multisnaptogrid 1,1,1,...</code>
3327
         @ only the xy-values snap_to_grid: all objects snap to grid <code>multisnaptogrid 1,1,1,...</code>
3327
         @ only the xy-values snap_to_grid: all objects snap to grid <code>multisnaptogrid 1,1,1,...</code>
3328
         @ only the x-values snap_to_grid: all objects snap to x-grid <code>multisnaptogrid 2,2,2,...</code>
3328
         @ only the x-values snap_to_grid: all objects snap to x-grid <code>multisnaptogrid 2,2,2,...</code>
3329
         @ only the y-values snap_to_grid: all objects snap to y-grid <code>multisnaptogrid 3,3,3,...</code>
3329
         @ only the y-values snap_to_grid: all objects snap to y-grid <code>multisnaptogrid 3,3,3,...</code>
3330
         @ if <a href='#snaptopoints'>snaptopoints</a> is defined: all objects snap to points <code>multisnaptogrid 4,4,4,...</code> <br /><b>make sure to define the points to snap on...</b> use command <a href='#snaptopoints'>snaptopoints</a>
3330
         @ if <a href='#snaptopoints'>snaptopoints</a> is defined: all objects snap to points <code>multisnaptogrid 4,4,4,...</code> <br><b>make sure to define the points to snap on...</b> use command <a href='#snaptopoints'>snaptopoints</a>
3331
         @ <code>multisnaptogrid 0,1,2,3,4<br />multidraw text,arrow,line,circle,image</code><br />''text`` is free hand, ''arrow`` is snap to grid, ''line`` is snap to x-grid, ''circle`` is snap to y-grid, ''image`` is snap to points defined by command <a href='#snaptopoints'>snaptopoints</a>
3331
         @ <code>multisnaptogrid 0,1,2,3,4<br>multidraw text,arrow,line,circle,image</code><br>''text`` is free hand, ''arrow`` is snap to grid, ''line`` is snap to x-grid, ''circle`` is snap to y-grid, ''image`` is snap to points defined by command <a href='#snaptopoints'>snaptopoints</a>
3332
         @ use before command <a href='#multidraw'>multidraw</a>
3332
         @ use before command <a href='#multidraw'>multidraw</a>
3333
         @ attention: if not set all objects will be set ''no snap``... unless a generic command ''snaptogrid`` was given before command ''multidraw``
3333
         @ attention: if not set all objects will be set ''no snap``... unless a generic command ''snaptogrid`` was given before command ''multidraw``
3334
         @ commands <a href='#xsnaptogrid'>xsnaptogrid</a>, <a href='#ysnaptogrid'>ysnaptogrid</a>, <a href='#snaptofunction'>snaptofunction</a> are <b>not</b> supported amd only functional for command <a href='#userdraw'>userdraw</a>
3334
         @ commands <a href='#xsnaptogrid'>xsnaptogrid</a>, <a href='#ysnaptogrid'>ysnaptogrid</a>, <a href='#snaptofunction'>snaptofunction</a> are <b>not</b> supported amd only functional for command <a href='#userdraw'>userdraw</a>
3335
         @ always use the same sequence as is used for ''multidraw``
3335
         @ always use the same sequence as is used for ''multidraw``
3336
         @ wims will <b>not</b> check if the number of 0 or 1's matches the amount of draw primitives...
3336
         @ wims will <b>not</b> check if the number of 0 or 1's matches the amount of draw primitives...
Line 3375... Line 3375...
3375
 
3375
 
3376
        case MULTIUSERINPUT:
3376
        case MULTIUSERINPUT:
3377
        /*
3377
        /*
3378
        @ multiuserinput 0,1,1,0
3378
        @ multiuserinput 0,1,1,0
3379
        @ alternative: multiinput
3379
        @ alternative: multiinput
3380
        @ meaning, when the command ''multidraw`` is used <code>multidraw circles,points,lines,triangles</code><br />objects ''points`` and ''lines`` may additionally be ''drawn`` by direct input (inputfields)<br/>all other objects must be drawn with a mouse
3380
        @ meaning, when the command ''multidraw`` is used <code>multidraw circles,points,lines,triangles</code><br>objects ''points`` and ''lines`` may additionally be ''drawn`` by direct input (inputfields)<br/>all other objects must be drawn with a mouse
3381
        @ in case of circle | circles a third inputfield for Radius (R) is added. The radius must be in the x/y coordinate system (x-range) and <b>not</b> in pixels...students don't think in pixels.<br />note: R-values will not snap-to-grid
3381
        @ in case of circle | circles a third inputfield for Radius (R) is added. The radius must be in the x/y coordinate system (x-range) and <b>not</b> in pixels...students don't think in pixels.<br>note: R-values will not snap-to-grid
3382
        @ in case of line(s) | segment(s) | arrow(s) the user should write <b>x1:y1</b> in the first inputfield and <b>x2:y2</b> in the second.<br />These ''hints`` are pre-filled into the input field.<br />Other coordinate delimiters are '';`` and '',`` e.g. <b>x1;y1</b> or <b>x1,y1</b>.<br />An error message (alert box) will popup when things are not correctly...
3382
        @ in case of line(s) | segment(s) | arrow(s) the user should write <b>x1:y1</b> in the first inputfield and <b>x2:y2</b> in the second.<br>These ''hints`` are pre-filled into the input field.<br>Other coordinate delimiters are '';`` and '',`` e.g. <b>x1;y1</b> or <b>x1,y1</b>.<br>An error message (alert box) will popup when things are not correctly...
3383
        @ in case of a triangle | poly3, three inputfields are provided.
3383
        @ in case of a triangle | poly3, three inputfields are provided.
3384
        @ in case of ''text`` and ''multiuserinput=1, 3`` inputfields will be shown: ''x,y,text``
3384
        @ in case of ''text`` and ''multiuserinput=1, 3`` inputfields will be shown: ''x,y,text``
3385
        @ in case of ''text`` and ''multiuserinput=0, 1`` inputfield will be shown: text ... a mouse click will place the text on the canvas.
3385
        @ in case of ''text`` and ''multiuserinput=0, 1`` inputfield will be shown: text ... a mouse click will place the text on the canvas.
3386
        @ may be styled using command <a href="#css">css</a>
3386
        @ may be styled using command <a href="#css">css</a>
3387
        @ an additional button ''stop drawing`` may be used to combine userbased drawings with ''drag&and;drop`` or ''onclick`` elements
3387
        @ an additional button ''stop drawing`` may be used to combine userbased drawings with ''drag&and;drop`` or ''onclick`` elements
3388
        @ when exercise if finished (status=done) the buttons will not be shown.<br />To override this default behaviour use command / keyword ''status``
3388
        @ when exercise if finished (status=done) the buttons will not be shown.<br>To override this default behaviour use command / keyword ''status``
3389
        @ use before command <a href='#multidraw'>multidraw</a>
3389
        @ use before command <a href='#multidraw'>multidraw</a>
3390
        @ always use the same sequence as is used for ''multidraw``
3390
        @ always use the same sequence as is used for ''multidraw``
3391
        */
3391
        */
3392
            /* simple rawmath and input check */
3392
            /* simple rawmath and input check */
3393
            js_function[JS_SAFE_EVAL] = 1;
3393
            js_function[JS_SAFE_EVAL] = 1;
Line 3399... Line 3399...
3399
        /*
3399
        /*
3400
        @ noreset
3400
        @ noreset
3401
        @ alternative: killreset
3401
        @ alternative: killreset
3402
        @ keyword
3402
        @ keyword
3403
        @ may come in handy if canvas script code is generated using loops
3403
        @ may come in handy if canvas script code is generated using loops
3404
        @ if used the following properties will remain to be valid<br /><ul><li>filled</li><li>dash settings</li><li>onclick or drag settings</li><li>centering or offset</li></ul>
3404
        @ if used the following properties will remain to be valid<br><ul><li>filled</li><li>dash settings</li><li>onclick or drag settings</li><li>centering or offset</li></ul>
3405
        @ if used again, these properies will be reset to the default values and normal behaviour is continued (e.g. the above properties will be reset after 'use' on a canvas object)
3405
        @ if used again, these properies will be reset to the default values and normal behaviour is continued (e.g. the above properties will be reset after 'use' on a canvas object)
3406
        @ etc etc
3406
        @ etc etc
3407
        @ commands <a href='#slider'>slider</a>, <a href='#linear'>linear</a>, <a href='#rotate'>rotate</a>, <a href='#translate'>translate</a>, <a href='#affine'>affine</a> are always active until the 'kill' commands are given: <br /><a href='#killlinear'>killlinear</a>, <a href='#killrotate'>killrotate</a>, <a href='#killtranslate'>killtranslate</a> and <a href='#killaffine'>killaffine</a>
3407
        @ commands <a href='#slider'>slider</a>, <a href='#linear'>linear</a>, <a href='#rotate'>rotate</a>, <a href='#translate'>translate</a>, <a href='#affine'>affine</a> are always active until the 'kill' commands are given: <br><a href='#killlinear'>killlinear</a>, <a href='#killrotate'>killrotate</a>, <a href='#killtranslate'>killtranslate</a> and <a href='#killaffine'>killaffine</a>
3408
        @ commands like 'opacity', 'linewidth', 'fontsize', 'fontfamily' are only changed when redefined again
3408
        @ commands like 'opacity', 'linewidth', 'fontsize', 'fontfamily' are only changed when redefined again
3409
        @%noreset%size 400,400%xrange -10,10%yrange -10,10%noreset%drag xy%linewidth 4%filled%rect -4,4,-2,2,blue%triangle -3,-3,0,0,1,-5,green%circle 0,0,50,orange%noreset%rect 2,4,4,2,blue
3409
        @%noreset%size 400,400%xrange -10,10%yrange -10,10%noreset%drag xy%linewidth 4%filled%rect -4,4,-2,2,blue%triangle -3,-3,0,0,1,-5,green%circle 0,0,50,orange%noreset%rect 2,4,4,2,blue
3410
        @%noreset_oefgraduation%size 800,100%xrange 0,11%yrange -1,1%hline 0,0,black%parallel 0,0,0,0.5,1,0,11,blue%noreset%onclick%centered%text black,1,0.6,large,20%text black,2,0.6,large,30%text black,3,0.6,large,40%text black,4,0.6,large,50%text black,5,0.6,large,60%text black,6,0.6,large,70%text black,7,0.6,large,80%text black,8,0.6,large,90%text black,9,0.6,large,100%text black,10,0.6,large,110
3410
        @%noreset_oefgraduation%size 800,100%xrange 0,11%yrange -1,1%hline 0,0,black%parallel 0,0,0,0.5,1,0,11,blue%noreset%onclick%centered%text black,1,0.6,large,20%text black,2,0.6,large,30%text black,3,0.6,large,40%text black,4,0.6,large,50%text black,5,0.6,large,60%text black,6,0.6,large,70%text black,7,0.6,large,80%text black,8,0.6,large,90%text black,9,0.6,large,100%text black,10,0.6,large,110
3411
        */
3411
        */
3412
            if(no_reset == FALSE){no_reset = TRUE;}else{no_reset = FALSE;reset();}
3412
            if(no_reset == FALSE){no_reset = TRUE;}else{no_reset = FALSE;reset();}
Line 3486... Line 3486...
3486
        @ will call the ''obabel`` program, if installed.
3486
        @ will call the ''obabel`` program, if installed.
3487
        @ output will be an svg file
3487
        @ output will be an svg file
3488
        @ see documentation of obabel for special keys
3488
        @ see documentation of obabel for special keys
3489
        @ command <a href='#affine'>affine</a> will produce CSS3 matrix transformations
3489
        @ command <a href='#affine'>affine</a> will produce CSS3 matrix transformations
3490
        @ command <a href='#rotate'>rotate</a> will rotate the object
3490
        @ command <a href='#rotate'>rotate</a> will rotate the object
3491
        @ can be set onclick: <code>javascript:read_dragdrop();</code> will return click numbers of mathml-objects<br />if 4 clickable object are drawn, the reply could be 1,0,1,0 ... meaning clicked on the first and third object
3491
        @ can be set onclick: <code>javascript:read_dragdrop();</code> will return click numbers of mathml-objects<br>if 4 clickable object are drawn, the reply could be 1,0,1,0 ... meaning clicked on the first and third object
3492
        @ can be set draggable: <code>javascript:read_dragdrop();</code> will return all coordinates in the same order as the canvas script: unmoved object will have their original coordinates...
3492
        @ can be set draggable: <code>javascript:read_dragdrop();</code> will return all coordinates in the same order as the canvas script: unmoved object will have their original coordinates...
3493
        @ snaptogrid is supported...snaptopoints will work, but use with care...due to the primitive dragging<br />technically: the dragstuff library is not used...the mathml is embedded in a new div element and not in the html5-canvas
3493
        @ snaptogrid is supported...snaptopoints will work, but use with care...due to the primitive dragging<br>technically: the dragstuff library is not used...the mathml is embedded in a new div element and not in the html5-canvas
3494
        @ external files may be loaded if they are present on the server or in the modules <br />for example:<br /> obabel 0,0,mol,&#36;module_dir/caffeine.mol,-P100,-xb none
3494
        @ external files may be loaded if they are present on the server or in the modules <br>for example:<br> obabel 0,0,mol,&#36;module_dir/caffeine.mol,-P100,-xb none
3495
        @%obabel_smi%size 400,400%xrange -10,10%yrange -10,10%fillcolor green%drag xy%centered%obabel 0,0,smi,-:c1cFccc1cc,-xb none,-xB blue,-xi,-xt,-xa,-xX,-xP180,-h
3495
        @%obabel_smi%size 400,400%xrange -10,10%yrange -10,10%fillcolor green%drag xy%centered%obabel 0,0,smi,-:c1cFccc1cc,-xb none,-xB blue,-xi,-xt,-xa,-xX,-xP180,-h
3496
        */
3496
        */
3497
            js_function[DRAW_XML] = 1;
3497
            js_function[DRAW_XML] = 1;
3498
            for(i=0;i<4;i++){
3498
            for(i=0;i<4;i++){
3499
                switch(i){
3499
                switch(i){
Line 3548... Line 3548...
3548
        /*
3548
        /*
3549
         @ onclick
3549
         @ onclick
3550
         @ keyword (no arguments required)
3550
         @ keyword (no arguments required)
3551
         @ if the next object is clicked, its ''object onclick_or_drag sequence number`` in fly script is returned by <code>javascript:read_canvas();</code>
3551
         @ if the next object is clicked, its ''object onclick_or_drag sequence number`` in fly script is returned by <code>javascript:read_canvas();</code>
3552
         @ onclick seqeuence numbering starts at ''0``, e.g. if there are 6 objects set onclick, the first onclick object will have id-number ''0``, the last id-number ''5``
3552
         @ onclick seqeuence numbering starts at ''0``, e.g. if there are 6 objects set onclick, the first onclick object will have id-number ''0``, the last id-number ''5``
3553
         @ line based objects will show an increase in line width<br />font based objects will show the text in ''bold`` when clicked.
3553
         @ line based objects will show an increase in line width<br>font based objects will show the text in ''bold`` when clicked.
3554
         @ the click zone (accuracy) is determined by 2&times; the line width of the object
3554
         @ the click zone (accuracy) is determined by 2&times; the line width of the object
3555
         @ onclick and <a href="#drag">drag x|y|xy</a> may be combined in a single flyscript (although a single object can <b>not</b> be onclick and draggable at the same time...)
3555
         @ onclick and <a href="#drag">drag x|y|xy</a> may be combined in a single flyscript (although a single object can <b>not</b> be onclick and draggable at the same time...)
3556
         @ note: not all objects may be set onclick
3556
         @ note: not all objects may be set onclick
3557
         @%onclick%size 400,400%xrange -10,10%yrange -10,10%opacity 255,60%linewidth 3%onclick%fcircles blue,-3,3,1,1,2,2,3,1,1%onclick%ftriangles red,-4,-4,-4,0,-3,-2,0,0,4,0,2,-4%onclick%frects green,-4,4,-2,2,1,-1,3,-4
3557
         @%onclick%size 400,400%xrange -10,10%yrange -10,10%opacity 255,60%linewidth 3%onclick%fcircles blue,-3,3,1,1,2,2,3,1,1%onclick%ftriangles red,-4,-4,-4,0,-3,-2,0,0,4,0,2,-4%onclick%frects green,-4,4,-2,2,1,-1,3,-4
3558
        */
3558
        */
Line 3769... Line 3769...
3769
        /*
3769
        /*
3770
        @ polyline color,x1,y1,x2,y2...x_n,y_n
3770
        @ polyline color,x1,y1,x2,y2...x_n,y_n
3771
        @ brokenline color,x1,y1,x2,y2...x_n,y_n
3771
        @ brokenline color,x1,y1,x2,y2...x_n,y_n
3772
        @ path color,x1,y1,x2,y2...x_n,y_n
3772
        @ path color,x1,y1,x2,y2...x_n,y_n
3773
        @ remark: there is <b>no</b> command polylines | brokenlines | paths ... just use multiple commands <code>polyline, x1,y1,x2,y2...x_n,y_n</code>
3773
        @ remark: there is <b>no</b> command polylines | brokenlines | paths ... just use multiple commands <code>polyline, x1,y1,x2,y2...x_n,y_n</code>
3774
        @ remark: there are commands <code>userdraw path(s),color</code> and <code>userdraw polyline,color</code>... these are two entirely different things ! the path(s) userdraw commands may be used for freehand drawing(s)<br />the polyline userdraw command is analogue to this polyline|brokenline command
3774
        @ remark: there are commands <code>userdraw path(s),color</code> and <code>userdraw polyline,color</code>... these are two entirely different things ! the path(s) userdraw commands may be used for freehand drawing(s)<br>the polyline userdraw command is analogue to this polyline|brokenline command
3775
        @ the command interconnects the points in the given order with a line (canvasdraw will not close the drawing: use command <a href="#poly">polygon</a> for this)
3775
        @ the command interconnects the points in the given order with a line (canvasdraw will not close the drawing: use command <a href="#poly">polygon</a> for this)
3776
        @ use command <a href='#segments'>segments</a> for a series of segments. These may be clicked/dragged individually
3776
        @ use command <a href='#segments'>segments</a> for a series of segments. These may be clicked/dragged individually
3777
        @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
3777
        @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
3778
        @%polyline_1%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%drag xy%snaptogrid%polyline blue,0,0,1,3,3,1,2,4,-1,3
3778
        @%polyline_1%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%drag xy%snaptogrid%polyline blue,0,0,1,3,3,1,2,4,-1,3
3779
        @%polyline_2%size 400,400%xrange -10,10%yrange -10,10%linewidth 1%onclick%polyline green,0,0,1,3,3,1,2,4,-1,3
3779
        @%polyline_2%size 400,400%xrange -10,10%yrange -10,10%linewidth 1%onclick%polyline green,0,0,1,3,3,1,2,4,-1,3
Line 3819... Line 3819...
3819
            @ popup
3819
            @ popup
3820
            @ keyword (no arguments)
3820
            @ keyword (no arguments)
3821
            @ if fly-script starts with keyword ''popup``, the canvas image will be exclusively in a popup window (xsize px &times; ysize px)
3821
            @ if fly-script starts with keyword ''popup``, the canvas image will be exclusively in a popup window (xsize px &times; ysize px)
3822
            @ if keyword ''popup`` is used after command <code>size xsize,ysize</code> the canvas will also be displayed in a popup window with size ''xsize &times; ysize``
3822
            @ if keyword ''popup`` is used after command <code>size xsize,ysize</code> the canvas will also be displayed in a popup window with size ''xsize &times; ysize``
3823
            @ the popup window will be embedded into the page as a normal image, when ''status=done``; override with keyword <a href="#status">nostatus</a>
3823
            @ the popup window will be embedded into the page as a normal image, when ''status=done``; override with keyword <a href="#status">nostatus</a>
3824
            @ to access the read_canvas and read_dragdrop functions in a popup window, use:<br /> <code> function read_all(){<br /> if( typeof popup !== 'undefined' ){<br /> var fun1 = popup['read_dragdrop'+canvas_scripts[0]];<br />var fun2 = popup['read_canvas'+canvas_scripts[0]];<br /> popup.close();<br /> return "dragdrop="+fun1()+"\\ncanvas="+fun2();<br /> };</code>
3824
            @ to access the read_canvas and read_dragdrop functions in a popup window, use:<br> <code> function read_all(){<br> if( typeof popup !== 'undefined' ){<br> var fun1 = popup['read_dragdrop'+canvas_scripts[0]];<br>var fun2 = popup['read_canvas'+canvas_scripts[0]];<br> popup.close();<br> return "dragdrop="+fun1()+"\\ncanvas="+fun2();<br> };</code>
3825
            @ to set a canvasdraw produced <a href="#clock">clock</a> or multiple clocks...use something like: <code>popup.set_clock(clock_id,type,diff);</code> as js-function for a button (or something else) in your document page.<br />where in <b>clock_id</b> starts with 0 for the first clock<br /><b>type</b> is 1 for Hours,2 for Minutes and 3 for Seconds<br /><b>diff</b> is the increment (positive or negative) per click
3825
            @ to set a canvasdraw produced <a href="#clock">clock</a> or multiple clocks...use something like: <code>popup.set_clock(clock_id,type,diff);</code> as js-function for a button (or something else) in your document page.<br>where in <b>clock_id</b> starts with 0 for the first clock<br><b>type</b> is 1 for Hours,2 for Minutes and 3 for Seconds<br><b>diff</b> is the increment (positive or negative) per click
3826
            @%popup%popup%size 400,400%xrange -2*pi,2*pi%yrange -5,5%precision 0%axis%axisnumbering%opacity 100,190%grid 1,1,grey,2,2,5,black%linewidth 4%fillcolor blue%trange -pi,pi%animate%linewidth 1%precision 1000%jsplot red,4*cos(2*x),2*sin(3*x-pi/6)%strokecolor green%functionlabel H(x)=%userinput function
3826
            @%popup%popup%size 400,400%xrange -2*pi,2*pi%yrange -5,5%precision 0%axis%axisnumbering%opacity 100,190%grid 1,1,grey,2,2,5,black%linewidth 4%fillcolor blue%trange -pi,pi%animate%linewidth 1%precision 1000%jsplot red,4*cos(2*x),2*sin(3*x-pi/6)%strokecolor green%functionlabel H(x)=%userinput function
3827
            */
3827
            */
3828
            use_tooltip = 2;
3828
            use_tooltip = 2;
3829
            break;
3829
            break;
3830
 
3830
 
3831
        case PROTRACTOR:
3831
        case PROTRACTOR:
3832
        /*
3832
        /*
3833
         @ protractor x,y,x_width,type,mode,use_a_scale
3833
         @ protractor x,y,x_width,type,mode,use_a_scale
3834
         @ x,y are the initial location
3834
         @ x,y are the initial location
3835
         @ x_width: give the width in x-coordinate system (e.g. not in pixels !)
3835
         @ x_width: give the width in x-coordinate system (e.g. not in pixels !)
3836
         @ type = 1: a triangle range 0 - 180<br />type = 2: a circle shape 0 - 360
3836
         @ type = 1: a triangle range 0 - 180<br>type = 2: a circle shape 0 - 360
3837
         @ mode: use -1 to set the protractor interactive (mouse movement of protractor)<br />use mode = '0&deg; - 360&deg;' to set the protractor with a static angle of some value
3837
         @ mode: use -1 to set the protractor interactive (mouse movement of protractor)<br>use mode = '0&deg; - 360&deg;' to set the protractor with a static angle of some value
3838
         @ if the value of the user_rotation angle is to be shown...use command <a href='#display'>display degree,color,fontsize</a><a href='#display'>display radian,color,fontsize</a>
3838
         @ if the value of the user_rotation angle is to be shown...use command <a href='#display'>display degree,color,fontsize</a><a href='#display'>display radian,color,fontsize</a>
3839
         @ use_scale = 1: the protractor will have some scale values printed; use_scale=0 to disable
3839
         @ use_scale = 1: the protractor will have some scale values printed; use_scale=0 to disable
3840
         @ the rotating direction of the mouse around the protractor determines the clockwise/ counter clockwise rotation of the protractor...
3840
         @ the rotating direction of the mouse around the protractor determines the clockwise/ counter clockwise rotation of the protractor...
3841
         @ commands ''stroke_color | fill_color | linewidth | opacity | font_family`` will determine the looks of the protractor.
3841
         @ commands ''stroke_color | fill_color | linewidth | opacity | font_family`` will determine the looks of the protractor.
3842
         @ default replyformat: reply[0] = x;reply[1] = y;reply[2] = angle_in_radians<br />use command ''precision`` to set the reply precision.
3842
         @ default replyformat: reply[0] = x;reply[1] = y;reply[2] = angle_in_radians<br>use command ''precision`` to set the reply precision.
3843
         @ if combined with a ruler, use replyformat = 32
3843
         @ if combined with a ruler, use replyformat = 32
3844
         @ command <code>snap_to_grid</code> may be used to assist the pupil at placing the protractor
3844
         @ command <code>snap_to_grid</code> may be used to assist the pupil at placing the protractor
3845
         @ when using command ''zoom``, pay <b>attention</b> to the size and symmetry of your canvas<br />...to avoid a partial image, locate the start position near the center of the visual canvas<br />technical: the actual ''protractor`` is just a static generated image in a new canvas-memory<br />This image is only generated once, and a copy of its bitmap is translated & rotated onto the visible canvas.<br />That is the reason for the ''high-speed dragging and rotating``.<br />I've limited its size to xsize &times; ysize e.g. the same size as the visual canvas...
3845
         @ when using command ''zoom``, pay <b>attention</b> to the size and symmetry of your canvas<br>...to avoid a partial image, locate the start position near the center of the visual canvas<br>technical: the actual ''protractor`` is just a static generated image in a new canvas-memory<br>This image is only generated once, and a copy of its bitmap is translated & rotated onto the visible canvas.<br>That is the reason for the ''high-speed dragging and rotating``.<br>I've limited its size to xsize &times; ysize e.g. the same size as the visual canvas...
3846
         @ only one protractor allowed (for the time being)
3846
         @ only one protractor allowed (for the time being)
3847
         @ usage: first left click on the protractor will activate dragging;<br />a second left click will activate rotating (just move mouse around)<br />a third click will freeze this position and the x/y-coordinate and angle in radians will be stored in reply(3)<br />a next click will restart this sequence...
3847
         @ usage: first left click on the protractor will activate dragging;<br>a second left click will activate rotating (just move mouse around)<br>a third click will freeze this position and the x/y-coordinate and angle in radians will be stored in reply(3)<br>a next click will restart this sequence...
3848
         @%protractor%size 400,400%xrange -5,10%yrange -5,10%hline 0,0,black%vline 0,0,black%fillcolor orange%opacity 255,40%protractor 2,-2,6,0,-1,1,1%mouse red,22
3848
         @%protractor%size 400,400%xrange -5,10%yrange -5,10%hline 0,0,black%vline 0,0,black%fillcolor orange%opacity 255,40%protractor 2,-2,6,0,-1,1,1%mouse red,22
3849
        */
3849
        */
3850
            for( i = 0;i < 6; i++ ){
3850
            for( i = 0;i < 6; i++ ){
3851
                switch(i){
3851
                switch(i){
3852
                    case 0: double_data[0] = get_real(infile,0);break; /* x-center */
3852
                    case 0: double_data[0] = get_real(infile,0);break; /* x-center */
Line 3921... Line 3921...
3921
        case PIECHART:
3921
        case PIECHART:
3922
        /*
3922
        /*
3923
        @ piechart xc,yc,radius,'data+colorlist'
3923
        @ piechart xc,yc,radius,'data+colorlist'
3924
        @ (xc: yc) center of circle diagram in xrange/yrange
3924
        @ (xc: yc) center of circle diagram in xrange/yrange
3925
        @ radius in pixels
3925
        @ radius in pixels
3926
        @ data+color list: a colon separated list of raw data and corresponding colours<br />canvasdraw will not check validity of colornames...<br />in case of trouble look into javascript debugging of your browser
3926
        @ data+color list: a colon separated list of raw data and corresponding colours<br>canvasdraw will not check validity of colornames...<br>in case of trouble look into javascript debugging of your browser
3927
        @ example data+colorlist: 32:red:65:green:23:black:43:orange:43:yellow:14:white
3927
        @ example data+colorlist: 32:red:65:green:23:black:43:orange:43:yellow:14:white
3928
        @ the number of colors must match the number of data.
3928
        @ the number of colors must match the number of data.
3929
        @ if defined <a href='#fillpattern'>fillpattern some_pattern</a> then the pie pieces will be filled with the respective color and a fill pattern...<br />the pattern is cycled from the 4 pattern primitives: grid,hatch,diamond,dot,grid,hatch,diamond,dot,...
3929
        @ if defined <a href='#fillpattern'>fillpattern some_pattern</a> then the pie pieces will be filled with the respective color and a fill pattern...<br>the pattern is cycled from the 4 pattern primitives: grid,hatch,diamond,dot,grid,hatch,diamond,dot,...
3930
        @ use command <a href='#opacity'>opacity</a> to adjust fill_opacity of colours
3930
        @ use command <a href='#opacity'>opacity</a> to adjust fill_opacity of colours
3931
        @ use command <a href='#legend'>legend</a> to automatically create a legend using the same colours as pie segments; unicode allowed in legend; expect javascript trouble if the amount of ''pie-slices``, ''pie-colors``, ''pie-legend-titles`` do not match, a javascript console is your best friend...<br />use command ''fontfamily`` to set the font of the legend.
3931
        @ use command <a href='#legend'>legend</a> to automatically create a legend using the same colours as pie segments; unicode allowed in legend; expect javascript trouble if the amount of ''pie-slices``, ''pie-colors``, ''pie-legend-titles`` do not match, a javascript console is your best friend...<br>use command ''fontfamily`` to set the font of the legend.
3932
        @ use command <a href='centered'>centered</a> to place <a href='#legend'>legend</a> text inside the piechart. The text is using the same color as the pie segment: use (fill) opacity to enhance visibility.
3932
        @ use command <a href='centered'>centered</a> to place <a href='#legend'>legend</a> text inside the piechart. The text is using the same color as the pie segment: use (fill) opacity to enhance visibility.
3933
        @%piechart_1%size 300,200%xrange -10,10%yrange -10,10%legend cars:motorcycles:bicycles:trikes%opacity 255,120%piechart -5,0,75,22:red:8:blue:63:green:7:purple%
3933
        @%piechart_1%size 300,200%xrange -10,10%yrange -10,10%legend cars:motorcycles:bicycles:trikes%opacity 255,120%piechart -5,0,75,22:red:8:blue:63:green:7:purple%
3934
        @%piechart_2%size 200,200%xrange -10,10%yrange -10,10%fontfamily 16px Arial%centered%legend cars:motorcycles:bicycles:trikes%opacity 255,60%piechart 0,0,100,22:red:8:blue:63:green:7:purple
3934
        @%piechart_2%size 200,200%xrange -10,10%yrange -10,10%fontfamily 16px Arial%centered%legend cars:motorcycles:bicycles:trikes%opacity 255,60%piechart 0,0,100,22:red:8:blue:63:green:7:purple
3935
        */
3935
        */
3936
            js_function[DRAW_PIECHART] = 1;
3936
            js_function[DRAW_PIECHART] = 1;
Line 4115... Line 4115...
4115
        @ replyformat number
4115
        @ replyformat number
4116
        @ use number=-1 to deactivate the js-functions read_canvas() and read_dragdrop()
4116
        @ use number=-1 to deactivate the js-functions read_canvas() and read_dragdrop()
4117
        @ default values should be fine !
4117
        @ default values should be fine !
4118
        @ use command <code>precision [0,1,10,100,1000,10000...]</code> before command ''replyformat`` to set the desired number of decimals in the student reply / drawing
4118
        @ use command <code>precision [0,1,10,100,1000,10000...]</code> before command ''replyformat`` to set the desired number of decimals in the student reply / drawing
4119
        @ the last value for ''precision int`` will be used to calculate the reply coordinates, if needed (read_canvas();)
4119
        @ the last value for ''precision int`` will be used to calculate the reply coordinates, if needed (read_canvas();)
4120
        @ choose<ul><li>replyformat 1: <code>x1,x2,x3,x4....x_n<br />y1,y2,y3,y4....y_n</code> x/y in pixels</li><li>replyformat 2: <code> x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n</code> x/y in xrange / yrange coordinate system</li><li>replyformat 3: <code> x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n</code> x/y in pixels, r in pixels</li><li>replyformat 4: <code> x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n</code> x/y in xrange / yrange coordinate system, r in pixels</li><li>replyformat 5: <code> Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br />  Cy1,Cy2,Cy3,Cy4....Cy_n<br />  ....<br />  Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n</code> x/y in pixels</li><li>replyformat 6: <code> Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n</code> x/y in xrange / yrange coordinate system</li><li>replyformat 7: <code> x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n</code> x/y in pixels</li><li>replyformat 8: <code> x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n</code> x/y in xrange / yrange coordinate system</li><li>replyformat 9: <code> x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n</code> x/y in pixels</li><li>replyformat 10: <code> x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n</code> x/y in xrange / yrange coordinate system</li><li>replyformat 11: <code> Ax1,Ay1,Ax2,Ay2<br />Bx1,By1,Bx2,By2<br /> Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2</code> x/y in xrange / yrange coordinate system</li><li>replyformat 12: <code> Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br />Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2</code> x/y in pixels</li><li>replyformat 13: <code> Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2</code> x/y in xrange / yrange coordinate system</li><li>replyformat 14: <code> Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2</code> x/y in pixels</li><li>replyformat 15: reply from inputfields,textareas <code>reply1,reply2,reply3,...,reply_n</code></li><li>replyformat 16: mathml input fields</li><li>replyformat 17: read ''userdraw text,color`` only <code>x1,y1,text1 \\n x2,y2,text2...\\n...x_n,y_n,text_n </code> x/y-values are in xrange/yrange</li><li>replyformat 18: read_canvas() will read all interactive clocks in <code>H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</code></li><li>replyformat 19: read_canvas() will return the object number of marked / clicked object (clock), analogue to (shape library) onclick command</li><li>replyformat 20: read_canvas() will reply "object_number:x:y" of external images: object_number of the first draggable external image in the fly-script starts with 0, e.g. expect something like 0:-5:4,1:6:2,2:-2:-5, the first image position is (-5:4), the second image position is (6:2) and the third image position is (-2:-5)         <li>replyformat 21: <code> (x1:y1) (x2:y2) ... (x_n:y_n)</code> verbatim coordinate return</li><li>replyformat 22: returns an array .... <code>reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n</code> x/y in xrange / yrange coordinate system</li><li>replyformat 23: can only be used for drawtype ''polyline``. A typical click sequence in drawtype polyline is x1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23 gives <code>x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn</code>; multiple occurences will be filtered out. The reply will be in x-y-range (xreply \\n yreply)</li><li>replyformat 24: read all inputfield values: even those set ''readonly``</li><li>replyformat 25: <code> angle1,angle2;...;angle_n</code> will return the radius (one or many) of the user drawn circle segment in degrees</li><li>replyformat 26: <code> rad1,rad2,...rad_n</code> will return the radius (one or many) of the user drawn circle segment in radians</li><li>replyformat 27: return (only) userdraw inputfields <code>x1,y1,text1<br /> x2,y2,text2...<br />...x_n,y_n,textn</code></li><li>replyformat 28: <code> x1,y1,r1,x2,y2,r2...x_n,y_n,r_n</code> x / y / r in xrange / yrange coordinate system: may be used to reinput into command <code>circles color,x1,y1,r1,x2,y2,r2...x_n,y_n,r_n</code> will not return anything else (e.g. no inputfields, text etc)</li><li>replyformat 34: a special for OEF and dragging external images -included via commands <a href='#copy'>copy</a> or <a href='#copyresized'>copyresized</a> there will be an extra function <code>read_canvas_images()</code> for reading the coordinates of the images.<br />for now this is a unique function, e.g. there is no ''canvas id`` linked to it. (TO DO !!! 18/5/2019)</li></ul>
4120
        @ choose<ul><li>replyformat 1: <code>x1,x2,x3,x4....x_n<br>y1,y2,y3,y4....y_n</code> x/y in pixels</li><li>replyformat 2: <code> x1,x2,x3,x4....x_n<br> y1,y2,y3,y4....y_n</code> x/y in xrange / yrange coordinate system</li><li>replyformat 3: <code> x1,x2,x3,x4....x_n<br> y1,y2,y3,y4....y_n<br> r1,r2,r3,r4....r_n</code> x/y in pixels, r in pixels</li><li>replyformat 4: <code> x1,x2,x3,x4....x_n<br> y1,y2,y3,y4....y_n<br> r1,r2,r3,r4....r_n</code> x/y in xrange / yrange coordinate system, r in pixels</li><li>replyformat 5: <code> Ax1,Ax2,Ax3,Ax4....Ax_n<br> Ay1,Ay2,Ay3,Ay4....Ay_n<br> Bx1,Bx2,Bx3,Bx4....Bx_n<br> By1,By2,By3,By4....By_n<br> Cx1,Cx2,Cx3,Cx4....Cx_n<br>  Cy1,Cy2,Cy3,Cy4....Cy_n<br>  ....<br>  Zx1,Zx2,Zx3,Zx4....Zx_n<br> Zy1,Zy2,Zy3,Zy4....Zy_n</code> x/y in pixels</li><li>replyformat 6: <code> Ax1,Ax2,Ax3,Ax4....Ax_n<br> Ay1,Ay2,Ay3,Ay4....Ay_n<br> Bx1,Bx2,Bx3,Bx4....Bx_n<br> By1,By2,By3,By4....By_n<br> Cx1,Cx2,Cx3,Cx4....Cx_n<br> Cy1,Cy2,Cy3,Cy4....Cy_n<br> ....<br> Zx1,Zx2,Zx3,Zx4....Zx_n<br> Zy1,Zy2,Zy3,Zy4....Zy_n</code> x/y in xrange / yrange coordinate system</li><li>replyformat 7: <code> x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n</code> x/y in pixels</li><li>replyformat 8: <code> x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n</code> x/y in xrange / yrange coordinate system</li><li>replyformat 9: <code> x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n</code> x/y in pixels</li><li>replyformat 10: <code> x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n</code> x/y in xrange / yrange coordinate system</li><li>replyformat 11: <code> Ax1,Ay1,Ax2,Ay2<br>Bx1,By1,Bx2,By2<br> Cx1,Cy1,Cx2,Cy2<br> Dx1,Dy1,Dx2,Dy2<br> ......<br> Zx1,Zy1,Zx2,Zy2</code> x/y in xrange / yrange coordinate system</li><li>replyformat 12: <code> Ax1,Ay1,Ax2,Ay2<br> Bx1,By1,Bx2,By2<br>Cx1,Cy1,Cx2,Cy2<br> Dx1,Dy1,Dx2,Dy2<br> ......<br> Zx1,Zy1,Zx2,Zy2</code> x/y in pixels</li><li>replyformat 13: <code> Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2</code> x/y in xrange / yrange coordinate system</li><li>replyformat 14: <code> Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2</code> x/y in pixels</li><li>replyformat 15: reply from inputfields,textareas <code>reply1,reply2,reply3,...,reply_n</code></li><li>replyformat 16: mathml input fields</li><li>replyformat 17: read ''userdraw text,color`` only <code>x1,y1,text1 \\n x2,y2,text2...\\n...x_n,y_n,text_n </code> x/y-values are in xrange/yrange</li><li>replyformat 18: read_canvas() will read all interactive clocks in <code>H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</code></li><li>replyformat 19: read_canvas() will return the object number of marked / clicked object (clock), analogue to (shape library) onclick command</li><li>replyformat 20: read_canvas() will reply "object_number:x:y" of external images: object_number of the first draggable external image in the fly-script starts with 0, e.g. expect something like 0:-5:4,1:6:2,2:-2:-5, the first image position is (-5:4), the second image position is (6:2) and the third image position is (-2:-5)         <li>replyformat 21: <code> (x1:y1) (x2:y2) ... (x_n:y_n)</code> verbatim coordinate return</li><li>replyformat 22: returns an array .... <code>reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n</code> x/y in xrange / yrange coordinate system</li><li>replyformat 23: can only be used for drawtype ''polyline``. A typical click sequence in drawtype polyline is x1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23 gives <code>x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn</code>; multiple occurences will be filtered out. The reply will be in x-y-range (xreply \\n yreply)</li><li>replyformat 24: read all inputfield values: even those set ''readonly``</li><li>replyformat 25: <code> angle1,angle2;...;angle_n</code> will return the radius (one or many) of the user drawn circle segment in degrees</li><li>replyformat 26: <code> rad1,rad2,...rad_n</code> will return the radius (one or many) of the user drawn circle segment in radians</li><li>replyformat 27: return (only) userdraw inputfields <code>x1,y1,text1<br> x2,y2,text2...<br>...x_n,y_n,textn</code></li><li>replyformat 28: <code> x1,y1,r1,x2,y2,r2...x_n,y_n,r_n</code> x / y / r in xrange / yrange coordinate system: may be used to reinput into command <code>circles color,x1,y1,r1,x2,y2,r2...x_n,y_n,r_n</code> will not return anything else (e.g. no inputfields, text etc)</li><li>replyformat 34: a special for OEF and dragging external images -included via commands <a href='#copy'>copy</a> or <a href='#copyresized'>copyresized</a> there will be an extra function <code>read_canvas_images()</code> for reading the coordinates of the images.<br>for now this is a unique function, e.g. there is no ''canvas id`` linked to it. (TO DO !!! 18/5/2019)</li></ul>
4121
        @ special replyformat = 100 ; will access to the raw javascript object data...use: read_dragdrop([property,property,...])<br />for example  properies like 'clicked','text', 'angle' , 'x'
4121
        @ special replyformat = 100 ; will access to the raw javascript object data...use: read_dragdrop([property,property,...])<br>for example  properies like 'clicked','text', 'angle' , 'x'
4122
        */
4122
        */
4123
         reply_format = (int) get_real(infile,1);
4123
         reply_format = (int) get_real(infile,1);
4124
         reply_precision = precision;
4124
         reply_precision = precision;
4125
        break;
4125
        break;
4126
 
4126
 
Line 4209... Line 4209...
4209
        /*
4209
        /*
4210
        @ ruler x,y,x-width,y-height,mode
4210
        @ ruler x,y,x-width,y-height,mode
4211
        @ x,y are the initial location
4211
        @ x,y are the initial location
4212
        @ x-width, y-height are the ruler dimensions width &amp; height in xy-coordinate system
4212
        @ x-width, y-height are the ruler dimensions width &amp; height in xy-coordinate system
4213
        @ the ruler scale is by definition the x-scale, set by command ''xrange``. For example: a ruler x-width of 6 will have a scale ranging from 0 to 6
4213
        @ the ruler scale is by definition the x-scale, set by command ''xrange``. For example: a ruler x-width of 6 will have a scale ranging from 0 to 6
4214
        @ mode: use -1 to set the ruler interactive (eg mouse movement of ruler; drag &amp; rotate)<br />use mode = '0&deg; - 360&deg;' to set the ruler with a static angle of some value
4214
        @ mode: use -1 to set the ruler interactive (eg mouse movement of ruler; drag &amp; rotate)<br>use mode = '0&deg; - 360&deg;' to set the ruler with a static angle of some value
4215
        @ if combined with a protractor, use replyformat = 32
4215
        @ if combined with a protractor, use replyformat = 32
4216
        @ only one ruler allowed (for the time being)
4216
        @ only one ruler allowed (for the time being)
4217
        @ when using command ''zoom``, pay <b>attention</b> to the size and symmetry of your canvas to avoid a partial image, locate the start position near the center of the visual canvas; technical: the actual ''ruler`` is just a static generated image in a new canvas-memory. This image is only generated once, and a copy of its bitmap is translated & rotated onto the visible canvas. That is the reason for the ''high-speed dragging and rotating``. I have limited its size to xsize &times; ysize e.g. the same size as the visual canvas...
4217
        @ when using command ''zoom``, pay <b>attention</b> to the size and symmetry of your canvas to avoid a partial image, locate the start position near the center of the visual canvas; technical: the actual ''ruler`` is just a static generated image in a new canvas-memory. This image is only generated once, and a copy of its bitmap is translated & rotated onto the visible canvas. That is the reason for the ''high-speed dragging and rotating``. I have limited its size to xsize &times; ysize e.g. the same size as the visual canvas...
4218
        @ usage: first left click on the ruler will activate dragging; a second left click will activate rotating (just move mouse around), a third click will freeze this position and the x/y-coordinate and angle in radians will be stored in reply(3), a next click will restart this sequence...
4218
        @ usage: first left click on the ruler will activate dragging; a second left click will activate rotating (just move mouse around), a third click will freeze this position and the x/y-coordinate and angle in radians will be stored in reply(3), a next click will restart this sequence...
4219
        @%ruler_interactive%size 800,400%xrange -10,10%yrange -10,10%strokecolor blue%opacity 200,50%filled%fillcolor lightgrey%ruler -9,0,10,2,-1%display degree,blue,22
4219
        @%ruler_interactive%size 800,400%xrange -10,10%yrange -10,10%strokecolor blue%opacity 200,50%filled%fillcolor lightgrey%ruler -9,0,10,2,-1%display degree,blue,22
Line 4258... Line 4258...
4258
        /*
4258
        /*
4259
         @ rotate rotation_angle
4259
         @ rotate rotation_angle
4260
         @ angle in degrees
4260
         @ angle in degrees
4261
         @ (only) the next object will be rotated is given angle
4261
         @ (only) the next object will be rotated is given angle
4262
         @ positive values rotate counter clockwise
4262
         @ positive values rotate counter clockwise
4263
         @ attention: all objects will be rotated around their first point...<br /><code>rotate 45<br />triangle 1,1,5,1,3,4,red</code><br />will rotate 45 degrees around point (1:1)
4263
         @ attention: all objects will be rotated around their first point...<br><code>rotate 45<br>triangle 1,1,5,1,3,4,red</code><br>will rotate 45 degrees around point (1:1)
4264
         @ if another rotation center is needed, use command <a href="#rotationcenter">rotationcenter xc,yc</a>.<br />to reset this rotationcenter, use keyword <a href="#killrotate">killrotate</a>
4264
         @ if another rotation center is needed, use command <a href="#rotationcenter">rotationcenter xc,yc</a>.<br>to reset this rotationcenter, use keyword <a href="#killrotate">killrotate</a>
4265
         @ attention: rotate will mess up the interactivity of the rotated object <br />e.g. if combined with command <a href="#drag">drag xy</a> or keyword <a href="#onclick">onclick</a>: the mouse recognises the original -unrotated- coordinates of the object
4265
         @ attention: rotate will mess up the interactivity of the rotated object <br>e.g. if combined with command <a href="#drag">drag xy</a> or keyword <a href="#onclick">onclick</a>: the mouse recognises the original -unrotated- coordinates of the object
4266
         @%rotate_1%size 400,400%xrange -10,10%yrange -10,10%fpoly yellow,0,0,4,3,2,5%rotate 45%fpoly violet,0,0,4,3,2,5%killrotate%rotate 90%fpoly violet,0,0,4,3,2,5%
4266
         @%rotate_1%size 400,400%xrange -10,10%yrange -10,10%fpoly yellow,0,0,4,3,2,5%rotate 45%fpoly violet,0,0,4,3,2,5%killrotate%rotate 90%fpoly violet,0,0,4,3,2,5%
4267
        */
4267
        */
4268
            use_rotate = TRUE;
4268
            use_rotate = TRUE;
4269
            angle = -1*(get_real(infile,1));/* -1: to be compatible with Flydraw... */
4269
            angle = -1*(get_real(infile,1));/* -1: to be compatible with Flydraw... */
4270
            break;
4270
            break;
Line 4295... Line 4295...
4295
        case SIZE:
4295
        case SIZE:
4296
            /*
4296
            /*
4297
            @ size width,height
4297
            @ size width,height
4298
            @ set canvas size in pixels
4298
            @ set canvas size in pixels
4299
            @ mandatory first command (can only be preceded by keyword <a href="#popup">popup</a>)
4299
            @ mandatory first command (can only be preceded by keyword <a href="#popup">popup</a>)
4300
            @ if xrange and/or yrange is not given the range will be set to pixels:<br />xrange 0,xsize yrange 0,ysize<br />note: lower left corner is origin (0:0) !!! this in contrast to flydraw
4300
            @ if xrange and/or yrange is not given the range will be set to pixels:<br>xrange 0,xsize yrange 0,ysize<br>note: lower left corner is origin (0:0) !!! this in contrast to flydraw
4301
            */
4301
            */
4302
            found_size_command = 1;
4302
            found_size_command = 1;
4303
            /* using fabs: however "xsize == int": so "xsize = abs( (int) get_real(infile,0))" would be the idea... */
4303
            /* using fabs: however "xsize == int": so "xsize = abs( (int) get_real(infile,0))" would be the idea... */
4304
            xsize = (int)(fabs(round(get_real(infile,0)))); /* just to be sure that sizes > 0 */
4304
            xsize = (int)(fabs(round(get_real(infile,0)))); /* just to be sure that sizes > 0 */
4305
            ysize = (int)(fabs(round(get_real(infile,1))));
4305
            ysize = (int)(fabs(round(get_real(infile,1))));
Line 4517... Line 4517...
4517
        /*
4517
        /*
4518
        @ slider start_value,end_value,width px,height px,type,label
4518
        @ slider start_value,end_value,width px,height px,type,label
4519
        @ type may be: ''x,y,angle``
4519
        @ type may be: ''x,y,angle``
4520
        @ if a slider value display is desired, use for argument ''type``: ''x display``, ''y display``, ''angle radian``, ''angle degree``
4520
        @ if a slider value display is desired, use for argument ''type``: ''x display``, ''y display``, ''angle radian``, ''angle degree``
4521
        @ is the slider is used for animation, add keyword ''anim`` or ''animate`` to ''type``; for now only one animated slider may be used...
4521
        @ is the slider is used for animation, add keyword ''anim`` or ''animate`` to ''type``; for now only one animated slider may be used...
4522
        @ default behaviour is: click on an object to use its slider(s)<br/>to use sliders without clicking on an object, use for ''type`` keyword ''active``<br />eg: <code>slider -2*pi,2*pi,300,30,angle degree active,Rotate</code>
4522
        @ default behaviour is: click on an object to use its slider(s)<br/>to use sliders without clicking on an object, use for ''type`` keyword ''active``<br>eg: <code>slider -2*pi,2*pi,300,30,angle degree active,Rotate</code>
4523
        @ if a unit (or something like that...) for x/y-value display is needed, use commands ''xunit`` and / or ''yunit``
4523
        @ if a unit (or something like that...) for x/y-value display is needed, use commands ''xunit`` and / or ''yunit``
4524
        @ if the translation should be performed using a function, use for type: ''x function``, ''y function``<br />use commands ''sliderfunction_x`` and/or ''sliderfunction_y`` before the slider command to define the functions. Example:<code>sliderfunction_x x^2<br />sliderfunction_y y^2<br />slider -5,5,100,100,xy function,Some_Text<br />...some stuff to slide<br />killslider<br />sliderfunction_x x^2-2<br />slider -15,15,100,10,x function,Some_Other_Text<br />...more stuff to slide<br />killslider... etc</code>
4524
        @ if the translation should be performed using a function, use for type: ''x function``, ''y function``<br>use commands ''sliderfunction_x`` and/or ''sliderfunction_y`` before the slider command to define the functions. Example:<code>sliderfunction_x x^2<br>sliderfunction_y y^2<br>slider -5,5,100,100,xy function,Some_Text<br>...some stuff to slide<br>killslider<br>sliderfunction_x x^2-2<br>slider -15,15,100,10,x function,Some_Other_Text<br>...more stuff to slide<br>killslider... etc</code>
4525
        @ use command ''slider`` before draggable/clickable objects.
4525
        @ use command ''slider`` before draggable/clickable objects.
4526
        @ drag and drop may be combined with rotation slider<br />for example an arrow rotated by a slider may be placed anywhere (drag&drop)<br /><code>size 300,300<br />xrange -5,5<br />yrange -5,5<br />grid 1,1,grey<br />linewidth 3<br />drag xy<br />fillcolor orange<br />strokecolor blue<br />slider 0,2*pi,250,30,angle degrees,Rotate arrow<br />arrow 2,2,5,5,8,red</code><br />note: except a combination 'drag' and 'slider' for command 'latex, katex, mathml, html, obabel'
4526
        @ drag and drop may be combined with rotation slider<br>for example an arrow rotated by a slider may be placed anywhere (drag&drop)<br><code>size 300,300<br>xrange -5,5<br>yrange -5,5<br>grid 1,1,grey<br>linewidth 3<br>drag xy<br>fillcolor orange<br>strokecolor blue<br>slider 0,2*pi,250,30,angle degrees,Rotate arrow<br>arrow 2,2,5,5,8,red</code><br>note: except a combination 'drag' and 'slider' for command 'latex, katex, mathml, html, obabel'
4527
        @ no slider for a math function, these can be traced using command ''trace_jscurve some_function_in_x``
4527
        @ no slider for a math function, these can be traced using command ''trace_jscurve some_function_in_x``
4528
        @ a slider will affect all draggable objects after the ''slider`` command...<br />and can be used to group translate / rotate several objects...<br />until a next ''slider`` or keyword ''killslider``
4528
        @ a slider will affect all draggable objects after the ''slider`` command...<br>and can be used to group translate / rotate several objects...<br>until a next ''slider`` or keyword ''killslider``
4529
        @ amount of sliders is not limited.
4529
        @ amount of sliders is not limited.
4530
        @ a slider can not be set ''snaptogrid`` or other ''snapto*`` : you may always use 'drag xy' in combination with the slider objects
4530
        @ a slider can not be set ''snaptogrid`` or other ''snapto*`` : you may always use 'drag xy' in combination with the slider objects
4531
        @ <code>javascript:read_dragdrop();</code> will return an array with ''object_number:slider_value``
4531
        @ <code>javascript:read_dragdrop();</code> will return an array with ''object_number:slider_value``
4532
        @ every draggable object may have its own slider (no limit in amount of sliders)
4532
        @ every draggable object may have its own slider (no limit in amount of sliders)
4533
        @ label: some slider text. <br />Note: on <a target='new' href='https://katex.org'>KaTeX</a> enabled wims, TeX produced by wims command ''mathmlmath``, is allowed.
4533
        @ label: some slider text. <br>Note: on <a target='new' href='https://katex.org'>KaTeX</a> enabled wims, TeX produced by wims command ''mathmlmath``, is allowed.
4534
        @ use fillcolor for slider controlkey
4534
        @ use fillcolor for slider controlkey
4535
        @ use strokecolor for slider bar
4535
        @ use strokecolor for slider bar
4536
        @ use fontfamily / fontcolor to set used fonts
4536
        @ use fontfamily / fontcolor to set used fonts
4537
        @ use opacity (only fill opacity will be used) to set transparency
4537
        @ use opacity (only fill opacity will be used) to set transparency
4538
        @ the slider canvas will be added to the ''tooltip div``: so incompatible with command tooltip ; setlimits etc
4538
        @ the slider canvas will be added to the ''tooltip div``: so incompatible with command tooltip ; setlimits etc
4539
        @%slider_x_y_angle%%size 300,300%xrange -5,5%yrange -5,5%grid 1,1,grey%linewidth 3%fillcolor orange%strokecolor blue%slider 0,2*pi,300,30,angle active degrees,Rotate arrow%arrow 0,0,4.5,0,8,red%killslider%opacity 200,100%slider -2,2,300,30,x active,move blue rectangle%frect -4,4,1,-1,blue%killslider%linewidth 2%slider -2,2,300,30,y,move green rectangle%frect -4,4,1,-1,green
4539
        @%slider_x_y_angle%%size 300,300%xrange -5,5%yrange -5,5%grid 1,1,grey%linewidth 3%fillcolor orange%strokecolor blue%slider 0,2*pi,300,30,angle active degrees,Rotate arrow%arrow 0,0,4.5,0,8,red%killslider%opacity 200,100%slider -2,2,300,30,x active,move blue rectangle%frect -4,4,1,-1,blue%killslider%linewidth 2%slider -2,2,300,30,y,move green rectangle%frect -4,4,1,-1,green
4540
        @%slider_click%%size 300,300%xrange -6,6%yrange -6,6%grid 1,1,grey%linewidth 2%slider 0,2*pi,300,28,angle degree, name%fillcolor lightgreen%#CLICK ON THE OBJECTS TO ACTIVATE%opacity 255,30%ftriangle 2,2,-2,2,0,0,red%ftriangle -2,2,-2,-2,0,0,blue%ftriangle -2,-2,2,-2,0,0,green%ftriangle 2,-2,2,2,0,0,orange%rotationcenter 0,0%frect -2,2,2,-2,black
4540
        @%slider_click%%size 300,300%xrange -6,6%yrange -6,6%grid 1,1,grey%linewidth 2%slider 0,2*pi,300,28,angle degree, name%fillcolor lightgreen%#CLICK ON THE OBJECTS TO ACTIVATE%opacity 255,30%ftriangle 2,2,-2,2,0,0,red%ftriangle -2,2,-2,-2,0,0,blue%ftriangle -2,-2,2,-2,0,0,green%ftriangle 2,-2,2,2,0,0,orange%rotationcenter 0,0%frect -2,2,2,-2,black
4541
        @%slider_active%%size 300,300%xrange -6,6%yrange -6,6%grid 1,1,grey%linewidth 1%slider 0,2*pi,300,28,angle degree active, name%fillcolor lightgreen%opacity 255,30%ftriangle 2,2,-2,2,0,0,red%ftriangle -2,2,-2,-2,0,0,blue%ftriangle -2,-2,2,-2,0,0,green%ftriangle 2,-2,2,2,0,0,orange%rotationcenter 0,0%frect -2,2,2,-2,black
4541
        @%slider_active%%size 300,300%xrange -6,6%yrange -6,6%grid 1,1,grey%linewidth 1%slider 0,2*pi,300,28,angle degree active, name%fillcolor lightgreen%opacity 255,30%ftriangle 2,2,-2,2,0,0,red%ftriangle -2,2,-2,-2,0,0,blue%ftriangle -2,-2,2,-2,0,0,green%ftriangle 2,-2,2,2,0,0,orange%rotationcenter 0,0%frect -2,2,2,-2,black
4542
        @%slider_animate%%size 300,300%xrange -6,6%yrange -6,6%grid 1,1,grey%linewidth 1%slider 0,2*pi,300,28,angle anim active, name%fillcolor lightgreen%opacity 255,30%ftriangle 2,2,-2,2,0,0,red%ftriangle -2,2,-2,-2,0,0,blue%ftriangle -2,-2,2,-2,0,0,green%ftriangle 2,-2,2,2,0,0,orange%rotationcenter 0,0%frect -2,2,2,-2,black
4542
        @%slider_animate%%size 300,300%xrange -6,6%yrange -6,6%grid 1,1,grey%linewidth 1%slider 0,2*pi,300,28,angle anim active, name%fillcolor lightgreen%opacity 255,30%ftriangle 2,2,-2,2,0,0,red%ftriangle -2,2,-2,-2,0,0,blue%ftriangle -2,-2,2,-2,0,0,green%ftriangle 2,-2,2,2,0,0,orange%rotationcenter 0,0%frect -2,2,2,-2,black
4543
        @%slider_html_image%%size 400,400%xrange -6,6%yrange -6,6%bgcolor white%grid 1,1,grey%linewidth 1%slider 0,2*pi,300,28,angle active degree,%centered%html 0,0,<img src="gifs/domains/sciences/flasks.svg" width="100px" height="100px" />
4543
        @%slider_html_image%%size 400,400%xrange -6,6%yrange -6,6%bgcolor white%grid 1,1,grey%linewidth 1%slider 0,2*pi,300,28,angle active degree,%centered%html 0,0,<img src="gifs/domains/sciences/flasks.svg" width="100px" height="100px">
4544
        */
4544
        */
4545
            js_function[INTERACTIVE] = 1;
4545
            js_function[INTERACTIVE] = 1;
4546
            int_data[2] = 0; /* --> show_display = 0; */
4546
            int_data[2] = 0; /* --> show_display = 0; */
4547
            for(i=0; i<6 ; i++){
4547
            for(i=0; i<6 ; i++){
4548
                switch(i){
4548
                switch(i){
Line 4600... Line 4600...
4600
 
4600
 
4601
        case SGRAPH:
4601
        case SGRAPH:
4602
        /*
4602
        /*
4603
         @ sgraph xstart,ystart,xmajor,ymajor,xminor,yminor,majorgrid_color,minorgrid_color
4603
         @ sgraph xstart,ystart,xmajor,ymajor,xminor,yminor,majorgrid_color,minorgrid_color
4604
         @ primitive implementation of a ''broken scale`` graph...
4604
         @ primitive implementation of a ''broken scale`` graph...
4605
         @ not very versatile: only usable in combination with userdraw <br />eg no other objects will obey this "coordinate system"<br />if you want to place an object into this coordinate system, be aware that 10% or 20% of xsize and/or ysize is ''lost``.<br />Use these "formulas" to recalculate the virtual coordinates:<br />factor=0.8 in case xstart != xmin (or ystart != ymin)<br />factor=0.9 in case xstart = xmin (or ystart = ymin)<br />px_x_point = ((factor*xsize)/(xmax - xstart))*(x_point - xmax)+xsize<br />x_recalculated = px*(xmax - xmin)/xsize + $xmin<br />px_y_point = -1*factor*y_point*ysize/(ymax - ystart) + ymax*factor*ysize/(ymax - ystart)<br />y_recalculated = ymax - py*(ymax - ymin)/ysize<br />
4605
         @ not very versatile: only usable in combination with userdraw <br>eg no other objects will obey this "coordinate system"<br>if you want to place an object into this coordinate system, be aware that 10% or 20% of xsize and/or ysize is ''lost``.<br>Use these "formulas" to recalculate the virtual coordinates:<br>factor=0.8 in case xstart != xmin (or ystart != ymin)<br>factor=0.9 in case xstart = xmin (or ystart = ymin)<br>px_x_point = ((factor*xsize)/(xmax - xstart))*(x_point - xmax)+xsize<br>x_recalculated = px*(xmax - xmin)/xsize + $xmin<br>px_y_point = -1*factor*y_point*ysize/(ymax - ystart) + ymax*factor*ysize/(ymax - ystart)<br>y_recalculated = ymax - py*(ymax - ymin)/ysize<br>
4606
         @%sgraph%size 400,400%xrange 0,10000%yrange 0,100%sgraph 9000,50,100,10,4,4,grey,blue%userinput_xy%linewidth 2%userdraw segments,red%precision 0%mouse blue,22
4606
         @%sgraph%size 400,400%xrange 0,10000%yrange 0,100%sgraph 9000,50,100,10,4,4,grey,blue%userinput_xy%linewidth 2%userdraw segments,red%precision 0%mouse blue,22
4607
        */
4607
        */
4608
            js_function[DRAW_SGRAPH] = 1;
4608
            js_function[DRAW_SGRAPH] = 1;
4609
            for(i = 0 ; i < 8 ;i++){
4609
            for(i = 0 ; i < 8 ;i++){
4610
                switch(i){
4610
                switch(i){
Line 4679... Line 4679...
4679
         @ keyword (no arguments required)
4679
         @ keyword (no arguments required)
4680
         @ a draggable object (use command ''drag x|y|xy``) will snap to the given grid when dragged (mouseup)
4680
         @ a draggable object (use command ''drag x|y|xy``) will snap to the given grid when dragged (mouseup)
4681
         @ in case of userdraw the drawn points will snap to xmajor / ymajor grid
4681
         @ in case of userdraw the drawn points will snap to xmajor / ymajor grid
4682
         @ if no grid is defined, points will snap to every integer xrange/yrange value. (eg snap_x=1,snap_y=1)
4682
         @ if no grid is defined, points will snap to every integer xrange/yrange value. (eg snap_x=1,snap_y=1)
4683
         @ if you do not want a visible grid, but you only want a ''snaptogrid`` with some value...define this grid with opacity 0.
4683
         @ if you do not want a visible grid, but you only want a ''snaptogrid`` with some value...define this grid with opacity 0.
4684
         @ if xminor / yminor is defined,(use keyword ''axis`` to activate the minor steps) the drawing will snap to xminor and yminor<br />use only even dividers in x/y-minor...for example <code>snaptogrid<br />axis<br />grid 2,1,grey,4,4,7,red</code> will snap on x=0, x=0.5, x=1, x=1.5 .... will snap on y=0, y=0.25 y=0.5 y=0.75 ...
4684
         @ if xminor / yminor is defined,(use keyword ''axis`` to activate the minor steps) the drawing will snap to xminor and yminor<br>use only even dividers in x/y-minor...for example <code>snaptogrid<br>axis<br>grid 2,1,grey,4,4,7,red</code> will snap on x=0, x=0.5, x=1, x=1.5 .... will snap on y=0, y=0.25 y=0.5 y=0.75 ...
4685
         @%snaptogrid_1%size 400,400%xrange -5,5%yrange -5,5%axis%axisnumbering%precision 1%grid 1,1,grey,2,2,6,grey%linewidth 2%snaptogrid%userdraw crosshairs,blue%mouse red,22
4685
         @%snaptogrid_1%size 400,400%xrange -5,5%yrange -5,5%axis%axisnumbering%precision 1%grid 1,1,grey,2,2,6,grey%linewidth 2%snaptogrid%userdraw crosshairs,blue%mouse red,22
4686
         @%snaptogrid_2%size 400,400%xrange -5,5%yrange -5,5%axis%axisnumbering%precision 1%grid 1,1,grey,4,1,6,grey%linewidth 1%snaptogrid%userdraw crosshairs,blue%mouse red,22
4686
         @%snaptogrid_2%size 400,400%xrange -5,5%yrange -5,5%axis%axisnumbering%precision 1%grid 1,1,grey,4,1,6,grey%linewidth 1%snaptogrid%userdraw crosshairs,blue%mouse red,22
4687
        */
4687
        */
4688
        use_snap = 1;
4688
        use_snap = 1;
4689
        break;
4689
        break;
Line 4735... Line 4735...
4735
 
4735
 
4736
        case STRING:
4736
        case STRING:
4737
        /*
4737
        /*
4738
         @ string color,x,y,the text string
4738
         @ string color,x,y,the text string
4739
         @ may be set ''onclick`` or ''drag xy``
4739
         @ may be set ''onclick`` or ''drag xy``
4740
         @ note: when set ''onclick``, use an extra command ''fontsize`` (default: fontsize=12) to adjust the size of the clicked text-string<br />note: a clicked text string will be hardcoded : fontsize+10 in the font family courier
4740
         @ note: when set ''onclick``, use an extra command ''fontsize`` (default: fontsize=12) to adjust the size of the clicked text-string<br>note: a clicked text string will be hardcoded : fontsize+10 in the font family courier
4741
         @ unicode supported: <code>string red,0,0,\\u2232</code><br/> See <a target='new' href='https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode'>https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode</a><br/> See <a  target='new' href='https://en.wikipedia.org/wiki/Greek_script_in_Unicode'>https://en.wikipedia.org/wiki/Greek_script_in_Unicode</a>
4741
         @ unicode supported: <code>string red,0,0,\\u2232</code><br/> See <a target='new' href='https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode'>https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode</a><br/> See <a  target='new' href='https://en.wikipedia.org/wiki/Greek_script_in_Unicode'>https://en.wikipedia.org/wiki/Greek_script_in_Unicode</a>
4742
         @ use a command like <code>fontfamily italic 24px Arial</code> to set fonts on browser that support font change
4742
         @ use a command like <code>fontfamily italic 24px Arial</code> to set fonts on browser that support font change
4743
         @ super / sub script is supported, using '<b>_</b>' and '<b>^</b>' <br />The font family for the sub/sup string will be Helvetica e.g. your font family settings will be ignored <br />to end the subscript/supscript, use an extra space...see example:
4743
         @ super / sub script is supported, using '<b>_</b>' and '<b>^</b>' <br>The font family for the sub/sup string will be Helvetica e.g. your font family settings will be ignored <br>to end the subscript/supscript, use an extra space...see example:
4744
         @%string_sup_sub%size 400,400%xrange -6,6%yrange -6,6%fontfamily 22px Arial%# use single space for separation in formula...%# use double space to create new word%string red,-5,0,H_3 O^+ + OH^\\u2212  \\u2192 2H_2 O%
4744
         @%string_sup_sub%size 400,400%xrange -6,6%yrange -6,6%fontfamily 22px Arial%# use single space for separation in formula...%# use double space to create new word%string red,-5,0,H_3 O^+ + OH^\\u2212  \\u2192 2H_2 O%
4745
         @%string%size 400,400%xrange -10,10%yrange -10,10%fontfamily 14px Arial%crosshair -3,-3,red%crosshair 3,3,blue%string red,-3,-3,Hello World%fontfamily Italic 18px Arial%string red,3,3,Hello World%fontfamily 22pt STIX%string black,-10,8,\\u03B1 \\u03B2 \\u03B3 \\u03B4 \\u03B5 \\u03B6 \\u03B7 \\u03B8 \\u03B9 \\u03BA \\u03BB \\u03BC \\u03BD \\u03BE \\u03BF
4745
         @%string%size 400,400%xrange -10,10%yrange -10,10%fontfamily 14px Arial%crosshair -3,-3,red%crosshair 3,3,blue%string red,-3,-3,Hello World%fontfamily Italic 18px Arial%string red,3,3,Hello World%fontfamily 22pt STIX%string black,-10,8,\\u03B1 \\u03B2 \\u03B3 \\u03B4 \\u03B5 \\u03B6 \\u03B7 \\u03B8 \\u03B9 \\u03BA \\u03BB \\u03BC \\u03BD \\u03BE \\u03BF
4746
        */
4746
        */
4747
            if( use_rotate == TRUE  ){js_function[JS_ROTATE_MOUSE] = 1; }
4747
            if( use_rotate == TRUE  ){js_function[JS_ROTATE_MOUSE] = 1; }
4748
            dragstuff[14] = 1;
4748
            dragstuff[14] = 1;
Line 4775... Line 4775...
4775
 
4775
 
4776
        case STRINGUP:
4776
        case STRINGUP:
4777
        /*
4777
        /*
4778
         @ stringup color,x,y,rotation_degrees,the text string
4778
         @ stringup color,x,y,rotation_degrees,the text string
4779
         @ may be set ''onclick`` or ''drag xy``
4779
         @ may be set ''onclick`` or ''drag xy``
4780
         @ note: when set ''onclick``, use an extra command ''fontsize`` (default: fontsize=12) to adjust the size of the clicked text-string<br />note: a clicked text string will be hardcoded : fontsize+10 in the font family courier
4780
         @ note: when set ''onclick``, use an extra command ''fontsize`` (default: fontsize=12) to adjust the size of the clicked text-string<br>note: a clicked text string will be hardcoded : fontsize+10 in the font family courier
4781
         @ unicode supported: <code>stringup red,0,0,45,\\u2232</code>
4781
         @ unicode supported: <code>stringup red,0,0,45,\\u2232</code>
4782
         @ use a command like <code>fontfamily bold 34px Courier</code> to set fonts on browser that support font change
4782
         @ use a command like <code>fontfamily bold 34px Courier</code> to set fonts on browser that support font change
4783
         @ you could use keyword <a href='#yoffset'>yoffset</a> to -sometimes- do a small correction of text placement under/above a point (e.g. text &amp; point have thesame coordinates)
4783
         @ you could use keyword <a href='#yoffset'>yoffset</a> to -sometimes- do a small correction of text placement under/above a point (e.g. text &amp; point have thesame coordinates)
4784
         @ note: no need to ''killrotate`` after ''stringup``<br /><code>onclick<br />rotate 45<br />string red,0,0,AAAAAA<br/>killrotate<br />string red,4,4,BBBBBB</code><br />is identical with:<br /><code>onclick<br />stringup red,0,0,45,AAAAAA<br />string red,4,4,BBBBBB</code>
4784
         @ note: no need to ''killrotate`` after ''stringup``<br><code>onclick<br>rotate 45<br>string red,0,0,AAAAAA<br/>killrotate<br>string red,4,4,BBBBBB</code><br>is identical with:<br><code>onclick<br>stringup red,0,0,45,AAAAAA<br>string red,4,4,BBBBBB</code>
4785
         @ super / sub script is supported, using '<b>_</b>' and '<b>^</b>' <br />to end the subscript/supscript, use an extra space...see example:
4785
         @ super / sub script is supported, using '<b>_</b>' and '<b>^</b>' <br>to end the subscript/supscript, use an extra space...see example:
4786
         @%stringup_sub_sup%size 400,400%xrange -6,6%yrange -6,6%fontfamily 22px Arial%# use single space for separation in formula...%# use double space to create new word%stringup red,-5,0,45,H_3 O^+ + OH^\\u2212  \\u2192 2H_2 O%
4786
         @%stringup_sub_sup%size 400,400%xrange -6,6%yrange -6,6%fontfamily 22px Arial%# use single space for separation in formula...%# use double space to create new word%stringup red,-5,0,45,H_3 O^+ + OH^\\u2212  \\u2192 2H_2 O%
4787
         @%stringup%size 400,400%xrange -10,10%yrange -10,10%fontsize 24%fontfamily 14px Arial%crosshair -3,0,red%crosshair 3,0,blue%onclick%stringup red,-3,0,-90,Hello World%drag xy%stringup red,-3,0,-45,Hello World%stringup red,-3,0,45,Hello World%stringup red,-3,0,90,Hello World%stringup blue,3,0,-90,Hello World%stringup blue,3,0,-45,Hello World%stringup blue,3,0,45,Hello World%stringup blue,3,0,90,Hello World
4787
         @%stringup%size 400,400%xrange -10,10%yrange -10,10%fontsize 24%fontfamily 14px Arial%crosshair -3,0,red%crosshair 3,0,blue%onclick%stringup red,-3,0,-90,Hello World%drag xy%stringup red,-3,0,-45,Hello World%stringup red,-3,0,45,Hello World%stringup red,-3,0,90,Hello World%stringup blue,3,0,-90,Hello World%stringup blue,3,0,-45,Hello World%stringup blue,3,0,45,Hello World%stringup blue,3,0,90,Hello World
4788
 
4788
 
4789
        */
4789
        */
4790
            /* html5 canvas rotation is only used for text objects  */
4790
            /* html5 canvas rotation is only used for text objects  */
Line 4844... Line 4844...
4844
        @ may be set ''onclick`` or ''drag xy``
4844
        @ may be set ''onclick`` or ''drag xy``
4845
        @ backwards compatible with flydraw
4845
        @ backwards compatible with flydraw
4846
        @ unicode supported: text red,0,0,huge,\\u2232
4846
        @ unicode supported: text red,0,0,huge,\\u2232
4847
        @ special: use '_' and '^' to imitate html sup/sub, like H_3O^+ + OH^\\u22i2  \\u2192 2H_2 O
4847
        @ special: use '_' and '^' to imitate html sup/sub, like H_3O^+ + OH^\\u22i2  \\u2192 2H_2 O
4848
        @ much better to use command <a href='#string'>string</a> combined with <a href='#fontfamily'>fontfamily</a> for a more fine grained control over html5 canvas text element
4848
        @ much better to use command <a href='#string'>string</a> combined with <a href='#fontfamily'>fontfamily</a> for a more fine grained control over html5 canvas text element
4849
        @ super / sub script is supported, using '<b>_</b>' and '<b>^</b>' <br />to end the subscript/supscript, use an extra space...see <a href='#string'>string </a> command
4849
        @ super / sub script is supported, using '<b>_</b>' and '<b>^</b>' <br>to end the subscript/supscript, use an extra space...see <a href='#string'>string </a> command
4850
        @ Avoid mixing old flydraw commands ''text``, ''textup`` with new canvasdraw commands ''string``, ''stringup``. If the fontfamily was set completely like <code>fontfamily italic 24px Arial</code>. In that case reset ''fontfamily`` to something lke ''fontfamily Arial`` before the old flydraw commands.
4850
        @ Avoid mixing old flydraw commands ''text``, ''textup`` with new canvasdraw commands ''string``, ''stringup``. If the fontfamily was set completely like <code>fontfamily italic 24px Arial</code>. In that case reset ''fontfamily`` to something lke ''fontfamily Arial`` before the old flydraw commands.
4851
        @%text%size 400,400%xrange -10,10%yrange -10,10%fontsize 14%onclick%drag xy%text green,-4,-4,small,Hello World%drag xy%text red,-4,-2,large,Hello World%drag xy%text blue,-4,0,huge,Hello World%drag xy%text green,-4,3,giant,Hello World%drag xy
4851
        @%text%size 400,400%xrange -10,10%yrange -10,10%fontsize 14%onclick%drag xy%text green,-4,-4,small,Hello World%drag xy%text red,-4,-2,large,Hello World%drag xy%text blue,-4,0,huge,Hello World%drag xy%text green,-4,3,giant,Hello World%drag xy
4852
        */
4852
        */
4853
            for(i = 0; i < 5 ;i++){
4853
            for(i = 0; i < 5 ;i++){
4854
                switch(i){
4854
                switch(i){
Line 5027... Line 5027...
5027
         @ will use a crosshair to trace the jsmath curve
5027
         @ will use a crosshair to trace the jsmath curve
5028
         @ two inputfields will display the current x/y-values (numerical evaluation by javascript)
5028
         @ two inputfields will display the current x/y-values (numerical evaluation by javascript)
5029
         @ default labels ''x`` and ''y``; use commands ''xlabel some_x_axis_name`` and ''ylabel some_y_axis_name`` to customize the labels for the input fields
5029
         @ default labels ''x`` and ''y``; use commands ''xlabel some_x_axis_name`` and ''ylabel some_y_axis_name`` to customize the labels for the input fields
5030
         @ use commands fontsize and css to format the fonts for labels and inputfields.
5030
         @ use commands fontsize and css to format the fonts for labels and inputfields.
5031
         @ use commands ''linewidth, strokecolor, crosshairsize`` to adjust the corsshair.
5031
         @ use commands ''linewidth, strokecolor, crosshairsize`` to adjust the corsshair.
5032
         @ the client browser will convert your math function to javascript math.<br />use parenthesis and rawmath: use 2*x instead of 2x etc etc no check is done on the validity of your function and/or syntax (use error console to debug any errors...)
5032
         @ the client browser will convert your math function to javascript math.<br>use parenthesis and rawmath: use 2*x instead of 2x etc etc no check is done on the validity of your function and/or syntax (use error console to debug any errors...)
5033
         @ be aware that the formulas of the plotted function(s) can be found in the page javascript source
5033
         @ be aware that the formulas of the plotted function(s) can be found in the page javascript source
5034
         @%trace_jscurve%size 400,400%xrange -10,10%yrange -10,10%precision 0%axis%axisnumbering%grid 2,2,grey,2,2,5,gray%recision 100%css color:blue;%linewidth 4%crosshairsize 8%trace_jscurve 5*sin(0.1*x^2)%linewidth 1%jsplot red,5*sin(0.1*x^2)%#only one curve can be traced
5034
         @%trace_jscurve%size 400,400%xrange -10,10%yrange -10,10%precision 0%axis%axisnumbering%grid 2,2,grey,2,2,5,gray%recision 100%css color:blue;%linewidth 4%crosshairsize 8%trace_jscurve 5*sin(0.1*x^2)%linewidth 1%jsplot red,5*sin(0.1*x^2)%#only one curve can be traced
5035
        */
5035
        */
5036
            js_function[INTERACTIVE] = 1;
5036
            js_function[INTERACTIVE] = 1;
5037
            js_function[DRAW_CROSSHAIRS] = 1;
5037
            js_function[DRAW_CROSSHAIRS] = 1;
Line 5146... Line 5146...
5146
        /*
5146
        /*
5147
         @ userboxplot
5147
         @ userboxplot
5148
         @ keyword, no arguments
5148
         @ keyword, no arguments
5149
         @ use before command <a href="#boxplot">boxplot x_or_y,box-height_or_box-width,x_or_y-position</a>
5149
         @ use before command <a href="#boxplot">boxplot x_or_y,box-height_or_box-width,x_or_y-position</a>
5150
         @ if set, the student will have to calculate "min,Q1,median,Q3,max" and feed these data into the ''draw_boxplot`` function
5150
         @ if set, the student will have to calculate "min,Q1,median,Q3,max" and feed these data into the ''draw_boxplot`` function
5151
         @ for example: put the canvas-script into a html element with id='boxplot' and set style='display:none'<br />define a variable called ''student_boxplot`` and fill it with the 5 student-data (from inputfields or something)<br /><code>var student_boxplot = new Array(5)<br />function show_boxplot(){<br />student_boxplot[0] = min;<br />student_boxplot[1] = Q1;<br />student_boxplot[2] = median;<br />student_boxplot[3] = Q3;<br />student_boxplot[4] = max;<br />document.getElementById('boxplot').style.display = "block";<br />draw_boxplot(12345,1,2.00,5.00,[0,0,0,0,0],4,"0,0,255",0.78,"255,165,0",0.60,1,0,1,1);<br />};</code><br />In the canvas-script the function draw_boxplot has the following arguments:<br />draw_boxplot=function(canvas_type,xy,hw,cxy,data,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype0,dashtype1)
5151
         @ for example: put the canvas-script into a html element with id='boxplot' and set style='display:none'<br>define a variable called ''student_boxplot`` and fill it with the 5 student-data (from inputfields or something)<br><code>var student_boxplot = new Array(5)<br>function show_boxplot(){<br>student_boxplot[0] = min;<br>student_boxplot[1] = Q1;<br>student_boxplot[2] = median;<br>student_boxplot[3] = Q3;<br>student_boxplot[4] = max;<br>document.getElementById('boxplot').style.display = "block";<br>draw_boxplot(12345,1,2.00,5.00,[0,0,0,0,0],4,"0,0,255",0.78,"255,165,0",0.60,1,0,1,1);<br>};</code><br>In the canvas-script the function draw_boxplot has the following arguments:<br>draw_boxplot=function(canvas_type,xy,hw,cxy,data,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype0,dashtype1)
5152
        */
5152
        */
5153
            js_function[DRAW_BOXPLOT] = 1;
5153
            js_function[DRAW_BOXPLOT] = 1;
5154
            fprintf(js_include_file,"var boxplot_source = 3;\n");
5154
            fprintf(js_include_file,"var boxplot_source = 3;\n");
5155
            js_function[DRAW_JSBOXPLOT] = 2;
5155
            js_function[DRAW_JSBOXPLOT] = 2;
5156
        break;
5156
        break;
Line 5174... Line 5174...
5174
        /*
5174
        /*
5175
        @ userdraw object_type,color
5175
        @ userdraw object_type,color
5176
        @ only a single object_type is allowed.
5176
        @ only a single object_type is allowed.
5177
        @ right mouse click will remove last drawn object.
5177
        @ right mouse click will remove last drawn object.
5178
        @ for multiple different 'userdraw' objects in an exercise, use command <a href="#multidraw">multidraw</a>
5178
        @ for multiple different 'userdraw' objects in an exercise, use command <a href="#multidraw">multidraw</a>
5179
        @ implemented object_type: <ul><li>point</li><li>points</li><li>crosshair</li><li>crosshairs</li><li>line</li><li>lines</li><li>vline</li><li>vlines</li><li>hline</li><li>hlines</li><li>demiline</li><li>demilines</li><li>segment</li><li>segments</li><li>polyline | brokenline</li><li>circle</li><li>circles</li><li>arrow</li><li>arrow2 (double arrow)</li><li>arrows</li><li>arrows2 (double arrows)</li><li>curvedarrow</li><li>curvedarrows</li><li>curvedarrow2</li><li>curvedarrows2</li><li>triangle</li><li>polygon</li><li>poly[3-9] (e.g poly3 ... poly7...poly9</li><li>rect</li><li>roundrect</li><li>rects</li><li>roundrects</li><li>freehandline | path</li><li>freehandlines | paths</li><li>clickfill: fill the clicked area with color<br />multiple areas may be selected <br />multiple colors may be provided using commands <a href='#colorpalette'>colorpalette color1,color2,color3,...</a> use <a href='#replyformat'>replyformat 10</a> for checking the user click color ... reply=x1:y1:color1,x2:y2:color2...<br/>attention: this will <b>not</b> work for pattern filling, because the pattern image is only generated once and after creation can not be changed !<br />the opacity of this image on a separate canvas is set to 0.01 and not 0 (!!)...in the ''fill algorithm`` the opacity of the matching pixels is set to 1</li><li>dotfill: fill the clicked area with a dot pattern; use command linewidth to change dot size</li><li>diamondfill: fill the clicked area with a diamond pattern</li><li>hatchfill: fill the clicked area with a hatch pattern</li><li>gridfill: fill the clicked area with a grid pattern</li><li>textfill: fill the clicked area with a repeating string<br />userdraw textfill,blue,some_text<br />use command <a href="#fontfamily">fontfamily</a> to adjust text style and size</li><li>''clickfill | pattern filling`` in general:<br />the clicks may be set <a href="#snaptogrid">snaptogrid</a><br />can be used together with command <a href="#floodfill">floodfill or fill</a><br /><b>always</b> use together with command <a href="#clearbutton">clearbutton some_text</a> for removal of all click_colored areas<br />the function read_canvas() will return the click coordinates in the sequence of the user clicks<br />use command <a href="#canvastype">canvastype</a> to fill another canvas (default should be fine: DRAG_CANVAS = 5)</li><li>text <br />an inputfield is provided, unicode allowed. The text is drawn a the mouse click, or if used with command ''userinput inputfield`` also at the given x/y-coordonates</li><li>arc</li><li>arcs</li><li>image<br/>only a single "image" of every supported type(*) may be added to canvas window from the surrounding html page.<br />the image should have an 'id' and an onclick handler.<br />(*) supported types are ''svg``,''bitmap``,''p-element``,''div-element`` and ''mathml/tex-code`` with ''\\mmlid{int}``.</li><li>images</li><li>input<br/>place a single inputfield on ''canvas`` <br />use commands 'css' for css styling: use command ''linewidth`` for adjusting the input field size (default 1)</li><li>inputs<br/>place multiple inputfield: placing inputfields on top of each other is not possible</li><li>function : identical to <a href="#userinput">userinput function</a></li></ul>
5179
        @ implemented object_type: <ul><li>point</li><li>points</li><li>crosshair</li><li>crosshairs</li><li>line</li><li>lines</li><li>vline</li><li>vlines</li><li>hline</li><li>hlines</li><li>demiline</li><li>demilines</li><li>segment</li><li>segments</li><li>polyline | brokenline</li><li>circle</li><li>circles</li><li>arrow</li><li>arrow2 (double arrow)</li><li>arrows</li><li>arrows2 (double arrows)</li><li>curvedarrow</li><li>curvedarrows</li><li>curvedarrow2</li><li>curvedarrows2</li><li>triangle</li><li>polygon</li><li>poly[3-9] (e.g poly3 ... poly7...poly9</li><li>rect</li><li>roundrect</li><li>rects</li><li>roundrects</li><li>freehandline | path</li><li>freehandlines | paths</li><li>clickfill: fill the clicked area with color<br>multiple areas may be selected <br>multiple colors may be provided using commands <a href='#colorpalette'>colorpalette color1,color2,color3,...</a> use <a href='#replyformat'>replyformat 10</a> for checking the user click color ... reply=x1:y1:color1,x2:y2:color2...<br/>attention: this will <b>not</b> work for pattern filling, because the pattern image is only generated once and after creation can not be changed !<br>the opacity of this image on a separate canvas is set to 0.01 and not 0 (!!)...in the ''fill algorithm`` the opacity of the matching pixels is set to 1</li><li>dotfill: fill the clicked area with a dot pattern; use command linewidth to change dot size</li><li>diamondfill: fill the clicked area with a diamond pattern</li><li>hatchfill: fill the clicked area with a hatch pattern</li><li>gridfill: fill the clicked area with a grid pattern</li><li>textfill: fill the clicked area with a repeating string<br>userdraw textfill,blue,some_text<br>use command <a href="#fontfamily">fontfamily</a> to adjust text style and size</li><li>''clickfill | pattern filling`` in general:<br>the clicks may be set <a href="#snaptogrid">snaptogrid</a><br>can be used together with command <a href="#floodfill">floodfill or fill</a><br><b>always</b> use together with command <a href="#clearbutton">clearbutton some_text</a> for removal of all click_colored areas<br>the function read_canvas() will return the click coordinates in the sequence of the user clicks<br>use command <a href="#canvastype">canvastype</a> to fill another canvas (default should be fine: DRAG_CANVAS = 5)</li><li>text <br>an inputfield is provided, unicode allowed. The text is drawn a the mouse click, or if used with command ''userinput inputfield`` also at the given x/y-coordonates</li><li>arc</li><li>arcs</li><li>image<br/>only a single "image" of every supported type(*) may be added to canvas window from the surrounding html page.<br>the image should have an 'id' and an onclick handler.<br>(*) supported types are ''svg``,''bitmap``,''p-element``,''div-element`` and ''mathml/tex-code`` with ''\\mmlid{int}``.</li><li>images</li><li>input<br/>place a single inputfield on ''canvas`` <br>use commands 'css' for css styling: use command ''linewidth`` for adjusting the input field size (default 1)</li><li>inputs<br/>place multiple inputfield: placing inputfields on top of each other is not possible</li><li>function : identical to <a href="#userinput">userinput function</a></li></ul>
5180
        @ note: mouselisteners are only active if ''&#36;status != done`` (eg only drawing in an active/non-finished exercise) <br /> to overrule use command/keyword ''status`` (no arguments required)
5180
        @ note: mouselisteners are only active if ''&#36;status != done`` (eg only drawing in an active/non-finished exercise) <br> to overrule use command/keyword ''status`` (no arguments required)
5181
        @ note: object_type text: Any string or multiple strings may be placed anywhere on the canvas.<br />Use command ''fontfamily`` to set font
5181
        @ note: object_type text: Any string or multiple strings may be placed anywhere on the canvas.<br>Use command ''fontfamily`` to set font
5182
        @ note: object_type polygone: Will be finished (the object is closed) when clicked on the first point of the polygone again.
5182
        @ note: object_type polygone: Will be finished (the object is closed) when clicked on the first point of the polygone again.
5183
        @ note: all objects will be removed -after a javascript confirm box- when clicked on an object point with middle or right mouse button (e.g. event.button != 1: all buttons but left)
5183
        @ note: all objects will be removed -after a javascript confirm box- when clicked on an object point with middle or right mouse button (e.g. event.button != 1: all buttons but left)
5184
        @ use a prefix <a href='#filled'>filled</a> or ''f`` to set fillable objects filled. (fcircles,filledcircles etc)<br/> in case of ''fillpattern`` do not use the ''f`` prefix !
5184
        @ use a prefix <a href='#filled'>filled</a> or ''f`` to set fillable objects filled. (fcircles,filledcircles etc)<br/> in case of ''fillpattern`` do not use the ''f`` prefix !
5185
        @ for non solid filling, use command <a href="#fillpattern">fillpattern grid,hatch,diamond,dot</a>
5185
        @ for non solid filling, use command <a href="#fillpattern">fillpattern grid,hatch,diamond,dot</a>
5186
        @ use <a href='#opacity'>opacity int,int</a> and <a href='#fillcolor'>fillcolor color</a> to trigger coloured filling of fillable objects
5186
        @ use <a href='#opacity'>opacity int,int</a> and <a href='#fillcolor'>fillcolor color</a> to trigger coloured filling of fillable objects
Line 5188... Line 5188...
5188
        @ use command ''replyformat int`` to control / adjust output formatting of javascript function read_canvas(); (the defaults should be fine...)
5188
        @ use command ''replyformat int`` to control / adjust output formatting of javascript function read_canvas(); (the defaults should be fine...)
5189
        @ may be combined with onclick or drag xy of other components of flyscript objects (although not very useful...)
5189
        @ may be combined with onclick or drag xy of other components of flyscript objects (although not very useful...)
5190
        @ may be combined with keyword <a href='#userinput_xy'>userinput_xy</a>
5190
        @ may be combined with keyword <a href='#userinput_xy'>userinput_xy</a>
5191
        @ may be combined width the <a href='#snaptogrid'>snaptogrid snaptopoints </a> etc, to simplify the checking of the student reply
5191
        @ may be combined width the <a href='#snaptogrid'>snaptogrid snaptopoints </a> etc, to simplify the checking of the student reply
5192
        @ the cursor may be appropriately styled using command <a href='cursor'>cursor</a>
5192
        @ the cursor may be appropriately styled using command <a href='cursor'>cursor</a>
5193
        @ note: when zooming / panning after a drawing, the drawing will NOT be zoomed / panned...this is a "design" flaw and not a feature <br />To avoid trouble do not use zooming / panning together width userdraw.!<br />use command <a href="#multidraw">multidraw</a> is this is a problem for you...
5193
        @ note: when zooming / panning after a drawing, the drawing will NOT be zoomed / panned...this is a "design" flaw and not a feature <br>To avoid trouble do not use zooming / panning together width userdraw.!<br>use command <a href="#multidraw">multidraw</a> is this is a problem for you...
5194
        @ note: the default replyformat for ''userdraw input(s),color`` used format x1;y1;text1 \n x2;y2;test2 \n x_n;y_n;text_n (e.g. it is not a comma separated array...use ''direct exec`` to test)
5194
        @ note: the default replyformat for ''userdraw input(s),color`` used format x1;y1;text1 \n x2;y2;test2 \n x_n;y_n;text_n (e.g. it is not a comma separated array...use ''direct exec`` to test)
5195
        @ note: a special case is ''userdraw image,boguscolor``. Images (bitmap or svg or div) present in the exercise page and the img/svg/div-tag with an unique 'id' and <code>onclick='javascript:place_image_on_canvas(this.id)'</code> can be placed onto the canvas.<br />The ''id`` and (x;y) coordinates will be returned using read_canvas();<br /> native MathML, MathJax or KaTeX typesetting may be included in div's.(experiments; wims_modules svn version only!)
5195
        @ note: a special case is ''userdraw image,boguscolor``. Images (bitmap or svg or div) present in the exercise page and the img/svg/div-tag with an unique 'id' and <code>onclick='javascript:place_image_on_canvas(this.id)'</code> can be placed onto the canvas.<br>The ''id`` and (x;y) coordinates will be returned using read_canvas();<br> native MathML, MathJax or KaTeX typesetting may be included in div's.(experiments; wims_modules svn version only!)
5196
        @ note: command <br /><code>userdraw function,color</code> is identical to acombination of <code>strokecolor color</code> and <code>userinput function</code><br />
5196
        @ note: command <br><code>userdraw function,color</code> is identical to acombination of <code>strokecolor color</code> and <code>userinput function</code><br>
5197
        @ note: commands :<br /><code>multicolors red,green,blue<br />multilabel f(x)=:g(x)=:h(x)=<br />userdraw functions3,color</code><br />is identical to commands :<br /><code>functionlabel f(x)=:p(x)=:w(x)=<br/>strokecolor red<br />userinput function <br />strokecolor green<br />userinput function <br />strokecolor blue<br />userinput function</code>
5197
        @ note: commands :<br><code>multicolors red,green,blue<br>multilabel f(x)=:g(x)=:h(x)=<br>userdraw functions3,color</code><br>is identical to commands :<br><code>functionlabel f(x)=:p(x)=:w(x)=<br/>strokecolor red<br>userinput function <br>strokecolor green<br>userinput function <br>strokecolor blue<br>userinput function</code>
5198
        @%userdraw_canvastype_a%size 400,400%xrange -10,10%yrange -10,10%linewidth 3%grid 2,2,grey%replyformat 10%colorpalette orange,yellow,red,green,lightgreen,blue,lightblue,cyan%canvastype 4%userdraw clickfill,blue%clearbutton REMOVE LAST RECTANGLE
5198
        @%userdraw_canvastype_a%size 400,400%xrange -10,10%yrange -10,10%linewidth 3%grid 2,2,grey%replyformat 10%colorpalette orange,yellow,red,green,lightgreen,blue,lightblue,cyan%canvastype 4%userdraw clickfill,blue%clearbutton REMOVE LAST RECTANGLE
5199
        @%userdraw_canvastype_b%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%canvastype 4%snaptogrid%replyformat 10%userdraw dotfill,blue%clearbutton REMOVE LAST RECTANGLE
5199
        @%userdraw_canvastype_b%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%canvastype 4%snaptogrid%replyformat 10%userdraw dotfill,blue%clearbutton REMOVE LAST RECTANGLE
5200
        @%userdraw_rect%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 2%fillcolor orange%opacity 200,50%userdraw rect,green
5200
        @%userdraw_rect%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 2%fillcolor orange%opacity 200,50%userdraw rect,green
5201
        @%userdraw_rects%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 2%fillcolor orange%opacity 200,50%userdraw rects,green
5201
        @%userdraw_rects%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 2%fillcolor orange%opacity 200,50%userdraw rects,green
5202
        @%userdraw_frect%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 2%fillcolor orange%opacity 200,50%userdraw frect,green
5202
        @%userdraw_frect%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 2%fillcolor orange%opacity 200,50%userdraw frect,green
Line 5322... Line 5322...
5322
         @ multiple ''userinput function`` commands may be used.
5322
         @ multiple ''userinput function`` commands may be used.
5323
         @ use command <code>functionlabel some_string</code> to define the inputfield text: default value "f(x)="
5323
         @ use command <code>functionlabel some_string</code> to define the inputfield text: default value "f(x)="
5324
         @ use command <code>strokecolor some_color</code> to adjust the plot / functionlabel color
5324
         @ use command <code>strokecolor some_color</code> to adjust the plot / functionlabel color
5325
         @ use command <code>css some_css</code> to adjust the inputfields
5325
         @ use command <code>css some_css</code> to adjust the inputfields
5326
         @ use command <code>fontsize int</code> to adjust the label fonts. (default 12px)
5326
         @ use command <code>fontsize int</code> to adjust the label fonts. (default 12px)
5327
         @ the user input for the function will be corrected by a simple ''rawmath`` implementation...<br />an error message will be shown if javascript can not interpret the user input
5327
         @ the user input for the function will be corrected by a simple ''rawmath`` implementation...<br>an error message will be shown if javascript can not interpret the user input
5328
         @%userinput_function%size 400,400%xrange -10,10%yrange -10,10%functionlabel your function g(x)=%axis%axisnumbering%xlabel x-axis%ylabel y-axis%grid 2,2,grey,3,3,5,grey%css color:blue;text-align:center%userinput function%# note: number of function inputs not limited
5328
         @%userinput_function%size 400,400%xrange -10,10%yrange -10,10%functionlabel your function g(x)=%axis%axisnumbering%xlabel x-axis%ylabel y-axis%grid 2,2,grey,3,3,5,grey%css color:blue;text-align:center%userinput function%# note: number of function inputs not limited
5329
         @%userinput_points%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%# adding 2 inputfields for x and y%userinput inputfield%userdraw points,blue
5329
         @%userinput_points%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%# adding 2 inputfields for x and y%userinput inputfield%userdraw points,blue
5330
         @%userinput_arrows%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%#adding 4 inputfields for (x1;y1)---(x2;y2)%userinput inputfieldd%userdraw arrows,blue
5330
         @%userinput_arrows%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%#adding 4 inputfields for (x1;y1)---(x2;y2)%userinput inputfieldd%userdraw arrows,blue
5331
         @%userinput_combined%size 400,400%xrange -10,10%yrange -10,10%functionlabel your function g(x)=%axis%axisnumbering%xlabel x-axis%ylabel y-axis%precision 0%grid 2,2,grey,3,3,5,grey%css color:blue;text-align:center%precision 1000%strokecolor red%opacity 255,255%userinput function%# note: number of function inputs not limited%userdraw line,blue
5331
         @%userinput_combined%size 400,400%xrange -10,10%yrange -10,10%functionlabel your function g(x)=%axis%axisnumbering%xlabel x-axis%ylabel y-axis%precision 0%grid 2,2,grey,3,3,5,grey%css color:blue;text-align:center%precision 1000%strokecolor red%opacity 255,255%userinput function%# note: number of function inputs not limited%userdraw line,blue
5332
        */
5332
        */
Line 5363... Line 5363...
5363
        case USERINPUT_XY:
5363
        case USERINPUT_XY:
5364
        /*
5364
        /*
5365
        @ userinput_xy
5365
        @ userinput_xy
5366
        @ keyword (no arguments required)
5366
        @ keyword (no arguments required)
5367
        @ to be used in combination with command "userdraw object_type,color"
5367
        @ to be used in combination with command "userdraw object_type,color"
5368
        @ if set two (or three) input fields are added to the document<br />(one for x-values, one for y-values and in case of drawing circle one for radius-values)
5368
        @ if set two (or three) input fields are added to the document<br>(one for x-values, one for y-values and in case of drawing circle one for radius-values)
5369
        @ the student may use this as correction for (x:y) on a drawing (or to draw without mouse, using just the coordinates)
5369
        @ the student may use this as correction for (x:y) on a drawing (or to draw without mouse, using just the coordinates)
5370
        @ math input is allowed (e.g something like: 1+3,2*6,1/3,sqrt(3), sin(pi/4),10^-2,log(2)...)<br />eval function is ''protected`` against code injection.
5370
        @ math input is allowed (e.g something like: 1+3,2*6,1/3,sqrt(3), sin(pi/4),10^-2,log(2)...)<br>eval function is ''protected`` against code injection.
5371
        @ can <b>not</b> be combined with command ''intooltip tiptext`` <br />note: the ''tooltip div element`` is used for placing inputfields
5371
        @ can <b>not</b> be combined with command ''intooltip tiptext`` <br>note: the ''tooltip div element`` is used for placing inputfields
5372
        @ user drawings will not zoom on zooming (or pan on panning)
5372
        @ user drawings will not zoom on zooming (or pan on panning)
5373
        @ use command ''css some_css`` to adjust the inputarea.
5373
        @ use command ''css some_css`` to adjust the inputarea.
5374
        @ use command ''fontsize int`` to adjust the text labels (if needed)
5374
        @ use command ''fontsize int`` to adjust the text labels (if needed)
5375
        @%userinput_xy%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 0%grid 2,2,grey,3,3,6,black%# provides inputfields for (x1:y1)---(x2:y2)%userinput_xy%linewidth 2%precision 1000%userdraw lines,blue
5375
        @%userinput_xy%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 0%grid 2,2,grey,3,3,6,black%# provides inputfields for (x1:y1)---(x2:y2)%userinput_xy%linewidth 2%precision 1000%userdraw lines,blue
5376
        */
5376
        */
Line 5385... Line 5385...
5385
        @ alternative: userinput
5385
        @ alternative: userinput
5386
        @ keyword (no arguments required)
5386
        @ keyword (no arguments required)
5387
        @ if set, a inputfield will be added to the page
5387
        @ if set, a inputfield will be added to the page
5388
        @ repeat keyword for more function input fields
5388
        @ repeat keyword for more function input fields
5389
        @ the userinput value will be plotted in the canvas
5389
        @ the userinput value will be plotted in the canvas
5390
        @ this value may be read with <code>read_canvas()</code>. <br />for do it yourself js-scripters: If this is the first inputfield in the script, its id is canvas_input0
5390
        @ this value may be read with <code>read_canvas()</code>. <br>for do it yourself js-scripters: If this is the first inputfield in the script, its id is canvas_input0
5391
        @ use before this command ''userinput_function``,<br />commands like ''css some_css``, ''xlabel some_description``, ''opacity int,int``, ''linewidth int``, ''dashed`` and ''dashtype int,int`` to modify
5391
        @ use before this command ''userinput_function``,<br>commands like ''css some_css``, ''xlabel some_description``, ''opacity int,int``, ''linewidth int``, ''dashed`` and ''dashtype int,int`` to modify
5392
        @ fontsize can be set using command ''fontsize int``
5392
        @ fontsize can be set using command ''fontsize int``
5393
        @ incompatible with command ''intooltip link_text_or_image``: it uses the tooltip div for adding the inputfield
5393
        @ incompatible with command ''intooltip link_text_or_image``: it uses the tooltip div for adding the inputfield
5394
        @%userinput_function%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%xlabel x-axis%ylabel y-axis%precision 0%grid 2,2,grey,2,2,5,grey%precision 1000%linewidth 2%# first inputfield%css color:blue;text-align:center;font-family:Italic;%strokecolor blue%functionlabel g(x)=:p(x)=:k(x)=%userinput function%# second inputfield%css color:green;text-align:center;font-family:Italic;%strokecolor green%userinput function%# third inputfield%css color:purple;text-align:center;font-family:Italic;%strokecolor purple%userinput function%# no limit in number of function inputfields
5394
        @%userinput_function%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%xlabel x-axis%ylabel y-axis%precision 0%grid 2,2,grey,2,2,5,grey%precision 1000%linewidth 2%# first inputfield%css color:blue;text-align:center;font-family:Italic;%strokecolor blue%functionlabel g(x)=:p(x)=:k(x)=%userinput function%# second inputfield%css color:green;text-align:center;font-family:Italic;%strokecolor green%userinput function%# third inputfield%css color:purple;text-align:center;font-family:Italic;%strokecolor purple%userinput function%# no limit in number of function inputfields
5395
        */
5395
        */
5396
            if( js_function[DRAW_JSFUNCTION] != 1 ){
5396
            if( js_function[DRAW_JSFUNCTION] != 1 ){
Line 5510... Line 5510...
5510
         @ alternative: xaxistext
5510
         @ alternative: xaxistext
5511
         @ usable for commands <a href="#numberline">numberline</a> and <a href="#grid">grid</a> or combinations thereof
5511
         @ usable for commands <a href="#numberline">numberline</a> and <a href="#grid">grid</a> or combinations thereof
5512
         @ use these x-axis num1...num_n values instead of default xmin...xmax
5512
         @ use these x-axis num1...num_n values instead of default xmin...xmax
5513
         @ in case of command ''grid``. there is no need to use keyword <a href="#axisnumbering">axisnumbering</a>
5513
         @ in case of command ''grid``. there is no need to use keyword <a href="#axisnumbering">axisnumbering</a>
5514
         @ use command <a href="#axis">axis</a> to have visual x/y-axis lines (see command <a href="#grid">grid</a>
5514
         @ use command <a href="#axis">axis</a> to have visual x/y-axis lines (see command <a href="#grid">grid</a>
5515
         @ use command ''fontcolor``, ''fontfamily`` to adjust font <br />defaults: black,12,Arial<br />note: command ''fontsize`` is not active for this command.(''fontsize`` can be used for the <a href="#legend">legend</a> in a <a href="#grid">grid</a>)
5515
         @ use command ''fontcolor``, ''fontfamily`` to adjust font <br>defaults: black,12,Arial<br>note: command ''fontsize`` is not active for this command.(''fontsize`` can be used for the <a href="#legend">legend</a> in a <a href="#grid">grid</a>)
5516
         @ a javascript error message will flag non-matching value:name pairs
5516
         @ a javascript error message will flag non-matching value:name pairs
5517
         @ if the ''x-axis words`` are too big and will overlap, a simple alternating offset will be applied
5517
         @ if the ''x-axis words`` are too big and will overlap, a simple alternating offset will be applied
5518
         @ to be used before command grid (see <a href="#grid">command grid</a>)
5518
         @ to be used before command grid (see <a href="#grid">command grid</a>)
5519
         @ ''xmajor`` steps should be synchronised with numbers eg. ''1`` in the next example <code>grid 1,100,grey,1,4,6,grey</code>
5519
         @ ''xmajor`` steps should be synchronised with numbers eg. ''1`` in the next example <code>grid 1,100,grey,1,4,6,grey</code>
5520
         @%xaxistext%size 800,200%xrange -1,13%yrange -5,10%axis%xaxistext 1:january:2:february:3:march:4:april:5:may:6:june:7:july:8:august:9:september:10:october:11:november:12:december%grid 1,4,grey,1,2,10,red
5520
         @%xaxistext%size 800,200%xrange -1,13%yrange -5,10%axis%xaxistext 1:january:2:february:3:march:4:april:5:may:6:june:7:july:8:august:9:september:10:october:11:november:12:december%grid 1,4,grey,1,2,10,red
Line 5531... Line 5531...
5531
         @ alternative: xaxistextup
5531
         @ alternative: xaxistextup
5532
         @ the text will be rotated 90&deg; up
5532
         @ the text will be rotated 90&deg; up
5533
         @ no need to use keyword <a href="#axisnumbering">axisnumbering</a>
5533
         @ no need to use keyword <a href="#axisnumbering">axisnumbering</a>
5534
         @ use command <a href="#axis">axis</a> to have visual x/y-axis lines (see command <a href="#grid">grid</a>
5534
         @ use command <a href="#axis">axis</a> to have visual x/y-axis lines (see command <a href="#grid">grid</a>
5535
         @ use these x-axis num1...num_n values instead of default xmin...xmax
5535
         @ use these x-axis num1...num_n values instead of default xmin...xmax
5536
         @ use command ''fontcolor``, <a href="#fontfamily">fontfamily</a> to adjust font <br />defaults: black,12,Arial<br />note: command ''fontsize`` is not active for this command.(''fontsize`` can be used for the <a href="#legend">legend</a> in a <a href="#grid">grid</a>)
5536
         @ use command ''fontcolor``, <a href="#fontfamily">fontfamily</a> to adjust font <br>defaults: black,12,Arial<br>note: command ''fontsize`` is not active for this command.(''fontsize`` can be used for the <a href="#legend">legend</a> in a <a href="#grid">grid</a>)
5537
         @ a javascript error message will flag non-matching value:name pairs
5537
         @ a javascript error message will flag non-matching value:name pairs
5538
         @ if the ''x-axis words`` are too big, they will overlap the graph<br /> (in this case the text will start from ysize upwards)
5538
         @ if the ''x-axis words`` are too big, they will overlap the graph<br> (in this case the text will start from ysize upwards)
5539
         @ to be used before command grid (see <a href="#grid">command grid</a>)
5539
         @ to be used before command grid (see <a href="#grid">command grid</a>)
5540
         @''xmajor`` steps should be synchronised with numbers eg. "1" in the next example <code>grid 1,100,grey,1,4,6,grey</code>
5540
         @''xmajor`` steps should be synchronised with numbers eg. "1" in the next example <code>grid 1,100,grey,1,4,6,grey</code>
5541
         @%xaxistextup%size 800,300%xrange -1,13%yrange -10,10%fontfamily Italic 18pt Courier%axis%xaxistextup 1:january:2:february:3:march:4:april:5:may:6:june:7:july:8:august:9:september:10:october:11:november:12:december%grid 1,4,grey,1,2,10,red
5541
         @%xaxistextup%size 800,300%xrange -1,13%yrange -10,10%fontfamily Italic 18pt Courier%axis%xaxistextup 1:january:2:february:3:march:4:april:5:may:6:june:7:july:8:august:9:september:10:october:11:november:12:december%grid 1,4,grey,1,2,10,red
5542
        */
5542
        */
5543
            use_axis_numbering++;
5543
            use_axis_numbering++;
Line 5610... Line 5610...
5610
         @ keyword (no arguments required)
5610
         @ keyword (no arguments required)
5611
         @ a draggable object (use command ''drag x|y|xy``) will snap to the given x-grid values when dragged (mouseup)
5611
         @ a draggable object (use command ''drag x|y|xy``) will snap to the given x-grid values when dragged (mouseup)
5612
         @ in case of userdraw the drawn points will snap to xmajor grid
5612
         @ in case of userdraw the drawn points will snap to xmajor grid
5613
         @ if no grid is defined, points will snap to every integer xrange value. (eg snap_x=1)
5613
         @ if no grid is defined, points will snap to every integer xrange value. (eg snap_x=1)
5614
         @ if you do not want a visible grid, but you only want a ''snaptogrid`` with some value...define this grid with opacity 0.
5614
         @ if you do not want a visible grid, but you only want a ''snaptogrid`` with some value...define this grid with opacity 0.
5615
         @ if xminor is defined (use keyword ''axis`` to activate xminor), the drawing will snap to xminor <br />use only even dividers in x-minor...for example<br /><code>xsnaptogrid<br />axis<br />grid 2,1,grey,4,4,7,red</code><br /> will snap on x=0, x=0.5, x=1, x=1.5 ....<br /> will snap on y=0, y=0.25 y=0.5 y=0.75 ...<br />
5615
         @ if xminor is defined (use keyword ''axis`` to activate xminor), the drawing will snap to xminor <br>use only even dividers in x-minor...for example<br><code>xsnaptogrid<br>axis<br>grid 2,1,grey,4,4,7,red</code><br> will snap on x=0, x=0.5, x=1, x=1.5 ....<br> will snap on y=0, y=0.25 y=0.5 y=0.75 ...<br>
5616
         @%xsnaptogrid_1%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 2%xsnaptogrid%userdraw segments,red%precision 1%display x,red,12
5616
         @%xsnaptogrid_1%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 2%xsnaptogrid%userdraw segments,red%precision 1%display x,red,12
5617
         @%xsnaptogrid_2%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 3%drag x%points red,0,0,0,0,0,0,0,0,0,0
5617
         @%xsnaptogrid_2%size 400,400%xrange -10,10%yrange -10,10%grid 1,1,grey%linewidth 3%drag x%points red,0,0,0,0,0,0,0,0,0,0
5618
 
5618
 
5619
        */
5619
        */
5620
        use_snap = 2;
5620
        use_snap = 2;
Line 5637... Line 5637...
5637
         @ xyoffset
5637
         @ xyoffset
5638
         @ keyword ; to place the text (x:y) to (x+dx:y+dy)... dx/dy are dependent on fontsize/fontfamily
5638
         @ keyword ; to place the text (x:y) to (x+dx:y+dy)... dx/dy are dependent on fontsize/fontfamily
5639
         @ may be used for points or other things requiring labels
5639
         @ may be used for points or other things requiring labels
5640
         @ use <a href="#fontfamily">fontfamily</a> for setting the font
5640
         @ use <a href="#fontfamily">fontfamily</a> for setting the font
5641
         @ only active for commands <a href="#text">text</a> and <a href="#string">string</a> (e.g. objects in the drag/drop/onclick-librariy
5641
         @ only active for commands <a href="#text">text</a> and <a href="#string">string</a> (e.g. objects in the drag/drop/onclick-librariy
5642
         @ in case of inputfields the inputfield will be centered x and y on its coordinates.<br />for example:<br />inputs 1,1,10,? <br />point 1,1,red <br /> the point will be completely invisible<br />note: keyword ''xyoffset`` will also provide centering if used with <a href='#userdraw'>input(s),color</a>
5642
         @ in case of inputfields the inputfield will be centered x and y on its coordinates.<br>for example:<br>inputs 1,1,10,? <br>point 1,1,red <br> the point will be completely invisible<br>note: keyword ''xyoffset`` will also provide centering if used with <a href='#userdraw'>input(s),color</a>
5643
         @%xyoffset%size 400,400%xrange -10,10%yrange -10,10%fontfamily 12pt Arial%string blue,-9,-9,no offset%point -9,-9,red%centered%string blue,-6,-6,centered%point -6,-6,red%xoffset%string blue,-3,-3,xoffset%point -3,-3,red%yoffset%string blue,0,0,yoffset%point 0,0,red%xyoffset%string blue,3,3,xyoffset%point 3,3,red%resetoffset%string blue,6,6,resetoffset%point 6,6,red
5643
         @%xyoffset%size 400,400%xrange -10,10%yrange -10,10%fontfamily 12pt Arial%string blue,-9,-9,no offset%point -9,-9,red%centered%string blue,-6,-6,centered%point -6,-6,red%xoffset%string blue,-3,-3,xoffset%point -3,-3,red%yoffset%string blue,0,0,yoffset%point 0,0,red%xyoffset%string blue,3,3,xyoffset%point 3,3,red%resetoffset%string blue,6,6,resetoffset%point 6,6,red
5644
        */
5644
        */
5645
         use_offset = 3;
5645
         use_offset = 3;
5646
         break;
5646
         break;
5647
 
5647
 
Line 5658... Line 5658...
5658
 
5658
 
5659
        case XLABEL:
5659
        case XLABEL:
5660
        /*
5660
        /*
5661
        @ xlabel some_string
5661
        @ xlabel some_string
5662
        @ will be used to create a label for the x-axis (label is in quadrant I)
5662
        @ will be used to create a label for the x-axis (label is in quadrant I)
5663
        @ can only be used together with command ''grid``<br />not depending on keywords ''axis`` and ''axisnumbering``
5663
        @ can only be used together with command ''grid``<br>not depending on keywords ''axis`` and ''axisnumbering``
5664
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)<br />use command ''fontsize`` to adjust.<br />(command ''fontfamily`` is not active for this command)
5664
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)<br>use command ''fontsize`` to adjust.<br>(command ''fontfamily`` is not active for this command)
5665
        @ use <a href="#ylabel">ylabel</a>
5665
        @ use <a href="#ylabel">ylabel</a>
5666
        @%xlabel%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%xlabel cm\\u00B2 %ylabel v\\u00B2 %precision 1%grid 2,2,grey,2,2,5,grey
5666
        @%xlabel%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%xlabel cm\\u00B2 %ylabel v\\u00B2 %precision 1%grid 2,2,grey,2,2,5,grey
5667
        */
5667
        */
5668
            temp = get_string(infile,1);
5668
            temp = get_string(infile,1);
5669
            fprintf(js_include_file,"var xaxislabel = \"%s\";",temp);
5669
            fprintf(js_include_file,"var xaxislabel = \"%s\";",temp);
Line 5688... Line 5688...
5688
         @ the opacity of major / minor grid lines is set by command <a href='#opacity'>opacity</a>
5688
         @ the opacity of major / minor grid lines is set by command <a href='#opacity'>opacity</a>
5689
         @ default logbase number = 10 ... when needed, set the logbase number with command ''xlogbase number``
5689
         @ default logbase number = 10 ... when needed, set the logbase number with command ''xlogbase number``
5690
         @ the x/y- axis numbering is triggered by keyword ''axisnumbering``<ul><li>use command ''precision`` before ''xlogscale`` command to set the precision (decimals) of the axis numbering</li><li>use commands ''xlabel some_text`` and/or ''ylabel some_text`` for text on axis: use command ''fontsize int`` to set the fontsize (default 12px)</li><li>use command ''fontfamily fnt_family_string`` to set the fonts for axis-numbering</li><li>use command ''fontcolor`` to set the colour</li></ul>
5690
         @ the x/y- axis numbering is triggered by keyword ''axisnumbering``<ul><li>use command ''precision`` before ''xlogscale`` command to set the precision (decimals) of the axis numbering</li><li>use commands ''xlabel some_text`` and/or ''ylabel some_text`` for text on axis: use command ''fontsize int`` to set the fontsize (default 12px)</li><li>use command ''fontfamily fnt_family_string`` to set the fonts for axis-numbering</li><li>use command ''fontcolor`` to set the colour</li></ul>
5691
         @ note: the complete canvas will be used for the ''log paper``
5691
         @ note: the complete canvas will be used for the ''log paper``
5692
         @ note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
5692
         @ note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
5693
         @ note: command ''mouse color,fontsize`` will show the real values in the logpaper.<br />\
5693
         @ note: command ''mouse color,fontsize`` will show the real values in the logpaper.<br>\
5694
         @ note: when using something like ''xrange 0.0001,0.01``...combined with commands <a href='#mouse'>mouse</a> and/or <a href='#userdraw'>userdraw</a>...<br /> make sure the <a href='#precision'>precision</a> is set accordingly
5694
         @ note: when using something like ''xrange 0.0001,0.01``...combined with commands <a href='#mouse'>mouse</a> and/or <a href='#userdraw'>userdraw</a>...<br> make sure the <a href='#precision'>precision</a> is set accordingly
5695
         @ note: in case of userdraw, the use of keyword <a href='#userinput_xy'>userinput_xy</a> may be handy !
5695
         @ note: in case of userdraw, the use of keyword <a href='#userinput_xy'>userinput_xy</a> may be handy !
5696
         @ <b>attention</b>: keyword ''snaptogrid`` may not lead to the desired result...
5696
         @ <b>attention</b>: keyword ''snaptogrid`` may not lead to the desired result...
5697
         @ <b>attention</b>: do not use command ''zoom``
5697
         @ <b>attention</b>: do not use command ''zoom``
5698
         @%xlogscale%size 400,400%xrange 10,50000%yrange -5,5%xlabel x-axis%ylabel y-axis%xlogscale 10,1,black,grey%display x,red,22
5698
         @%xlogscale%size 400,400%xrange 10,50000%yrange -5,5%xlabel x-axis%ylabel y-axis%xlogscale 10,1,black,grey%display x,red,22
5699
        */
5699
        */
Line 5725... Line 5725...
5725
         @ the opacity of major / minor grid lines is set by command ''opacity [0-255],[0-255]``
5725
         @ the opacity of major / minor grid lines is set by command ''opacity [0-255],[0-255]``
5726
         @ default logbase number = 10 ... when needed, set the logbase number with command ''xlogbase number`` and/or ''ylogbase number``
5726
         @ default logbase number = 10 ... when needed, set the logbase number with command ''xlogbase number`` and/or ''ylogbase number``
5727
         @ the x/y- axis numbering is triggered by keyword ''axisnumbering``<ul><li>use commands ''xlabel some_text`` and/or ''ylabel some_text`` for text on axis: use command ''fontsize int`` to set the fontsize (default 12px)</li><li>use command ''fontfamily fnt_family_string`` to set the fonts for axis-numbering</li><li>use command ''fontcolor`` to set the colour</li></ul>
5727
         @ the x/y- axis numbering is triggered by keyword ''axisnumbering``<ul><li>use commands ''xlabel some_text`` and/or ''ylabel some_text`` for text on axis: use command ''fontsize int`` to set the fontsize (default 12px)</li><li>use command ''fontfamily fnt_family_string`` to set the fonts for axis-numbering</li><li>use command ''fontcolor`` to set the colour</li></ul>
5728
         @ note: the complete canvas will be used for the ''log paper``
5728
         @ note: the complete canvas will be used for the ''log paper``
5729
         @ note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
5729
         @ note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
5730
         @ note: command ''mouse color,fontsize`` will show the real values in the logpaper.<br />\
5730
         @ note: command ''mouse color,fontsize`` will show the real values in the logpaper.<br>\
5731
         @ note: when using something like ''yrange 0.0001,0.01``...combined with commands ''mouse color,fontsize`` and/or ''userdraw type,color``...<br /> make sure the precision is set accordingly (eg command ''precision 10000``)
5731
         @ note: when using something like ''yrange 0.0001,0.01``...combined with commands ''mouse color,fontsize`` and/or ''userdraw type,color``...<br> make sure the precision is set accordingly (eg command ''precision 10000``)
5732
         @ note: in case of userdraw, the use of keyword ''userinput_xy`` may be handy !
5732
         @ note: in case of userdraw, the use of keyword ''userinput_xy`` may be handy !
5733
         @ <b>attention</b>: keyword ''snaptogrid`` may not lead to the desired result...
5733
         @ <b>attention</b>: keyword ''snaptogrid`` may not lead to the desired result...
5734
         @ <b>attention</b>: do not use command ''zoom``
5734
         @ <b>attention</b>: do not use command ''zoom``
5735
         @%xylogscale%size 400,400%xrange 10,50000%yrange 10,50000%xlabel x-axis%ylabel y-axis%xylogscale black,grey%display xy,red,22
5735
         @%xylogscale%size 400,400%xrange 10,50000%yrange 10,50000%xlabel x-axis%ylabel y-axis%xylogscale black,grey%display xy,red,22
5736
        */
5736
        */
Line 5755... Line 5755...
5755
 
5755
 
5756
        case Y_AXIS_STRINGS:
5756
        case Y_AXIS_STRINGS:
5757
        /*
5757
        /*
5758
         @ yaxis num1:string1:num2:string2:num3:string3:num4:string4:....num_n:string_n
5758
         @ yaxis num1:string1:num2:string2:num3:string3:num4:string4:....num_n:string_n
5759
         @ alternative: yaxistext
5759
         @ alternative: yaxistext
5760
         @ use command ''fontcolor``, ''fontfamily`` to adjust font <br />defaults: black,12,Arial<br /> note: command ''fontsize`` is not active for this command.(''fontsize`` can be used for the <a href="#legend">legend</a> in a <a href="#grid">grid</a>)
5760
         @ use command ''fontcolor``, ''fontfamily`` to adjust font <br>defaults: black,12,Arial<br> note: command ''fontsize`` is not active for this command.(''fontsize`` can be used for the <a href="#legend">legend</a> in a <a href="#grid">grid</a>)
5761
         @ no need to use keyword <a href="#axisnumbering">axisnumbering</a>
5761
         @ no need to use keyword <a href="#axisnumbering">axisnumbering</a>
5762
         @ use command <a href="#axis">axis</a> to have visual x/y-axis lines (see command <a href="#grid">grid</a>
5762
         @ use command <a href="#axis">axis</a> to have visual x/y-axis lines (see command <a href="#grid">grid</a>
5763
         @ use these y-axis num1...num_n values instead of default ymin...ymax
5763
         @ use these y-axis num1...num_n values instead of default ymin...ymax
5764
         @ a javascript error message will flag non-matching value:name pairs
5764
         @ a javascript error message will flag non-matching value:name pairs
5765
         @ to be used before command grid (see <a href="#grid">command grid</a>)
5765
         @ to be used before command grid (see <a href="#grid">command grid</a>)
Line 5833... Line 5833...
5833
                    case 0: ymin = get_real(infile,0);break;
5833
                    case 0: ymin = get_real(infile,0);break;
5834
                    case 1: ymax = get_real(infile,1);break;
5834
                    case 1: ymax = get_real(infile,1);break;
5835
                    default: break;
5835
                    default: break;
5836
                }
5836
                }
5837
            }
5837
            }
5838
            if(ymin >= ymax){canvas_error(" yrange is not OK: ymin &lt; ymax !<br />");}
5838
            if(ymin >= ymax){canvas_error(" yrange is not OK: ymin &lt; ymax !<br>");}
5839
            fprintf(js_include_file,"var ymin = %f;var ymax = %f;",ymin,ymax);
5839
            fprintf(js_include_file,"var ymin = %f;var ymax = %f;",ymin,ymax);
5840
            found_size_command++;
5840
            found_size_command++;
5841
            break;
5841
            break;
5842
 
5842
 
5843
        case YSNAPTOGRID:
5843
        case YSNAPTOGRID:
Line 5846... Line 5846...
5846
         @ keyword (no arguments required)
5846
         @ keyword (no arguments required)
5847
         @ a draggable object (use command ''drag x|y|xy``) will snap to the given y-grid values when dragged (mouseup)
5847
         @ a draggable object (use command ''drag x|y|xy``) will snap to the given y-grid values when dragged (mouseup)
5848
         @ in case of userdraw the drawn points will snap to ymajor grid
5848
         @ in case of userdraw the drawn points will snap to ymajor grid
5849
         @ if no grid is defined, points will snap to every integer yrange value. (eg snap_y=1)
5849
         @ if no grid is defined, points will snap to every integer yrange value. (eg snap_y=1)
5850
         @ if you do not want a visible grid, but you only want a ''snaptogrid`` with some value...define this grid with opacity 0.
5850
         @ if you do not want a visible grid, but you only want a ''snaptogrid`` with some value...define this grid with opacity 0.
5851
         @ if yminor is defined (use keyword ''axis`` to activate yminor), the drawing will snap to yminor <br />use only even dividers in y-minor...for example<br /><code>ysnaptogrid<br />axis<br />grid 2,1,grey,4,4,7,red</code><br /> will snap on x=0, x=0.5, x=1, x=1.5 ....<br /> will snap on y=0, y=0.25 y=0.5 y=0.75 ...<br />
5851
         @ if yminor is defined (use keyword ''axis`` to activate yminor), the drawing will snap to yminor <br>use only even dividers in y-minor...for example<br><code>ysnaptogrid<br>axis<br>grid 2,1,grey,4,4,7,red</code><br> will snap on x=0, x=0.5, x=1, x=1.5 ....<br> will snap on y=0, y=0.25 y=0.5 y=0.75 ...<br>
5852
         @%ysnaptogrid_1%size 400,400%xrange -10,10%yrange -10,10%ysnaptogrid%grid 1,1,grey%linewidth 2%userdraw crosshairs,blue%css font-size:8px;color:blue%clearbutton delete all crosshairs
5852
         @%ysnaptogrid_1%size 400,400%xrange -10,10%yrange -10,10%ysnaptogrid%grid 1,1,grey%linewidth 2%userdraw crosshairs,blue%css font-size:8px;color:blue%clearbutton delete all crosshairs
5853
         @%ysnaptogrid_2%size 400,400%xrange -10,10%yrange -10,10%ysnaptogrid%grid 1,1,grey%linewidth 3%drag y%points red,0,0,0,0,0,0,0,0,0,0
5853
         @%ysnaptogrid_2%size 400,400%xrange -10,10%yrange -10,10%ysnaptogrid%grid 1,1,grey%linewidth 3%drag y%points red,0,0,0,0,0,0,0,0,0,0
5854
        */
5854
        */
5855
        use_snap = 3;
5855
        use_snap = 3;
5856
        break;
5856
        break;
5857
 
5857
 
5858
        case YLABEL:
5858
        case YLABEL:
5859
        /*
5859
        /*
5860
        @ ylabel some_string
5860
        @ ylabel some_string
5861
        @ will be used to create a (vertical) label for the y-axis (label is in quadrant I)
5861
        @ will be used to create a (vertical) label for the y-axis (label is in quadrant I)
5862
        @ can only be used together with command <a href="#grid">grid</a><br />not depending on keywords ''axis`` and ''axisnumbering``
5862
        @ can only be used together with command <a href="#grid">grid</a><br>not depending on keywords ''axis`` and ''axisnumbering``
5863
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)<br />use command ''fontsize`` to adjust (command ''fontsize`` is not active for this command)
5863
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)<br>use command ''fontsize`` to adjust (command ''fontsize`` is not active for this command)
5864
        @ use <a href="#xlabel">xlabel</a>
5864
        @ use <a href="#xlabel">xlabel</a>
5865
        @%ylabel%size 400,400%xrange -10,10%yrange -10,10%fontsize 8%axis%axisnumbering%precision 1%xlabel x-axis%ylabel y-axis%grid 1,1,grey,2,2,2,red
5865
        @%ylabel%size 400,400%xrange -10,10%yrange -10,10%fontsize 8%axis%axisnumbering%precision 1%xlabel x-axis%ylabel y-axis%grid 1,1,grey,2,2,2,red
5866
        */
5866
        */
5867
            temp = get_string(infile,1);
5867
            temp = get_string(infile,1);
5868
            fprintf(js_include_file,"var yaxislabel = \"%s\";",temp);
5868
            fprintf(js_include_file,"var yaxislabel = \"%s\";",temp);
Line 5885... Line 5885...
5885
         @ the opacity of major / minor grid lines is set by command ''opacity [0-255],[0-255]``
5885
         @ the opacity of major / minor grid lines is set by command ''opacity [0-255],[0-255]``
5886
         @ default logbase number = 10 ... when needed, set the logbase number with command ''ylogbase number``
5886
         @ default logbase number = 10 ... when needed, set the logbase number with command ''ylogbase number``
5887
         @ the x/y- axis numbering is triggered by keyword ''axisnumbering``<ul><li>use command ''precision`` before ''ylogscale`` command to set the precision (decimals) of the axis numbering</li><li>use commands ''xlabel some_text`` and/or ''ylabel some_text`` for text on axis: use command ''fontsize int`` to set the fontsize (default 12px)</li><li>use command ''fontfamily fnt_family_string`` to set the fonts for axis-numbering</li><li>use command ''fontcolor`` to set the color</li></ul>
5887
         @ the x/y- axis numbering is triggered by keyword ''axisnumbering``<ul><li>use command ''precision`` before ''ylogscale`` command to set the precision (decimals) of the axis numbering</li><li>use commands ''xlabel some_text`` and/or ''ylabel some_text`` for text on axis: use command ''fontsize int`` to set the fontsize (default 12px)</li><li>use command ''fontfamily fnt_family_string`` to set the fonts for axis-numbering</li><li>use command ''fontcolor`` to set the color</li></ul>
5888
         @ note: the complete canvas will be used for the ''log paper``
5888
         @ note: the complete canvas will be used for the ''log paper``
5889
         @ note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
5889
         @ note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
5890
         @ note: command ''mouse color,fontsize`` will show the real values in the logpaper.<br />\
5890
         @ note: command ''mouse color,fontsize`` will show the real values in the logpaper.<br>\
5891
         @ note: when using something like ''yrange 0.0001,0.01``...combined with commands ''mouse color,fontsize`` and/or ''userdraw type,color``...<br /> make sure the precision is set accordingly (eg command ''precision 10000``)
5891
         @ note: when using something like ''yrange 0.0001,0.01``...combined with commands ''mouse color,fontsize`` and/or ''userdraw type,color``...<br> make sure the precision is set accordingly (eg command ''precision 10000``)
5892
         @ note: in case of userdraw, the use of keyword ''userinput_xy`` may be handy !
5892
         @ note: in case of userdraw, the use of keyword ''userinput_xy`` may be handy !
5893
         @ <b>attention</b>: do not use command ''zoom``
5893
         @ <b>attention</b>: do not use command ''zoom``
5894
         @ <b>attention</b>: keyword ''snaptogrid`` may not lead to the desired result...
5894
         @ <b>attention</b>: keyword ''snaptogrid`` may not lead to the desired result...
5895
        */
5895
        */
5896
            use_axis_numbering++;if(use_axis_numbering > 1){use_axis_numbering = 1;}
5896
            use_axis_numbering++;if(use_axis_numbering > 1){use_axis_numbering = 1;}
Line 5925... Line 5925...
5925
 
5925
 
5926
        case ZOOM:
5926
        case ZOOM:
5927
        /*
5927
        /*
5928
         @ zoom button_color
5928
         @ zoom button_color
5929
         @ introduce a very small ''controlpanel`` at the lower right corner (font size of the panel is fixed to: 22px Arial)
5929
         @ introduce a very small ''controlpanel`` at the lower right corner (font size of the panel is fixed to: 22px Arial)
5930
         @ giving six 15&times;15px ''active`` rectangle areas<br />(''&times;,&darr;,&uarr;,&larr;,&rarr;,&minus;,+``) for zooming and/or panning of the image
5930
         @ giving six 15&times;15px ''active`` rectangle areas<br>(''&times;,&darr;,&uarr;,&larr;,&rarr;,&minus;,+``) for zooming and/or panning of the image
5931
         @ a mouse wheel is active for in/out zooming. Drag panning is not supported (this will conflict with many ''userdraw`` or ''multidraw`` primitives)
5931
         @ a mouse wheel is active for in/out zooming. Drag panning is not supported (this will conflict with many ''userdraw`` or ''multidraw`` primitives)
5932
         @ the ''controlpanel`` is not active for a ''userdraw`` mousedown (but it can interfere with some ''userdraw`` types)
5932
         @ the ''controlpanel`` is not active for a ''userdraw`` mousedown (but it can interfere with some ''userdraw`` types)
5933
         @ the ''&times;`` symbol will reset to your original xmax/xmin ymax/ymin values.
5933
         @ the ''&times;`` symbol will reset to your original xmax/xmin ymax/ymin values.
5934
         @ choose an appropriate color, so the small ''&times;,&darr;,&uarr;,&larr;,&rarr;,&minus;,+`` are clearly visible
5934
         @ choose an appropriate color, so the small ''&times;,&darr;,&uarr;,&larr;,&rarr;,&minus;,+`` are clearly visible
5935
         @ command ''opacity`` may be used to set stroke_opacity of buttons
5935
         @ command ''opacity`` may be used to set stroke_opacity of buttons
Line 6034... Line 6034...
6034
 for(i=0;i<num;i = i+incr){
6034
 for(i=0;i<num;i = i+incr){
6035
  ii = i+1;
6035
  ii = i+1;
6036
  x = double_data[i]*affine_matrix[0] + double_data[ii]*affine_matrix[1]+affine_matrix[4];
6036
  x = double_data[i]*affine_matrix[0] + double_data[ii]*affine_matrix[1]+affine_matrix[4];
6037
  y = double_data[i]*affine_matrix[2] + double_data[ii]*affine_matrix[3]+affine_matrix[5];
6037
  y = double_data[i]*affine_matrix[2] + double_data[ii]*affine_matrix[3]+affine_matrix[5];
6038
 /*
6038
 /*
6039
  printf("(%f:%f) &rarr; (%f:%f)<br />",double_data[i],double_data[ii],x,y);
6039
  printf("(%f:%f) &rarr; (%f:%f)<br>",double_data[i],double_data[ii],x,y);
6040
 */
6040
 */
6041
  double_data[i] = x;
6041
  double_data[i] = x;
6042
  double_data[ii] = y;
6042
  double_data[ii] = y;
6043
 }
6043
 }
6044
}
6044
}
Line 6052... Line 6052...
6052
  ii = i+1;
6052
  ii = i+1;
6053
  x = c*(double_data[i]-center[0]) + s*(double_data[ii] - center[1] ) + center[0];
6053
  x = c*(double_data[i]-center[0]) + s*(double_data[ii] - center[1] ) + center[0];
6054
  y = c*(double_data[ii]-center[1]) - s*(double_data[i] - center[0] ) + center[1];
6054
  y = c*(double_data[ii]-center[1]) - s*(double_data[i] - center[0] ) + center[1];
6055
  double_data[i] = x;
6055
  double_data[i] = x;
6056
  double_data[ii] = y;
6056
  double_data[ii] = y;
6057
 // printf("(x:y) - (%f:%f)<br />",x,y);
6057
 // printf("(x:y) - (%f:%f)<br>",x,y);
6058
 }
6058
 }
6059
}
6059
}
6060
/* not used: see transform()
6060
/* not used: see transform()
6061
void translate(int num){
6061
void translate(int num){
6062
 int i;int ii;
6062
 int i;int ii;
Line 6117... Line 6117...
6117
        if( i > MAX_COLOR_STRING ){ canvas_error("colour string is too big ... ? ");}
6117
        if( i > MAX_COLOR_STRING ){ canvas_error("colour string is too big ... ? ");}
6118
        if( c == '#' ){
6118
        if( c == '#' ){
6119
            is_hex = 1;
6119
            is_hex = 1;
6120
        }
6120
        }
6121
        if( c != ' '){
6121
        if( c != ' '){
6122
            if( is_hex == 0 ){if(strchr(not_allowed,c) != 0){canvas_error("found something like a number...but is should have been a colour or #hex color number...<br />Do not use R,G,B !!! ");}}
6122
            if( is_hex == 0 ){if(strchr(not_allowed,c) != 0){canvas_error("found something like a number...but is should have been a colour or #hex color number...<br>Do not use R,G,B !!! ");}}
6123
            temp[i]=tolower(c);
6123
            temp[i]=tolower(c);
6124
            i++;
6124
            i++;
6125
        }
6125
        }
6126
    }
6126
    }
6127
    if( ( c == '\n' || c == EOF || c == ';' || c == '\t' ) && last == 0){canvas_error("expecting more arguments in command");}
6127
    if( ( c == '\n' || c == EOF || c == ';' || c == '\t' ) && last == 0){canvas_error("expecting more arguments in command");}
Line 6244... Line 6244...
6244
    return y;
6244
    return y;
6245
}
6245
}
6246
 
6246
 
6247
 
6247
 
6248
void canvas_error(char *msg){
6248
void canvas_error(char *msg){
6249
    fprintf(stdout,"\n</script><hr /><span style=\"color:red\">FATAL syntax error: line %d: %s</span><hr />",line_number,msg);
6249
    fprintf(stdout,"\n</script><hr><span style=\"color:red\">FATAL syntax error: line %d: %s</span><hr>",line_number,msg);
6250
    finished = 1;
6250
    finished = 1;
6251
    exit(EXIT_SUCCESS);
6251
    exit(EXIT_SUCCESS);
6252
}
6252
}
6253
 
6253
 
6254
 
6254
 
Line 6267... Line 6267...
6267
double px2y(int y){
6267
double px2y(int y){
6268
 return (y*(ymax - ymin)/ysize + ymin);
6268
 return (y*(ymax - ymin)/ysize + ymin);
6269
}
6269
}
6270
 
6270
 
6271
void add_to_buffer(char *tmp){
6271
void add_to_buffer(char *tmp){
6272
//fprintf(stdout,"tmp = %s<br />buffer = %s<br />",tmp,buffer);
6272
//fprintf(stdout,"tmp = %s<br>buffer = %s<br>",tmp,buffer);
6273
 if( tmp == NULL || tmp == 0 ){ canvas_error("nothing to add_to_buffer()...");}
6273
 if( tmp == NULL || tmp == 0 ){ canvas_error("nothing to add_to_buffer()...");}
6274
 /*  do we have enough space left in buffer[MAX_BUFFER] ? */
6274
 /*  do we have enough space left in buffer[MAX_BUFFER] ? */
6275
 int space_left = (int) (sizeof(buffer) - strlen(buffer));
6275
 int space_left = (int) (sizeof(buffer) - strlen(buffer));
6276
 if( space_left > strlen(tmp)){
6276
 if( space_left > strlen(tmp)){
6277
  strncat(buffer,tmp,space_left - 1);/* add safely "tmp" to the string buffer */
6277
  strncat(buffer,tmp,space_left - 1);/* add safely "tmp" to the string buffer */
6278
 }
6278
 }
6279
 else
6279
 else
6280
 {
6280
 {
6281
  canvas_error("your memory buffer is too big<br />simplify your script...it produces too many lines ");
6281
  canvas_error("your memory buffer is too big<br>simplify your script...it produces too many lines ");
6282
 }
6282
 }
6283
 tmp = NULL;free(tmp);
6283
 tmp = NULL;free(tmp);
6284
 return;
6284
 return;
6285
}
6285
}
6286
 
6286
 
Line 6327... Line 6327...
6327
  idx = 3;int i;
6327
  idx = 3;int i;
6328
  char *ptr = strtok(keys,",");
6328
  char *ptr = strtok(keys,",");
6329
  while(ptr != NULL ){
6329
  while(ptr != NULL ){
6330
    for(i = 0 ; i < 6; i++ ){if( strncmp(ptr,forbidden[i],2) == 0 ){return "NOT ALLOWED ARGUMENT";}}
6330
    for(i = 0 ; i < 6; i++ ){if( strncmp(ptr,forbidden[i],2) == 0 ){return "NOT ALLOWED ARGUMENT";}}
6331
    argv[idx] = ptr; idx++;
6331
    argv[idx] = ptr; idx++;
6332
    if(idx > 18){canvas_error("too many arguments for obabel....see docs<br />");}
6332
    if(idx > 18){canvas_error("too many arguments for obabel....see docs<br>");}
6333
    ptr = strtok(NULL,",");
6333
    ptr = strtok(NULL,",");
6334
  }
6334
  }
6335
  /* last arguments; no 'javascript', only 'svg to STDOUT' and 'NULL' */
6335
  /* last arguments; no 'javascript', only 'svg to STDOUT' and 'NULL' */
6336
  argv[idx] = "-xj";argv[idx+1] = "-o"; argv[idx+2] = "svg";argv[idx+3] = NULL;
6336
  argv[idx] = "-xj";argv[idx+1] = "-o"; argv[idx+2] = "svg";argv[idx+3] = NULL;
6337
  int link[2];
6337
  int link[2];