Subversion Repositories wimsdev

Rev

Rev 16942 | Rev 17518 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
16849 obado 1
# Canvasdraw changes log
2
## TODO :
3
- sort out the global/local variable mess...and reorganize headerfile
15111 schaersvoo 4
	 : zooming and grid: scaling needs to be more adaptive ! (use constant amount of grid lines)
16847 schaersvoo 5
 
16849 obado 6
## 2022
17425 schaersvoo 7
* 28/8/2022: added command "newrange xmin,xmax,ymin,ymax" see https://wimsedu.info/?topic=dessiner-des-portions-de-fonctions-sur-un-meme-graphe
16942 schaersvoo 8
* 01/8/2022: getMouse(),latest improvements related to 'reponsiveness' will fatally lockup browsers in the pixel-by-pixel filling...at least in userdraw clickfill
16920 schaersvoo 9
* 19/7/2022: checked and corrected 'dashed' objects like arc,arrowarc,ellipse...
16910 schaersvoo 10
* 16/7/2022: solved long standing issue of dashed arrow(s) and dashed arrow(s)2 
16900 schaersvoo 11
* 06/7/2022: clearbutton preserves div's with '<' && '/>' and objects placed with 'placed_image_on_canvas(id)' e.g. with 'id = placed*'
16910 schaersvoo 12
* 05/7/2022: corrected flaw in 'clearbutton' https://wimsedu.info/?topic=geometrie-interactive-avec-canvasdraw
16892 schaersvoo 13
* 05/7/2022: command 'group' :
14
	- still some issues with direct clicks on group members (NaN due to competing mouselisteners)
15
	- removed 'debug newlines'
16
	- external images -via command 'copy' NOT supported (too much trouble)
17
	- need to add 'copy' to dragstuff library or introduce another command...
16872 schaersvoo 18
* 26/6/2022: added keyword 'group' : provides mouse-driven movements of all objects after keyword 'group' until keyword 'kill group;
19
	- may be combined with 'slider' to move or rotate single objects or grouped objects
20
	- may not be combined with command 'drag xy' (mouse listeners are already occupied...)
21
	- may be combined with command 'onclick'
16882 schaersvoo 22
	- added objects created by command 'latex' to grouping (todo : external images etc)
16872 schaersvoo 23
 
16849 obado 24
* 23/6/2022: corrected drag&drop reply of external images (via command 'copy') when mixed with other external/internal objects...
25
 
26
	 	 #
27
	 	 size 400,400
28
	 	 xrange -10,10
29
	 	 yrange -10,10
30
	 	 grid 2,2,grey
31
	 	 linewidth 2
32
	 	 onclick
33
	 	 fcircle -6,6,50,red
34
	 	 onclick
35
	 	 fcircle -6,-6,50,green
36
	 	 noreset
37
	 	 snaptogrid
38
	 	 drag xy
39
	 	 centered
40
	 	 latex 0,0,\frac{12345}{23456} \times \frac{12345}{23456}
41
	 	 translate 4,4
42
	 	 html 0,0,<table style='border:solid red 2px'><tr><th>HTML TABLE</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>
43
	 	 userdraw arrow2,red
44
	 	 translate 8,8
45
	 	 copy 0,0,-1,-1,-1,-1,gifs/nl.gif
46
 
47
* 20/6/2022: Start to make canvasdraw responsive [OB] :
16845 bpr 48
	- reduce size on small screens,
49
	- use percentage instead of absolute positioning for xml/html/tex
50
	- convert mouse position coords on shrinked canvas
51
	- correct mouse coordinates when inside a scrolled wims_scrollable div
16849 obado 52
	- Replace "Ariel" font references by "Arial"
53
* 19/6/2022: added function plot to multidraw (https://wimsedu.info/?topic=userinput-function)
54
	command 'multidraw functions' will -for now- give just 2 inputfields... *TODO*: make configurable, so implement commands like 'multidraw functions5')
55
	for multiple function input fields, use multiple keywords 'function', e.g. something like:
56
	multidraw text,line,function,function,function,points
57
* 27/5/2022: added subsup to userdraw and multidraw 'text' (which is always 'centered' e.g use_offset=4)
58
* 26/5/2022: corrected replyformat 100 
59
* 23/5/2022: overriding fontfamily and use Helvetica as font for _sub ^sup  strings: all inline numbers are in script-size (80% eg the same as strings+numbers for sub/sup)
60
* 21/5/2022: using 'scriptsize' imitation on sub / sup  
61
* 20/5/2022: added a sub / sup imitation to the canvas 'string' command family
16700 schaersvoo 62
 
16849 obado 63
		size 400,400
64
		xrange -6,6
65
		yrange -6,6
66
		fontfamily 22px Arial
16700 schaersvoo 67
 
16849 obado 68
		# use single space for separation in formula...
69
		# use double space to create new word
70
		string red,-5,0,H_3 O^+ + OH^\u2212  \u2192 2H_2 O
16845 bpr 71
 
16849 obado 72
* 2/4/2022: added timeout fix for centering issue in case of MathJaX (draw_xml())
15758 schaersvoo 73
 
16849 obado 74
## 2021
75
* 14/4/2021: added flydraw command 'range xmin,xmax,ymin,ymax'
76
* 6/4/2021: corrected 'text objects' (from cmd's text/string) were not added to 'noreset', e.g. keyword 'noreset' was ignored...
77
added a live example from E3/number/oefgraduation.fr  
78
* 4/4/2021: corrected use of precompiler directive "KATEX_INSTALLED" (was not working...)
79
* 12/3/2021: add "version 0.5" to canvasdraw include file
80
* 23/2/2021:
15716 schaersvoo 81
added generic command 'kill argument'
82
work in progress
15717 schaersvoo 83
corrected wrong alternative command for jscurve
16849 obado 84
* 21/2/2021:
15715 schaersvoo 85
alternative commands now 'seachable' using js-function look()
16849 obado 86
* 19/2/2021:
15711 schaersvoo 87
slightly improved dashing of arrows (in dragstuff,userdraw & multidraw)
88
to test : other objects+dashing !
89
resetting dashing for the arrow head (head was also dashed...)
90
see https://wimsedu.info/?topic=dashed-arrows-not-dashed-in-canvasdraw
16849 obado 91
* 2/2/2021:
15690 schaersvoo 92
added command 'arcarrow|arrowarc', left,right,left/right
93
added commands 'arc','angle','arcarrow' to onclick and drag&drop
16849 obado 94
* 17/1/2021: 
15672 schaersvoo 95
corrected syntax issue in canvasmultidraw.c signalled by Opera Presto : 'forbidden function user_drawstop(evt) declaration in statement'*/
15674 schaersvoo 96
 
15673 schaersvoo 97
can not correct centering in case of MathJaX, in commands like
16849 obado 98
 
99
```
15672 schaersvoo 100
####
15673 schaersvoo 101
centered
15672 schaersvoo 102
math 0,0,\frac{1}{222}
103
####
16849 obado 104
```
105
 
15674 schaersvoo 106
Things get even worse when activating in exec.c the "Safari/MathJax bugfix : refresh display when document ready."
107
(besides the ridiculous delay !!)
108
You should really try KaTeX on these systems/browsers !!!
15672 schaersvoo 109
 
15673 schaersvoo 110
OEF example of the problem:
16849 obado 111
 
112
```
15672 schaersvoo 113
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
114
\text{m1=wims(mathmlmath \frac{12344}{\pi\pi\pi\pi^{\pi}})}
115
\text{m2=wims(mathmlmath \frac{\pi\pi\pi\pi^{\pi}}{\alpha})}
116
\text{m3=wims(mathmlmath \sqrt{\pi\pi\pi\pi^{\pi}})}
117
\text{m4=wims(mathmlmath \sqrt{\frac{1223}{3344}})}
118
 
119
\statement{
120
<script type="text/javascript">
121
 function read_canvas(){
122
   var fun = eval("read_canvas"+canvas_scripts[0]);
123
   if( typeof fun === 'function'){ return fun();};
124
 };
125
 function read_dragdrop(){
16849 obado 126
   var fun = eval("read_dragdrop"+canvas_scripts[0]); 
15672 schaersvoo 127
   if(typeof fun === 'function'){return fun();};
128
 };
129
 
130
</script>
131
<br/>
132
<span id="m1" onclick="javascript:place_image_on_canvas(this.id)" >\m1</span>
133
<span id="m2" onclick="javascript:place_image_on_canvas(this.id)" >\m2</span>
134
<span id="m3" onclick="javascript:place_image_on_canvas(this.id)" >\m3</span>
135
<span id="m4" onclick="javascript:place_image_on_canvas(this.id)" >\m4</span>
136
 
137
\canvasdraw{400,400}{
138
xrange -10,10
139
yrange -10,10
140
grid 1,1,grey
141
noreset
142
# use keyword 'noreset' to avoid using keyword 'centered' before every addition of objects !
143
centered
144
fontfamily Bold Italic 42pt Courier
145
# these images are internal the reply prefix is imagepalette_0, imagepalette_1... !!
146
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
147
multicolors red,green,blue,lightblue,cyan
148
multisnaptogrid 1,1,1,1,0
149
multilinewidth 0,4,0,3,1
150
multidraw text,arrow,images,points,lines
151
math -6,6,\frac{1}{\pi}
152
math -2,2,\frac{1}{\pi}
153
math 2,-2,\frac{1}{\pi}
154
math 6,-6,\frac{1}{\pi}
155
linewidth 3
156
points red,-6,6,-2,2,2,-2,6,-6
157
mouse red,22
158
}
159
 
160
 
161
These images are external...The reply id-prefix is "placed_0_'this.id'"
162
<table><tr>
163
<td><img src="gifs/ca.gif" onclick='javascript:place_image_on_canvas(this.id);' id="ca" /></td>
164
<td><img src="gifs/nl.gif" onclick='javascript:place_image_on_canvas(this.id);' id="nl" /></td>
165
<td><img src="gifs/en.gif" onclick='javascript:place_image_on_canvas(this.id);' id="en" /></td>
166
<td><img src="gifs/fr.gif" onclick='javascript:place_image_on_canvas(this.id);' id="fr" /></td>
167
<td><img src="gifs/cn.gif" onclick='javascript:place_image_on_canvas(this.id);' id="cn" /></td>
168
<td><img src="gifs/it.gif" onclick='javascript:place_image_on_canvas(this.id);' id="it" /></td>
169
<td><img src="gifs/kh.gif" onclick='javascript:place_image_on_canvas(this.id);' id="kh" /></td>
170
<td><img src="gifs/de.gif" onclick='javascript:place_image_on_canvas(this.id);' id="de" /></td>
171
</tr>
172
</table>
173
   <input type="button" onclick="alert(read_canvas());" value="read_canvas()" />
174
   <input type="button" onclick="alert(read_dragdrop());" value="read_dragdrop()" />
175
}
16849 obado 176
```
15672 schaersvoo 177
 
16849 obado 178
* 15/1/2021:
15665 schaersvoo 179
corrected long standing flaw regarding "centered" on external stuff...tested: bitmap,svg,TeX [on KaTeX]
15669 schaersvoo 180
corrected 'onclick' for 'draw_xml()'
15665 schaersvoo 181
 
16849 obado 182
* 14/1/2021: 
15657 schaersvoo 183
only on KaTeX enabled wims, a slider title may use TeX produced by command "mathmlmath"
16849 obado 184
 
185
* 13/1/2021:
15655 schaersvoo 186
slider title may use TeX produced by command "mathmlmath"
187
 
16849 obado 188
=> oef example...
189
 
190
```
15655 schaersvoo 191
\title{slider + tex title}
192
\text{A = \frac{1}{2}}
193
\text{B = \frac{1}{3}}
194
\text{C = \frac{1}{4}}
15657 schaersvoo 195
\text{a = \(\frac{1}{2}\)}
15655 schaersvoo 196
\text{b = wims(mathmlmath \\Huge \\frac{1}{3} )}
197
\text{c = wims(mathmlmath \\Huge \\frac{1}{4} )}
198
\text{canvas=wims(exec canvasdraw
199
size 400,400
200
xrange -10,10
201
yrange -10,10
16849 obado 202
fontfamily 38px Arial
15655 schaersvoo 203
opacity 255,40
204
grid 1,1,grey
205
strokecolor red
15657 schaersvoo 206
slider -10,10,400,50,x active,\( \frac{1}{2} \)
15655 schaersvoo 207
frect -6,5,-4,-5,red
208
centered
209
latex -5,0,\A
210
killslider
211
strokecolor blue
212
slider -10,10,400,50,x active,\b
213
frect -6,5,-4,-5,blue
214
centered
215
latex -5,0,\B
216
killslider
217
strokecolor green
218
slider -10,10,400,50,x active,\c
219
frect -6,5,-4,-5,green
220
centered
221
latex -5,0,\C
222
killslider)
223
}
224
\statement{
225
canvas = \canvas
16849 obado 226
} 
227
```
15655 schaersvoo 228
 
16849 obado 229
* 8/1/2021:
15646 schaersvoo 230
added affine transformation to Fly text commmand analogue
15655 schaersvoo 231
 
16849 obado 232
* 3/1/2021:
15628 schaersvoo 233
added check on 'nan' in case of parametric curve
16849 obado 234
		size 260,220
235
		xrange 0,13
236
		yrange 0,11
237
		trange 0,2
238
		curve black,1/t,4*sin(t)
15540 schaersvoo 239
 
16849 obado 240
 
241
## 2020
242
* 29/12/2020:
15623 schaersvoo 243
disabled limitation of adding "curve points outside the visual ymin/ymax range" (parametric curves)
244
 
16849 obado 245
* 27/12/2020:
15611 schaersvoo 246
corrected command "parallel" , to be more compatible with flydraw & affine transformations
15613 schaersvoo 247
when a transformation is set  before command parallel...the lines may be set onclick or drag xy!
15611 schaersvoo 248
 
16849 obado 249
* 24/12/2020:
15601 schaersvoo 250
solved some issues with curve & affine/rotate...
16849 obado 251
see [https://wimstest1.di.u-psud.fr/wims/wims.cgi?lang=en&module=adm/doc&cmd=new&job=read&doc=1028&block=transform]()
15601 schaersvoo 252
 
16849 obado 253
```
15601 schaersvoo 254
size 200,200
255
xrange -5,5
256
yrange -5,5
257
linewidth 2
258
trange 0,1
259
curve blue,2*t,sin(2*pi*t)
260
affine 0,1,1,2,-1,1
261
trange 0,1
262
curve green,2*t,sin(2*pi*t)
16849 obado 263
```
15601 schaersvoo 264
 
16849 obado 265
* 22/12/2020:
266
command "fillpattern image_url" was gone fishing! `get_image_from_url()` needs to be called after function definition..
267
* 16/11/2020: 
268
	- added 'affine' to curve evaluation
15540 schaersvoo 269
 
16849 obado 270
	```
271
	size 220,220
272
	xrange -5,5
273
	yrange -5,5
274
	hline 0,0,black
275
	vline 0,0,black
276
	rotationcenter 0,0
277
	slider -2*pi,2*pi,200,28,angle degree active,Rotate
278
	linewidth 4
279
	curve blue,sin(x)
280
	affine 1,-0.2,-0.6,1,0,2
281
	curve red,sin(x)
282
	```
15540 schaersvoo 283
 
16849 obado 284
* 13/11/2020: 
285
	- added `safe_eval()` to userinput (using inputfields)
7614 schaersvoo 286
 
16849 obado 287
* 8/7/2020:
288
	- command `input x,y,size,readonly,value` gave canvaserror when 'value' was ommitted or a 'space'
289
	- corrected bug [https://wimsedu.info/?topic=bug-canvasdraw-et-ou-drawinput]()
290
		```
291
		case 4: temp = get_string(infile,1); --->  case 4: temp = get_string(infile,3);
292
		```
293
* 14/6/2020:
294
	- corrected bug in multidraw snaptopoints+curvedarrow
295
* 11/6/2020:
296
	- added 'touchend' to improve behaviour of touch devices in case 'userdraw' and 'multidraw' [TO TEST]
297
* 9/6/2020
298
	- touchend  not supported (eg lifting finger+tapping after dragging to signal some 'corner point')
299
	- in case of touch devices, use commands 'userinput' to enforce mathematical precise drawing and not finger painting...
300
	- function calc_lines(): 'multidraw lines' & 'userdraw line,color' returned (xmin:y1)--(xmax:y2)
301
	    that should have been (x1:y1)---(x2:y2) ...otherwise snaptogrid gives float values !
302
* 8/6/2020:
303
	- added command 'noreset' or 'killreset'
304
* 5/6/2020:
305
	- solved issue of sync loading of images (`command:html 0,0,<img src="modules/U2/geometry/oefrosoni.it/images/273x273/fig4.png"  />`)
306
 
307
	```
308
		size 400,400
309
		xrange -6,6
310
		yrange -6,6
311
		fontsize 40
312
		linewidth 1
313
		slider -10,10,300,28,angle active degree, 
314
		centered
315
		html 0,0,<img src="modules/U2/geometry/oefrosoni.it/images/273x273/fig4.png"  />
316
		killslider
317
		centered
318
		html 0,0,<img src="modules/U2/geometry/oefrosoni.it/images/273x273/fig4_ovr.png"  />
319
	```
320
 
321
	- commands math, katex, latex are identical
322
	- added compile time checking of 'katex.c' presence:
15111 schaersvoo 323
if present: use KaTeX for all browsers
324
if not present: use MathJaX (chrome) or native MathML (firefox)
16849 obado 325
	- TO DO: check if this actually works on non-KaTeX...
7614 schaersvoo 326
 
16849 obado 327
* 25/5/2020:
328
	- removed js-code for rotating (and transforming mouse-coordinates...) Now coordinates are transformed in C
329
	- slider, solved several issues (removed old slider stuff)
330
	- animated slider may be combined with manual/mouse slider
331
	- slider corrected for touch device
332
* 24/5/2020:
333
	- add keyword 'animate' to slider
7614 schaersvoo 334
 
16849 obado 335
	```
336
		size 300,300
337
		xrange -6,6
338
		yrange -6,6
339
		grid 1,1,grey
340
		linewidth 1
341
		slider 0,2*pi,300,28,angle animate active, no
342
		opacity 255,30
343
		ftriangle 2,2,-2,2,0,0,red
344
		ftriangle -2,2,-2,-2,0,0,blue
345
		ftriangle -2,-2,2,-2,0,0,green
346
		ftriangle 2,-2,2,2,0,0,orange
347
		rotationcenter 0,0
348
		frect -2,2,2,-2,black
349
	```
7614 schaersvoo 350
 
351
 
16849 obado 352
* 22/5/2020:
353
	- slider things...
354
* 21/5/2020:
355
	- minor changes: not yet really satisfied with combinations of xml+dragdrop+slider
356
	- some doc examples
357
* 20/5/2020:
358
	- slider reorganized:
359
	- restored all listeners on slider.(mousedown ,mousemove and mouseup)
360
	- update example 'angle': angle and arc are exceptions in case of sliders...they are always active (e.g. not click-activated)
361
	- added 'onclick=4' : in case of sliders ,no need for click-on-object to active the object--slider (important for objects covering each other)
362
 
363
* 18/5/2020:
364
	- restored interaction of commands 'arc' and 'angle' with sliders (specially Rotate)
365
	- drawxml() objects like katex,mathml,latex,html,obabel now interact identical as
15111 schaersvoo 366
    dragstuff library objects with slider...eg. 'first click'=select for sliders, 'second click' unselect sliders
16849 obado 367
    e.g.: `slidergroup[object_cnt] = obj or slidergroup[object_cnt] = null`
15111 schaersvoo 368
    selected sliders until 'killslider'
16849 obado 369
 
370
    ```
371
	######################################################
372
	size 500,500
373
	xrange -6,6
374
	yrange -6,6
375
	grid 1,1,grey
376
	fontfamily 42px Arial
377
	opacity 255,60
378
	centered
379
	#drag xy
380
	snaptogrid
381
	slider -10,10,500,50,angle,R
382
	slider -10,10,500,50,x,X
383
	slider -10,10,500,50,y,Y
384
	# these objects act -if selected- on the above sliders
385
	katex 3,3,\frac{123}{123^{\pi}}
386
	centered
387
	obabel 0,0,smi,-:c1cccc1cc,-xb none -xP100
388
	filled
389
	fillcolor blue
390
	angle 0,0,4,0,0,red
391
	killslider
392
	linewidth 4
393
	slider -10,10,500,50,angle,Rotate rect
394
	# if selected this object will use only the above slider
395
	frect -5,5,-4,4,red
396
	##########################################################
397
	```
15271 bpr 398
 
16849 obado 399
* 15/5/2020:
400
	- further reduced size of 'plain' grid (like 'grid 1,1,grey')
401
	- using uniform "slidergroup[object_cnt] = object" to avoid difficulies with reply's of dragstuff/xml [IN PROGRESS]				         __
402
	- slider appearance changed to :  _____\/______________
7614 schaersvoo 403
 
16849 obado 404
	- xml-objects (katex/latex/mathml/html) and slider: onclick will activate slider for object and deactivate after second click
14071 bpr 405
 
16849 obado 406
	```
407
	size 500,500
408
	xrange -6,6
409
	yrange -6,6
410
	grid 1,1,grey
411
	fontfamily 42px Arial
412
	strokecolor red
413
	fillcolor orange
414
	#rotationcenter 0,0
415
	slider -12,12,500,50,angle,rotate
416
	katex 0,0,\frac{1}{2}
417
	katex 3,3,\frac{1}{3}
418
	katex -3,3,\frac{9}{3}
419
	#latex 0,0,\frac{1}{2}
420
	#latex 3,3,\frac{1}{3}
421
	#latex -3,3,\frac{9}{3}
422
	obabel 0,5,smi,-:c1cFccc1cc,-xb none,-xB blue,-xi,-xt,-xa,-xX,-xP100,-h
423
	html 3,-3,<img src='gifs/en.gif' />
424
	html 4,-2,<H2>OK?</H2>
425
	html -4,-2,<input size='4' value='?" />
426
	```
14071 bpr 427
 
16849 obado 428
	- added import of 'TD' and 'TH' elements with an unique 'id' and onclick='javascript:place_image_on_canvas(this.id)' to the canvas
14071 bpr 429
 
16849 obado 430
* 13/5/2020:
431
	- fixed several incompatibilities
432
	- moved legend_cnt,linegraph_cnt barchar_cnt variables (used by 'grid') to global. reducing the size of default grid
433
 
434
* 12/5/2020:
435
	- reorganized command copy/copyresized: reply is now js-object, identical to dragstuff library
436
	- onclick/drag of 'copy images' transparent integration with dragstuff objects onclick/drag and external XML material
437
	- slider is not supported for flydraw analogues copy/copyresized : use command `html x,y,<img src='gifs/en.gif' />`
438
	- IOS fixed (thx Olivier Obado)
439
	- renamed variable 'click_cnt' into 'object_cnt' : it counts all interactive (onclick,dragdrop,slider) objects and results
15111 schaersvoo 440
    in a uniform 'reply' object{}
14071 bpr 441
 
16849 obado 442
* 8/5/2020:
443
	- finished commands 'html','katex','latex','mathml' using draw_xml()
15271 bpr 444
    with 'html' virtually all material can be imported
15111 schaersvoo 445
    affine operations and sliders are supported
16849 obado 446
	- corrected reply & slider
447
* 6/5/2020:
448
	- added imported object to sliders [work in progress]
449
	- added rotation center to draw_xml(obj); [only for command katex]
450
* 5/5/2020:
451
	- changed draw_xml() to object, for importing svg,img,div,p,span,mathml,katex in canvasdraw
452
	- added transformation matrix to draw_xml(). Preparing for slider manipulation of imported objects
453
* 3/5/2020: corrected error avoiding multiple calls to 'obabel'
454
* 1/5/2020: killed 'stderr' default message from 'obabel' : "converted 1 molecule"
455
* 30/4/2020:
456
	- added command 'katex x,y,tex-string'
457
	- thus bypassing cludge between firefox/mathml/mathjax/katex
458
	- for traditional wims (using MathML) use command 'latex x,y,tex-string' or 'mathml x,y,xml-code'
459
	- for katex-only wims, use only 'katex'
460
	- solved 'centered' and 'snaptogrid' issues dealing with drag&drop of generated 'svg/mathml/xml/html/js-code'
461
	- added link to 'howto katex and wims'
7614 schaersvoo 462
 
16849 obado 463
* 21/4/2020:
464
	- using execvp() to call "obabel" , using $PATH
7614 schaersvoo 465
 
16849 obado 466
* 20/4/2020:
467
	- changed command 'smiles' into 'obabel'
468
	- now all formats may be used as input
469
	- obabel 5,5,mol,$module_dir/mymolfile.mol,-xb none,-xB blue,-xi,-xt,-xa,-xX,-xP180,-h
470
	- obabel -5,-5,smi,-:c1ccFccc1,-xb none,-xB blue,-xi,-xt,-xa,-xX,-xP180,-h
471
	- added check on 'forbidden argument' to call obabel
14071 bpr 472
 
16849 obado 473
* 18/4/2020:
474
	- added command 'smiles args' , calling -if installed- 'obabel' to produce an SVG image
475
	- added command 'chemtex' , adding "mhchem.js" for typesetting (needs to come first!)
476
	- chemtex: added bogus code for mathjax. THIS WILL ONLY WORK ON KATEX ENABLED WIMS !
477
 
478
```
15111 schaersvoo 479
chemtex
480
size 400,400
481
xrange -10,10
482
yrange -10,10
483
fillcolor green
484
grid 1,1,grey
485
drag xy
486
centered
487
smiles 5,5,-:c1cFccc1cc,-xb none,-xB blue,-xi,-xt,-xa,-xX,-xP180,-h
488
rotate 180
489
drag xy
490
centered
491
smiles -5,-5,-:c1cFccc1cc,-xb none,-xB blue,-xi,-xt,-xa,-xX,-xP180,-h
492
drag xy
493
rotate -90
494
centered
495
smiles -5,5,-:c1cFccc1cc,-xb none,-xB blue,-xi,-xt,-xa,-xX,-xP180,-h
496
zoom red
497
drag xy
498
killrotate
16849 obado 499
fontfamily 32px Arial
15271 bpr 500
latex 0,0,\frac{1}{2} \ce{H3O+}
16849 obado 501
```
7991 schaersvoo 502
 
16849 obado 503
* 15/3/2020:
504
	- command latex ; improve code...minor cosmetic things (need to test on android)
505
	- changed syntax command html : 'html x,y,some-html-code'
506
	- drag/drop centering for html/latex/mathml/images
507
 
508
```
15111 schaersvoo 509
size 500,500
510
xrange -10,10
511
yrange -10,10
512
grid 1,1,grey
513
linewidth 3
514
vline 0,0,green
515
hline 0,0,green
16849 obado 516
fontfamily 16px Arial
15111 schaersvoo 517
fillcolor red
518
strokecolor blue
519
drag xy
520
centered
521
latex 0,0,\frac{12345}{23456} \times \frac{12345}{23456}
522
drag xy
523
centered
524
latex 5,5,\frac{12345}{\frac{12345}{ \frac{12345}{12345}}}
525
centered
526
drag xy
527
html -5,5,<table border=1><tr><td>1234567</td></tr><tr><td>1234567</td></tr><tr><td>1234567</td></tr><tr><td>1234567</td></tr></table>
528
drag xy
529
centered
530
copy 5,-5,-1,-1,-1,-1,gifs/images/skull_and_crossbones50.png
531
centered
532
drag xy
533
html 5,0,<img src=gifs/images/skull_and_crossbones50.png />
16849 obado 534
```
7991 schaersvoo 535
 
536
 
16849 obado 537
* 13/3/2020:
538
	- corrected stupid error in default replyformat
539
	- added support for touch/android for 'drag_xml()' 'drag_external_images()'
540
	- unified onclick/drag&drop answer format for MathML,JS_TeX,bitmap-images,html5-canvas-objects
541
	- compiler warnings (BPR)
14071 bpr 542
 
16849 obado 543
* 10/3/2020:
544
	- command 'rotate angle (deg)' now works for 'draw_xml()' e.g. for commands like latex,mathml,html,video,audio etc
545
	- corrected drag&drop reply for external things...
8112 schaersvoo 546
 
16849 obado 547
* 7/3/2020:
548
	- command functionlabel is now converted to js-array "functionlabel f(x)=:g(x)=:h(x)=:f'(x)="
549
	- so multiple funtion inputs may all have different colours and function agruments
8112 schaersvoo 550
 
16849 obado 551
* 6/3/2020:
552
	- added alternative command 'userdraw function,color' , is identical to 'userinput function'
553
	- added alternative command 'userdraw functions[n],color' , is identical to n-times 'userinput function' (n=1..9)
554
	- command 'multistrokecolors' or 'multicolors' may be used for setting  function argument/plot colour
14071 bpr 555
 
16849 obado 556
* 15/2/2020:
557
	- corrected flaw in drawing+zooming+multiple jscurves
558
	- userinput for arrows and polylines (forgotten and corrected)
559
	- zooming js-curves created by 'userinput function' (or should it be 'userdraw function'?...)
15111 schaersvoo 560
    will adapt to new x/y-ranges after re-clicking the 'draw' or 'OK' button. This is a flaw and not a feature !!
561
 
16849 obado 562
* 13/2/2020:
563
	- corrected stuff related to 'onclick'
564
	- corrected combo of clickreply+dragreply
15111 schaersvoo 565
 
16849 obado 566
* 11/2/2020:
567
	- corrected commands 'arc' and 'angle'
568
	- reset() will not reset the 'use_rotate' eg only 'killrotate' will set 'angle = 0.0'
569
	- default css_class="none"
570
	- corrected flaw in command 'input' ('style' is no longer needed...-> css)
15111 schaersvoo 571
 
16849 obado 572
* 9/2/2020:
573
	- restored command 'userinput function|inputfield'
574
	- 'userdraw text,color' uses `text_inputfield+mouse` and/or `text_inputfield+xy-inputfields`
15271 bpr 575
 
16849 obado 576
* 7/2/2020:
577
	- made a few corrections (Marina)
578
	- 'userinput inputfield'
15111 schaersvoo 579
 
16849 obado 580
* 6/2/2020:
581
	- added (forgotten) 'userdraw demiline(s),color'
582
	- restored command 'userinput inputfields|textarea|function'
15111 schaersvoo 583
 
16849 obado 584
* 5/2/2020:
585
	- forgotten rotation/translation for object 'segment'
586
	- restored 'setlimits' and added 'redraw_jsplot()'
587
	- added 'jsplot' to 'zoom'
15111 schaersvoo 588
 
16849 obado 589
* 4/2/2020:
590
	- restored copy/copyresized with onclick or drag xy
591
	- start with affine transformation without using canvas/html5 transform system (e.g. drag&drop&click will work for transformed objects)
15111 schaersvoo 592
    [work in progress]
16849 obado 593
	- added commands 'linear a,b,c,d' and 'killlinear|killinear' (flydraw compatibility needs to be tested)
594
	- updated internal doc's; (todo : example scripts)
595
	- added forgotten userdraw arrow(s)2,color
15111 schaersvoo 596
 
16849 obado 597
* 31/1/2020:
598
	- cleaning: removed unused js-functions
599
	- work in progress: combined drag/drop external images, draggable copy/resized images and dragstuff objects
15111 schaersvoo 600
 
16849 obado 601
* 30/1/2020:
602
	- userdraw zooming ; marked 'canvas-zoom-buttons' forbidden (eg clicking on zoom will not produce extra userdrawing clicks...)
603
	- start with cleaning...
15271 bpr 604
 
16849 obado 605
* 29/1/2020:
606
	- minor stuff
15111 schaersvoo 607
 
16849 obado 608
* 28/1/2020:
609
	- restored 'userdraw dotfill...textfill,color|text' (pattern filling)
610
	- restored 'userdraw inputs'
611
	- changed 'style' for elements by command 'css some_css' for buttons etc (style="xxxx" --> class="xxxx" )
15111 schaersvoo 612
 
16849 obado 613
* 26/1/2020:
614
	- restored 'userdraw clickfill,color' (the lrest like 'userdraw dotfill,color' not yet ready)
15111 schaersvoo 615
 
16849 obado 616
* 25/1/2020:
617
	- rightmouse click removes last drawn userdraw thing
15111 schaersvoo 618
(including svg/div/p/span/images/inputfields...eg non-canvas elements)
16849 obado 619
	- restored 'userdraw inputs,color'
15271 bpr 620
 
16849 obado 621
* 24/1/2020:
622
	- restored "userdraw" image(s),arc(s),parallelogram(s)  etc
15111 schaersvoo 623
 
16849 obado 624
* 22/1/2020:
625
	- moving "userdraw" things to separate file, simular to "multidraw"
15111 schaersvoo 626
    work in progress...not all primitives are implemented.
627
    giving further reduction of resulting javascript filesize
628
 
16849 obado 629
* 17/1/2020
630
	- zooming : added mouse wheel zoom-in-out
15111 schaersvoo 631
	    : restored panning and reset (x) is now back to original x|y min|max
632
	    : added basic support for touch devices
633
	    : TODO adjust zooming params
634
 
16849 obado 635
* 16/1/2020
636
	- removed unused variables (clang, compiled with: -Weverything)
637
	- zoom & drag/drop
638
	- TODO: zoom & other-grid-types ; use mousewheel & tablets?
15111 schaersvoo 639
 
16849 obado 640
* 11/1/2020
641
	- corrected long standing design flaw (zooming would reset dragged objects...)
642
	- modified command grid (concering zooming)
643
	- TODO : rethink zooming & panning !!
15111 schaersvoo 644
 
16849 obado 645
	```
646
	##############
647
	performance/size_reductions:
648
 
649
	U1/logic/oefmap.fr&+cmd=new&defaultlist=free01&+exo=free01&+qnum=1&+scoredelay=&+seedrepeat=0&+qcmlevel=1
650
		- old canvasdraw version approx 40 kb
651
		- new canvasdraw version approx 20 kb
652
		- latest canvasdraw version approx 18 kb
653
 
654
	H5/analysis/gebieden-1.nl&subject=4&level=0&total_exos=3&rounding=-1&usage=2&taal=nl
655
		- old canvasdraw version approx 83 kb
656
		- new canvasdraw version approx 38 kb
657
	##############
658
	```
15111 schaersvoo 659
 
16849 obado 660
	- split large files into fragments:still needs some further shifting/reorganizing
661
	- multidraw: add draw primitive: crosshair | crosshairs (draw_type no. 25 | 26)
662
    TODO: arc,angle,ellipse??
15111 schaersvoo 663
 
16849 obado 664
	- multidraw: finished fillpatterns
15111 schaersvoo 665
 
16849 obado 666
```
8379 schaersvoo 667
size 400,400
668
xrange -10,10
669
yrange -10,10
15111 schaersvoo 670
grid 1,1,grey
671
linewidth  3
672
snaptogrid
673
multilinewidth 1,2,3,1,2,3
674
multifillcolors red,green,blue,brown,cyan,yellow
675
multistrokecolors red,green,blue,brown,cyan,yellow
676
#solid, grid, hatch, diamond, dot, none
677
multifill 1,2,3,4,0
678
multidraw rects,circles,triangles,poly5,parallelogram,points
16849 obado 679
```
8379 schaersvoo 680
 
16849 obado 681
* 10/1/2020
682
	- simplified 'fillpattern' for static and dynamic objects
683
	- multidraw:
15111 schaersvoo 684
    started with implementing fillpatterns for multidraw (only rects/circles for now)
685
    command: multifill 0,1,2,3,4,5 ... none,fillcolor,grid,hatch,diamond,dot
686
    image filling not yet ready...
16849 obado 687
	- corrected flaw in 'ellipses'
688
	- corrected docs for 'ellipse | ellipses'
689
	- corrected zoom issue (minimized code increase)
8448 schaersvoo 690
 
16849 obado 691
* 8/1/2020
692
	- added a few other object to "non-html5-canvas" rotation
14071 bpr 693
 
16849 obado 694
* 6/1/2020
695
	- "stringup" now can be "onclick & dragdrop"
15111 schaersvoo 696
eg: stringup == string+angle+mouse_rotation-code
697
note: no need to reset rotation through 'killrotate'
16849 obado 698
 
699
	```
700
	onclick
701
	rotate 45
702
	string red,0,0,AAAAAA
703
	killrotate
704
	string red,4,4,BBBBBB
705
	```
706
 
707
	is identical with:
708
 
709
	```
710
	onclick
711
	stringup red,0,0,45,AAAAAA
712
	string red,4,4,BBBBBB
713
	```
14071 bpr 714
 
16849 obado 715
	- dragstuff using C-switch
716
	- code kbytes:
14071 bpr 717
 
16849 obado 718
```
15271 bpr 719
 minimal: 		 4 kb
15111 schaersvoo 720
 grid only: 		15 kb
721
 userdraw only: 	10 kb
722
 multidraw single:	18 kb
723
 multidraw all: 	40 kb
724
 onclick + objects: 	14 kb
725
 drag xy + objects: 	14 kb
726
 typical exercise : 	30 kb
16849 obado 727
```
15271 bpr 728
 
16849 obado 729
* 4/1/2020
730
	- moved dragstuff code : needs to simplify
731
	- start to move HTML5/Canvas transformation things to canvasdraw.c:
732
		- e.g. just recalculate the coordinates for objects: so there is no need for recalculating mouse coordinates in case of onclick/drag
733
		- except for 'text' and ?
734
		- keep optional mouse coordinate recalculation when using HTML5 transformations...
9266 schaersvoo 735
 
15271 bpr 736
 
16849 obado 737
* 11/2019
738
	- rewrite of multidraw code and removal of verbatim js-code
739
	A few notes:
740
	- command 'inputstyle' will be used for setting 'css class' of the multidraw control table
15111 schaersvoo 741
    for example: inputstyle wimstable
16849 obado 742
	- when using a single draw primitive , command 'multilable nocontrols' will remove the 'control buttons'
743
	- when using keyword "duplicates" || "allowdups"  multiple identical points will NOT be removed from the student answer/reply
744
	- drag&drop math typesetting onto canvasdraw image:
745
	    - multidraw|userdraw images will only work with Mathml (through !insmath etc) if you use the 'wims modules svn' version of wims_mathml !!
746
		- e.g. things like !insdraw  \mmlid{123} \frac{1}{\pi}
747
		- of course the 'id' will only be added to a single call: this will NOT work: \mmlid{1} \frac{1}{\pi} + \mmlid{2} \frac{\pi}{2}
748
	   - multidraw|userdraw images and MathJaX will not work !
749
	   - multidraw|userdraw images and native MathML and KaTeX will work
750
	- drag&drop external material onto canvasdraw image:
751
		- all objects/content of type 'p','span','div','bitmap image','svg image' with an unique 'id' and
15111 schaersvoo 752
       onclick handler "onclick='javascript:place_image_on_canvas(this.id)'" may be placed onto a canvasdraw image
753
       when 'userdraw images,boguscolor' or 'multidraw images,...' is declared.
16849 obado 754
	- currently implemented multidraw primitives:
755
		*     "point","points",
756
		*     "circle","circles",
757
		*     "line","lines",
758
		*     "segment","segments",
759
		*     "arrow","arrows",
760
		*     "triangle","triangles",
761
		*     "closedpoly",
762
		*     "text",
763
		*     "rect","rects",
764
		*     "poly","polys",
765
		*     "parallelogram","parallelograms",
766
		*     "images",
767
		*     "curvedarrow","curvedarrows",
768
		*     "curvedarrow2","curvedarrows2"
15271 bpr 769
 
16849 obado 770
	- TODO: add a few more draw primitives, like
15111 schaersvoo 771
    "crosshair(s)","ellipse(s)","arc(s) || angle(s)"...
15271 bpr 772
 
773
 
15111 schaersvoo 774
############## REWRITE ################################
11769 schaersvoo 775
 
15111 schaersvoo 776
added 'angle' to draw_xml()10/4/2020
777
typo in 'case 12' command 'arc'
16849 obado 778
 
779
* 23/3/2020
15111 schaersvoo 780
added alternative commands for a few 'multidraw' subcommands
781
typo in doc
16849 obado 782
* 29/1/2020
15111 schaersvoo 783
stringup may now be set onclick (drag&drop not supported: is implemented in 'canvasdraw.min')
784
corrected non-univeral path to wims_mathml
16849 obado 785
* 6/1/2020
15111 schaersvoo 786
forgotten to reset angle=0 in 'killrotate'
16849 obado 787
 
788
## 2019
789
* 26/12/2019
15111 schaersvoo 790
NO support for dragging and transformation / rotations
791
generic mouse coordinate transformation ( transform_mouse(x,y,obj) ) usable for 'affine transformation' and 'onclick'
16849 obado 792
* 25/12/2019
15111 schaersvoo 793
 
794
"drag" and "rotate" WILL NOT WORK !!
795
"onclick" and "rotate" may be combined. (see createxo help "rotate")
796
 
797
adjusted documentation.
798
string/text using 'xoffset','xyoffset','yoffset' will now use a 2*linewidth marge
799
22/12/2019
800
 
16849 obado 801
object 10: clicked
15271 bpr 802
object 9 : clicked
15111 schaersvoo 803
object 8 : not clicked
804
object 7 : not clicked
805
object 6 : clicked
806
object 5 : moved from (1:2) -> (2:2)
807
object 4 : not moved
808
object 3 : moved from (1:1) -> (3:3)
809
object 2 : moved from (1:3) -> (3:2)
810
object 1 : moved from (1:0) -> (2:1)
811
object 0 : not moved
812
reply = ["not_moved", "1:1:0:2:1:0", "2:0:1:3:2:0", "3:1:1:3:3:0", "not_moved", "5:1:2:2:2:0",1,0,0,1,1]
15271 bpr 813
for example:
15111 schaersvoo 814
 
815
the clicked objects are '0' or '1'
816
obj_number,xorg[0],yorg[0],xnew[0],ynew[0],new_angle
817
moved object are items in the javascript reply array...in the same order as their appearance in the fly_script
818
unmoved object are labelled "not_moved" !
819
"onclick" and "drag x|y|xy" may now be used together and all data be read using "read_dragdrop()"
820
 
821
[ these are bugs, not features... ]
822
drag xy & rotate are only compatible if you are using a 'slider'
823
onclick & rotate are not compatible
824
impoved mouse selection of text (height of selection box was not ok)
825
corrected missing font-change when text was set 'onclick' [BPR]
826
 
16849 obado 827
* 21/12/2019
15111 schaersvoo 828
corrected wrong hexcolor conversion [Sophie Lemaire]
16849 obado 829
 
830
* 12/11/2019
15111 schaersvoo 831
if set, multiple identical points will NOT be removed from the student answer/reply
832
added keyword "duplicates" || "allowdups" for default "multidraw" replyformat
16849 obado 833
* 9/11/2019
15111 schaersvoo 834
corrected multidraw curvedarrows numeric input [BPR]
16849 obado 835
* 8/11/2019
836
correction in multidraw circles : list_uniq(A,B,C) will reserve 'C' for non-numeric answers !
15111 schaersvoo 837
 
16849 obado 838
* 2/11/2019
15271 bpr 839
this will break module "H4/logic/logica-1.nl/exos/exo14" (only dutch module, so no serious conflicts)
15111 schaersvoo 840
reply format for "multidraw" in case of "circles" will give radius in x-range [BPR]
841
 
16849 obado 842
* 2/11/2019
843
 
844
```
15111 schaersvoo 845
#######
846
}
847
<input type="button" onclick="alert(read_dragdrop());" value="read_dragdrop()" />
848
<input type="button" onclick="alert(read_canvas());" value="read_canvas()" />
849
 
850
 
851
</script>
852
 find_images();
853
 };
854
  };
855
   };
856
    img.setAttribute('onclick','javascript:place_image_on_canvas(this.id);');
857
    idx++;
858
    img.setAttribute('id','drag_'+idx);
859
   if(id.indexOf('insert')!= -1){
860
   var id = img.id;
861
   var img = images[p];
862
  for(var p=0;p<len;p++){
863
  var idx=0;
864
  var len = images.length;
865
  var images = document.getElementsByTagName('img');
866
 /* look for images with 'insert' in the 'id'*/
867
 function find_images(){
868
 };
869
   if(typeof fun === 'function'){return fun();};
15271 bpr 870
   var fun = eval("read_dragdrop"+canvas_scripts[0]);
15111 schaersvoo 871
 function read_dragdrop(){
872
 };
873
   if( typeof fun === 'function'){ return fun();};
874
   var fun = eval("read_canvas"+canvas_scripts[0]);
875
 function read_canvas(){
876
<script type="text/javascript">
877
 
878
</table>
15271 bpr 879
 <tr><th> <img src="gifs/en.gif"  id="insert_en" /> </th><th>  <img src="gifs/nl.gif"  id="insert_nl" /> </th><th>  <img src="gifs/cn.gif"  id="insert_cn" />  </th><th>  <img src="gifs/it.gif"  id="insert_it" />  </th></tr>
880
 <tr><th> \I1   </th><th> \I2 </th><th> \I3 </th><th> \I4 </th></tr>
881
 <tr><th> \(\M1\) </th><th> \(\M2)</th><th> \(\M3) </th><th> \(\M4\) </th></tr>
882
 <tr><th> M1   </th><th> M2 </th><th> M3 </th><th> M4 </th></tr>
15111 schaersvoo 883
<table border="1">
884
}
885
# multidraw images
886
userdraw images,red
11764 schaersvoo 887
snaptogrid
15111 schaersvoo 888
centered
889
grid 2,2,grey,1,1,6,grey
890
axisnumbering
891
axis
892
precision 1
893
yrange -10,10
894
xrange -10,10
895
bgcolor white
896
\canvasdraw{500,500}{
11769 schaersvoo 897
 
15111 schaersvoo 898
\statement{
11820 schaersvoo 899
 
15111 schaersvoo 900
\text{divstyle="display:inline-block;width:auto;text-align: center;"}
15271 bpr 901
\text{I4=<img style="width:50%;height:50%" onclick="javascript:place_image_on_canvas(this.id);" src="modules/data/chemistry/mol2D.fr/images/100_39_0.png" id="I4" />}
15111 schaersvoo 902
\text{I3=<img style="width:50%;height:50%" onclick="javascript:place_image_on_canvas(this.id);" src="modules/data/chemistry/mol2D.fr/images/1002_69_3.png" id="I3" />}
903
\text{I2=<img style="width:50%;height:50%" onclick="javascript:place_image_on_canvas(this.id);" src="modules/data/chemistry/mol2D.fr/images/1002_57_9.png" id="I2" />}
904
\text{I1=<img style="width:50%;height:50%" onclick="javascript:place_image_on_canvas(this.id);" src="modules/data/chemistry/mol2D.fr/images/1002_28_4.png" id="I1" />}
905
\text{M4=\mmlid{M4}\xrightarrow{\rm N_2 \uparrow}}
906
\text{M3=\mmlid{M3}\xrightarrow{\rm O_2 \uparrow}}
907
\text{M2=\mmlid{M2}\xrightarrow{\rm H_2 \uparrow}}
908
\text{M1=\mmlid{M1}\xrightarrow{\text{reaction}}}
909
##### example OEF...
16849 obado 910
```
11823 schaersvoo 911
 
16849 obado 912
	- 'userdraw images,bogus color' : right mouse click removes item/object under mouse pointer
913
	- solving issue with size of dynamic created div's in 'userdraw images,color' and 'multidraw images'
11823 schaersvoo 914
 
16849 obado 915
* 26/9/2019
15111 schaersvoo 916
 
917
multidraw images
918
userdraw images,red
919
using command:
920
including KaTeX or MathJaX js-typesetting, MathML,bitmap, and any other html content,
921
All 'svg','div','span' elements on page may be used to drop onto canvas,
16849 obado 922
 
923
* 17/9/2019
15111 schaersvoo 924
on touch devices the canvasdraw inputfields could not be used
925
add attrubute autofocus,true to function 'add_inputs()'
926
 
16849 obado 927
* 8/9/2019
15111 schaersvoo 928
will now accept anything from the exercise page (including MathML,MathJaX,KaTeX typesetting) if included a 'div' with unique id and onclick='javascript:place_image_on_canvas(this.id);'
929
multidraw images
15271 bpr 930
userdraw images,somecolor
15111 schaersvoo 931
 
16849 obado 932
* 5/9/2019
15111 schaersvoo 933
case killslider: replaced 'int p' by loop indicator 'i' [obado]
934
 
16849 obado 935
* 27/8/2019
15111 schaersvoo 936
TEMPORARY ---> all browsers are type 'GECKO' and MathJaX will take care of all others in command 'latex'
937
 
938
in case of KaTeX only use command 'latex x,y,tex_string'
939
command mathml is only suitable for "GECKO" and "NON-GECKO+MathJaX"
940
command latex calls 'getMML()' e.g. 'wims_mathml'  in case of "GECKO"
941
 
16849 obado 942
* 26/8/2019
15111 schaersvoo 943
Needs looking into. In mathml.c: katex div: 'display:block;visibility:hidden'./SCHAERSVOORDE/H1/algebra/vergelijkingen-1.nl/exos/exo9:mathml 0,10,10,0,$fun\
15271 bpr 944
setting 'drag_type = -1' to drag KaTeX with left top corner...problems reading width of created div's/span's
15111 schaersvoo 945
WORK IN PROGRESS ( canvasdraw will need to call wims_mathml in case of GECKO browsers!)
946
to be used for KaTeX
947
Added command 'latex x,y,tex-string
948
 
16849 obado 949
* 25/8/2019
950
 
951
```
15111 schaersvoo 952
fcircles blue,3,3,1
953
drag xy
954
angle 0,0,2,0,0,red
955
fillpattern dot
956
arrow 0,0,5,0,7,red
957
fillcolor blue
958
slider -pi,pi,250,30,angle degrees,Rotate
959
opacity 200,100
960
fillcolor white
961
rotationcenter 0,0
962
linewidth 3
963
precision 1000
964
yrange -5,5
11820 schaersvoo 965
xrange -5,5
15111 schaersvoo 966
size 300,300
16849 obado 967
```
15111 schaersvoo 968
 
15271 bpr 969
- click on 'reset' will deactivate all
15111 schaersvoo 970
- click on objects will activate
971
- command 'angle x0,y0,x1,y1,angle,color' will always be active in case of a rotation slider.
972
- drag x|y|xy may be combined with slider(s)
973
- snapto* will not work !
974
in slider exercises:
975
 
976
onclick and dragdrop may be combined, but is not really usefull :)
977
- every onclick object starts with obj.onclick_cnt = 0... when clicked obj.click_cnt = 1
978
- only the first element of a row is important (obj.click_cnt), which is 0 or 1
979
in onclick exercises
980
 
981
- obj.click_cnt is the objects sequence number (starting with '0' for the first draggable object in the script)
982
- only clicked objects have a line in the reply
983
in dragdrop exercises:
984
 
985
obj.click_cnt+','+obj.xorg[0]+','+obj.yorg[0]+','+current_x+','+current_y+','+current_angle+';\\n
986
dragdrop reply is now in format:
987
broken modules adapted
988
 
16849 obado 989
* 15/8/2019
990
 
15111 schaersvoo 991
   -- todo: restore slider 'follow_function system'
15271 bpr 992
6) -- todo: restore xy-slider??
15111 schaersvoo 993
6) finished: reply&display precision and reply-format
15271 bpr 994
5) finished: restored slider display 'system'
15111 schaersvoo 995
4) finished: slider rotation with preservation of coordinates e.g. 'mouse dragging' is supported
996
3) finished: group selection (just by clicking...no 'lasso')
15271 bpr 997
2) finished: real coordinates when using 'drag & manual rotating' objects
15111 schaersvoo 998
1) finished: multiple sliders per object or objects (until 'killslider')
999
targets:
1000
 
16849 obado 1001
* 8/2019 rewriting of slider stuff (reponse to request/question of BPR)
15111 schaersvoo 1002
 
16849 obado 1003
* 10/8 correctedd stupid typo in DRAW_EXTERNAL_IMAGES
15271 bpr 1004
and corrected snapping to grid
15111 schaersvoo 1005
corrected flaw in multidraw cirle [BPR]
16849 obado 1006
* 3/7/2019
15111 schaersvoo 1007
removed 'touchend' (MC)
16849 obado 1008
* 22/6/2019
15111 schaersvoo 1009
(changes should be made, not yet fixed)
1010
work on the documentation: add '' ``for emphased words and <code></code>
16849 obado 1011
* 08/06/2019
1012
`userdraw circles,red`
15111 schaersvoo 1013
is identical to
16849 obado 1014
`multidraw circles
1015
strokecolor red
1016
multilabel NOCONTROLS`
15111 schaersvoo 1017
 
1018
in multidraw NOCONTROLS and a single object, no need for a 'draw object' button. It's analogue to userdraw.
1019
in multidraw right mouse click will remove last drawn object of the currently selected  draw primitive
16849 obado 1020
 
1021
* 7/6
15111 schaersvoo 1022
added ruler & protractor to new multisnap_check(x,y,use_snap);
1023
 
16849 obado 1024
```
15111 schaersvoo 1025
#<input type='button' onclick='javascript:var fun=eval("clear_draw_area"+canvas_scripts[0]);fun(9,0);' value='REMOVE LAST ARROW ' />
1026
<input type='button' onclick='javascript:var fun=eval("clear_draw_area"+canvas_scripts[0]);fun(24,0);' value='REMOVE LAST CURVEDARROW2 ' />
1027
<input type='button' onclick='javascript:userdraw_primitive=24;multidraw_click_cnt = 0;' value='start drawing curvedarrows2' /> etc etc
1028
<input type='button' onclick='javascript:userdraw_primitive=null' value='STOP DRAWING' />
16849 obado 1029
```
15111 schaersvoo 1030
controls for example:
16849 obado 1031
 
1032
```
15111 schaersvoo 1033
curvedarrows2 = 24
1034
curvedarrow2 = 23
1035
curvedarrows = 22
1036
curvedarrow = 21
1037
images = 20
1038
parallelograms = 19
1039
parallelogram = 18
1040
polys[3-9] = 17
1041
poly[3-9] = 16
1042
rects = 15
1043
rect = 14
1044
text = 13
1045
closedspoly = 12
1046
triangles = 11
1047
triangle = 10
1048
arrows = 9
1049
arrow = 8
1050
segments = 7
1051
segment = 6
1052
lines = 5
1053
line = 4
1054
circles = 3
1055
circle = 2
1056
points =1
1057
point = 0
16849 obado 1058
```
15111 schaersvoo 1059
The object types are internally represented by the following numbers (makeing typo's will render your exercise null and void)
1060
To activate this feature, use multilabel NOCONTROLS
1061
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...
1062
### from doc's
1063
6/6 added keyword 'NOCONTROLS' to disable all buttons for multidraw
1064
 
1065
command 'drag xy|x|y' was fallen of the wagon...
1066
 
1067
don't touch replyformat 29: it is universal and for multidraw  !
1068
todo: modify/change 6,10,11,15,16,17,18,19,20,25,27,31
1069
 
1070
OEF : replyformat		22,23,28
1071
USERDRAW DEFAULTS: replyformat  2,6,8,10,11,15,16,17,18,19,20,23,24,25,27,29,31
1072
SCHAERSVOORDE : replyformat	2,7,8,21,22,23,24
1073
Starting with unifying the 'replyformat' jungle...without touching existing modules
1074
A single function "multisnap_check(x,y,use_snap)" will return xy[2] array with corrected  coordinates
1075
 
16849 obado 1076
* 5/6 removed confusing code about 'snapping to something' and unified it in a single variable 'use_snap=0,1,2,3,4' for 'dragstuff library', 'userdraw' and 'multidraw'
1077
* 4/6 modified 'find_angle()' now using Math.atan2(x,y) ... smooth turning 360+ without flipping...see 'protractor'
1078
 
1079
```
1080
<script>
15111 schaersvoo 1081
 resize_svg_mathml(mythings);
1082
 var mythings = [ array_with_image_id's ];
1083
 };
1084
  };
1085
   svg.setAttribute("width", w+'px');
1086
   svg.setAttribute("height", h+'px');
1087
   var h = parseInt(getComputedStyle(div).height);
1088
   var w = parseInt(getComputedStyle(div).width);
1089
   var div = document.getElementById(mythings[p+1]);
1090
   var svg = document.getElementById(mythings[p]);
1091
  for(var p=0; p < len ; lpp){
1092
  var len = mythings.length;
1093
 function resize_svg_mathml( mythings ){
1094
<script type="text/javascript">
1095
To resize and used the svg element, a small piece of javascript is needed..
1096
</svg>
1097
</foreignObject>
1098
<div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;width:auto;text-align: center;" > MATHML </div>
1099
<foreignObject width="100%" height="100%">
1100
<svg xmlns="http://www.w3.org/2000/svg" width="1px" height="1px" onclick="javascript:place_image_on_canvas(this.id);" id='my_id'>
16849 obado 1101
```
1102
when the MathML code is embedded in a foreignObject, a div and an svg with size 1px, like in:
15111 schaersvoo 1103
On Gecko browsers there is an option to include MathML from the page onto the canvas,
1104
The 'id' and (x;y) coordinates will be returned using read_canvas();
16849 obado 1105
`<img src="somewhere" id="myid" onclick="javascript:place_image_on_canvas(this.id)" alt="hmm" />`
15111 schaersvoo 1106
Images (bitmap or svg) present in the exercise page and the img-tag with an unique 'id' and onclick='javascript:place_image_on_canvas(this.id)' can be placed onto the canvas.
1107
(*)
1108
 
1109
multidraw curvedimages,curvedimages2
1110
multidraw images  (*)
1111
userdraw curvedimages2,color
1112
userdraw curvedimages,color
1113
userdraw curvedimage2,color
1114
userdraw curvedimage,color
1115
userdraw images,boguscolor (*)
1116
using: in canvasdraw.c: int use_snap = 0; /* 0 = none 1=grid : 2=x-grid : 3=y-grid : 4=snap to points ... to finally harmonize the 'snap to grid etc etc */
1117
using multisnap_check(x,y,snap_type)
1118
preparing replyformat 29 (multidraw) as generic reply system (every object has a line, every line is a matrix)
1119
Merged with wimsmodules:
1120
 
1121
 
1122
y1,y2,yc,...
1123
x1,x2,xc,...
1124
default replyformat = 2
1125
 
16849 obado 1126
* 3/6 curvedarrow now has 3 points :
1127
 
15111 schaersvoo 1128
added to multidraw family 'curvedarrow' and 'curvedarrow2'
1129
added to dragstuff library objects 'curvedarrows color,x1,y1,xc,yc,x2,y2,...' and  'curvedarrows2 color,x1,y1,xc,yc,x2,y2,...'
1130
just to be complete...
1131
added to dragstuff library objects 'curvedarrow x1,y1,xc,yc,x2,y2,color' and  'curvedarrow2 x1,y1,xc,yc,x2,y2,color'
1132
added 'userdraw curvedarrow2,color' and 'userdraw curvedarrows2,color'
16849 obado 1133
 
1134
* 1/6/2019
15111 schaersvoo 1135
TODO: add curvedarrow to dragstuff object library
1136
TODO: multidraw curvedarrow
1137
TODO: 'userdraw curvedarrow2,color' and  'userdraw curvedarrows2,color'
16849 obado 1138
* 31/5/2019 added userdraw primitive 'userdraw curvedarrow,color' and  'userdraw curvedarrows,color'
1139
* 15/5/2019 dragging external images now centers the image around the mouse pointer
15111 schaersvoo 1140
all other drag&drop things (canvas related and div's (from xml/mathml) seem to work fine, only dragging of images fails
1141
this -however- does not seem to correct the problem om 'styled' wims-servers [BPR].
1142
draw_external images now makes use of the same dragstuff.getMouse()
16849 obado 1143
* 14/5/2019 problems with dragging images...
1144
* 13/5/2019 bugfix command angle|arc combined with command 'slider'...slidervalue is in radians...arc|angle needs degrees
1145
* 11/5/2019 add some examples for OEF [BPR] (work in progress)
1146
* 4/3/2019 corrected fontsize behaviour of command 'text' (always trouble between 'fontsize' and 'fontfamily' commands) [BPR]
1147
* 2/2/2019 corrected behaviour of replyformat 11 etc (dealing with (x1:y1)---<x2:y2) )
15111 schaersvoo 1148
 
16849 obado 1149
```
15111 schaersvoo 1150
jsplot red,4*cos(2*x),2*sin(3*x-pi/6),cos(x),3*sin(x),3*cos(x),sin(x),x,x^2
1151
multistrokecolors red,red,blue,blue,green,green,orange,orange
1152
precision 1000
1153
linewidth 1
1154
animate
1155
trange -pi,pi
1156
fillcolor blue
1157
linewidth 4
1158
grid 1,1,grey,4,4,7,black
1159
opacity 100,190
1160
axisnumbering
1161
axis
1162
precision 0
11820 schaersvoo 1163
yrange -5,5
15111 schaersvoo 1164
xrange -5,5
1165
size 400,400
16849 obado 1166
```
15111 schaersvoo 1167
(command animate may only be used once)
16849 obado 1168
 
1169
* 28/12 multiple animated curves using command jsplot
1170
* 25 --> 26
15111 schaersvoo 1171
corrected "snprintf(tmp_buffer,25,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer);"
16849 obado 1172
* 15/10 BPR
1173
* 12/4 piechart will show 'legend' text inside piechart when using keyword 'centered': use fill opacity to enhance visibility
1174
* 14/3/2018 draw_crosshairs: forgotten ctx.save(); (crosshairs will 'move' with every click...)
1175
* 13/11 live docs
1176
* 12/11 added command 'ellipses'
1177
* 6/11 added few things to "live documentation" work in progress
1178
* 18/10 reoganised string/text keywords 'centered','xoffset','yoffset','xyoffset'
1179
* 8/10 remove duplicates while drawing 2-point objects (circle/line/demiline/segment/rect)
15111 schaersvoo 1180
 
16849 obado 1181
* 4/10 work in progress: adding examples to documentation (the "example:"  flag can be used to extract)
15111 schaersvoo 1182
 
16849 obado 1183
* 2/10 fixed bugs (thx B.Perrin)
1184
* 28/9 bug fix : variable use_axis_numbering was reset by introduction of numberline command...
1185
* 20/9 bug fix in command curve (a parameter was wrongly set, resulting in curve being type=13 (is a circle) insteadof type=9
15111 schaersvoo 1186
 
16849 obado 1187
```
15111 schaersvoo 1188
mouse blue,22
1189
precision 1
1190
userinput function
1191
functionlabel f(x)=
1192
strokecolor green
1193
jsplot red,4*cos(2*x),2*sin(3*x-pi/6)
1194
precision 1000
11820 schaersvoo 1195
linewidth 1
15111 schaersvoo 1196
animate
1197
trange -pi,pi
1198
fillcolor blue
1199
linewidth 4
1200
grid 1,1,grey,2,2,5,black
1201
opacity 100,190
1202
axisnumbering
1203
axis
1204
precision 0
1205
yrange -5,5
1206
xrange -2*pi,2*pi
1207
size 400,400
1208
popup
16849 obado 1209
```
11824 schaersvoo 1210
 
16849 obado 1211
* 17/9 added basic 'point_on_curve' animation (parametric and 'normal' functions)
11837 schaersvoo 1212
 
16849 obado 1213
```
15111 schaersvoo 1214
zoom red
1215
numberline -5,5,2,10,-3.5,-3
1216
zoom red
1217
xaxis -4:AAAAA:-2:BBBBB:2:CCCCC:4:DDDDD
1218
strokecolor purple
1219
numberline -5,5,1,8,-2,-1.5
1220
xaxisup -4:AAAA:-2:BBBB:2:CCCC:4:DDDD
1221
strokecolor blue
1222
numberline -5,5,1,5,2,2.5
1223
xaxis -4:AAA:-2:BBB:2:CCC:4:DDD
1224
strokecolor green
1225
numberline -5,5,1,4,4,4.5
1226
xaxisup -4:AA:-2:BB:2:CC:4:DD
1227
strokecolor red
1228
opacity 255,255
1229
grid 1,1,grey
1230
hline 0,0,black
1231
xaxis -4:A:-2:B:2:C:4:D
1232
noyaxis
1233
yrange -5,5
11837 schaersvoo 1234
xrange -5,5
15111 schaersvoo 1235
size 400,400
16849 obado 1236
```
15111 schaersvoo 1237
     adding y-offset when x-values overlap.
1238
     multiple numberlines are allowed using multiple 'xaxis' commmands for labeling several numberlines, including a x-axis label in command grid...
1239
     numberline is mapped to xrange/yrange
16849 obado 1240
* 15/9 added command macro "numberline x0,x1,xmajor,xminor,y0,y1"
15111 schaersvoo 1241
 
1242
     solved long  standing issue with color 0,0,0 (black) as fill border
1243
     added 'fixed' pattern filling to primitives 'boxplot' and 'piechart'
16849 obado 1244
* 6/9  just for completeness: added pattern filling to all fillable userdraw primitives
15111 schaersvoo 1245
 
16849 obado 1246
```
15111 schaersvoo 1247
clearbutton removed
1248
userdraw gridfill,red
1249
circle 10,10,100,red
1250
imagefill 0,0,0,gifs/en.gif
1251
# syntax: x,y,scale?,image
1252
plot blue,-x^2+4
1253
plot red,x^2-4
11837 schaersvoo 1254
yrange -5,5
15111 schaersvoo 1255
xrange -5,5
1256
size 150,150
16849 obado 1257
```
11839 schaersvoo 1258
 
15111 schaersvoo 1259
NOTE: special filling (hatch,dot,...,image) should be harmonized to include userdraw and drag&drop library objects !!
1260
26/8 command imagefill x0,y0,URL now works like flydraw should
1261
 
16849 obado 1262
```
15111 schaersvoo 1263
fcircle 2,-3,100,cyan
11854 schaersvoo 1264
drag xy
15111 schaersvoo 1265
fillpattern gifs/fr.gif
1266
fcircle 2,3,100,green
11854 schaersvoo 1267
drag xy
15111 schaersvoo 1268
fillpattern gifs/de.gif
11854 schaersvoo 1269
fcircle -2,-3,100,red
1270
drag xy
15111 schaersvoo 1271
fillpattern gifs/nl.gif
1272
fcircle -2,3,100,blue
11854 schaersvoo 1273
drag xy
15111 schaersvoo 1274
fillpattern gifs/en.gif
1275
snaptogrid
1276
yrange -5,5
1277
xrange -5,5
1278
size 400,400
16849 obado 1279
```
14071 bpr 1280
 
16849 obado 1281
note: needs an alert for synchrone loading of images (TO DO: closures in fill routines ? )
1282
 
1283
* 25/8	added commmand 'fillpattern image_url' to use an image as 'ctx.fillStyle()'
1284
* 20/8	added patternfilling to 'userdraw' family
1285
 
1286
```
15111 schaersvoo 1287
zoom red
1288
userdraw dotfill,blue
1289
fcircle 3,-3,160,cyan
1290
filpattern diamond
1291
fcircle 0,3,160,green
1292
fillpattern hatch
1293
fcircle -3,-3,160,red
1294
fillpattern dot
1295
fcircle -6,3,160,blue
1296
fillpattern grid
1297
opacity 165,160
1298
yrange -5,5
11858 schaersvoo 1299
xrange -5,5
15111 schaersvoo 1300
size 370,370
16849 obado 1301
```
11874 schaersvoo 1302
 
16849 obado 1303
* 18/8	added command 'fillpattern grid | dot | hatch | diamond'
1304
* 14/8 	added commands 'textfill x,y,color,sometext' and 'userdraw textfill,color,some_text'
1305
* 13/8	updated html docs
11891 schaersvoo 1306
 
16849 obado 1307
```
15111 schaersvoo 1308
clearbutton REMOVE
1309
fill 0,5,red
1310
gridfill 4,0,3,3,blue
1311
diamondfill -4,0,6,6,cyan
1312
dotfill 0,0,6,6,green
1313
linewidth 1
1314
userdraw hatchfill,red
1315
plot blue,-x^2+4
1316
plot red,x^2-4
1317
yrange -5,5
11891 schaersvoo 1318
xrange -5,5
15111 schaersvoo 1319
size 150,150
16849 obado 1320
```
11891 schaersvoo 1321
 
15111 schaersvoo 1322
	userdraw clickfill,color (will use only color,no pattern)
1323
	userdraw hatchfill,color
1324
	userdraw dotfill,color
1325
	userdraw gridfill,color
1326
	userdraw diamondfill,color
11893 schaersvoo 1327
 
16849 obado 1328
* 12/8  added to userdraw family (not yet 'cleaned' the js-code)  the commands:
1329
* 11/8  function 'find_angle' was gone fishing in case of command 'protractor'
1330
        added gridfill,hatchfill,diamondfill
15111 schaersvoo 1331
example:
1332
     added pattern to command 'userdraw clickfill,color'
1333
     other patterns will -hopefully- follow
16849 obado 1334
* 10/8 premature version of pattern filling ; for now only 'dotfill x,y,dx,dy,color'
15111 schaersvoo 1335
     if set the text will not start at given (x:y) but end at (x:y)
16849 obado 1336
* 8/8  added keyword 'yoffset' for use with rotated text strings (command textup or stringup)
1337
* 4/8  multidraw primitive 'text' is now always x-centered on click-coordinates
15111 schaersvoo 1338
     reorganized canvasdraw.c : commands in alfabetical order (cleaning & formatting not yet ready)
1339
     (added 'this.use_once')
16849 obado 1340
* 3/8  corrected flaw introduced by keywords xyoffset etc... removed repeated shifting of text-strings in redraw of canvas
15111 schaersvoo 1341
     the inputfields will be x/y centered on (x:y)... default was left top corner
1342
     keyword xoffset also active for commands 'input x,y,size,editable,value'  and 'userdraw input(s),color'
16849 obado 1343
* 2/8  added keywords xyoffset,xoffset|centered,resetoffset for easier text-label placing close to 'objects' like crosshairs,points...
1344
* 26/7 multidraw_button_table now centered in tooltip placeholder div element (using style="margin: 0 auto;" )
1345
* 25/7 multidraw command 'text' now will place a 'text string' on canvas via a mouse-click or (if command multiuserinput is set to 1 for 'text') via x/y inputfields
1346
* 24/7 corrected multidraw text error (duplicate text)
1347
* 15/7 added command 'fillall color,x1,y1,x2,y2,x3,y3...xn,yn' for filling multiple speparated areas with the same color
1348
* 14/7 set timeout on clickfill and while waiting set cursor to 'wait'
11996 schaersvoo 1349
 
16849 obado 1350
```
15111 schaersvoo 1351
clearbutton REMOVE
1352
userdraw clickfill,purple
1353
colorpalette orange,yellow,red,green,lightgreen,blue,lightblue,cyan
1354
# multifillcolors orange,yellow,red,green,lightgreen,blue,lightblue,cyan
1355
replyformat 10
1356
snaptogrid
1357
grid 1,1,grey
1358
canvastype 4
1359
# use the grid canvas 4 as fill borders
1360
yrange -5,5
1361
xrange -5,5
13514 schaersvoo 1362
size 400,400
16849 obado 1363
```
15111 schaersvoo 1364
example of a simple clicktile in direct exec:
13521 schaersvoo 1365
 
16849 obado 1366
      this will bind coordinates with color...if the exercise wishes.
15111 schaersvoo 1367
      added command 'colorpalette color1,color2...color2' for creation of color-buttons to change the click color.
14038 schaersvoo 1368
 
15111 schaersvoo 1369
      to identify the correct color on the correct area...
1370
      When using something like 'replyformat 10' or another format reporting the 'userdraw_radius[]' the color-number will be part of 'read_canvas()'
1371
      the colors will re-cycle when there are more clicks than colors...
16849 obado 1372
 
1373
* 13/7  'userdraw clickfill,color' may now make use  of command 'multifillcolors color1,color2,color3...color_n'
15111 schaersvoo 1374
      fill commands may be used together with 'userdraw clickfill,color'
1375
      (it will still ignore the bordercolor...I just can't make this work... grrr )
1376
      comman 'filltoborder x,y,bordercolor,color' is still the same as fill
1377
      command 'fill x,y,color' or 'floodfill c,y,color' may now be used multiple times.
14035 schaersvoo 1378
 
15111 schaersvoo 1379
      read_canvas() will return the click-coordinates
1380
      areas can be removed (after confirm 'clear ?' ) with command 'clearbutton some_text'
16849 obado 1381
* 11/7  now 'userdraw clickfill,color' can fill multiple selected area's
15111 schaersvoo 1382
      (although this is possible through foreignobject --> blob --> image --> canvas )
16849 obado 1383
      will be located at (1:0) and the mathml will decide the width and height of the drag/click div's (the div's are added to the 'mother' div and not -of c ourse- to the html5 canvas
1384
 
1385
      ```mathml 1,0,-10000,10000, <span style="font-size:1em;">
1386
      <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
1387
       <mstyle id="wims_mathml347806" mathsize="110%">
1388
        <mstyle mathsize="200%">
1389
         <mstyle displaystyle="true">
1390
          <mfrac>
1391
           <mi>?</mi>
1392
           <mrow><mi>sin</mi>
1393
            <mrow>
1394
             <mo stretchy="true">(</mo>
1395
             <mstyle displaystyle="true">
1396
              <mfrac><mi>?</mi><mi>?</mi></mfrac>
1397
             </mstyle>
1398
             <mo stretchy="true">)</mo>
1399
            </mrow>
1400
           </mrow>
1401
          </mfrac>
1402
         </mstyle>
1403
        </mstyle>
1404
       </mstyle>
1405
      </math></span>```
1406
 
15111 schaersvoo 1407
      so the left top corner of
1408
      however, the  values must still be defined (syntax backwards compatibility)
16849 obado 1409
 
1410
* 8/7   command mathml will use fill_color/fill_opacity when dragged / clicked ; x2,y2 (used for determining the width/height of the embedded mathml div, are no longer used
1411
* 6/7   improved onclick & (standard) reply format
1412
* 5/7   improved drag&drop in case of mathml (or better all xml/html inclusives)
1413
* 4/7   corrected -again?- color cludge in 'barchart'...
1414
* 20/5  added forgotten minimal touch-support for multidraw routines
15111 schaersvoo 1415
      drag xy|x|y and [xy]snaptogrid are supproted
1416
      (it's not really dragging , but selecting and moving to a new location by click)
16849 obado 1417
* 12/2  added very primitive dragging to 'mathml'
14038 schaersvoo 1418
 
16849 obado 1419
	```
15111 schaersvoo 1420
      line 11 = text_x+";"+text_y+";"+text"\n"
1421
      line 10 = parallelogram_x+";"+parallelogram_y+"\n"
1422
      line 9 = closedpoly_x+";"+closedpoly_y+"\n"
1423
      line 8 = rects_x +";"+rects_y+"\n"
1424
      line 7 = polys[3-9]_x+";"+polys[3-9]_y+"\n"
1425
      line 6 = triangles_x+";"+triangles_y+"\n"
1426
      line 5 = lines_x+";"+lines_y+"\n"
1427
      line 4 = arrows_x+";"+arrows_y+"\n"
1428
      line 3 = segments_x+";"+segments_y+"\n"
1429
      line 2 = circles_x+";"+circlespoint_y+";"+multi_radius+"\n"
1430
      line 1 = points_x+";"+points_y+"\n"
16849 obado 1431
   ```
15111 schaersvoo 1432
      The output is always a 11 lines string with fixed sequence.
14038 schaersvoo 1433
 
15111 schaersvoo 1434
      multiple parallograms may be used: the coordinates are stored in "line 10" in the reply
1435
      multiple polys[3-9] may be used: poly[3-9] or polys[3-9] has "line 7" in the reply
1436
      removed command poly[s][3-9] and parallelogram[s] from 'triangle' sub-command and used as additional commands.
1437
      command multidraw
16849 obado 1438
* 9/2
1439
 
1440
## 2017
15111 schaersvoo 1441
      the same  canvas :making it possible to do a 'userdraw clickfill,color' & pan & zoom on the single js-curves-canvas
16849 obado 1442
* 30/10 added some options to command jsplot/jscurve: multiple js-curves may now be plot in a single command and on
15111 schaersvoo 1443
      But it's still a vary ugly cludge caused by the "Flydraw backwards compatibility"
1444
      then this family&size will be used.
1445
      if command "fontfamily 'size px Family'" was given and the size of "m" is larger then a set/default fontsize
16849 obado 1446
      the context will use this fontsize in Arial...
1447
      if command "fontsize int" is given and it's size is larger than the default fontfamily "12px Arial"
1448
 
1449
      ```
15111 schaersvoo 1450
      ###
16849 obado 1451
      if( font_size > tmp_font_size ){context_userdraw.font = font_size+\"px Arial\";};
15111 schaersvoo 1452
      var tmp_font_size = parseInt(context_userdraw.measureText(\"m\").width);\
1453
      ###
16849 obado 1454
      ```
15111 schaersvoo 1455
      corrected cludge of fontsize versus fontfamily :
1456
      color was taken from fontcolor... and not from userdraw command... which is color --> strokecolor
16849 obado 1457
* 29/10 corrected "userdraw text,color" :
1458
      `x1,y1,text1 \n x2,y2,text2 \n` etc
15111 schaersvoo 1459
      changed the default replyformat for 'userdraw text,color' and 'userdraw input(s),color' to the type:
1460
      (in both cases a right | middle button click will always remove the drawings
1461
      and added to 'clearbutton' the removal of inputfields produced by command "userdraw input(s),color"
16849 obado 1462
* 28/10 corrected ctx-reset flaw in "userdraw text,color" when removing text with the "clearbutton xxx"
1463
* 24/10 command vline | hline now have range -100*xmin | 100*ymax : so on "moderate" zooming there will still be a vline | hline
1464
* 13/10 added keywords "noxaxis" "noyaxis" to "grid" command family
1465
* 8/10  canvasinfo.sh will (after chmod +x) generate also canvasdraw.phtml and move it to "../../../public_html/scripts/help/en"
15111 schaersvoo 1466
      so now every userdraw object may be deleted (indiviually) by a right mouse click...middle click still no good
1467
      added 'oncontextmenu="return false;"' to main canvas_div to disable context menu with right click on image
16849 obado 1468
* 7/10  added snapto*** to "userdraw clickfill,color"
1469
* 6/10  moved command "clickfill color" to the userdraw command list e.g. userdraw clickfill,color: clickfill is per default on the drag_canvas (unless you specify an other canvastype)
1470
* 5/10  added support for touch devices
1471
* 30/9  `clear_draw_area()` used by "clearbutton txt"  did not reset the internal click-count-variable "xy_cnt"
1472
* 29/9  corrected errors in replyformat 23 (B. Perrin)
1473
* 26/9  tried to solve the syntax issues with polyline etc
1474
* 11/9  added an option to command clock (and corrected the modulo bug :javascript remainder % is not the same as modulo)
15111 schaersvoo 1475
      added some html info
16849 obado 1476
* 10/9  corrected slider display (arguments "display x" and "display y" always showed "x : y" values
1477
* 4/7   using '\t' as command separator (for use within OEF)
1478
*       difference between 'arc' and 'angle': 'arc' may set width+height (ellipse)
1479
* 15/2 corrected filling in command 'arc'
1480
* 4/2  added command 'rotationcenter xc,yc' and keyword 'killrotate'
1481
* 3/1  corrected fontsize flaw in commands text / textup
1482
 
1483
## 2016
1484
	removed nonexisting 'div' argument 'tabindex=0' (thx to Perrin)
1485
 
1486
* 29/12 clearbutton was incompatible with chromium etc (revert to button.style = "style_text" when all browsers are supporting this construct)
1487
* 18/9 corrected command 'centerstring' : forgotten clearRect()
1488
* 17/9 corrected command clock: colors are now -really- optional
1489
*       corrected -fixed- interactive boxplot stuff (js-related)
1490
* 15/9 disabled 'crispy-lines' when zooming is activated (repeated translation of context)
1491
*       e.g. producing crispy sharp lines : if(line_width %2 == 1){ctx.translate(0.5,0.5);}
1492
* 12/9 now linewidth 1 == 1px and linewidth 2 == 2px
1493
* 5/9  added command boxplot and jsboxplot
1494
* 3/9  added commands xerrorbars,yerrorbars to dragdrop library
15111 schaersvoo 1495
      minor corrections in html-doc for fontsize ; although it will not compensate for 'not-reading-the-docs' !
1496
      corrected flaw in draw_points()
1497
      (the single command 'userdraw type,color) will NOT ZOOM / PAN !!)
16849 obado 1498
* 30/8 multidraw primitives will now zoom / pan (added function redraw_all())
1499
       added several alternatives to html-doc
1500
* 25/8 added command 'cursor some_css_cursor'
1501
* 20/8 added 'rect' and 'rects' to multidraw command
1502
* 10/8 added 'xaxisup' and modified grid extension 'barchart' using the xminor/x2step for the bar-width...
1503
* 2/8   added 'text' to 'multidraw'
1504
* 	when status=done the image will be shown in the page --> canvas_div.style.display='block'
1505
* 28/7  read_canvas and read_dragdrop in popup window
1506
*        no yet suitable for communication back to wims...[work in progress]
1507
*        embedding canvasdraw into separate window xsize x ysize
1508
* 26/7  added keyword 'popup'
1509
* 21/7  added command `triangles color,x1,y1,x2,y2,x3,y3,...`
14038 schaersvoo 1510
 
16849 obado 1511
```
15111 schaersvoo 1512
# reply[3]...reply[5] = protractor
1513
# reply[0]...reply[2] = ruler
1514
replyformat 32
14044 schaersvoo 1515
 
15111 schaersvoo 1516
protractor 2,-2,6,0,-1,1,1
1517
ruler -4,3,5,1,-1,1
1518
opacity 255,40
1519
fillcolor orange
14071 bpr 1520
 
15111 schaersvoo 1521
vline 0,0,black
1522
hline 0,0,black
1523
yrange -5,10
1524
xrange -5,10
1525
size 400,400
16849 obado 1526
```
14053 schaersvoo 1527
 
16849 obado 1528
* 14/7 combinations of ruler & protractor
1529
* 13/7 added command macro `ruler x,y,x-width ,y-height,passive_mode`
15111 schaersvoo 1530
	snaptogrid implementes ( xy | x | y )
16849 obado 1531
 	reply format implemented  `(read_canvas())  reply[0] = x;reply[1] = y;reply[2]=angle_in_radians`,
1532
 	value display implemented,
1533
 	left-right rotation with mouse (left click & drag),
1534
 	zooming implemented,
1535
* 12/7	added 'macro' command 'protractor x,y,x-width,type,passive_mode,value_display
1536
* 8/7	revert to normal size of a point at 'linewidth = 1' (e.g. differ from ridiculous small point size of flydraw)
15111 schaersvoo 1537
	This last -duplicated- point is removed from the answer array
1538
	only 1 onject can be drawn (only with mouse).The poly is closed when clicking on the first point again (+/- 10px)
16849 obado 1539
* 7/7	added argument 'closedpoly' to command 'multidraw'
14063 schaersvoo 1540
 
15111 schaersvoo 1541
	When things are more mature and speed is no longer an issue, the 'single userdraw' command will be replaced by multi*
1542
	And yes, these are horrible long command names.
1543
	multifillopacity,multiuserinput,multilabel,multilinewidth,multisnaptogrid
1544
	multidraw,multidash,multistrokecolors,multifill,multifillcolors,multistrokeopacity,
16849 obado 1545
* 26/6	multi-family of commands are 'finished'
15111 schaersvoo 1546
        NOT READY: many issues are still unadressed
14071 bpr 1547
 
15111 schaersvoo 1548
	(to increase speed of execution)
1549
	The js-canvas drawfunctions will be different (simpler) compared with the single 'userdraw obj,color' functions
1550
	using buttons to switch drawing primitive...
16849 obado 1551
* 17/6   added experimental 'multidraw', allowing multiple drawing primitives in a single canvas image,
14208 schaersvoo 1552
 
15111 schaersvoo 1553
	added command 'snaptofunction some_fun_x,some_fun_y'
14208 schaersvoo 1554
 
16849 obado 1555
		frect -3,3,0,0,red
1556
		slider -5,5,120,10,x function display,some_text
1557
		sliderfunction_x 5*sin(x)
1558
 
1559
		'sliderfunction_y some_operation_on_y'
1560
		'sliderfunction_x some_operation_on_x'
1561
		added command
1562
		added argument 'function' to the slider objects.
1563
* 28/4	removed point2point...
1564
* 24/4	added experimental command 'point2point x,y,color1,color2,x-relation_1:y-relation_1: ... : x-relation_n_:y-relation_n
15111 schaersvoo 1565
	make background color in generated <span> elements adjustable via command 'fillcolor'
1566
	make font color in generated <span> elements adjustable via command 'strokecolor'
1567
	todo:
16849 obado 1568
* 23/4	removed most static settings of fontsize and/or style.
1569
* 22/4	corrected 'static fontsize settings' in some js-user-input stuff, using size set by 'command fontsize int'... to be continued
1570
* 21/4	corrected missing 'ctx.restore()' in case of arrow (gives very strange  rotations when using a slider to rotate only the arrow...)
1571
* 19/4	changing "abs" by "fabs" in case of floating point variables. (BPR)
1572
* 8/4	added forgotten /*<![CDATA[*/ .... /*]]>*/ to script tag
1573
* 25/2	Internet Explorer & "use strict" : changed 'span.style="color:..." into span.setAttribute('style','color:...');
14208 schaersvoo 1574
 
15111 schaersvoo 1575
	 (even those not set draggable)
1576
	 note: all external images positions will be present in the 'read_canvas' array
1577
	 the third image position is (-2:-5)
1578
	 the second image position is (6:2) and
1579
	 the first image position is (-5:4) ,
1580
	 0:-5:4,1:6:2,2:-2:-5
1581
	 e.g. expect in  case of 3 external images set draggable, something like
1582
	 read_canvas() will reply "object_number:x:y" of all external images introduced by commands 'copy copyresized'
16849 obado 1583
 
1584
	- corrected replyformat 20 (only used for external image drag&drop... outside the dragstuff library !!)
1585
	- corrected resetting of 'reply array' in case of zooming... (why did I reset this?)
1586
* 17/2
1587
	- added check on wims_status=done when using 'onclick' (otherwise objects can be 'clicked/dragged' in an answer.phtml)
1588
	- simplified onclick things in external images
1589
	- fixed bug when onclick external images were mixed with static external images
1590
* 16/12 - corrected 'userdraw points,color' erase/redraw bug (using 'clearbutton buttontxt')
1591
* 7/12	- onclick objects may now be of any type (eg external images ,via copy /copyresized or any other canvas 'object')
15111 schaersvoo 1592
	 see canvassdraw.html for possible usage and limitations
16849 obado 1593
* 25/11 - added "onclick" to external images (via commands copy / copyresized)
15111 schaersvoo 1594
	-again tried to fix copy/copyresized (grrr)
1595
	 and thus reset to "0,0,0"
16849 obado 1596
* 24/11
1597
	- corrected syntax-flaw in js-function draw_rects() ; both stroke_color and fill_color were not correctly defined
15111 schaersvoo 1598
          analogue to command 'ellipse'
16849 obado 1599
	- corrected command 'arc' : switched from width/height (width and height may now be different) in pixels to width / heigth in x/y-range
15111 schaersvoo 1600
          now "linewidth 1" is almost invisible, just as in 'flydraw'...that is a clear improvement :)
16849 obado 1601
	- synchronised size of point / points with flydraw
15111 schaersvoo 1602
          The image may be of type BITMAP and SVG
1603
          (even if there is no external image imported)
16849 obado 1604
* 23/11	- solved issue with drawing onto external images: now a empty 'external_image' canvas is created first / per default...
15111 schaersvoo 1605
	  image operations are now performed on a "real canvas" and no longer on a "canvas_div"
16849 obado 1606
* 22/11
1607
	- joined draw_external_images and drag_external_images
15111 schaersvoo 1608
	- changed output "function distance()" from integer to floating point. (slightly better in case of snaptopoints)
16849 obado 1609
* 9/11
1610
	- fixed bug of increasing font_size when using multiple 'text' commands [perrin]
15111 schaersvoo 1611
	- added "xsnaptogrid,ysnaptogrid,snaptogrid,snaptopoints" to dragging of 'external images'
1612
	- "click_cnt" counter (to identify the object in reply) only incremented when 'onclick' and / or "drag x|y|xy" is set.
1613
	- added "snaptopoints" to userdraw primitives and drag&onclick library
16849 obado 1614
* 6/11	- corrected dragging (dragging was missing...) of closed polygon (triangle etc)
1615
```
15111 schaersvoo 1616
userdraw arrow,blue
1617
#userdraw arrows2,blue
1618
arrowhead 10
1619
linewidth 2
1620
snaptopoints 0,0,-6,0,-3,3,0,6,3,3,6,0,3,-3,0,-6,-3,-3
1621
points red,-6,0,-3,3,0,6,3,3,6,0,3,-3,0,-6,-3,-3
1622
point 0,0,blue
1623
linewidth 3
1624
yrange -10,10
1625
xrange -10,10
1626
size 400,400
16849 obado 1627
```
15111 schaersvoo 1628
	 only implemented in command "userdraw arrow(s),color"
16849 obado 1629
* 5/11
1630
   - added experimental command "snaptopoints x1,y1,x2,y2,..."
1631
   - added command "bezier color,xs,ys,x1,y1,x2,y2,x3,y3"
1632
   - added alernative to command "polyline" : "path color,x1,y1,x2,y2,...."
1633
   - added command "roundrects color,radius,x1,y1,x2,y2,...."
1634
   - added command "vlines color,x1,y1,x2,y2,...."
1635
   - added command "hlines color,x1,y1,x2,y2,...."
1636
   - added command "demilines color,x1,y1,x2,y2,...." alternative "halflines"
1637
* 3/11   - added commands "rects color,x1,y1,x2,y2,...." and "frects color,x1,y1,x2,y2,...."
1638
* 2/11   - docs
1639
* 1/11
1640
   - corrected font behaviour of Flydraw text command.
15111 schaersvoo 1641
        Flydraw command "lines" is equivalent to "polyline"
1642
        "polyline" | "polylines" | "brokenline" | "brokenlines" will produce interconnected segments between the points (not closed)
1643
        "lines" will produce not connected lines through points (x1:y1)--(x2:y) etc
16849 obado 1644
   - syntax changed for command "lines color,x1,y1,x2,y2...x_n-1,y_n-1,x_n,y_n"
1645
   - corrected command "clearbutton some_text" : multiple interactive scripts in web page may have individual 'clear drawing buttons'
1646
   - corrected crosshair_size
15111 schaersvoo 1647
	can be set draggable / onclick individually
14208 schaersvoo 1648
 
16849 obado 1649
* 29/10
1650
	- added command "arrows2 color,head px,x_1a,y_1a,x_1b,y_1b,x_2a,y_2a,x_2b,y_2b....x_na,y_na,x_nb,y_nb
1651
	- added 'replyformat 28' to reinput date from 'userdraw circles,color' [perrin]
1652
* 17/10
1653
	- removed empty string error warning in 'char *get_string_argument(); [perrin]
1654
	- removed macro "iscalculation" and replace it by something better...
1655
	- added command "arrows color,x1,y1,x2,y2...x_n,y_n
15111 schaersvoo 1656
        note: radius is not in pixels but in xy-coordinate system ! (so dragging / onclick / scaling works )
16849 obado 1657
* 11/10
1658
	- added command "circles color,x1,y1,r1,x2,y2,r2...x_n,y_n,r_n
15111 schaersvoo 1659
	like: "0.2345^1.234x" will receive a warning : it should be "(0.2345)^(1.234x)"
1660
	(but they have a small footprint...)
16849 obado 1661
	- added warnings when plot function input has "syntax" issues...well it's more likely that my simple math-parsers are too simple
1662
	- added command segments color,x1,y1,x2,y2....x_n,y_n  	[perrin]
1663
	- added simple javascript "rawmath" to convert user function input (like : 4x --> 4*x)
15111 schaersvoo 1664
	 default value 'f(x)='
16849 obado 1665
	- added command 'functionlabel some_string' to label the specific inputfields for function input
1666
 
1667
* 9/10
1668
	- now multiple functions may be plotted by user via 'userinput function' and read via read_canvas()
1669
 
1670
```
1671
	  function read_dragdrop(){
1672
	  var script_len = canvas_scripts.length;var dragdrop_reply = "";var found_result = false;for(var p = 0 ; p < script_len ; p++){var fun = eval("read_dragdrop"+canvas_scripts[p]);if(typeof fun === 'function'){var result = fun();if( result && result.length != 0 ){if(script_len == 1 ){ return result;};found_result = true;dragdrop_reply = dragdrop_reply + result +"\n";};};};if( found_result ){return dragdrop_reply;}else{return null;};};
15111 schaersvoo 1673
	  <!-- will return all 'drag&drop' or 'onclick' data from all canvas javascript includes -->
1674
	  };
1675
	   };
1676
	    return null;
1677
	   {
1678
	   else
1679
	   }
1680
	    return draw_reply;
1681
	   if( found_result ){
1682
	   };
1683
	    };
1684
	     };
1685
	      draw_reply = draw_reply + result + "\n";
1686
	      found_result = true;
1687
	      if(script_len == 1 ){ return result;};
1688
	     if( result  && result.length != 0){
1689
	     var result = fun();
1690
	    if( typeof fun === 'function'){
1691
	    var fun = eval("read_canvas"+canvas_scripts[p]);
1692
	   for(var p = 0 ; p < script_len ; p++){
1693
	   var found_result = false;
1694
	   var draw_reply = "";
1695
	   var script_len = canvas_scripts.length;
1696
	  function read_canvas(){
1697
	  <!-- will return all 'userdraw' or 'userinput' data from all canvas javascript includes -->
16849 obado 1698
```
15111 schaersvoo 1699
	 A special version of 'read_canvas()' and 'read_dragdrop()' should be included in the web page, something like this:
14208 schaersvoo 1700
 
16849 obado 1701
	 In the C-program, the local functions will be called `read_canvas%d()` with '%d' is the random `canvas_root_id`
1702
	 array `canvas_scripts` will keep track of the `canvas_root_id` number of scripts included in the page.
1703
	 The native `read_canvas()` and `read_dragdrop()` are now linked to the `canvas_root_id` and a global
14225 schaersvoo 1704
 
16849 obado 1705
* 1/10	-multiple interactive canvasdraw scripts in a single page may now work correctly in replying the userdrawarrays and the drag&drop data..
1706
* 25/9	-added command 'demiline x1,y1,x2,y2,color` and commands 'userdraw demiline,color' 'userdraw demilines,color'
1707
* 22/9	-corrected missing js-variable declaration in 'userdraw path(s) ' [use strict]
1708
* 20/9	-added userinput function | input | textarea as alternative command + argment to keywords "userinput_function","userinput_textarea" and "userinput_xy"
1709
* 11/9	-tried to improve 'filltoborder x,y,bordercolor,fillcolor'
1710
* 10/9	-added keyword 'userinput_function'
1711
* 9/9	-corrected placement of inputfields 'userdraw inputs,color' (no longer can input fields be placed on top of each other
1712
* 30/8
1713
	- added command 'clearbutton button_text' to remove all user drawings from userdraw_canvas (and empty all userdraw data arrays)
15111 schaersvoo 1714
	(although I'm not happy to increase the size of the general part of the include file)
1715
	...sometimes functions expect these array's to be defined [use strict]
1716
	- added userdraw_x = [],yserdraw_y = [],userdraw_radius = [] to global section of javascript include
16849 obado 1717
* 29/8
1718
	- corrected 'display radius,color,fontsize' in case there is no 'userdraw circle,color' defined
1719
	- corrected 'use strict' problems with 'clock'
15111 schaersvoo 1720
	display x | y | xy | degree | radius ,color,fontsize
16849 obado 1721
 
1722
* 28/8
1723
	- added argument 'radius' to mousedisplay (in case of 'userdraw circle,color'
15111 schaersvoo 1724
	x_input_1:y_input_:1input_value_1,x_input_2:y_input_:2input_value_2...
16849 obado 1725
	- added 'replyformat 27' : read_canvas() will return array
1726
* 27/8	- corrected flaw [sigalled by 'use strict'] in 'userdraw text,color'
1727
* 26/8	- added command 'userdraw input,color' and 'userdraw inputs,color' [work in progress]
15111 schaersvoo 1728
	 type: x display | y display | xy display | angle degree | angle radian
1729
	 display slider values, use:
1730
	 type: x | y | xy | angle
1731
	 slider min,max,width,height,type,string
14230 schaersvoo 1732
 
16849 obado 1733
* 24/8	- reverted to originale command 'display' and modified slider arguments to support a per slider display of it's value in the main canvas window
15111 schaersvoo 1734
	 work in progress
16849 obado 1735
* 23/8	- added 'slider | slider_degree | slider_radian' to command "display x|y|xy|degree|slider|slider_degree|slider_radian,color,fontsize"
14232 schaersvoo 1736
 
16849 obado 1737
```
15111 schaersvoo 1738
zoom blue
1739
userdraw segment,orange
1740
string black,0.9,0.1,P
1741
fontfamily italic 24px Courier
1742
point 1,0,orange
1743
linewidth 4
1744
angle 0,0,0.3,0,0,green
1745
fillcolor yellow
1746
filled
1747
segment 0,0,1,0,orange
1748
linewidth 2
1749
slider 0,2*pi,200,40,angle degree,use slider to rotate point P
1750
circle 0,0,200,red
1751
fillcolor white
1752
grid 1,1,grey,4,4,10,blue
1753
xaxis 0:0:1:1:2:2:3:3:4:4:5:5:6:6:0.5*pi:\u03c0/2:pi:\u03c0:1.5*pi:3\u03c0/2:2*pi:2\u03c0:3*pi:3\u03c0:4*pi:4\u03c0
16849 obado 1754
fontfamily bold 14px Arial
15111 schaersvoo 1755
opacity 200,150
1756
axis
1757
yrange -1,1
1758
xrange -1,7
1759
size 800,200
16849 obado 1760
```
1761
    for example:
1762
    	if the grid does not match the xaxis values:strings there will be extra tics
15111 schaersvoo 1763
	- added x/y-tics in command 'grid xmajor,ymajor,color,xminor,yminor,tics-size,axiscolor'  case of command 'xaxis' or 'yaxis'
16849 obado 1764
 
1765
* 21/8
1766
	- corrected rotation direction in case of 'slider type angle' (anti-clockwise)
15111 schaersvoo 1767
	- removed 'animate' from dragstuff library : this should be done with a kind of slider...TO DO !!
1768
	  hope this works for all browsers...tested on FreeBSD Opera/Firefox/Seamonkey/Chrome
14234 schaersvoo 1769
 
16849 obado 1770
* 20/8
1771
	- added 'use strict'; to js-include [just to make sure the js-code is "properly written"
15111 schaersvoo 1772
	- slider using 'xy' will start & end by clicking the 'slider rect'
1773
	  'angle' will zoom in/out (using scale_x_radius();) and will use radians for slider values (in contrast to 'arc' which uses width/height in pixels)
1774
	- added command 'angle x,y,width,start,end,color' as alternative to flydraw compatible command 'arc'
16849 obado 1775
 
1776
* 19/8	- improved response speed of slider (in dragstuff library)
15111 schaersvoo 1777
	  The amount of sliders in not limited
1778
	  now a slider may adjust several different objects...until keyword 'killslider' or next 'slider'
16849 obado 1779
 
1780
* 18/8
1781
	- added keyword 'killslider'
15111 schaersvoo 1782
	- for all other object the slider will 'move' / 'rotate' the complete object
1783
	- if slider is used for command 'arc' the angle will be set with the slider
1784
	- javascript:read_dragdrop(); will return an array  'object number:slider value'
16849 obado 1785
* 17/8	- type: xy,x,y,angle : added slider 'rect' for xy movement
1786
* 15/8	- further integration of slider: all draggable objects may have sliders (x/y/angle)
1787
* 14/8
1788
	- adding slider to dragstuff library : work in "progress"
15111 schaersvoo 1789
	- adapted 'rotate angle' to be compatible with flydraw... :  -1*angle (Marina)
1790
	- correct imagefill etc : reset() was missing (Marina)
16849 obado 1791
* 5/8	- added replyformat 25/26 : 'userdraw arc(s),color' with degrees or radians
15111 schaersvoo 1792
	  STILL NOT 100%  CORRECT !!
16849 obado 1793
* 4/8
1794
	- corrected command 'userdraw arc,color'
15111 schaersvoo 1795
	- added precision to the dragdrop library (eg. read_dragdrop() )
16849 obado 1796
* 28/7
1797
	- added precision to the read_canvas() functions.
15111 schaersvoo 1798
	- corrected command 'ellipse' : switched from Beziercurve to arc-method. Should now be a true ellipse
1799
	- corrected command 'roundrect' : no inverted roundrect possible
16849 obado 1800
* 27/7	- corrected command 'square' ...
1801
* 26/7
1802
	- corrected a few flaws introduced by internal changing from 'translation' to 'affine'
15111 schaersvoo 1803
	- corrected command 'lattice' (hope it's ok now)
1804
	- corrected missing dashing of 'arrow' 'arrow2'
1805
	 to imitate flydraw's filling is too much work ... for both browser js-engine and me ...
1806
remark:  hatchfill/dotfill/diamondfill are not the same as flydraw...I've  not understood the flydraw filling correctly...
1807
	- corrected 'filltoborder' and 'floodfill' ... it should / could work now
1808
	- corrected command 'square x,y,side px,color'
1809
	  Changed several functions: new flaws in javascript may be introduced.
1810
	  the translation_ty being affine_matrix[5]
1811
	  the translation_tx being affine_matrix[4]
1812
	- removed internal variable used by 'translate' and moved to generic 'affine matrix'
1813
	- corrected affine : tx/ty now in x/y-range
16849 obado 1814
* 25/7	Thanks to Marina:
1815
 
1816
* 29/6
1817
	- added mousex / mousey commands : just show x or y values of mouse coordinates
1818
	- changed command 'barchart' : now "unlimited" barchart commands will be plotted in a single graph.
1819
	- reverted some correction mechanism for grid / axisnumbering when zooming out...need to rething
15111 schaersvoo 1820
          'userdraw vlines,color'
1821
          'userdraw vline,color'
1822
          'userdraw hlines,color'
1823
          'userdraw hline,color'
16849 obado 1824
	- added
15111 schaersvoo 1825
          Now the sequence is not important. However  both commands should be called at the end of the script
1826
          ('mouse' was only active when 'zoom' function was called before 'mouse')
16849 obado 1827
 
1828
* 28/6
1829
	- corrected preference behaviour of commands 'zoom' and 'mouse'
15111 schaersvoo 1830
	- removed some '\n' from js include code
14234 schaersvoo 1831
 
16849 obado 1832
* 27/6
1833
	- "replyformat 15" will only report inputfields/textareas set 'write' (eg not set 'readonly')
15111 schaersvoo 1834
	- added "replyformat 24" read all inputfields/textareas even those set 'readonly'
16849 obado 1835
* 23/6	- added command 'centerstring color,y,text' for placing a x-centered text in the canvas
1836
* 21/6
1837
	- corrected command jsplot : now more complex(...) functions may be used.
1838
	- increased value MAX_INT from 64 -> 128 : this is used for several arrays in C
1839
	- added some info on 'sgraph' (...)
1840
* 18/6
1841
	- solved small issue with removal of userdraw circle
15111 schaersvoo 1842
	- solved issue with precision (multiple roundings  x <--> px) in read_canvas() and js-functions x2px(x) / px2x(px):last precision in script is used for reply-precision
1843
	- fix stupid error in 'replyformat 23'
1844
	- zoom in y-direction was gone fishing...
1845
	- if wims_status='done' all 'drawing' related input fields are removed  (eg. userinput_xy etc)
1846
	- added flag to avoid multiple including of safe_eval, usd by several optional things
1847
	  added some alert message when inputstring has unfinished calculations , 'like 123 + 10^5/678'
1848
	- adapted 'safe_eval' to accept numbers like 2.345*10^5 (previous version only accepted 10^5...)
1849
          (barchart and linegraph are closely linked to grid: there can be multiple linegraphs in a single grid...but there can only be 1 grid)
16849 obado 1850
 
1851
* 17/6
1852
	- modified command 'piechart' and 'legend' : now multiple piecharts with legends may be present in a single canvas image
15111 schaersvoo 1853
 	- mouseup() in draglibrary corrected
16849 obado 1854
* 15/6	- added timeout for floodfill and filltoborder: the canvas was not yet 'drawn' in current setup , when floodfill was called...
1855
* 10/6	- added '(xy)snaptogrid' to drag library
15111 schaersvoo 1856
	  overide this default behaviour with keyword 'status' or 'nostatus'
16849 obado 1857
* 8/6
1858
	- inputfields/textarea's in canvasimage will be cleared and set 'readonly' when wims status variable is 'done'
15111 schaersvoo 1859
	  (in case you want to draw something...but not send the drawing to wims..)
1860
	- added 'replyformat -1' to disable the javascript read_canvas() function
1861
	  added commands 'userdraw arrow2' and 'userdraw arrows2'
16849 obado 1862
* 7/6
1863
	- corrected more inbalance in save() / restore() in 'draw_arrow()'
15111 schaersvoo 1864
	- corrected inbalance in save() / restore() causing annoying problems in command 'arc'
1865
	  todo CHECK THE REST !!
1866
	- added forgotten rotate&angle arguments to commands 'string / text'
1867
	- changed command 'grid' : now zooming and axisnumbering is slightly better...but it stays amateur scribling, grrrr...
1868
	- corrected typo "};else{" in javascript  replyformat 7
16849 obado 1869
* 6/6
1870
	- removed randomness from command clock (was annoying)
15111 schaersvoo 1871
	    added a lightweight javascipt function to convert math into js-math (only suitable for basic stuff)
1872
	    for plotting curves using clientside calculations: formula is verbatim in page-source
16849 obado 1873
	- added command jscurve color,formula_in_x
1874
* 5/6	- work in progress:
1875
* 2/6    - BPR: replace the dependance with libmatheval to the wims evaluation.
15111 schaersvoo 1876
	  allowing all combinations of 'setlimits', 'trace_jsmath' ,'jsmath' , 'userinput_xy+userdraw' , mouse , drag etc
16849 obado 1877
* 1/6
1878
	- added keyword 'setlimits'
15111 schaersvoo 1879
	- work in progress: added keyword 'setlimits'
16849 obado 1880
* 31/5	- slightly modified "trace_jsmath some_js_math_function_in_x" and "jsmath some_js_math_function_in_x"
1881
* 30/5	- added commands `trace_jsmath some_js_math_function_in_x` and `jsmath some_js_math_function_in_x`
1882
* 27/5	- javascript variable 'precision' was gone fishing
15111 schaersvoo 1883
	  level curve may be set 'onclick' or 'draggable'; every single curve has an unique identifier
16849 obado 1884
* 23/5	- command 'levelcurve' : the quality of the curves is not to be compared with the 'Flydraw levelcurve'
15111 schaersvoo 1885
          I'm not sure if this should be implemented in javascript...
16849 obado 1886
* 22/5	- work in progress: added command 'levelcurve'
15111 schaersvoo 1887
	  removed function get_double() from canvasdraw.
1888
	  corrected command 'rays color,xc,yc,x1,y1....xn,yn' (it was using pixels instead of x/y-range coordinates)
16849 obado 1889
* 21/5	- added forgotten commande 'dvline' and 'dhline'
15111 schaersvoo 1890
	  note: mouse coordinates (for drag / onclick) are not transformed....TODO)
16849 obado 1891
* 20/5	- added command 'affine a,b,c,d,tx,ty' and keyword 'killaffine'  (Marina Cazzola)
15111 schaersvoo 1892
	  'snaptogrid'  " will snap to both xmajor and ymajor (or xminor and yminor, if defined)
1893
	  'ysnaptogrid' : will snap to ymajor (or yminor, if defined)
1894
	  'xsnaptogrid' : will snap to xmajor (or xminor, if defined)
16849 obado 1895
* 19/5	- added keywords
15111 schaersvoo 1896
	- removed command 'debug'
1897
	    x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn
1898
	    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-->
16849 obado 1899
* 18/5	- add replyformat 23 : used for 'userdraw polyline' : filtering out the second click on the same (+/- 5 px) point
15111 schaersvoo 1900
	  corrected mixup between userdraw polyline / polygon...
1901
	  if the mouse coordinate display or the student reply -in case of 'userdraw'-  needs a higher precision, just use as last command something like 'precision 10000'
16849 obado 1902
 
1903
* 16/5	- command 'precision' before ylogscale / xlogscale will set the number of decimals of the x-axis / y -axis (a local variable precision is set)
15111 schaersvoo 1904
	  corrected y-axis numbering in case of 'xlogscale'
16849 obado 1905
* 11/5
1906
	- added js function safe_eval() to command 'userinput_xy' to "safely" evaluate math inputs like 10^2 or sqrt(5)
1907
	- corrected x-axis numbering in case of 'ylogscale'
1908
	- corrected problems with ';' in html-text / text-arguments (the ';' is a command separator ... added 22/4)
1909
	- forgotten to clearRect()
15111 schaersvoo 1910
	  (just more copy and paste "programming")
16849 obado 1911
* 10/5	- added 'userdraw polygon,color'  'userdraw line,color' and 'userdraw lines,color' to userinput_xy
1912
* 5/5	- added commands 'ylogscale' , 'xlogscale' , 'xylogscale' , 'xlogbase' and 'ylogbase'
1913
* 25/4	- add 'nok' button to remove last item from userdraw arrays
15111 schaersvoo 1914
	  add keyword usertextarea_xy (...)
16849 obado 1915
* 24/4	- add userdraw polyline,color
1916
* 23/4	- corrected sgraph
1917
* 22/4	- added semicolon ; as 'new line separator' (Marina Cazzola)
1918
* 21/4	- corrected command grid in case xmin > 0  and / or ymin > 0
15111 schaersvoo 1919
	  for use as very (!) primitive 'broken axis graph'
16849 obado 1920
* 20/4	- work in progress: add command `sgraph xstart,ystart,xmajor,ymajor,xminor,yminor,majorgrid_color,minorgrid_color`
14295 schaersvoo 1921
 
16849 obado 1922
```
15111 schaersvoo 1923
	  'userdraw arrows,color'
1924
	  'userdraw arrow,color'
1925
	  'userdraw crosshairs,color'
1926
	  'userdraw crosshair,color'
1927
	  'userdraw circles,color'
1928
	  'userdraw circle,color'
1929
	  'userdraw points,color'
1930
	  'userdraw point,color'
1931
	  'userdraw segments,color'
1932
	  'userdraw segment,color'
1933
	  for now: only implemented in
16849 obado 1934
```
14295 schaersvoo 1935
 
16849 obado 1936
* 18/4	- added keyword 'userinput_xy' : if set 2 or 3 inputfields will be shown...the pupil will be able to 'draw' with mouse and/or by giving  a x-value and y-value (or radius-value)
1937
* 14/4   - added 'snaptogrid' to gridfill and dotfill (e.g. userdraw will snap to the grid)
1938
* 11/4	- corrected flaw in snaptogrid : now works correctly for dividers xminor  and yminor (only if they are even dividers e.g. 2,4,6,8 etc)
1939
* 8/4	- added to wims_svn
1940
 
1941
* 5/4	- corrected flaw in 'normal' userdraw (without snaptogrid)
15111 schaersvoo 1942
	  todo: other gridfill commands may use snaptogrid
1943
	  grid 1,1,black,2,2,6,grey  : will snap to all minor grid lines n/2
1944
	  grid 1,1,black : it will snap to all major grid lines 'n'
16849 obado 1945
* 2/4	- added command / keyword 'snaptogrid' : a userdrawing will snap to the given grid...
15111 schaersvoo 1946
	  added keyword 'status' to disable this default behaviour (e.g. pupils may draw in canvas when wims $status=done
16849 obado 1947
* 25/3	- userdraw functions only active if wims $status != done
15111 schaersvoo 1948
	  canvasdraw now only works in correct wims_environment : e.g. ./canvadraw < fly.txt  will not work anymore
1949
	  No option anymore to gzip the include.
1950
	  The rest is printed in a fairly small buffer and printed to stdout at the end of parsing the fly-script.
16849 obado 1951
* 23/3	- simplified buffer usage : now js-include file in wims-getfile-directoy is standard.
14295 schaersvoo 1952
 
16849 obado 1953
	Probably have to look into str_replace() !
1954
	segfault occured in case "blah" was not present in "temp"  (and no replacement was made) and string length wos big
1955
	On 32/64 bits FreeBSD ; 32/64 bits OpenBSD no problems
1956
 
1957
	```
1958
	if( strstr(temp,"blah") != 0 ){ temp = str_replace( temp ,"blah","beh");}
1959
    char *temp = getstring(infile,1);
1960
    Changed into:
1961
    char *temp = str_replace( getstring(infile,1),"blah","beh");
1962
	```
1963
* 21/3	- corrected spurious segfault on Gentoo 64 bits (leiden) and OpenSuSE-32 :
1964
* 14/3	- forgotten 'break;'
1965
* 3/3	- synchronized commands "arrow" and "arrow2" with flydraw syntax; e.g. arrow x1,y1,x2,y2,head_in_px,color
15111 schaersvoo 1966
	  It works if not too much cropping is required.
1967
	  The commands are still not equal to Flydraw: I'm giving up on this !!
16849 obado 1968
* 28/2
1969
	- tried to correct copy/ropyresized ; using image as background image of div (e.g. no canvas !)
1970
	  We just use the URL of the image...and add some CSS to it (no-repreat / Size / Position) and det the URL to the backgroundImage of the main div
1971
	- an external image copied into a canvas / resized etc... can be set as background of the document.body...
1972
	- an external image copied into a canvas / resized etc... can not be set as CSS backgroundImage of a div... (at least in firefox)
1973
	- there is no way to paint on top of an external image loaded into a canvas...
14295 schaersvoo 1974
 
16849 obado 1975
* 27/2	- solved nasty issue with "drawing on top of external image"  with copy / copyresized
1976
* 19/2	- added command 'animate type' as primitive animation ; only 'point' on curve is implemented
15111 schaersvoo 1977
	  Using generic js-functions in wims-pages to read all mathml-inputs (including the ones in a canvas image !)
16849 obado 1978
* 12/2	- removed reading of mathml-inputfield in canvas (only "replyformat 16" will read it)
14295 schaersvoo 1979
 
15111 schaersvoo 1980
	  canvas_div.style.background-size --> canvas_div.style.backgroundSize
16849 obado 1981
* 8/2
1982
	- corrected syntax in bgimage:
15111 schaersvoo 1983
	- command "bgimage url" will scale to fit background image
16849 obado 1984
* 7/2
1985
	- corrected x-y mixup in case xrange/yrange was forgotten (eg xrange = 0 px ,sizex px)
15111 schaersvoo 1986
	- added forgotten filling of an arc ;command 'filledarc'
1987
	  (something like:fontfamily bold italic 24px Courier)
1988
	  the rest of the gridfonts (numbering or x/yaxis text) is determined by the 'fontfamily'
16849 obado 1989
* 6/2
1990
	- added default fontfamily settings to 'legend', 'xlabel' and 'ylabel' ; size may be set by command 'fontsize'
15111 schaersvoo 1991
	- add command 'dsegment' as alias for dashed segment
1992
	  eg only active inputfields will be read with read_canvas();
16849 obado 1993
* 5/2	- if inputfield has attribute 'readonly', do not read the value when using javascript:read_canvas();
1994
* 3/2
1995
	- added forgotten 'readonly' attribute to js-function 'draw_inputs()'
1996
	- solved(?) some strange fill issues (pixel manipulation) added demo
14295 schaersvoo 1997
 
15111 schaersvoo 1998
          If legendcolors was not set , the default stroke_color will be used in a 'legend'
1999
          for all other legends, we can specify.
2000
          barchart & piechart will use -ofcourse- the same colours for legend
16849 obado 2001
* 1/2
2002
	- add command 'legendcolors color1:color2:color3:...:color_n'
15111 schaersvoo 2003
	- command 'legend string1:string2:string3:..:string_n' may now be used with any 'grid' (e.g. not only for barchart/linegraph/piechart)
2004
	- commands 'xlabel' 'ylabel' only depend on command 'grid' (eg without 'axis' and/or 'axisnumbering')
2005
	- added commands 'xlabel some_string' ylabel some_string'
2006
	- corrected tooltip when using images as 'linktext'
14295 schaersvoo 2007
 
15111 schaersvoo 2008
	will output reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n
16849 obado 2009
 
2010
* 31/1
2011
	- read_canvas() : Added 'replyformat 22' : single array output (just for use in my existing checkfile)
15111 schaersvoo 2012
	will output words (x1:y1) (x2:y2) (x3:y3) ... (x_n:y_n)
2013
	- read_canvas() : Added 'replyformat 21' : verbatim coordinate output (just for use in my existing checkfile)
2014
	Command "intooltip tooltip_text" will accept html-text, images and now also Mathml as tooltip_text
16849 obado 2015
	- Now "mouse red,24" will default to font '24px Arial'
15111 schaersvoo 2016
	fontfamily [type] [size]px [family]
2017
	was set, the argument fontsize of command "mouse color,fontsize" was ignored...due to the strict syntax in html/js
16849 obado 2018
 
2019
* 29/1  - Corrected js-fontfamily kludge...when something like "fontfamily italic 14px Arial"
15111 schaersvoo 2020
	(On multiple panning/zooming the mouse coordinate display will get 'sluggish' and not very quick in response)
2021
	When 'x' is pressed the page will reload (location.reload();) so the panned/zoomed image or drawing will be reset to it's original state.
16849 obado 2022
 
2023
* 23/1	Added a 'x' to pan/zoom-buttons (command "zoom color")
2024
	`xaxis -4*pi:-4\u03c0:-3*pi:-3\u03c0:-2*pi:-2\u03c0:-1*pi:-\u03c0:pi/2:\u03c0/2:pi:\u03c0`
15111 schaersvoo 2025
	example (unicode allowed; no html)
16849 obado 2026
 
2027
		yaxis y_value:y_text:y_value:y_text:y_value:y_text....
2028
		xaxis x_value:x_text:x_value:x_text:x_value:x_text....
2029
 
2030
* 22/1 Corrected commands with "pi"... javascript did not calculate the x-value...
2031
 
2032
## 2014
2033
(was using keyword 'input' but changed wims_mathml to use a styled textarea as input...)
2034
 
2035
* 28/12 in case of command 'mathml' , look for 'mathml0' to trigger javascript:read_mathml() if no other ineractiveness was previously defined
2036
* 29/11 copy & copyresized of external images : preparing for drag&drop (outside the drag&drop shape library)
15111 schaersvoo 2037
	correction of zoom_buttons (wrong panning in wrong direction...)
16849 obado 2038
* 27/11 improved plotting of asymptotic curves
2039
* 16/11 setting & reading clock (preliminiary: for now just html-buttons for adjusting H,M,S...should be active fields in canvas...)
15111 schaersvoo 2040
	custom  colours: clock 0,0,60,4,35,45,1,2,white,white,white,black,yellow
2041
	custom  colours: clock 0,0,60,4,35,45,1,2,,,,yellow,red
2042
	default colours: clock 0,0,60,4,35,45,1,2,[space]
2043
	clock x,y,r(px),H,M,S,type hourglass,interactive [ ,H_color,M_color,S_color,background_color,foreground_color ]
16849 obado 2044
* 15/11 changed basic syntax of command clock : all colours are now optional
15111 schaersvoo 2045
	Temporarily removed check on 'valid wims-session' : it is not working for a 'chroot' environment (TODO correct this !!)
2046
	(only when using canvasdraw in a 'chroot' environment , giving : Undefined symbol "_ThreadRuneLocale)
2047
	I can not use the normal implementations found in 'ctypes.h' for this purpose, due to a bug in FreeBSD's C-library
16849 obado 2048
* 14/11 implemented own versions of "tolower()" and "toupper()"...
15111 schaersvoo 2049
	clock x,y,r(px),H,M,S,type hourglass,interactive,H_color,M_color,S_color,background_color,foreground_color
16849 obado 2050
* 13/11 Added interactive=2 (multiple choice  / onclick) to select a single clock
15111 schaersvoo 2051
	(work in progress)
2052
	Add basic interactivness
2053
	Add argument 'hourglass type' to controle appearance of analogue clock
16849 obado 2054
* 12/11 Multiple clocks may be set interactive ; read_canvas() will read all active clocks in H:M:S
15111 schaersvoo 2055
	Preparing for command clock (work in progress)
2056
	(was x/y-range -10,10)
2057
	ymin = 0 ymax = ysize
2058
	xmin = 0 xmax = xsize
16849 obado 2059
* 11/11 If xrange / yrange is not given :
15111 schaersvoo 2060
	Todo: check compatibility...I'm not sure it works the same as in 'flydraw'
2061
	"copyresized x1,y2,x2,y2,dx1,dy1,dx2,dy2,filename_URL"	and "copy x,y,x1,y1,x2,y2,filename_URL"
16849 obado 2062
* 08/11 Added commands
15111 schaersvoo 2063
	Just use a fairly recent Firefox / Opera / Chrome
2064
	E.g all non supported browsers will be excluded...no intention to offer 'canvas glue' library for IE < 9
2065
	try(document.createElement('canvas');)catch(e){alert("no support");return;}
16849 obado 2066
* 03/11	Added check on canvas-support in function 'create_canvas()';
2067
* 01/11 Added 'userdraw text,color' to reply types
15111 schaersvoo 2068
	a confirm will popup asking to delete the selected text.This text will be removed from the "userdraw_txt()" answer array.
16849 obado 2069
	Placing the cursor somewhere on a typed text and hitting "delete/backspace/esc",
15111 schaersvoo 2070
	You will need to hit "enter" to add the text to the array "userdraw_txt()" : lightblue background will disappear
2071
	"backspace / delete / esc" will remove typed text.
2072
	While typing the background of every typed char will be lightblue...
2073
	Any string of multiple strings may be placed anywhere on the canvas.
16849 obado 2074
* 30/10 Finished command 'userdraw text,color'
15111 schaersvoo 2075
	(it is ofcource possible, but at a very very high price)
2076
	because the mouse coordinates do not follow the transformation matrix if in the proximity of a text-object.
2077
	vertical or rotated text can not be set drag / onclick,
16849 obado 2078
* 29/10 add horizontal text to drag / onclick
2079
* 28/10 preparing for adding all 'text' commands to drag / click library
15111 schaersvoo 2080
	Would be nice to have some feedback (...)
2081
	need to find a way to bypass browser differences...using 'String.fromCharCode(evt.keyCode);' is not really a safe method ?
16849 obado 2082
* 27/10 add command "userdraw text,color" work in progress...just a single char, for now (no answer_type,yet)
15111 schaersvoo 2083
	(for example to be used for a barchart created by students)
2084
	add commands "userdraw rects,color" "userdraw roundrects,color" for drawing multiple rectangles
2085
	Many different linegraphs may be used in a single plot.
2086
	to be used together with commands 'grid'. May be combined with freestyle x-axis / y0-axis text (commands 'xaxis' 'yaxis')
16849 obado 2087
* 26/10 add command "linegraph x1:y1:x2:y2...x_n:y_n" : may be further controlled by commands 'strokecolor','linewidth','dashed','dashtype'
15111 schaersvoo 2088
	to be used together with commands 'grid'. May be combined with freestyle x-axis / y0-axis text (commands 'xaxis' 'yaxis')
2089
	add command "barchart x1:y1:color1:x2:y2:color2...x_n:y_n:color_n" to automate generation of barchart
16849 obado 2090
* 25/10 add command "legend string1:string2:...:string_n" to add an automatically sized legend to a graph
2091
* 24/10 add command "piechart xc,yc,radius,'data+colorlist'"
14295 schaersvoo 2092
 
15111 schaersvoo 2093
	add command "fontcolor color" (previously fontcolor=strokecolor) now x/y axis-texts color may be different from axis / xy-tics color
16849 obado 2094
* 22/10 grid: x/y major tics and x/y minor tics now different
15111 schaersvoo 2095
	update 'drag curve fill mathml-input' example (selective removal of filled area)
2096
	freestyle x/y-axistext move with panning (e.g stay in visual image)
2097
	to automate filling axis with text insteadof default numbering xmin...xmax
2098
	yaxis num1:string1:num2:string2:num3:string3:num4:string4:....num_n:string-n
2099
	xaxis num1:string1:num2:string2:num3:string3:num4:string4:....num_n:string-n
16849 obado 2100
* 21/10 added commands:
15111 schaersvoo 2101
	tried to improve 'axisnumbering' in command 'grid' ( avoiding number overlap )
16849 obado 2102
* 20/10 added testresults flydraw versus canvasdraw.
15111 schaersvoo 2103
	added "use_rotate" argument to shape library
16849 obado 2104
* 19/10 ellipse x,y,rx,ry,color is draggable/clickable and will scale/resize on zooming (like all other draggable 'massive' objects)
15111 schaersvoo 2105
	multiple instances of tooltip are allowed (as ofcourse is true for multiple canvas)
16849 obado 2106
* 18/10 corrected tooltip to work / integrate in 'real' wims modules
2107
* 15/10 circle x,y,radius(px),color will scale/resize on zooming (like all other draggable 'massive' objects)
2108
* 13/10 corrected hexcolor input
15111 schaersvoo 2109
	reading of useractions in canvas is only possible for a single instance (for now)
2110
	(experimental work in progress)
2111
	by using unique names for all potential conflicting functions
16849 obado 2112
* 12/10 added support for multi-canvasses in a single html-page
2113
* 10/10 added missing "userdraw polygone,color"
2114
* 9/10  added parallel to shape_library
15111 schaersvoo 2115
	default distance is 20 pix from original 'fill click'
2116
	size of 'measuring rectangle' may be tuned with "clickfillmarge"
16849 obado 2117
* 8/10  added specific removal of a 'click_filled' area.
2118
* 7/10  added arc to shape_library
2119
* 6/10  corrected syntax "fill" == "floodfill" = pixel filling to a border
2120
* 5/10  added missing "userdraw rect,color" "userdraw roundrect,color" "userdraw triangle,color"
2121
* 4/10  added missing "userdraw line,color" "userdraw lines,color"
14381 schaersvoo 2122
 
15111 schaersvoo 2123
or search keywords 'html5' 'canvas' om leiden mirror
2124
For live testing: use "directexec" module on Leiden mirror.
2125
For demo: see demo-directory.
2126
For implemented commands: see canvasdraw.html
2127
   (first need to solve  re-draw issues; managing multiple canvasses in drag/click library)
16849 obado 2128
	- Isolate static javascript code  components/functions from C-"programs"
2129
	- Some bitmap operations (like copyresize etc)
2130
	- OEF interface
15111 schaersvoo 2131
Unadressed issues at this point :
14544 schaersvoo 2132
 
15111 schaersvoo 2133
Opera (>9)
2134
Gecko browsers (Firefox > 17)
2135
Microsoft IE10
2136
Tested on :
14546 schaersvoo 2137
 
15111 schaersvoo 2138
(on Leiden mirror and intranet servers only)
2139
It will be used and tested to replace "flydraw" , "GeoGebra" and "flyapplet" in Schaersvoorde modules.
2140
Preliminary version. All javascript code is generated by 'C-program'
14548 schaersvoo 2141
 
16849 obado 2142
* 4/10/2013 First version