1 /*
  2     Copyright 2008-2017
  3         Matthias Ehmann,
  4         Michael Gerhaeuser,
  5         Carsten Miller,
  6         Bianca Valentin,
  7         Alfred Wassermann,
  8         Peter Wilfahrt
  9 
 10     This file is part of JSXGraph.
 11 
 12     JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
 13 
 14     You can redistribute it and/or modify it under the terms of the
 15 
 16       * GNU Lesser General Public License as published by
 17         the Free Software Foundation, either version 3 of the License, or
 18         (at your option) any later version
 19       OR
 20       * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
 21 
 22     JSXGraph is distributed in the hope that it will be useful,
 23     but WITHOUT ANY WARRANTY; without even the implied warranty of
 24     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 25     GNU Lesser General Public License for more details.
 26 
 27     You should have received a copy of the GNU Lesser General Public License and
 28     the MIT License along with JSXGraph. If not, see <http://www.gnu.org/licenses/>
 29     and <http://opensource.org/licenses/MIT/>.
 30  */
 31 
 32 
 33 /*global JXG:true, define: true*/
 34 /*jslint nomen: true, plusplus: true*/
 35 
 36 /* depends:
 37  jxg
 38  base/constants
 39  math/math
 40  utils/color
 41  utils/type
 42  */
 43 
 44 define([
 45     'jxg', 'base/constants', 'math/math', 'utils/color', 'utils/type'
 46 ], function (JXG, Const, Mat, Color, Type) {
 47 
 48     "use strict";
 49 
 50     /**
 51      * Options Namespace
 52      * @description These are the default options of the board and of all geometry elements.
 53      * @namespace
 54      * @name JXG.Options
 55      */
 56     JXG.Options = {
 57         jc: {
 58             enabled: true,
 59             compile: true
 60         },
 61 
 62         /*
 63          * Options that are used directly within the board class
 64          */
 65         board: {
 66             /**#@+
 67              * @visprop
 68              */
 69 
 70             //updateType: 'hierarchical', // 'all'
 71 
 72             /**
 73              * Bounding box of the visible area in user coordinates.
 74              * It is an array consisting of four values:
 75              * [x<sub>1</sub>, y<sub>1</sub>, x<sub>2</sub>, y<sub>2</sub>]
 76              *
 77              * The canvas will be spanned from the upper left corner (<sub>1</sub>, y<sub>1</sub>)
 78              * to the lower right corner (x<sub>2</sub>, y<sub>2</sub>).
 79              *
 80              * @name JXG.Board#boundingbox
 81              * @type Array
 82              * @default [-5, 5, 5, -5]
 83              */
 84             boundingBox: [-5, 5, 5, -5],
 85 
 86             /**
 87              * Additional zoom factor multiplied to {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}.
 88              *
 89              * @name JXG.Board#zoomFactor
 90              * @type Number
 91              * @default 1.0
 92              */
 93             zoomFactor: 1,
 94 
 95             /**
 96              * Zoom factor in horizontal direction.
 97              *
 98              * @name JXG.Board#zoomX
 99              * @see JXG.Board#zoomY
100              * @type Number
101              * @default 1.0
102              */
103             zoomX: 1,
104 
105             /**
106              * Zoom factor in vertical direction.
107              *
108              * @name JXG.Board#zoomY
109              * @see JXG.Board#zoomX
110              * @type Number
111              * @default 1.0
112              */
113             zoomY: 1,
114 
115             /**
116              * Show copyright string in canvas.
117              *
118              * @name JXG.Board#showCopyright
119              * @type Boolean
120              * @default true
121              */
122             showCopyright: true,
123 
124             /**
125              * Show default axis.
126              * If shown, the horizontal axis can be accessed via JXG.Board.defaultAxes.x, the
127              * vertical axis can be accessed via JXG.Board.defaultAxes.y.
128              * Both axes have a sub-element "defaultTicks".
129              *
130              * Value can be Boolean or an object containing axis attributes.
131              *
132              * @name JXG.Board#axis
133              * @type Boolean
134              * @default false
135              */
136             axis: false,
137 
138             /**
139              * Attributes for the default axes in case of the attribute
140              * axis:true in {@link JXG.JSXGraph#iniBoard}.
141              *
142              * @name JXG.Board#defaultAxes
143              * @type {Object}
144              * @default {x: {name:'x'}, y: {name: 'y'}}
145              *
146              */
147             defaultAxes: {
148                 x: {
149                     name: 'x',
150                     ticks: {
151                         label: {
152                             visible: 'inherit',
153                             anchorX: 'middle',
154                             anchorY: 'top',
155                             fontSize: 12,
156                             offset: [0, -3]
157                         },
158                         drawZero: false,
159                         visible: 'inherit'
160                     }
161                 },
162                 y: {
163                     name: 'y',
164                     ticks: {
165                         label: {
166                             visible: 'inherit',
167                             anchorX: 'right',
168                             anchorY: 'middle',
169                             fontSize: 12,
170                             offset: [-6, 0]
171                         },
172                         drawZero: false,
173                         visible: 'inherit'
174                     }
175                 }
176             },
177 
178             /**
179              * Display of navigation arrows and zoom buttons
180              *
181              * @name JXG.Board#showNavigation
182              * @type Boolean
183              * @default true
184              */
185             showNavigation: true,
186 
187             /**
188              * Display of zoom buttons. To show zoom buttons, additionally
189              * showNavigation has to be set to true.
190              *
191              * @name JXG.Board#showZoom
192              * @type Boolean
193              * @default true
194              */
195             showZoom: true,
196 
197             /**
198              * Show a button to force reload of a construction.
199              * Works only with the JessieCode tag
200              *
201              * @name JXG.Board#showReload
202              * @type Boolean
203              * @default false
204              */
205             showReload: false,
206 
207             showScreenshot: false,
208 
209             screenshot: {
210                 scale: 1.0,
211                 type: 'png',
212                 symbol: '\u2318', //'\u22b9', //'\u26f6',
213                 css: 'background-color:#eeeeee; opacity:1.0; border:2px solid black; border-radius:10px; text-align:center',
214                 cssButton:  'padding: 4px 10px; border: solid #356AA0 1px; border-radius: 5px; position: absolute; right: 2ex; top: 2ex; background-color: rgba(255, 255, 255, 0.3);',
215             },
216 
217             /**
218              * Show a button which allows to clear all traces of a board.
219              *
220              * @name JXG.Board#showClearTraces
221              * @type Boolean
222              * @default false
223              */
224             showClearTraces: false,
225 
226             /**
227              * If set to true the bounding box might be changed such that
228              * the ratio of width and height of the hosting HTML div is equal
229              * to the ratio of wifth and height of the bounding box.
230              *
231              * This is necessary if circles should look like circles and not
232              * like ellipses. It is recommended to set keepAspectRatio = true
233              * for geometric applets. For function plotting keepAspectRatio = false
234              * might be the better choice.
235              *
236              * @name JXG.Board#keepAspectRatio
237              * @see JXG.Board#boundingbox
238              * @see JXG.Board#setBoundingBox
239              * @type Boolean
240              * @default false
241              */
242             keepAspectRatio: false,
243 
244             /**
245              * If set true and
246              * hasPoint() is true for both an element and it's label,
247              * the element (and not the label) is taken as drag element.
248              *
249              * If set false and hasPoint() is true for both an element and it's label,
250              * the label is taken (if it is on a higher layer than the element)
251              *
252              * @name JXG.Board#ignoreLabels
253              * @type Booelan
254              * @default true
255              */
256             ignoreLabels: true,
257 
258             /**
259              * Maximum number of digits in automatic label generation.
260              * For example, if set to 1 automatic point labels end at "Z".
261              * If set to 2, point labels end at "ZZ".
262              *
263              * @name JXG.Board#maxNameLength
264              * @see JXG.Board#generateName
265              * @type Number
266              * @default 1
267              */
268             maxNameLength: 1,
269 
270             /**
271              * Supply the document object. Defaults to window.document
272              *
273              * @name JXG.Board#document
274              * @type DOM object
275              * @default false (meaning window.document)
276              */
277             document: false,
278 
279             /**
280              * If true the first element of the set JXG.board.objects having hasPoint==true is taken as drag element.
281              *
282              * @name JXG.Board#takeFirst
283              * @type Boolean
284              * @default false
285              */
286             takeFirst: false,
287 
288             /**
289             * If true, when read from a file or string - the size of the div can be changed by the construction text.
290             *
291             * @name JXG.Board#takeSizeFromFile
292             * @type Boolean
293             * @default false
294             */
295             takeSizeFromFile: false,
296 
297             /**
298              * Default rendering engine. Possible values are 'svg', 'canvas', 'vml', 'no'.
299              * If the rendering engine is not available JSXGraph tries to detect a different engine.
300              *
301              * <p>
302              * In case of 'canvas' it is advisable to call 'board.update()' after all elements have been
303              * constructed. This ensures that all elements are drawn with their intended visual appearance.
304              *
305              * @name JXG.Board#renderer
306              * @type String
307              * @default 'svg'
308              */
309             renderer: 'svg',
310 
311             /**
312              * Time (in msec) between two animation steps. Used in
313              * {@link JXG.CoordsElement#moveAlong}, {@link JXG.CoordsElement#moveTo} and
314              * {@link JXG.CoordsElement#visit}.
315              *
316              * @name JXG.Board#animationDelay
317              * @type Number
318              * @default 35
319              * @see JXG.CoordsElement#moveAlong
320              * @see JXG.CoordsElement#moveTo
321              * @see JXG.CoordsElement#visit
322              */
323             animationDelay: 35,
324 
325             /**
326              * Allow user interaction by registering mouse and touch events.
327              *
328              * @name JXG.Board#registerEvents
329              * @type Boolean
330              * @default true
331              */
332             registerEvents: true,
333 
334             /**
335              * Change redraw strategy in SVG rendering engine.
336              *
337              * If set to 'svg', before every redrawing of the JSXGraph construction
338              * the SVG sub-tree of the DOM tree is taken out of the DOM.
339              *
340              * If set to 'all', before every redrawing of the JSXGraph construction the
341              * complete DOM tree is taken out of the DOM.
342              * If set to 'none' the redrawing is done in-place.
343              *
344              * Using 'svg' or 'all' speeds up the update process considerably. The risk
345              * is that if there is an exception, only a white div or window is left.
346              *
347              * @name JXG.Board#minimizeReflow
348              * @type String
349              * @default 'svg'
350              */
351             minimizeReflow: 'svg',
352 
353             /**
354              * A number that will be added to the absolute position of the board used in mouse coordinate
355              * calculations in {@link JXG.Board#getCoordsTopLeftCorner}.
356              *
357              * @name JXG.Board#offsetX
358              * @see JXG.Board#offsetY
359              * @type Number
360              * @default 0
361              */
362             offsetX: 0,
363 
364             /**
365              * A number that will be added to the absolute position of the board used in mouse coordinate
366              * calculations in {@link JXG.Board#getCoordsTopLeftCorner}.
367              *
368              * @name JXG.Board#offsetY
369              * @see JXG.Board#offsetX
370              * @type Number
371              * @default 0
372              */
373             offsetY: 0,
374 
375             /**
376              * Control the possibilities for zoom interaction.
377              *
378              * Possible sub-attributes with default values are:
379              * <pre>
380              * zoom: {
381              *   factorX: 1.25,  // horizontal zoom factor (multiplied to {@link JXG.Board#zoomX})
382              *   factorY: 1.25,  // vertical zoom factor (multiplied to {@link JXG.Board#zoomY})
383              *   wheel: false,     // allow zooming by mouse wheel or
384              *   				   // by pinch-to-toom gesture on touch devices
385              *   needShift: false, // mouse wheel zooming needs pressing of the shift key
386              *   min: 0.001        // minimal values of {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}, limits zoomOut
387              *   max: 1000.0       // maximal values of {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}, limits zoomIn
388              *
389              *   pinchHorizontal: true // Allow pinch-to-zoom to zoom only horizontal axis
390              *   pinchVertical: true   // Allow pinch-to-zoom to zoom only vertical axis
391              *   pinchSensitivity: 7   // Sensitivity (in degrees) for recognizing horizontal or vertical pinch-to-zoom gestures.
392              * }
393              * </pre>
394              *
395              * Deprecated: zoom.eps which is superseded by zoom.min
396              *
397              * @name JXG.Board#zoom
398              * @type Object
399              * @default
400              */
401             zoom: {
402                 enabled: true,
403                 factorX: 1.25,
404                 factorY: 1.25,
405                 wheel: false,
406                 needShift: false,
407                 min: 0.0001,
408                 max: 10000.0,
409                 pinchHorizontal: true,
410                 pinchVertical: true,
411                 pinchSensitivity: 7
412             },
413 
414             /**
415              * Control the possibilities for panning interaction (i.e. moving the origin).
416              *
417              * Possible sub-attributes with default values are:
418              * <pre>
419              * pan: {
420              *   enabled: true   // Allow panning
421              *   needTwoFingers: true, // panning is done with two fingers on touch devices
422              *   needShift: true, // mouse panning needs pressing of the shift key
423              * }
424              * </pre>
425              *
426              * @name JXG.Board#pan
427              * @type Object
428              * @default
429              */
430             pan: {
431                 needShift: true,
432                 needTwoFingers: false,
433                 enabled: true
434             },
435 
436             /**
437              * Control the possibilities for a selection rectangle.
438              * Starting a selection event triggers the "startselecting" event.
439              * When the mouse pointer is released, the "stopselecting" event is fired.
440              * The "stopselecting" event must be supplied by the user.
441              * <p>
442              * Possible sub-attributes with default values are:
443              * <pre>
444              * selection: {
445              *   enabled: false,
446              *   name: 'selectionPolygon',
447              *   needShift: false,  // mouse selection needs pressing of the shift key
448              *   needCtrl: true,    // mouse selection needs pressing of the shift key
449              *   withLines: false,  // Selection polygon has border lines
450              *   vertices: {
451              *       visible: false
452              *   },
453              *   fillColor: '#ffff00',
454              *   visible: false      // Initial visibility. Should be set to false always
455              * }
456              * </pre>
457              *
458              * @example
459              * board.on('stopselecting', function(){
460              *     var box = board.stopSelectionMode(),
461              *     // bbox has the coordinates of the selectionr rectangle.
462              *     // Attention: box[i].usrCoords have the form [1, x, y], i.e.
463              *     // are homogeneous coordinates.
464              *     bbox = box[0].usrCoords.slice(1).concat(box[1].usrCoords.slice(1));
465              *     // Set a new bounding box
466              *     board.setBoundingBox(bbox, false);
467              * });
468              *
469              * @name JXG.Board#selection
470              * @see JXG.Board#startselecting
471              * @see JXG.Board#stopselecting
472              * @see JXG.Board#mousestartselecting
473              * @see JXG.Board#pointerstartselecting
474              * @see JXG.Board#touchstartselecting
475              * @see JXG.Board#mousestopselecting
476              * @see JXG.Board#pointerstopselecting
477              * @see JXG.Board#touchstopselecting
478              * @type Object
479              * @default
480              */
481             selection: {
482                 enabled: false,
483                 name: 'selectionPolygon',
484                 needShift: false,
485                 needCtrl: true,
486                 withLines: false,
487                 vertices: {
488                     visible: false
489                 },
490                 fillColor: '#ffff00',
491                 visible: false
492             }
493             /**#@-*/
494         },
495 
496         /**
497          * Options that are used by the navigation bar.
498          *
499          * Default values are
500          * <pre>
501          * JXG.Option.navbar: {
502          *   strokeColor: '#333333',
503          *   fillColor: 'transparent',
504          *   highlightFillColor: '#aaaaaa',
505          *   padding: '2px',
506          *   position: 'absolute',
507          *   fontSize: '14px',
508          *   cursor: 'pointer',
509          *   zIndex: '100',
510          *   right: '5px',
511          *   bottom: '5px'
512          * },
513          * </pre>
514          */
515         navbar: {
516             strokeColor: '#333333', //'#aaaaaa',
517             fillColor: 'transparent', //#f5f5f5',
518             highlightFillColor: '#aaaaaa',
519             padding: '2px',
520             position: 'absolute',
521             fontSize: '14px',
522             cursor: 'pointer',
523             zIndex: '100',
524             right: '5px',
525             bottom: '5px'
526             //border: 'none 1px black',
527             //borderRadius: '4px'
528         },
529 
530          /*
531           *  Generic options used by {@link JXG.GeometryElement}
532           */
533         elements: {
534             // the following tag is a meta tag: http://code.google.com/p/jsdoc-toolkit/wiki/MetaTags
535 
536             /**#@+
537              * @visprop
538              */
539 
540             /**
541              * The stroke color of the given geometry element.
542              * @type String
543              * @name JXG.GeometryElement#strokeColor
544              * @see JXG.GeometryElement#highlightStrokeColor
545              * @see JXG.GeometryElement#strokeWidth
546              * @see JXG.GeometryElement#strokeOpacity
547              * @see JXG.GeometryElement#highlightStrokeOpacity
548              * @default {@link JXG.Options.elements.color#strokeColor}
549              */
550             strokeColor: '#0000ff',
551 
552             /**
553              * The stroke color of the given geometry element when the user moves the mouse over it.
554              * @type String
555              * @name JXG.GeometryElement#highlightStrokeColor
556              * @see JXG.GeometryElement#strokeColor
557              * @see JXG.GeometryElement#strokeWidth
558              * @see JXG.GeometryElement#strokeOpacity
559              * @see JXG.GeometryElement#highlightStrokeOpacity
560              * @default {@link JXG.Options.elements.color#highlightStrokeColor}
561              */
562             highlightStrokeColor: '#C3D9FF',
563 
564             /**
565              * The fill color of this geometry element.
566              * @type String
567              * @name JXG.GeometryElement#fillColor
568              * @see JXG.GeometryElement#highlightFillColor
569              * @see JXG.GeometryElement#fillOpacity
570              * @see JXG.GeometryElement#highlightFillOpacity
571              * @default {@link JXG.Options.elements.color#fillColor}
572              */
573             fillColor: 'red',
574 
575             /**
576              * The fill color of the given geometry element when the mouse is pointed over it.
577              * @type String
578              * @name JXG.GeometryElement#highlightFillColor
579              * @see JXG.GeometryElement#fillColor
580              * @see JXG.GeometryElement#fillOpacity
581              * @see JXG.GeometryElement#highlightFillOpacity
582              * @default {@link JXG.Options.elements.color#highlightFillColor}
583              */
584             highlightFillColor: 'none',
585 
586             /**
587              * Opacity for element's stroke color.
588              * @type number
589              * @name JXG.GeometryElement#strokeOpacity
590              * @see JXG.GeometryElement#strokeColor
591              * @see JXG.GeometryElement#highlightStrokeColor
592              * @see JXG.GeometryElement#strokeWidth
593              * @see JXG.GeometryElement#highlightStrokeOpacity
594              * @default {@link JXG.Options.elements#strokeOpacity}
595              */
596             strokeOpacity: 1,
597 
598             /**
599              * Opacity for stroke color when the object is highlighted.
600              * @type number
601              * @name JXG.GeometryElement#highlightStrokeOpacity
602              * @see JXG.GeometryElement#strokeColor
603              * @see JXG.GeometryElement#highlightStrokeColor
604              * @see JXG.GeometryElement#strokeWidth
605              * @see JXG.GeometryElement#strokeOpacity
606              * @default {@link JXG.Options.elements#highlightStrokeOpacity}
607              */
608             highlightStrokeOpacity: 1,
609 
610             /**
611              * Opacity for fill color.
612              * @type number
613              * @name JXG.GeometryElement#fillOpacity
614              * @see JXG.GeometryElement#fillColor
615              * @see JXG.GeometryElement#highlightFillColor
616              * @see JXG.GeometryElement#highlightFillOpacity
617              * @default {@link JXG.Options.elements.color#fillOpacity}
618              */
619             fillOpacity: 1,
620 
621             /**
622              * Opacity for fill color when the object is highlighted.
623              * @type number
624              * @name JXG.GeometryElement#highlightFillOpacity
625              * @see JXG.GeometryElement#fillColor
626              * @see JXG.GeometryElement#highlightFillColor
627              * @see JXG.GeometryElement#fillOpacity
628              * @default {@link JXG.Options.elements.color#highlightFillOpacity}
629              */
630             highlightFillOpacity: 1,
631 
632             /**
633              * Transition duration (in milliseconds) for color and opacity
634              * changes. Works in SVG renderer, only.
635              * @type Number
636              * @name JXG.GeometryElement#transitionDuration
637              * @see JXG.GeometryElement#strokeColor
638              * @see JXG.GeometryElement#highlightStrokeColor
639              * @see JXG.GeometryElement#strokeOpacity
640              * @see JXG.GeometryElement#highlightStrokeOpacity
641              * @see JXG.GeometryElement#fillColor
642              * @see JXG.GeometryElement#highlightFillColor
643              * @see JXG.GeometryElement#fillOpacity
644              * @see JXG.GeometryElement#highlightFillOpacity
645              * @default {@link JXG.Options.elements#transitionDuration}
646              */
647             transitionDuration: 100,
648 
649             /**
650              * Width of the element's stroke.
651              * @type number
652              * @name JXG.GeometryElement#strokeWidth
653              * @see JXG.GeometryElement#strokeColor
654              * @see JXG.GeometryElement#highlightStrokeColor
655              * @see JXG.GeometryElement#strokeOpacity
656              * @see JXG.GeometryElement#highlightStrokeOpacity
657              * @default {@link JXG.Options.elements#strokeWidth}
658              */
659             strokeWidth: 2,
660 
661             /**
662              * Width of the element's stroke when the mouse is pointed over it.
663              * @type number
664              * @name JXG.GeometryElement#highlightStrokeWidth
665              * @see JXG.GeometryElement#strokeColor
666              * @see JXG.GeometryElement#highlightStrokeColor
667              * @see JXG.GeometryElement#strokeOpacity
668              * @see JXG.GeometryElement#highlightStrokeOpacity
669              * @see JXG.GeometryElement#highlightFillColor
670              * @default {@link JXG.Options.elements#strokeWidth}
671              */
672             highlightStrokeWidth: 2,
673 
674             /**
675              * If true the element is fixed and can not be dragged around. The element
676              * will be repositioned on zoom and moveOrigin events.
677              * @type Boolean
678              * @default false
679              * @name JXG.GeometryElement#fixed
680              */
681             fixed: false,
682 
683             /**
684              * If true the element is fixed and can not be dragged around. The element
685              * will even stay at its position on zoom and moveOrigin events.
686              * Only free elements like points, texts, curves can be frozen.
687              * @type Boolean
688              * @default false
689              * @name JXG.GeometryElement#frozen
690              */
691             frozen: false,
692 
693             /**
694              * If true a label will display the element's name.
695              * @type Boolean
696              * @default false
697              * @name JXG.GeometryElement#withLabel
698              */
699             withLabel: false,
700 
701             /**
702              * If false the element won't be visible on the board, otherwise it is shown.
703              * @type boolean
704              * @name JXG.GeometryElement#visible
705              * @see JXG.GeometryElement#hideElement
706              * @see JXG.GeometryElement#showElement
707              * @default true
708              */
709             visible: true,
710 
711             /**
712              * A private element will be inaccessible in certain environments, e.g. a graphical user interface.
713              * @default false
714              */
715             priv: false,
716 
717             /**
718              * Display layer which will contain the element.
719              * @see JXG.Options#layer
720              * @default See {@link JXG.Options#layer}
721              */
722             layer: 0,
723 
724             /**
725              * Determines the elements border-style.
726              * Possible values are:
727              * <ul><li>0 for a solid line</li>
728              * <li>1 for a dotted line</li>
729              * <li>2 for a line with small dashes</li>
730 
731 
732              * <li>3 for a line with medium dashes</li>
733              * <li>4 for a line with big dashes</li>
734              * <li>5 for a line with alternating medium and big dashes and large gaps</li>
735              * <li>6 for a line with alternating medium and big dashes and small gaps</li></ul>
736              * @type Number
737              * @name JXG.GeometryElement#dash
738              * @default 0
739              */
740             dash: 0,
741 
742             /**
743              * If true the element will get a shadow.
744              * @type boolean
745              * @name JXG.GeometryElement#shadow
746              * @default false
747              */
748             shadow: false,
749 
750             /**
751              * If true the element will be traced, i.e. on every movement the element will be copied
752              * to the background. Use {@link JXG.GeometryElement#clearTrace} to delete the trace elements.
753              * @see JXG.GeometryElement#clearTrace
754              * @see JXG.GeometryElement#traces
755              * @see JXG.GeometryElement#numTraces
756              * @type Boolean
757              * @default false
758              * @name JXG.GeometryElement#trace
759              */
760             trace: false,
761 
762             /**
763              * Extra visual properties for traces of an element
764              * @type Object
765              * @see JXG.GeometryElement#trace
766              * @name JXG.GeometryElement#traceAttributes
767              */
768             traceAttributes: {},
769 
770             /**
771              *
772              * @type Boolean
773              * @default true
774              * @name JXG.GeometryElement#highlight
775              */
776             highlight: true,
777 
778             /**
779              * If this is set to true, the element is updated in every update
780              * call of the board. If set to false, the element is updated only after
781              * zoom events or more generally, when the bounding box has been changed.
782              * Examples for the latter behaviour should be axes.
783              * @type Boolean
784              * @default true
785              * @see JXG.GeometryElement#needsRegularUpdate
786              * @name JXG.GeometryElement#needsRegularUpdate
787              */
788             needsRegularUpdate: true,
789 
790             /**
791              * Snaps the element or its parents to the grid. Currently only relevant for points, circles,
792              * and lines. Points are snapped to grid directly, on circles and lines it's only the parent
793              * points that are snapped
794              * @type Boolean
795              * @default false
796              * @name JXG.GeometryElement#snapToGrid
797              */
798             snapToGrid: false,
799 
800             /**
801              * Determines whether two-finger manipulation of this object may change its size.
802              * If set to false, the object is only rotated and translated.
803              * @type Boolean
804              * @default true
805              * @name JXG.GeometryElement#scalable
806              */
807             scalable: true,
808 
809             /**
810              * If the element is dragged it will be moved on mousedown or touchstart to the
811              * top of its layer. Works only for SVG renderer and for ssimple elements
812              * consisting of one SVG node.
813              * @type Boolean
814              * @default false
815              * @name JXG.GeometryElement#scalable
816              */
817             dragToTopOfLayer: false,
818 
819             /*draft options */
820             draft: {
821                 /**
822                  * If true the element will be drawn in grey scale colors to visualize that it's only a draft.
823                  * @type boolean
824                  * @name JXG.GeometryElement#draft
825                  * @default {@link JXG.Options.elements.draft#draft}
826                  */
827                 draft: false,
828                 strokeColor: '#565656',
829                 fillColor: '#565656',
830                 strokeOpacity: 0.8,
831                 fillOpacity: 0.8,
832                 strokeWidth: 1
833             },
834 
835             /**
836              * @private
837              * By default, an element is not a label. Do not change this.
838              */
839             isLabel: false
840             // close the meta tag
841             /**#@-*/
842         },
843 
844          /*
845           *  Generic options used by {@link JXG.Ticks}
846           */
847         ticks: {
848             /**#@+
849              * @visprop
850              */
851 
852             /**
853              * A function that expects two {@link JXG.Coords}, the first one representing the coordinates of the
854              * tick that is to be labeled, the second one the coordinates of the center (the tick with position 0).
855              *
856              * @type function
857              * @name Ticks#generateLabelText
858              */
859             generateLabelText: null,
860 
861             /**
862              * A function that expects two {@link JXG.Coords}, the first one representing the coordinates of the
863              * tick that is to be labeled, the second one the coordinates of the center (the tick with position 0).
864              *
865              * @deprecated Use {@link JGX.Options@generateLabelValue}
866              * @type function
867              * @name Ticks#generateLabelValue
868              */
869             generateLabelValue: null,
870 
871             /**
872              * Draw labels yes/no
873              *
874              * @type Boolean
875              * @name Ticks#drawLabels
876              * @default false
877              */
878             drawLabels: false,
879             label: {
880             },
881 
882             /**
883              * Use the unicode character 0x2212, i.e. the HTML entity &minus; as minus sign.
884              * That is −1 instead of -1.
885              *
886              * @type Boolean
887              * @name Ticks#useUnicodeMinus
888              * @default true
889              */
890             useUnicodeMinus: true,
891 
892             /**
893              * Determine the position of the tick with value 0. 'left' means point1 of the line, 'right' means point2,
894              * and 'middle' is equivalent to the midpoint of the defining points. This attribute is ignored if the parent
895              * line is of type axis and is parallel to either the x (i.e. y = 0) or the y (i.e. x = 0) axis.
896              *
897              * @type String
898              * @name Ticks#anchor
899              * @default 'left'
900              */
901             anchor: 'left',
902 
903             /**
904              * Draw the zero tick, that lies at line.point1?
905              *
906              * @type Boolean
907              * @name Ticks#drawZero
908              * @default false
909              */
910             drawZero: false,
911 
912             /**
913              * If the distance between two ticks is too big we could insert new ticks. If insertTicks
914              * is <tt>true</tt>, we'll do so, otherwise we leave the distance as is.
915              * This option is ignored if equidistant is false. In the example below the distance between
916              * two ticks is given as <tt>1</tt> but because insertTicks is set to true many ticks will
917              * be omitted in the rendering process to keep the display clear.
918              *
919              * @type Boolean
920              * @name Ticks#insertTicks
921              * @see Ticks#equidistant
922              * @see Ticks#minTicksDistance
923              * @default false
924              * @example
925              * // Create an axis providing two coord pairs.
926              *   var p1 = board.create('point', [0, 0]);
927              *   var p2 = board.create('point', [50, 25]);
928              *   var l1 = board.create('line', [p1, p2]);
929              *   var t = board.create('ticks', [l1, 1], {
930              *      insertTicks: true,
931              *      majorHeight: -1,
932              *      label: {
933              *          offset: [4, -9]
934              *      },
935              *      drawLabels: true
936              *  });
937              * </pre><div class="jxgbox" id="2f6fb842-40bd-4223-aa28-3e9369d2097f" style="width: 300px; height: 300px;"></div>
938              * <script type="text/javascript">
939              * (function () {
940              *   var board = JXG.JSXGraph.initBoard('2f6fb842-40bd-4223-aa28-3e9369d2097f', {boundingbox: [-100, 70, 70, -100], showcopyright: false, shownavigation: false});
941              *   var p1 = board.create('point', [0, 0]);
942              *   var p2 = board.create('point', [50, 25]);
943              *   var l1 = board.create('line', [p1, p2]);
944              *   var t = board.create('ticks', [l1, 1], {insertTicks: true, majorHeight: -1, label: {offset: [4, -9]}, drawLabels: true});
945              * })();
946              * </script><pre>
947              */
948             insertTicks: false,
949             minTicksDistance: 10,
950 
951             /**
952              * Total height of a minor tick. If negative the full height of the board is taken.
953              *
954              * @type Number
955              * @name Ticks#minorHeight
956              * @default 4
957              */
958             minorHeight: 4,
959 
960             /**
961              * Total height of a major tick. If negative the full height of the board is taken.
962              *
963              * @type Number
964              * @name Ticks#majorHeight
965              * @default 10
966              */
967             majorHeight: 10,
968 
969             /**
970              * Decides in which direction finite ticks are visible. Possible values are either the constants
971              * 0=false or 1=true or a function returning 0 or 1.
972              *
973              * In case of [0,1] the tick is only visible to the right of the line. In case of
974              * [1,0] the tick is only visible to the left of the line.
975              *
976              * @type Array
977              * @name Ticks#tickEndings
978              * @default [1, 1]
979              */
980             tickEndings: [1, 1],
981 
982             /**
983              * The number of minor ticks between two major ticks.
984              * @type Number
985              * @name Ticks#minorTicks
986              * @default 4
987              */
988             minorTicks: 4,
989 
990             /**
991              * Scale the ticks but not the tick labels.
992              * @type Number
993              * @default 1
994              * @name Ticks#scale
995              * @see Ticks#scaleSymbol
996              */
997             scale: 1,
998 
999             /**
1000              * A string that is appended to every tick, used to represent the scale
1001              * factor given in {@link JXG.Ticks#scaleSymbol}.
1002              *
1003              * @type String
1004              * @default ''
1005              * @name Ticks#scaleSymbol
1006              * @see Ticks#scale
1007              */
1008             scaleSymbol: '',
1009 
1010             /**
1011              * User defined labels for special ticks. Instead of the i-th tick's position, the i-th string stored in this array
1012              * is shown. If the number of strings in this array is less than the number of special ticks, the tick's position is
1013              * shown as a fallback.
1014              *
1015              * @type Array
1016              * @name Ticks#labels
1017              * @default []
1018              */
1019             labels: [],
1020 
1021             /**
1022              * The maximum number of characters a tick label can use.
1023              *
1024              * @type Number
1025              * @name Ticks#maxLabelLength
1026              * @see Ticks#precision
1027              * @default 5
1028              */
1029             maxLabelLength: 5,
1030 
1031             /**
1032              * If a label exceeds {@link JXG.Ticks#maxLabelLength} this determines the precision used to shorten the tick label.
1033              *
1034              * @type Number
1035              * @name Ticks#precision
1036              * @see Ticks#maxLabelLength
1037              * @default 3
1038              */
1039             precision: 3,
1040 
1041             /**
1042              * The default distance between two ticks. Please be aware that this value does not have
1043              * to be used if {@link JXG.Ticks#insertTicks} is set to true.
1044              *
1045              * @type Number
1046              * @name Ticks#ticksDistance
1047              * @see Ticks#equidistant
1048              * @see Ticks#insertTicks
1049              * @default 1
1050              */
1051             ticksDistance: 1,
1052             strokeOpacity: 1,
1053             strokeWidth: 1,
1054             strokeColor: 'black',
1055             highlightStrokeColor: '#888888',
1056             visible: 'inherit',
1057 
1058             /**
1059              * Whether line boundaries should be counted or not in the lower and upper bounds when
1060              * creating ticks.
1061              *
1062              * @type Boolean
1063              * @name Ticks#includeBoundaries
1064              * @default false
1065              */
1066             includeBoundaries: false
1067             // close the meta tag
1068             /**#@-*/
1069         },
1070 
1071          /*
1072           *  Generic options used by {@link JXG.Hatch}
1073           */
1074         hatch: {
1075             drawLabels: false,
1076             drawZero: true,
1077             majorHeight: 20,
1078             anchor: 'middle',
1079             strokeWidth: 2,
1080             strokeColor: 'blue',
1081             ticksDistance: 0.2
1082         },
1083 
1084         /**
1085          * Precision options.
1086          *
1087          * The default values are
1088          * <pre>
1089          * JXG.Options.precision: {
1090          *   touch: 30,
1091          *   touchMax: 100,
1092          *   mouse: 4,
1093          *   epsilon: 0.0001,
1094          *   hasPoint: 4
1095          * }
1096          * </pre>
1097          */
1098         precision: {
1099             touch: 30,
1100             touchMax: 100,
1101             mouse: 4,
1102             epsilon: 0.0001,
1103             hasPoint: 4
1104         },
1105 
1106         /**
1107          * Default ordering of the layers.
1108          *
1109          * The default values are
1110          * <pre>
1111          * JXG.Options.layer: {
1112          *   numlayers: 20, // only important in SVG
1113          *   text: 9,
1114          *   point: 9,
1115          *   glider: 9,
1116          *   arc: 8,
1117          *   line: 7,
1118          *   circle: 6,
1119          *   curve: 5,
1120          *   turtle: 5,
1121          *   polygon: 3,
1122          *   sector: 3,
1123          *   angle: 3,
1124          *   integral: 3,
1125          *   axis: 2,
1126          *   ticks: 2,
1127          *   grid: 1,
1128          *   image: 0,
1129          *   trace: 0
1130          * }
1131          * </pre>
1132          */
1133         layer: {
1134             numlayers: 20, // only important in SVG
1135             text: 9,
1136             point: 9,
1137             glider: 9,
1138             arc: 8,
1139             line: 7,
1140             circle: 6,
1141             curve: 5,
1142             turtle: 5,
1143             polygon: 3,
1144             sector: 3,
1145             angle: 3,
1146             integral: 3,
1147             axis: 2,
1148             ticks: 2,
1149             grid: 1,
1150             image: 0,
1151             trace: 0
1152         },
1153 
1154         /* special angle options */
1155         angle: {
1156             /**#@+
1157              * @visprop
1158              */
1159 
1160             withLabel: true,
1161 
1162             /**
1163              * Radius of the sector, displaying the angle.
1164              *
1165              * @type Number
1166              * @name Angle#radius
1167              * @default 0.5
1168              * @visprop
1169              */
1170             radius: 0.5,
1171 
1172             /**
1173              * Display type of the angle field. Possible values are
1174              * 'sector' or 'sectordot' or 'square' or 'none'.
1175              *
1176              * @type String
1177              * @default 'sector'
1178              * @name Angle#type
1179              * @visprop
1180              */
1181             type: 'sector',
1182 
1183             /**
1184              * Display type of the angle field in case of a right angle. Possible values are
1185              * 'sector' or 'sectordot' or 'square' or 'none'.
1186              *
1187              * @type String
1188              * @default square
1189              * @name Angle#orthoType
1190              * @see Angle#orthoSensitivity
1191              * @visprop
1192              */
1193             orthoType: 'square',
1194 
1195             /**
1196              * Sensitivity (in degrees) to declare an angle as right angle.
1197              * If the angle measure is inside this distance from a rigth angle, the orthoType
1198              * of the angle is used for display.
1199              *
1200              * @type Number
1201              * @default 1.0
1202              * @name Angle#orthoSensitivity
1203              * @see Angle#orthoType
1204              * @visprop
1205              */
1206             orthoSensitivity: 1.0,
1207 
1208             fillColor: '#FF7F00',
1209             highlightFillColor: '#FF7F00',
1210             strokeColor: '#FF7F00',
1211             fillOpacity: 0.3,
1212             highlightFillOpacity: 0.3,
1213 
1214             /**
1215              * @deprecated
1216              */
1217             radiuspoint: {
1218                 withLabel: false,
1219                 visible: false,
1220                 name: ''
1221             },
1222             /**
1223              * @deprecated
1224              */
1225             pointsquare: {
1226                 withLabel: false,
1227                 visible: false,
1228                 name: ''
1229             },
1230 
1231             dot: {
1232                 visible: false,
1233                 strokeColor: 'none',
1234                 fillColor: 'black',
1235                 size: 2,
1236                 face: 'o',
1237                 withLabel: false,
1238                 name: ''
1239             },
1240             label: {
1241                 position: 'top',
1242                 offset: [0, 0],
1243                 strokeColor: '#0000FF'
1244             },
1245 
1246             arc: {
1247                 visible: false
1248             }
1249 
1250             /**#@-*/
1251         },
1252 
1253         /* special arc options */
1254         arc: {
1255             /**#@+
1256              * @visprop
1257              */
1258 
1259             label: {},
1260             firstArrow: false,
1261             lastArrow: false,
1262             fillColor: 'none',
1263             highlightFillColor: 'none',
1264             strokeColor: '#0000ff',
1265             highlightStrokeColor: '#C3D9FF',
1266             useDirection: false
1267 
1268             /**#@-*/
1269         },
1270 
1271         /* special axis options */
1272         axis: {
1273             /**#@+
1274              * @visprop
1275              */
1276 
1277             name: '',                            // By default, do not generate names for axes.
1278             needsRegularUpdate: false,           // Axes only updated after zooming and moving of the origin.
1279             strokeWidth: 1,
1280             lastArrow: {
1281                 type: 1,
1282                 size: 8
1283             },
1284             strokeColor: '#666666',
1285             highlightStrokeWidth: 1,
1286             highlightStrokeColor: '#888888',
1287             withTicks: true,
1288             straightFirst: true,
1289             straightLast: true,
1290             margin: -4,
1291             withLabel: false,
1292             scalable: false,
1293 
1294             /**
1295              * Attributes for ticks of the axis.
1296              *
1297              * @type Ticks
1298              * @name Axis#ticks
1299              */
1300             ticks: {
1301                 label: {
1302                     offset: [4, -12 + 3],     // This seems to be a good offset for 12 point fonts
1303                     parse: false,
1304                     needsRegularUpdate: false,
1305                     display: 'internal',
1306                     visible: 'inherit',
1307                     layer: 9
1308                 },
1309                 visible: 'inherit',
1310                 needsRegularUpdate: false,
1311                 strokeWidth: 1,
1312                 strokeColor: '#666666',
1313                 highlightStrokeColor: '#888888',
1314                 drawLabels: true,
1315                 drawZero: false,
1316                 insertTicks: true,
1317                 minTicksDistance: 5,
1318                 minorHeight: 10,          // if <0: full width and height
1319                 majorHeight: -1,          // if <0: full width and height
1320                 tickEndings: [0, 1],
1321                 minorTicks: 4,
1322                 ticksDistance: 1,         // TODO doc
1323                 strokeOpacity: 0.25
1324             },
1325 
1326             /**
1327              * Attributes for first point the axis.
1328              *
1329              * @type Point
1330              * @name Axis#point1
1331              */
1332             point1: {                  // Default values for point1 if created by line
1333                 needsRegularUpdate: false,
1334                 visible: false
1335             },
1336 
1337             /**
1338              * Attributes for second point the axis.
1339              *
1340              * @type Point
1341              * @name Axis#point2
1342              */
1343             point2: {                  // Default values for point2 if created by line
1344                 needsRegularUpdate: false,
1345                 visible: false
1346             },
1347 
1348             /**
1349              * Attributes for the axis label.
1350              *
1351              * @type Label
1352              * @name Axis#label
1353              */
1354             label: {
1355                 position: 'lft',
1356                 offset: [10, 10]
1357             }
1358             /**#@-*/
1359         },
1360 
1361         /* special options for angle bisector of 3 points */
1362         bisector: {
1363             /**#@+
1364              * @visprop
1365              */
1366 
1367             strokeColor: '#000000', // Bisector line
1368 
1369             /**
1370              * Attributes for the helper point of the bisector.
1371              *
1372              * @type Point
1373              * @name Bisector#point
1374              */
1375             point: {               // Bisector point
1376                 visible: false,
1377                 fixed: false,
1378                 withLabel: false,
1379                 name: ''
1380             }
1381 
1382             /**#@-*/
1383         },
1384 
1385         /* special options for the 2 bisectors of 2 lines */
1386         bisectorlines: {
1387             /**#@+
1388              * @visprop
1389              */
1390 
1391             /**
1392              * Attributes for first line.
1393              *
1394              * @type Line
1395              * @name Bisectorlines#line1
1396              */
1397             line1: {               //
1398                 strokeColor: 'black'
1399             },
1400 
1401             /**
1402              * Attributes for second line.
1403              *
1404              * @type Line
1405              * @name Bisectorlines#line2
1406              */
1407             line2: {               //
1408                 strokeColor: 'black'
1409             }
1410 
1411             /**#@-*/
1412         },
1413 
1414         /* special button options */
1415         button: {
1416             /**#@+
1417              * @visprop
1418              */
1419 
1420             /**
1421              * Control the attribute "disabled" of the HTML button.
1422              *
1423              * @name disabled
1424              * @memberOf Button.prototype
1425              *
1426              * @type Boolean
1427              * @default false
1428              */
1429             disabled: false,
1430 
1431             /**#@-*/
1432         },
1433 
1434         /* special chart options */
1435         chart: {
1436             /**#@+
1437              * @visprop
1438              */
1439 
1440             chartStyle: 'line',
1441             colors: ['#B02B2C', '#3F4C6B', '#C79810', '#D15600', '#FFFF88', '#C3D9FF', '#4096EE', '#008C00'],
1442             highlightcolors: null,
1443             fillcolor: null,
1444             highlightonsector: false,
1445             highlightbysize: false,
1446 
1447             fillOpacity: 0.6,
1448             withLines:  false,
1449 
1450             label: {
1451             }
1452             /**#@-*/
1453         },
1454 
1455         /* special html slider options */
1456         checkbox: {
1457             /**#@+
1458              * @visprop
1459              */
1460 
1461             /**
1462              * Control the attribute "disabled" of the HTML checkbox.
1463              *
1464              * @name disabled
1465              * @memberOf Checkbox.prototype
1466              *
1467              * @type Boolean
1468              * @default false
1469              */
1470             disabled: false,
1471 
1472             /**#@-*/
1473         },
1474 
1475         /*special circle options */
1476         circle: {
1477             /**#@+
1478              * @visprop
1479              */
1480 
1481             /**
1482              * If <tt>true</tt>, moving the mouse over inner points triggers hasPoint.
1483              *
1484              * @see JXG.GeometryElement#hasPoint
1485              * @name Circle#hasInnerPoints
1486              * @type Boolean
1487              * @default false
1488              */
1489             hasInnerPoints: false,
1490 
1491             fillColor: 'none',
1492             highlightFillColor: 'none',
1493             strokeColor: '#0000ff',
1494             highlightStrokeColor: '#C3D9FF',
1495 
1496             /**
1497              * Attributes for center point.
1498              *
1499              * @type Point
1500              * @name Circle#center
1501              */
1502             center: {
1503                 visible: false,
1504                 withLabel: false,
1505                 fixed: false,
1506                 name: ''
1507             },
1508 
1509             /**
1510              * Attributes for circle label.
1511              *
1512              * @type Label
1513              * @name Circle#label
1514              */
1515             label: {
1516                 position: 'urt'
1517             }
1518             /**#@-*/
1519         },
1520 
1521         /* special options for circumcircle of 3 points */
1522         circumcircle: {
1523             /**#@+
1524              * @visprop
1525              */
1526 
1527             fillColor: 'none',
1528             highlightFillColor: 'none',
1529             strokeColor: '#0000ff',
1530             highlightStrokeColor: '#C3D9FF',
1531 
1532             /**
1533              * Attributes for center point.
1534              *
1535              * @type Point
1536              * @name Circumcircle#center
1537              */
1538             center: {               // center point
1539                 visible: false,
1540                 fixed: false,
1541                 withLabel: false,
1542                 name: ''
1543             }
1544             /**#@-*/
1545         },
1546 
1547         circumcirclearc: {
1548             /**#@+
1549              * @visprop
1550              */
1551 
1552             fillColor: 'none',
1553             highlightFillColor: 'none',
1554             strokeColor: '#0000ff',
1555             highlightStrokeColor: '#C3D9FF',
1556 
1557             /**
1558              * Attributes for center point.
1559              *
1560              * @type Point
1561              * @name CircumcircleArc#center
1562              */
1563             center: {
1564                 visible: false,
1565                 withLabel: false,
1566                 fixed: false,
1567                 name: ''
1568             }
1569             /**#@-*/
1570         },
1571 
1572         /* special options for circumcircle sector of 3 points */
1573         circumcirclesector: {
1574             /**#@+
1575              * @visprop
1576              */
1577 
1578             useDirection: true,
1579             fillColor: '#00FF00',
1580             highlightFillColor: '#00FF00',
1581             fillOpacity: 0.3,
1582             highlightFillOpacity: 0.3,
1583             strokeColor: '#0000ff',
1584             highlightStrokeColor: '#C3D9FF',
1585 
1586             /**
1587              * Attributes for center point.
1588              *
1589              * @type Point
1590              * @name Circle#point
1591              */
1592             point: {
1593                 visible: false,
1594                 fixed: false,
1595                 withLabel: false,
1596                 name: ''
1597             }
1598             /**#@-*/
1599         },
1600 
1601         /* special conic options */
1602         conic: {
1603             /**#@+
1604              * @visprop
1605              */
1606 
1607             fillColor: 'none',
1608             highlightFillColor: 'none',
1609             strokeColor: '#0000ff',
1610             highlightStrokeColor: '#C3D9FF',
1611 
1612             /**
1613              * Attributes for foci points.
1614              *
1615              * @type Point
1616              * @name Conic#foci
1617              */
1618             foci: {
1619                 // points
1620                 fixed: false,
1621                 visible: false,
1622                 withLabel: false,
1623                 name: ''
1624             },
1625 
1626             /**
1627              * Attributes for center point.
1628              *
1629              * @type Point
1630              * @name Conic#center
1631              */
1632             center: {
1633                 visible: false,
1634                 withLabel: false,
1635                 name: ''
1636             },
1637 
1638             /**
1639              * Attributes for five points defining the conic, if some of them are given as coordinates.
1640              *
1641              * @type Point
1642              * @name Conic#point
1643              */
1644             point: {
1645                 withLabel: false,
1646                 name: ''
1647             }
1648 
1649             /**#@-*/
1650         },
1651 
1652         /* special curve options */
1653         curve: {
1654             strokeWidth: 1,
1655             strokeColor: '#0000ff',
1656             fillColor: 'none',
1657             fixed: true,
1658 
1659             useQDT: false,
1660 
1661             /**#@+
1662              * @visprop
1663              */
1664 
1665             /**
1666              * The data points of the curve are not connected with straight lines but with bezier curves.
1667              * @name Curve#handDrawing
1668              * @type Boolean
1669              * @default false
1670              */
1671             handDrawing: false,
1672 
1673             /**
1674              * The curveType is set in {@link JXG.Curve#generateTerm} and used in {@link JXG.Curve#updateCurve}.
1675              * Possible values are <ul>
1676              * <li>'none'</li>
1677              * <li>'plot': Data plot</li>
1678              * <li>'parameter': we can not distinguish function graphs and parameter curves</li>
1679              * <li>'functiongraph': function graph</li>
1680              * <li>'polar'</li>
1681              * <li>'implicit' (not yet)</li></ul>
1682              * Only parameter and plot are set directly. Polar is set with {@link JXG.GeometryElement#setAttribute} only.
1683              * @name Curve#curveType
1684              * @type String
1685              * @default null
1686              */
1687             curveType: null,
1688 
1689             /**
1690              * Apply Ramer-Douglas-Peuker smoothing.
1691              *
1692              * @type Boolean
1693              * @name Curve#RDPsmoothing
1694              * @default false
1695              */
1696             RDPsmoothing: false,     // Apply the Ramer-Douglas-Peuker algorithm
1697 
1698             /**
1699              * Number of points used for plotting triggered by up events in case {@link Curve#doAdvancedPlot} is false.
1700              *
1701              * @name Curve#numberPointsHigh
1702              * @see Curve#doAdvancedPlot
1703              * @type Number
1704              * @default 1600
1705              */
1706             numberPointsHigh: 1600,  // Number of points on curves after mouseUp
1707 
1708             /**
1709              * Number of points used for plotting triggered by move events in case {@link Curve#doAdvancedPlot} is false.
1710              *
1711              * @name Curve#numberPointsLow
1712              * @see Curve#doAdvancedPlot
1713              * @type Number
1714              * @default 400
1715              */
1716             numberPointsLow: 400,    // Number of points on curves after mousemove
1717 
1718             /**
1719              * If true use a recursive bisection algorithm.
1720              * It is slower, but usually the result is better. It tries to detect jumps
1721              * and singularities.
1722              *
1723              * @name Curve#doAdvancedPlot
1724              * @type Boolean
1725              * @default true
1726              */
1727             doAdvancedPlot: true,
1728 
1729             /**
1730              * If true use the algorithm by Gillam and Hohenwarter, which was default until version 0.98.
1731              *
1732              * @name Curve#doAdvancedPlotOld
1733              * @see Curve#doAdvancedPlot
1734              * @type Boolean
1735              * @default false
1736              */
1737             doAdvancedPlotOld: false,
1738 
1739             /**
1740              * Attributes for circle label.
1741              *
1742              * @type Label
1743              * @name Circle#label
1744              */
1745             label: {
1746                 position: 'lft'
1747             }
1748 
1749             /**#@-*/
1750         },
1751 
1752         glider: {
1753             /**#@+
1754              * @visprop
1755              */
1756 
1757             label: {}
1758             /**#@-*/
1759         },
1760 
1761         /* special grid options */
1762         grid: {
1763             /**#@+
1764              * @visprop
1765              */
1766 
1767             /* grid styles */
1768             needsRegularUpdate: false,
1769             hasGrid: false,
1770             gridX: 1,
1771             gridY: 1,
1772             //strokeColor: '#C0C0C0',
1773             strokeColor: '#C0C0C0',
1774             strokeOpacity: 0.5,
1775             strokeWidth: 1,
1776             dash: 0,    // dashed grids slow down the iPad considerably
1777             /* snap to grid options */
1778 
1779             /**
1780              * @deprecated
1781              */
1782             snapToGrid: false,
1783             /**
1784              * @deprecated
1785              */
1786             snapSizeX: 10,
1787             /**
1788              * @deprecated
1789              */
1790             snapSizeY: 10
1791 
1792             /**#@-*/
1793         },
1794 
1795         group: {
1796             needsRegularUpdate: true
1797         },
1798 
1799         /* special html slider options */
1800         htmlslider: {
1801             /**#@+
1802              * @visprop
1803              */
1804 
1805             /**
1806              *
1807              * These affect the DOM element input type="range".
1808              * The other attributes affect the DOM element div containing the range element.
1809              */
1810             widthRange: 100,
1811             widthOut: 34,
1812             step: 0.01,
1813 
1814             frozen: true,
1815             isLabel: false,
1816             strokeColor: 'black',
1817             display: 'html',
1818             anchorX: 'left',
1819             anchorY: 'middle',
1820             withLabel: false
1821 
1822             /**#@-*/
1823         },
1824 
1825         /* special image options */
1826         image: {
1827             /**#@+
1828              * @visprop
1829              */
1830 
1831             imageString: null,
1832             fillOpacity: 1.0,
1833             highlightFillOpacity: 0.6,
1834 
1835 
1836             /**
1837              * Defines the CSS class used by the image. CSS attributes defined in
1838              * this class will overwrite the corresponding JSXGraph attributes, e.g.
1839              * opacity.
1840              * The default CSS class is defined in jsxgraph.css.
1841              *
1842              * @name Image#cssClass
1843              *
1844              * @see Image#highlightCssClass
1845              * @type String
1846              * @default 'JXGimage'
1847              */
1848             cssClass: 'JXGimage',
1849 
1850             /**
1851              * Defines the CSS class used by the image when highlighted.
1852              * CSS attributes defined in this class will overwrite the
1853              * corresponding JSXGraph attributes, e.g. highlightFillOpacity.
1854              * The default CSS class is defined in jsxgraph.css.
1855              *
1856              * @name Image#highlightCssClass
1857              *
1858              * @see Image#cssClass
1859              * @type String
1860              * @default 'JXGimageHighlight'
1861              */
1862             highlightCssClass: 'JXGimageHighlight',
1863 
1864             /**
1865              * Image rotation in degrees.
1866              *
1867              * @name Image#rotate
1868              * @type Number
1869              * @default 0
1870              */
1871             rotate: 0,
1872 
1873             /**
1874              * Defines together with {@link Image#snapSizeY} the grid the image snaps on to.
1875              * The image will only snap on integer multiples to snapSizeX in x and snapSizeY in y direction.
1876              * If this value is equal to or less than <tt>0</tt>, it will use the grid displayed by the major ticks
1877              * of the default ticks of the default x axes of the board.
1878              *
1879              * @name Image#snapSizeX
1880              *
1881              * @see JXG.Point#snapToGrid
1882              * @see Image#snapSizeY
1883              * @see JXG.Board#defaultAxes
1884              * @type Number
1885              * @default 1
1886              */
1887             snapSizeX: 1,
1888 
1889             /**
1890              * Defines together with {@link Image#snapSizeX} the grid the image snaps on to.
1891              * The image will only snap on integer multiples to snapSizeX in x and snapSizeY in y direction.
1892              * If this value is equal to or less than <tt>0</tt>, it will use the grid displayed by the major ticks
1893              * of the default ticks of the default y axes of the board.
1894              *
1895              * @name Image#snapSizeY
1896              *
1897              * @see JXG.Point#snapToGrid
1898              * @see Image#snapSizeX
1899              * @see JXG.Board#defaultAxes
1900              * @type Number
1901              * @default 1
1902              */
1903             snapSizeY: 1,
1904 
1905             /**
1906              * List of attractor elements. If the distance of the image is less than
1907              * attractorDistance the image is made to glider of this element.
1908              *
1909              * @name Image#attractors
1910              *
1911              * @type array
1912              * @default empty
1913              */
1914             attractors: []
1915 
1916             /**#@-*/
1917         },
1918 
1919         /* special options for incircle of 3 points */
1920         incircle: {
1921             /**#@+
1922              * @visprop
1923              */
1924 
1925             fillColor: 'none',
1926             highlightFillColor: 'none',
1927             strokeColor: '#0000ff',
1928             highlightStrokeColor: '#C3D9FF',
1929 
1930             /**
1931              * Attributes of circle center.
1932              *
1933              * @type Point
1934              * @name Incircle#center
1935              */
1936             center: {               // center point
1937                 visible: false,
1938                 fixed: false,
1939                 withLabel: false,
1940                 name: ''
1941             }
1942             /**#@-*/
1943         },
1944 
1945         inequality: {
1946             /**#@+
1947              * @visprop
1948              */
1949 
1950             fillColor: 'red',
1951             fillOpacity: 0.2,
1952             strokeColor: 'none',
1953 
1954             /**
1955              * By default an inequality is less (or equal) than. Set inverse to <tt>true</tt> will consider the inequality
1956              * greater (or equal) than.
1957              *
1958              * @type Boolean
1959              * @default false
1960              * @name Inequality#inverse
1961              * @visprop
1962              */
1963             inverse: false
1964             /**#@-*/
1965         },
1966 
1967         infobox: {
1968             /**#@+
1969              * @visprop
1970              */
1971 
1972             fontSize: 12,
1973             isLabel: false,
1974             strokeColor: '#bbbbbb',
1975             display: 'html',             // 'html' or 'internal'
1976             anchorX: 'left',             //  'left', 'middle', or 'right': horizontal alignment
1977                                          //  of the text.
1978             anchorY: 'middle',           //  'top', 'middle', or 'bottom': vertical alignment
1979                                          //  of the text.
1980             cssClass: 'JXGinfobox',
1981             rotate: 0,                   // works for non-zero values only in combination
1982                                          // with display=='internal'
1983             visible: true,
1984             parse: false,
1985             transitionDuration: 0,
1986             needsRegularUpdate: false
1987 
1988             /**#@-*/
1989         },
1990 
1991         /* special options for integral */
1992         integral: {
1993             /**#@+
1994              * @visprop
1995              */
1996 
1997             axis: 'x',        // 'x' or 'y'
1998             withLabel: true,    // Show integral value as text
1999             strokeWidth: 0,
2000             strokeOpacity: 0,
2001             fillColor: 'red',
2002             fillOpacity: 0.4,
2003             highlightFillColor: 'red',
2004             highlightFillOpacity: 0.2,
2005 
2006             /**
2007              * Attributes of the (left) starting point of the integral.
2008              *
2009              * @type Point
2010              * @name Integral#curveLeft
2011              * @see Integral#baseLeft
2012              */
2013             curveLeft: {    // Start point
2014                 visible: true,
2015                 withLabel: false,
2016                 color: 'red',
2017                 fillOpacity: 0.8,
2018                 layer: 9
2019             },
2020 
2021             /**
2022              * Attributes of the (left) base point of the integral.
2023              *
2024              * @type Point
2025              * @name Integral#baseLeft
2026              * @see Integral#curveLeft
2027              */
2028             baseLeft: {    // Start point
2029                 visible: false,
2030                 fixed: false,
2031                 withLabel: false,
2032                 name: ''
2033             },
2034 
2035             /**
2036              * Attributes of the (right) end point of the integral.
2037              *
2038              * @type Point
2039              * @name Integral#curveRight
2040              * @see Integral#baseRight
2041              */
2042             curveRight: {      // End point
2043                 visible: true,
2044                 withLabel: false,
2045                 color: 'red',
2046                 fillOpacity: 0.8,
2047                 layer: 9
2048             },
2049 
2050             /**
2051              * Attributes of the (right) base point of the integral.
2052              *
2053              * @type Point
2054              * @name Integral#baseRight
2055              * @see Integral#curveRight
2056              */
2057             baseRight: {      // End point
2058                 visible: false,
2059                 fixed: false,
2060                 withLabel: false,
2061                 name: ''
2062             },
2063 
2064             /**
2065              * Attributes for integral label.
2066              *
2067              * @type Label
2068              * @name Integral#label
2069              */
2070             label: {
2071                 fontSize: 20
2072             }
2073             /**#@-*/
2074         },
2075 
2076         /* special input options */
2077         input: {
2078             /**#@+
2079              * @visprop
2080              */
2081 
2082             /**
2083              * Control the attribute "disabled" of the HTML input field.
2084              *
2085              * @name disabled
2086              * @memberOf Input.prototype
2087              *
2088              * @type Boolean
2089              * @default false
2090              */
2091             disabled: false,
2092 
2093             /**
2094              * Control the attribute "maxlength" of the HTML input field.
2095              *
2096              * @name maxlength
2097              * @memberOf Input.prototype
2098              *
2099              * @type Number
2100              * @default 524288 (as in HTML)
2101              */
2102             maxlength: 524288
2103 
2104             /**#@-*/
2105         },
2106 
2107         /* special intersection point options */
2108         intersection: {
2109             /**#@+
2110              * @visprop
2111              */
2112 
2113             /**
2114              * Used in {@link JXG.Intersection}.
2115              * This flag sets the behaviour of intersection points of e.g.
2116              * two segments. If true, the intersection is treated as intersection of lines. If false
2117              * the intersection point exists if the segments intersect setwise.
2118              *
2119              * @name Intersection.alwaysIntersect
2120              * @type Boolean
2121              * @default true
2122              */
2123             alwaysIntersect: true
2124 
2125             /**#@-*/
2126         },
2127 
2128         /* special label options */
2129         label: {
2130             /**#@+
2131              * @visprop
2132              */
2133 
2134             visible: 'inherit',
2135             strokeColor: 'black',
2136             strokeOpacity: 1,
2137             highlightStrokeOpacity: 0.666666,
2138             highlightStrokeColor: 'black',
2139 
2140             fixed: true,
2141 
2142             /**
2143              * Possible string values for the position of a label for
2144              * label anchor points are:
2145              * <ul>
2146              * <li> 'lft'
2147              * <li> 'rt'
2148              * <li> 'top'
2149              * <li> 'bot'
2150              * <li> 'ulft'
2151              * <li> 'urt'
2152              * <li> 'llft'
2153              * <li> 'lrt'
2154              * </ul>
2155              * This is relevant for non-points: line, circle, curve.
2156              *
2157              * The names have been borrowed from <a href="https://www.tug.org/metapost.html">MetaPost</a>.
2158              *
2159              * @name Label#position
2160              * @see Label#offset
2161              * @type String
2162              * @default 'urt'
2163              */
2164             position: 'urt',
2165 
2166             /**
2167              *  Label offset from label anchor
2168              *  The label anchor is determined by JXG.GeometryElement#label.position
2169              *
2170              * @name Label#offset
2171              * @see Label#position
2172              * @type Array
2173              * @default [10,10]
2174              **/
2175             offset: [10, 10]
2176 
2177             /**#@-*/
2178         },
2179 
2180         /* special legend options */
2181         legend: {
2182             /**
2183              * @visprop
2184              */
2185             style: 'vertical',
2186             labels: ['1', '2', '3', '4', '5', '6', '7', '8'],
2187             colors: ['#B02B2C', '#3F4C6B', '#C79810', '#D15600', '#FFFF88', '#C3D9FF', '#4096EE', '#008C00']
2188             /**#@-*/
2189         },
2190 
2191         /* special line options */
2192         line: {
2193             /**#@+
2194              * @visprop
2195              */
2196 
2197             /**
2198              * Line has an arrow head at the position of its first point or the corresponding
2199              * intersection with the canvas border.
2200              *
2201              * @name Line#firstArrow
2202              * @see Line#lastArrow
2203              * @see Line#touchFirstPoint
2204              * @type Boolean / Object
2205              * @default false
2206              */
2207             firstArrow: false,
2208 
2209             /**
2210              * Line has an arrow head at the position of its second point or the corresponding
2211              * intersection with the canvas border.
2212              *
2213              * @name Line#lastArrow
2214              * @see Line#firstArrow
2215              * @see Line#touchLastPoint
2216              * @type Boolean / Object
2217              * @default false
2218              */
2219             lastArrow: false,
2220 
2221 
2222             /**
2223              * This number (pixel value) controls where infinite lines end at the canvas border. If zero, the line
2224              * ends exactly at the border, if negative there is a margin to the inside, if positive the line
2225              * ends outside of the canvas (which is invisible).
2226              * @type {Number}
2227              * @default 0
2228              */
2229             margin: 0,
2230 
2231             /**
2232              * If true, line stretches infinitely in direction of its first point.
2233              * Otherwise it ends at point1.
2234              *
2235              * @name Line#straightFirst
2236              * @see Line#straightLast
2237              * @type Boolean
2238              * @default true
2239              */
2240             straightFirst: true,
2241 
2242             /**
2243              * If true, line stretches infinitely in direction of its second point.
2244              * Otherwise it ends at point2.
2245              *
2246              * @name Line#straightLast
2247              * @see Line#straightFirst
2248              * @type Boolean
2249              * @default true
2250              */
2251             straightLast: true,
2252 
2253             fillColor: 'none',               // Important for VML on IE
2254             highlightFillColor: 'none',  // Important for VML on IE
2255             strokeColor: '#0000ff',
2256             highlightStrokeColor: '#888888',
2257             withTicks: false,
2258 
2259             /**
2260              * Attributes for first defining point of the line.
2261              *
2262              * @type Point
2263              * @name Line#point1
2264              */
2265             point1: {                  // Default values for point1 if created by line
2266                 visible: false,
2267                 withLabel: false,
2268                 fixed: false,
2269                 name: ''
2270             },
2271 
2272             /**
2273              * Attributes for second defining point of the line.
2274              *
2275              * @type Point
2276              * @name Line#point2
2277              */
2278             point2: {                  // Default values for point2 if created by line
2279                 visible: false,
2280                 withLabel: false,
2281                 fixed: false,
2282                 name: ''
2283             },
2284 
2285             /**
2286              * Attributes for ticks of the line.
2287              *
2288              * @type Ticks
2289              * @name Line#ticks
2290              */
2291             ticks: {
2292                 drawLabels: true,
2293                 label: {
2294                     offset: [4, -12 + 3] // This seems to be a good offset for 12 point fonts
2295                 },
2296                 drawZero: false,
2297                 insertTicks: false,
2298                 minTicksDistance: 50,
2299                 minorHeight: 4,          // if <0: full width and height
2300                 majorHeight: -1,         // if <0: full width and height
2301                 minorTicks: 4,
2302                 defaultDistance: 1,
2303                 strokeOpacity: 0.3,
2304                 visible: 'inherit'
2305             },
2306 
2307             /**
2308              * Attributes for the line label.
2309              *
2310              * @type Label
2311              * @name Line#label
2312              */
2313             label: {
2314                 position: 'llft'
2315             },
2316 
2317             /**
2318              * If set to true, the point will snap to a grid defined by
2319              * {@link JXG.Point#snapSizeX} and {@link JXG.Point#snapSizeY}.
2320              *
2321              * @see Point#snapSizeX
2322              * @see Point#snapSizeY
2323              * @type Boolean
2324              * @name Line#snapToGrid
2325              * @default false
2326              */
2327             snapToGrid: false,
2328 
2329             /**
2330              * Defines together with {@link JXG.Point#snapSizeY} the grid the point snaps on to.
2331              * The point will only snap on integer multiples to snapSizeX in x and snapSizeY in y direction.
2332              * If this value is equal to or less than <tt>0</tt>, it will use the grid displayed by the major ticks
2333              * of the default ticks of the default x axes of the board.
2334              *
2335              * @see Point#snapToGrid
2336              * @see Point#snapSizeY
2337              * @see JXG.Board#defaultAxes
2338              * @type Number
2339              * @name Line#snapSizeX
2340              * @default 1
2341              */
2342             snapSizeX: 1,
2343 
2344             /**
2345              * Defines together with {@link JXG.Point#snapSizeX} the grid the point snaps on to.
2346              * The point will only snap on integer multiples to snapSizeX in x and snapSizeY in y direction.
2347              * If this value is equal to or less than <tt>0</tt>, it will use the grid displayed by the major ticks
2348              * of the default ticks of the default y axes of the board.
2349              *
2350              * @see Point#snapToGrid
2351              * @see Point#snapSizeX
2352              * @see Board#defaultAxes
2353              * @type Number
2354              * @name Line#snapSizeY
2355              * @default 1
2356              */
2357             snapSizeY: 1,
2358 
2359             /**
2360              * If set to true and {@link Line#firstArrow} is set to true, the arrow head will just touch
2361              * the circle line of the start point of the line.
2362              *
2363              * @see Line#firstArrow
2364              * @type Boolean
2365              * @name Line#touchFirstPoint
2366              * @default false
2367              */
2368             touchFirstPoint: false,
2369 
2370             /**
2371              * If set to true and {@link Line#lastArrow} is set to true, the arrow head will just touch
2372              * the circle line of the start point of the line.
2373              * @see Line#firstArrow
2374              * @type Boolean
2375              * @name Line#touchLastPoint
2376              * @default false
2377              */
2378             touchLastPoint: false,
2379 
2380             /**
2381              * Line endings (linecap) of a straight line.
2382              * Possible values are:
2383              * <ul>
2384              * <li> 'butt',
2385              * <li> 'round',
2386              * <li> 'square'.
2387              * </ul>
2388              * Not available for VML renderer.
2389              * [lineCap description]
2390              * @name Line#lineCap
2391              * @type {String}
2392              * @default 'butt'
2393              */
2394             lineCap: 'butt'
2395 
2396 
2397             /**#@-*/
2398         },
2399 
2400         /* special options for locus curves */
2401         locus: {
2402             /**#@+
2403              * @visprop
2404              */
2405 
2406             translateToOrigin: false,
2407             translateTo10: false,
2408             stretch: false,
2409             toOrigin: null,
2410             to10: null
2411             /**#@-*/
2412         },
2413 
2414         // /* special options for Msector of 3 points */
2415         // msector: {
2416         //     strokeColor: '#000000', // Msector line
2417         //     point: {               // Msector point
2418         //         visible: false,
2419         //         fixed: false,
2420         //         withLabel: false,
2421         //         name: ''
2422         //     }
2423         // },
2424 
2425         /* special options for normal lines */
2426         normal: {
2427             /**#@+
2428              * @visprop
2429              */
2430 
2431             strokeColor: '#000000', //  normal line
2432 
2433             /**
2434              * Attributes of helper point of normal.
2435              *
2436              * @type Point
2437              * @name Normal#point
2438              */
2439             point: {
2440                 visible: false,
2441                 fixed: false,
2442                 withLabel: false,
2443                 name: ''
2444             }
2445             /**#@-*/
2446         },
2447 
2448         /* special options for orthogonal projection points */
2449         orthogonalprojection: {
2450             /**#@+
2451              * @visprop
2452              */
2453 
2454 
2455             /**#@-*/
2456         },
2457 
2458         /* special options for parallel lines */
2459         parallel: {
2460             /**#@+
2461              * @visprop
2462              */
2463 
2464             strokeColor: '#000000', // Parallel line
2465 
2466             /**
2467              * Attributes of helper point of normal.
2468              *
2469              * @type Point
2470              * @name Parallel#point
2471              */
2472             point: {
2473                 visible: false,
2474                 fixed: false,
2475                 withLabel: false,
2476                 name: ''
2477             },
2478 
2479             label: {
2480                 position: 'llft'
2481             }
2482             /**#@-*/
2483         },
2484 
2485         /* special perpendicular options */
2486         perpendicular: {
2487             /**#@+
2488              * @visprop
2489              */
2490 
2491             strokeColor: '#000000', // Perpendicular line
2492             straightFirst: true,
2493             straightLast: true
2494             /**#@-*/
2495         },
2496 
2497         /* special perpendicular options */
2498         perpendicularsegment: {
2499             /**#@+
2500              * @visprop
2501              */
2502 
2503             strokeColor: '#000000', // Perpendicular segment
2504             straightFirst: false,
2505             straightLast: false,
2506             point: {               // Perpendicular point
2507                 visible: false,
2508                 fixed: true,
2509                 withLabel: false,
2510                 name: ''
2511             }
2512             /**#@-*/
2513         },
2514 
2515         /* special point options */
2516         point: {
2517             /**#@+
2518              * @visprop
2519              */
2520 
2521             withLabel: true,
2522             label: {},
2523 
2524             /**
2525              * This attribute was used to determined the point layout. It was derived from GEONExT and was
2526              * replaced by {@link Point#face} and {@link Point#size}.
2527              *
2528              * @name Point#style
2529              *
2530              * @see Point#face
2531              * @see Point#size
2532              * @type Number
2533              * @default 5
2534              * @deprecated
2535              */
2536             style: 5,
2537 
2538             /**
2539              * There are different point styles which differ in appearance.
2540              * Posssible values are
2541              * <table><tr><th>Value</th></tr>
2542              * <tr><td>cross</td></tr>
2543              * <tr><td>circle</td></tr>
2544              * <tr><td>square</td></tr>
2545              * <tr><td>plus</td></tr>
2546              * <tr><td>diamond</td></tr>
2547              * <tr><td>triangleUp</td></tr>
2548              * <tr><td>triangleDown</td></tr>
2549              * <tr><td>triangleLeft</td></tr>
2550              * <tr><td>triangleRight</td></tr>
2551              * </table>
2552              *
2553              * @name Point#face
2554              *
2555              * @type string
2556              * @see Point#setStyle
2557              * @default circle
2558              */
2559             face: 'o',
2560 
2561             /**
2562              * Size of a point.
2563              * Means radius resp. half the width of a point (depending on the face).
2564              *
2565              * @name Point#size
2566              *
2567              * @see Point#face
2568              * @see Point#setStyle
2569              * @type number
2570              * @default 3
2571              */
2572             size: 3,
2573 
2574             fillColor: '#ff0000',
2575             highlightFillColor: '#EEEEEE',
2576             strokeWidth: 2,
2577             strokeColor: '#ff0000',
2578             highlightStrokeColor: '#C3D9FF',
2579 
2580             /**
2581              * If true, the point size changes on zoom events.
2582              *
2583              * @type Boolean
2584              * @name Point#zoom
2585              * @default false
2586              *
2587              */
2588             zoom: false,             // Change the point size on zoom
2589 
2590             /**
2591              * If true, the infobox is shown on mouse over, else not.
2592              *
2593              * @name Point#showInfobox
2594              *
2595              * @type Boolean
2596              * @default true
2597              */
2598             showInfobox: true,
2599 
2600             /**
2601              * Truncating rule for the digits in the infobox.
2602              * <ul>
2603              * <li>'auto': done automatically by JXG#autoDigits
2604              * <li>'none': no truncation
2605              * <li>number: truncate after "number digits" with JXG.toFixed();
2606              * </ul>
2607              *
2608              * @name Point#infoboxDigits
2609              *
2610              * @type String, Number
2611              * @default 'auto'
2612              */
2613             infoboxDigits: 'auto',
2614 
2615             draft: false,
2616 
2617             /**
2618              * List of attractor elements. If the distance of the point is less than
2619              * attractorDistance the point is made to glider of this element.
2620              *
2621              * @name Point#attractors
2622              *
2623              * @type array
2624              * @default empty
2625              */
2626             attractors: [],
2627 
2628             /**
2629              * Unit for attractorDistance and snatchDistance, used for magnetized points and for snapToPoints.
2630              * Possible values are 'screen' and 'user.
2631              *
2632              * @name Point#attractorUnit
2633              *
2634              * @see Point#attractorDistance
2635              * @see Point#snatchDistance
2636              * @see Point#snapToPoints
2637              * @see Point#attractors
2638              * @type string
2639              * @default 'user'
2640              */
2641             attractorUnit: 'user',    // 'screen', 'user'
2642 
2643             /**
2644              * If the distance of the point to one of its attractors is less
2645              * than this number the point will be a glider on this
2646              * attracting element.
2647              * If set to zero nothing happens.
2648              *
2649              * @name Point#attractorDistance
2650              *
2651              * @type number
2652              * @default 0.0
2653              */
2654             attractorDistance: 0.0,
2655 
2656             /**
2657              * If the distance of the point to one of its attractors is at least
2658              * this number the point will be released from being a glider on the
2659              * attracting element.
2660              * If set to zero nothing happens.
2661              *
2662              * @name Point#snatchDistance
2663              *
2664              * @type number
2665              * @default 0.0
2666              */
2667             snatchDistance: 0.0,
2668 
2669             /**
2670              * If set to true, the point will snap to a grid defined by
2671              * {@link Point#snapSizeX} and {@link Point#snapSizeY}.
2672              *
2673              * @name Point#snapToGrid
2674              *
2675              * @see JXG.Point#snapSizeX
2676              * @see JXG.Point#snapSizeY
2677              * @type Boolean
2678              * @default false
2679              */
2680             snapToGrid: false,
2681 
2682             /**
2683              * Defines together with {@link Point#snapSizeY} the grid the point snaps on to.
2684              * The point will only snap on integer multiples to snapSizeX in x and snapSizeY in y direction.
2685              * If this value is equal to or less than <tt>0</tt>, it will use the grid displayed by the major ticks
2686              * of the default ticks of the default x axes of the board.
2687              *
2688              * @name Point#snapSizeX
2689              *
2690              * @see Point#snapToGrid
2691              * @see Point#snapSizeY
2692              * @see Board#defaultAxes
2693              * @type Number
2694              * @default 1
2695              */
2696             snapSizeX: 1,
2697 
2698             /**
2699              * Defines together with {@link Point#snapSizeX} the grid the point snaps on to.
2700              * The point will only snap on integer multiples to snapSizeX in x and snapSizeY in y direction.
2701              * If this value is equal to or less than <tt>0</tt>, it will use the grid displayed by the major ticks
2702              * of the default ticks of the default y axes of the board.
2703              *
2704              * @name Point#snapSizeY
2705              *
2706              * @see Point#snapToGrid
2707              * @see Point#snapSizeX
2708              * @see Board#defaultAxes
2709              * @type Number
2710              * @default 1
2711              */
2712             snapSizeY: 1,
2713 
2714             /**
2715              * If set to true, the point will snap to the nearest point in distance of
2716              * {@link Point#attractorDistance}.
2717              *
2718              * @name Point#snapToPoints
2719              *
2720              * @see Point#attractorDistance
2721              * @type Boolean
2722              * @default false
2723              */
2724             snapToPoints: false,
2725 
2726             /**
2727              * List of elements which are ignored by snapToPoints.
2728              * @name Point#ignoredSnapToPoints
2729              *
2730              * @type array
2731              * @default empty
2732              */
2733             ignoredSnapToPoints: []
2734 
2735             /**#@-*/
2736         },
2737 
2738         /* special polygon options */
2739         polygon: {
2740             /**#@+
2741              * @visprop
2742              */
2743 
2744             /**
2745              * If <tt>true</tt>, moving the mouse over inner points triggers hasPoint.
2746              *
2747              * @see JXG.GeometryElement#hasPoint
2748              * @name Polygon#hasInnerPoints
2749              * @type Boolean
2750              * @default false
2751              */
2752             hasInnerPoints: false,
2753 
2754             fillColor: '#00FF00',
2755             highlightFillColor: '#00FF00',
2756             fillOpacity: 0.3,
2757             highlightFillOpacity: 0.3,
2758 
2759             /**
2760              * Is the polygon bordered by lines?
2761              *
2762              * @type Boolean
2763              * @name Polygon#withLines
2764              * @default true
2765              */
2766             withLines: true,
2767 
2768             /**
2769              * Attributes for the polygon border lines.
2770              *
2771              * @type Line
2772              * @name Polygon#borders
2773              */
2774             borders: {
2775                 withLabel: false,
2776                 strokeWidth: 1,
2777                 highlightStrokeWidth: 1,
2778                 // Polygon layer + 1
2779                 layer: 5,
2780                 label: {
2781                     position: 'top'
2782                 }
2783             },
2784 
2785             /**
2786              * Attributes for the polygon vertices.
2787              *
2788              * @type Point
2789              * @name Polygon#vertices
2790              */
2791             vertices: {
2792                 layer: 9,
2793                 withLabel: false,
2794                 name: '',
2795                 strokeColor: '#ff0000',
2796                 fillColor: '#ff0000',
2797                 fixed: false
2798             },
2799 
2800             /**
2801              * Attributes for the polygon label.
2802              *
2803              * @type Label
2804              * @name Polygon#label
2805              */
2806             label: {
2807                 offset: [0, 0]
2808             }
2809 
2810             /**#@-*/
2811         },
2812 
2813         /* special prescribed angle options
2814         * Not yet implemented. But angle.setAngle(val) is implemented.
2815         */
2816         prescribedangle: {
2817             /**#@+
2818              * @visprop
2819              */
2820 
2821             /**
2822              * Attributes for the helper point of the prescribed angle.
2823              *
2824              * @type Point
2825              * @name PrescribedAngle#anglepoint
2826              */
2827             anglepoint: {
2828                 size: 2,
2829                 visible: false,
2830                 withLabel: false
2831             }
2832 
2833             /**#@-*/
2834         },
2835 
2836         /* special regular polygon options */
2837         regularpolygon: {
2838             /**#@+
2839              * @visprop
2840              */
2841 
2842             /**
2843              * If <tt>true</tt>, moving the mouse over inner points triggers hasPoint.
2844              * @see JXG.GeometryElement#hasPoint
2845              *
2846              * @name RegularPolygon#hasInnerPoints
2847              * @type Boolean
2848              * @default false
2849              */
2850             hasInnerPoints: false,
2851             fillColor: '#00FF00',
2852             highlightFillColor: '#00FF00',
2853             fillOpacity: 0.3,
2854             highlightFillOpacity: 0.3,
2855 
2856             /**
2857              * Is the polygon bordered by lines?
2858              *
2859              * @type Boolean
2860              * @name RegularPolygon#withLines
2861              * @default true
2862              */
2863             withLines: true,
2864 
2865             /**
2866              * Attributes for the polygon border lines.
2867              *
2868              * @type Line
2869              * @name RegularPolygon#borders
2870              */
2871             borders: {
2872                 withLabel: false,
2873                 strokeWidth: 1,
2874                 highlightStrokeWidth: 1,
2875                 // Polygon layer + 1
2876                 layer: 5,
2877                 label: {
2878                     position: 'top'
2879                 },
2880             },
2881 
2882             /**
2883              * Attributes for the polygon vertices.
2884              *
2885              * @type Point
2886              * @name RegularPolygon#vertices
2887              */
2888             vertices: {
2889                 layer: 9,
2890                 withLabel: true,
2891                 strokeColor: '#ff0000',
2892                 fillColor: '#ff0000',
2893                 fixed: false
2894             },
2895 
2896             /**
2897              * Attributes for the polygon label.
2898              *
2899              * @type Label
2900              * @name Polygon#label
2901              */
2902             label: {
2903                 offset: [0, 0]
2904             }
2905 
2906             /**#@-*/
2907         },
2908 
2909         /* special options for riemann sums */
2910         riemannsum: {
2911             /**#@+
2912              * @visprop
2913              */
2914 
2915             withLabel: false,
2916             fillOpacity: 0.3,
2917             fillColor: '#ffff00'
2918 
2919             /**#@-*/
2920         },
2921 
2922         /* special sector options */
2923         sector: {
2924             /**#@+
2925              * @visprop
2926              */
2927 
2928             fillColor: '#00FF00',
2929             highlightFillColor: '#00FF00',
2930             fillOpacity: 0.3,
2931             highlightFillOpacity: 0.3,
2932             highlightOnSector: false,
2933             highlightStrokeWidth: 0,
2934 
2935             /**
2936              * Attributes for sub-element arc. It is only available, if the sector is defined by three points.
2937              *
2938              * @type Arc
2939              * @name Sector#arc
2940              */
2941             arc: {
2942                 visible: false,
2943                 fillColor: 'none'
2944             },
2945 
2946             /**
2947              * Attributes for helper point radiuspoint in case it is provided by coordinates.
2948              *
2949              * @type Point
2950              * @name Sector#radiuspoint
2951              */
2952             radiuspoint: {
2953                 visible: false,
2954                 withLabel: false
2955             },
2956 
2957             /**
2958              * Attributes for helper point center in case it is provided by coordinates.
2959              *
2960              * @type Point
2961              * @name Sector#center
2962              */
2963             center: {
2964                 visible: false,
2965                 withLabel: false
2966             },
2967 
2968             /**
2969              * Attributes for helper point anglepoint in case it is provided by coordinates.
2970              *
2971              * @type Point
2972              * @name Sector#anglepoint
2973              */
2974             anglepoint: {
2975                 visible: false,
2976                 withLabel: false
2977             },
2978 
2979             /**
2980              * Attributes for the sector label.
2981              *
2982              * @type Label
2983              * @name Sector#label
2984              */
2985             label: {
2986                 offset: [0, 0]
2987             }
2988 
2989             /**#@-*/
2990         },
2991 
2992         /* special segment options */
2993         segment: {
2994             /**#@+
2995              * @visprop
2996              */
2997 
2998             label: {
2999                 position: 'top'
3000             }
3001             /**#@-*/
3002         },
3003 
3004         semicircle: {
3005             /**#@+
3006              * @visprop
3007              */
3008 
3009             /**
3010              * Attributes for center point of the semicircle.
3011              *
3012              * @type Point
3013              * @name Semicircle#midpoint
3014              */
3015             midpoint: {
3016                 visible: false,
3017                 withLabel: false,
3018                 fixed: false,
3019                 name: ''
3020             }
3021 
3022             /**#@-*/
3023         },
3024 
3025         /* special slider options */
3026         slider: {
3027             /**#@+
3028              * @visprop
3029              */
3030 
3031             /**
3032              * The slider only returns integer multiples of this value, e.g. for discrete values set this property to <tt>1</tt>. For
3033              * continuous results set this to <tt>-1</tt>.
3034              *
3035              * @memberOf Slider.prototype
3036              * @name snapWidth
3037              * @type Number
3038              */
3039             snapWidth: -1,      // -1 = deactivated
3040 
3041             /**
3042              * The precision of the slider value displayed in the optional text.
3043              * @memberOf Slider.prototype
3044              * @name precision
3045              * @type Number
3046              * @default 2
3047              */
3048             precision: 2,
3049 
3050             firstArrow: false,
3051             lastArrow: false,
3052 
3053             /**
3054              * Show slider ticks.
3055              *
3056              * @type Boolean
3057              * @name Slider#withTicks
3058              * @default true
3059              */
3060             withTicks: true,
3061 
3062             /**
3063              * Show slider label.
3064              *
3065              * @type Boolean
3066              * @name Slider#withLabel
3067              * @default true
3068              */
3069             withLabel: true,
3070 
3071             /**
3072              * If not null, this replaces the part "name = " in the slider label.
3073              * Possible types: string, number or function.
3074              * @type {String}
3075              * @name suffixLabel
3076              * @default null
3077              * @see JXG.Slider#unitLabel
3078              * @see JXG.Slider#postLabel
3079              */
3080             suffixLabel: null,
3081 
3082             /**
3083              * If not null, this is appended to the value in the slider label.
3084              * Possible types: string, number or function.
3085              * @type {String}
3086              * @name unitLabel
3087              * @default null
3088              * @see JXG.Slider#suffixLabel
3089              * @see JXG.Slider#postLabel
3090              */
3091             unitLabel: null,
3092 
3093             /**
3094              * If not null, this is appended to the value and to unitLabel in the slider label.
3095              * Possible types: string, number or function.
3096              * @type {String}
3097              * @name postLabel
3098              * @default null
3099              * @see JXG.Slider#suffixLabel
3100              * @see JXG.Slider#unitLabel
3101              */
3102             postLabel: null,
3103 
3104             layer: 9,
3105             showInfobox: false,
3106             name: '',
3107             visible: true,
3108             strokeColor: '#000000',
3109             highlightStrokeColor: '#888888',
3110             fillColor: '#ffffff',
3111             highlightFillColor: 'none',
3112 
3113             /**
3114              * Size of slider point.
3115              *
3116              * @type Number
3117              * @name Slider#size
3118              * @default 6
3119              * @see Point#size
3120              */
3121             size: 6,
3122 
3123             /**
3124              * Attributes for first (left) helper point defining the slider position.
3125              *
3126              * @type Point
3127              * @name Slider#point1
3128              */
3129             point1: {
3130                 needsRegularUpdate: false,
3131                 showInfobox: false,
3132                 withLabel: false,
3133                 visible: false,
3134                 fixed: true,
3135                 name: ''
3136             },
3137 
3138             /**
3139              * Attributes for second (right) helper point defining the slider position.
3140              *
3141              * @type Point
3142              * @name Slider#point2
3143              */
3144             point2: {
3145                 needsRegularUpdate: false,
3146                 showInfobox: false,
3147                 withLabel: false,
3148                 visible: false,
3149                 fixed: true,
3150                 name: ''
3151             },
3152 
3153             /**
3154              * Attributes for the base line of the slider.
3155              *
3156              * @type Line
3157              * @name Slider#baseline
3158              */
3159             baseline: {
3160                 needsRegularUpdate: false,
3161                 fixed: true,
3162                 name: '',
3163                 strokeWidth: 1,
3164                 strokeColor: '#000000',
3165                 highlightStrokeColor: '#888888'
3166             },
3167 
3168             /**
3169              * Attributes for the ticks of the base line of the slider.
3170              *
3171              * @type Ticks
3172              * @name Slider#ticks
3173              */
3174             ticks: {
3175                 needsRegularUpdate: false,
3176                 fixed: true,
3177 
3178                 // Label drawing
3179                 drawLabels: false,
3180                 precision: 2,
3181                 includeBoundaries: 1,
3182                 drawZero: true,
3183                 label: {
3184                     offset: [-4, -14],
3185                     display: 'internal'
3186                 },
3187 
3188                 minTicksDistance: 30,
3189                 insertTicks: true,
3190                 minorHeight: 4,         // if <0: full width and height
3191                 majorHeight: 5,        // if <0: full width and height
3192                 minorTicks: 0,
3193                 defaultDistance: 1,
3194                 strokeOpacity: 1,
3195                 strokeWidth: 1,
3196                 tickEndings: [0, 1],
3197                 strokeColor: '#000000',
3198                 visible: 'inherit'
3199 
3200             },
3201 
3202             /**
3203              * Attributes for the highlighting line of the slider.
3204              *
3205              * @type Line
3206              * @name Slider#highline
3207              */
3208             highline: {
3209                 strokeWidth: 3,
3210                 fixed: true,
3211                 name: '',
3212                 strokeColor: '#000000',
3213                 highlightStrokeColor: '#888888'
3214             },
3215 
3216             /**
3217              * Attributes for the slider label.
3218              *
3219              * @type Label
3220              * @name Slider#label
3221              */
3222             label: {
3223                 strokeColor: '#000000'
3224             }
3225 
3226             /**#@-*/
3227         },
3228 
3229         /* special options for slope triangle */
3230         slopetriangle: {
3231             /**#@+
3232              * @visprop
3233              */
3234 
3235             fillColor: 'red',
3236             fillOpacity: 0.4,
3237             highlightFillColor: 'red',
3238             highlightFillOpacity: 0.3,
3239 
3240             borders: {
3241                 lastArrow: {
3242                     type: 2,
3243                     size: 10
3244                 }
3245             },
3246 
3247             /**
3248              * Attributes for the gliding helper point.
3249              *
3250              * @type Point
3251              * @name Slopetriangle#glider
3252              */
3253             glider: {
3254                 fixed: true,
3255                 visible: false,
3256                 withLabel: false
3257             },
3258 
3259             /**
3260              * Attributes for the base line.
3261              *
3262              * @type Line
3263              * @name Slopetriangle#baseline
3264              */
3265             baseline: {
3266                 visible: false,
3267                 withLabel: false,
3268                 name: ''
3269             },
3270 
3271             /**
3272              * Attributes for the base point.
3273              *
3274              * @type Point
3275              * @name Slopetriangle#basepoint
3276              */
3277             basepoint: {
3278                 visible: false,
3279                 withLabel: false,
3280                 name: ''
3281             },
3282 
3283             /**
3284              * Attributes for the tangent.
3285              * The tangent is constructed by slop triangle if the construction
3286              * is based on a glider, solely.
3287              *
3288              * @type Line
3289              * @name Slopetriangle#tangent
3290              */
3291             tangent: {
3292                 visible: false,
3293                 withLabel: false,
3294                 name: ''
3295             },
3296 
3297             /**
3298              * Attributes for the top point.
3299              *
3300              * @type Point
3301              * @name Slopetriangle#toppoint
3302              */
3303             toppoint: {
3304                 visible: false,
3305                 withLabel: false,
3306                 name: ''
3307             },
3308 
3309             /**
3310              * Attributes for the slope triangle label.
3311              *
3312              * @type Label
3313              * @name Slopetriangle#label
3314              */
3315             label: {
3316                 visible: true
3317             }
3318             /**#@-*/
3319         },
3320 
3321         /* special options for step functions */
3322         stepfunction: {
3323             /**#@+
3324              * @visprop
3325              */
3326 
3327             /**#@-*/
3328         },
3329 
3330         /* special tape measure options */
3331         tapemeasure: {
3332             /**#@+
3333              * @visprop
3334              */
3335 
3336             strokeColor: '#000000',
3337             strokeWidth: 2,
3338             highlightStrokeColor: '#000000',
3339 
3340             /**
3341              * Show tape measure ticks.
3342              *
3343              * @type Boolean
3344              * @name Tapemeasure#withTicks
3345              * @default true
3346              */
3347             withTicks: true,
3348 
3349             /**
3350              * Show tape measure label.
3351              *
3352              * @type Boolean
3353              * @name Tapemeasure#withLabel
3354              * @default true
3355              */
3356             withLabel: true,
3357 
3358             /**
3359              * The precision of the tape measure value displayed in the optional text.
3360              * @memberOf Tapemeasure.prototype
3361              * @name precision
3362              * @type Number
3363              * @default 2
3364              */
3365             precision: 2,
3366 
3367             /**
3368              * Attributes for first helper point defining the tape measure position.
3369              *
3370              * @type Point
3371              * @name Tapemeasure#point1
3372              */
3373             point1: {
3374                 visible: 'inherit',
3375                 strokeColor: '#000000',
3376                 fillColor: '#ffffff',
3377                 fillOpacity: 0.0,
3378                 highlightFillOpacity: 0.1,
3379                 size: 6,
3380                 snapToPoints: true,
3381                 attractorUnit: 'screen',
3382                 attractorDistance: 20,
3383                 showInfobox: false,
3384                 withLabel: false,
3385                 name: ''
3386             },
3387 
3388             /**
3389              * Attributes for second helper point defining the tape measure position.
3390              *
3391              * @type Point
3392              * @name Tapemeasure#point2
3393              */
3394             point2: {
3395                 visible: 'inherit',
3396                 strokeColor: '#000000',
3397                 fillColor: '#ffffff',
3398                 fillOpacity: 0.0,
3399                 highlightFillOpacity: 0.1,
3400                 size: 6,
3401                 snapToPoints: true,
3402                 attractorUnit: 'screen',
3403                 attractorDistance: 20,
3404                 showInfobox: false,
3405                 withLabel: false,
3406                 name: ''
3407             },
3408 
3409             /**
3410              * Attributes for the ticks of the tape measure.
3411              *
3412              * @type Ticks
3413              * @name Tapemeasure#ticks
3414              */
3415             ticks: {
3416                 drawLabels: false,
3417                 drawZero: true,
3418                 insertTicks: true,
3419                 minorHeight: 8,
3420                 majorHeight: 16,
3421                 minorTicks: 4,
3422                 tickEndings: [0, 1],
3423                 defaultDistance: 0.1,
3424                 strokeOpacity: 1,
3425                 strokeWidth: 1,
3426                 strokeColor: '#000000',
3427                 visible: 'inherit'
3428             },
3429 
3430             /**
3431              * Attributes for the tape measure label.
3432              *
3433              * @type Label
3434              * @name Tapemeasure#label
3435              */
3436             label: {
3437                 position: 'top'
3438             }
3439             /**#@-*/
3440         },
3441 
3442         /* special text options */
3443         text: {
3444             /**#@+
3445              * @visprop
3446              */
3447 
3448             /**
3449              * The font size in pixels.
3450              *
3451              * @name fontSize
3452              * @memberOf Text.prototype
3453              * @default 12
3454              * @type Number
3455              */
3456             fontSize: 12,
3457 
3458             /**
3459              * Used to round texts given by a number.
3460              *
3461              * @name digits
3462              * @memberOf Text.prototype
3463              * @default 2
3464              * @type Number
3465              */
3466             digits: 2,
3467 
3468             /**
3469              * If set to true, the text is parsed and evaluated.
3470              * For labels parse==true results in converting names of the form k_a to subscripts.
3471              * If the text is given by string and parse==true, the string is parsed as
3472              * JessieCode expression.
3473              *
3474              * @name parse
3475              * @memberOf Text.prototype
3476              * @default true
3477              * @type Boolean
3478              */
3479             parse: true,
3480 
3481             /**
3482              * If set to true and caja's sanitizeHTML function can be found it
3483              * will be used to sanitize text output.
3484              *
3485              * @name useCaja
3486              * @memberOf Text.prototype
3487              * @default false
3488              * @type Boolean
3489              */
3490             useCaja: false,
3491 
3492             /**
3493              * If enabled, the text will be handled as label. Intended for internal use.
3494              *
3495              * @name isLabel
3496              * @memberOf Text.prototype
3497              * @default false
3498              * @type Boolean
3499              */
3500             isLabel: false,
3501 
3502             strokeColor: 'black',
3503             highlightStrokeColor: 'black',
3504             highlightStrokeOpacity: 0.666666,
3505 
3506             /**
3507              * Default CSS properties of the HTML text element.
3508              * <p>
3509              * The CSS properties which are set here, are handed over to the style property
3510              * of the HTML text element. That means, they have higher property than any
3511              * CSS class.
3512              * <p>
3513              * If a property which is set here should be overruled by a CSS class
3514              * then this property should be removed here.
3515              * <p>
3516              * The reason, why this attribute should be kept to its default value at all,
3517              * is that screen dumps of SVG boards with <tt>board.renderer.dumpToCanvas()</tt>
3518              * will ignore the font-family if it is set in a CSS class.
3519              * It has to be set explicitly as style attribute.
3520              * <p>
3521              * In summary, the order of priorities from high to low is
3522              * <ol>
3523              *  <li> JXG.Options.text.cssStyle
3524              *  <li> JXG.Options.text.cssDefaultStyle
3525              *  <li> JXG.Options.text.cssClass
3526              * </ol>
3527              * @example
3528              * If all texts should get its font-family from the default CSS class
3529              * before initializing the board
3530              * <pre>
3531              *   JXG.Options.text.cssDefaultStyle = '';
3532              * </pre>
3533              * should be called.
3534              *
3535              * @name cssDefaultStyle
3536              * @memberOf Text.prototype
3537              * @default  'font-family: Arial, Helvetica, Geneva, sans-serif;'
3538              * @type String
3539              * @see JXG.Text#highlightCssDefaultStyle
3540              * @see JXG.Text#cssStyle
3541              * @see JXG.Text#highlightCssStyle
3542              */
3543             cssDefaultStyle: 'font-family: Arial, Helvetica, Geneva, sans-serif;',
3544 
3545             /**
3546              * Default CSS properties of the HTML text element in case of highlighting.
3547              * <p>
3548              * The CSS properties which are set here, are haded over to the style property
3549              * of the HTML text element. That means, they have higher property than any
3550              * CSS class.
3551              *
3552              * @name cssDefaultStyle
3553              * @memberOf Text.prototype
3554              * @default  'font-family: Arial, Helvetica, Geneva, sans-serif;'
3555              * @type String
3556              * @see JXG.Text#cssDefaultStyle
3557              * @see JXG.Text#cssStyle
3558              * @see JXG.Text#highlightCssStyle
3559             */
3560             highlightCssDefaultStyle: 'font-family: Arial, Helvetica, Geneva, sans-serif;',
3561 
3562             /**
3563              * CSS properties of the HTML text element.
3564              * <p>
3565              * The CSS properties which are set here, are haded over to the style property
3566              * of the HTML text element. That means, they have higher property than any
3567              * CSS class.
3568              *
3569              * @name cssStyle
3570              * @memberOf Text.prototype
3571              * @default  ''
3572              * @type String
3573              * @see JXG.Text#cssDefaultStyle
3574              * @see JXG.Text#highlightCssDefaultStyle
3575              * @see JXG.Text#highlightCssStyle
3576             */
3577             cssStyle: '',
3578 
3579             /**
3580              * CSS properties of the HTML text element in case of highlighting.
3581              * <p>
3582              * The CSS properties which are set here, are haded over to the style property
3583              * of the HTML text element. That means, they have higher property than any
3584              * CSS class.
3585              *
3586              * @name cssDefaultStyle
3587              * @memberOf Text.prototype
3588              * @default  ''
3589              * @type String
3590              * @see JXG.Text#cssDefaultStyle
3591              * @see JXG.Text#highlightCssDefaultStyle
3592              * @see JXG.Text#cssStyle
3593             */
3594             highlightCssStyle: '',
3595 
3596             /**
3597              * If true the input will be given to ASCIIMathML before rendering.
3598              *
3599              * @name useASCIIMathML
3600              * @memberOf Text.prototype
3601              * @default false
3602              * @type Boolean
3603              */
3604             useASCIIMathML: false,
3605 
3606             /**
3607              * If true MathJax will be used to render the input string.
3608              *
3609              * @name useMathJax
3610              * @memberOf Text.prototype
3611              * @default false
3612              * @type Boolean
3613              */
3614             useMathJax: false,
3615 
3616             /**
3617              * Determines the rendering method of the text. Possible values
3618              * include <tt>'html'</tt> and <tt>'internal</tt>.
3619              *
3620              * @name display
3621              * @memberOf Text.prototype
3622              * @default 'html'
3623              * @type String
3624              */
3625             display: 'html',
3626 
3627             /**
3628              * Anchor element {@link Point}, {@link Text} or {@link Image} of the text. If it exists, the coordinates of the text are relative
3629              * to this anchor element.
3630              *
3631              * @name anchor
3632              * @memberOf Text.prototype
3633              * @default null
3634              * @type Object
3635              */
3636             anchor: null,
3637 
3638             /**
3639              * The horizontal alignment of the text. Possible values include <tt>'left'</tt>, <tt>'middle'</tt>, and
3640              * <tt>'right'</tt>.
3641              *
3642              * @name anchorX
3643              * @memberOf Text.prototype
3644              * @default 'left'
3645              * @type String
3646              */
3647             anchorX: 'left',
3648 
3649             /**
3650              * The vertical alignment of the text. Possible values include <tt>'top'</tt>, <tt>'middle'</tt>, and
3651              * <tt>'bottom'</tt>.
3652              *
3653              * @name anchorY
3654              * @memberOf Text.prototype
3655              * @default 'middle'
3656              * @type String
3657              */
3658             anchorY: 'middle',
3659 
3660             /**
3661              * CSS class of the text in non-highlighted view.
3662              *
3663              * @name cssClass
3664              * @memberOf Text.prototype
3665              * @type String
3666              */
3667             cssClass: 'JXGtext',
3668 
3669             /**
3670              * CSS class of the text in highlighted view.
3671              *
3672              * @name highlightCssClass
3673              * @memberOf Text.prototype
3674              * @type String
3675              */
3676             highlightCssClass: 'JXGtext',
3677 
3678             /**
3679              * Sensitive area for dragging the text.
3680              * Possible values are 'all', or something else.
3681              * This may be extended to left, right, ... in the future.
3682              *
3683              * @name Text#dragArea
3684              * @type String
3685              * @default 'all'
3686              */
3687             dragArea: 'all',
3688 
3689             withLabel: false,
3690 
3691             /**
3692              * Text rotation in degrees.
3693              * Works for non-zero values only in combination with display=='internal'.
3694              *
3695              * @name Text#rotate
3696              * @type Number
3697              * @default 0
3698              */
3699             rotate: 0,
3700 
3701             visible: true,
3702 
3703             /**
3704              * Defines together with {@link Text#snapSizeY} the grid the text snaps on to.
3705              * The text will only snap on integer multiples to snapSizeX in x and snapSizeY in y direction.
3706              * If this value is equal to or less than <tt>0</tt>, it will use the grid displayed by the major ticks
3707              * of the default ticks of the default x axes of the board.
3708              *
3709              * @name snapSizeX
3710              * @memberOf Text.prototype
3711              *
3712              * @see JXG.Point#snapToGrid
3713              * @see Text#snapSizeY
3714              * @see JXG.Board#defaultAxes
3715              * @type Number
3716              * @default 1
3717              */
3718             snapSizeX: 1,
3719 
3720             /**
3721              * Defines together with {@link Text#snapSizeX} the grid the text snaps on to.
3722              * The text will only snap on integer multiples to snapSizeX in x and snapSizeY in y direction.
3723              * If this value is equal to or less than <tt>0</tt>, it will use the grid displayed by the major ticks
3724              * of the default ticks of the default y axes of the board.
3725              *
3726              * @name snapSizeY
3727              * @memberOf Text.prototype
3728              *
3729              * @see JXG.Point#snapToGrid
3730              * @see Text#snapSizeX
3731              * @see JXG.Board#defaultAxes
3732              * @type Number
3733              * @default 1
3734              */
3735             snapSizeY: 1,
3736 
3737             /**
3738              * List of attractor elements. If the distance of the text is less than
3739              * attractorDistance the text is made to glider of this element.
3740              *
3741              * @name attractors
3742              * @memberOf Text.prototype
3743              * @type array
3744              * @default empty
3745              */
3746             attractors: []
3747 
3748             /**#@-*/
3749         },
3750 
3751         /* special options for trace curves */
3752         tracecurve: {
3753             /**#@+
3754              * @visprop
3755              */
3756             strokeColor: '#000000',
3757             fillColor: 'none',
3758 
3759             /**
3760              * The number of evaluated data points.
3761              * @memberOf Tracecurve.prototype
3762              * @default 100
3763              * @name numberPoints
3764              * @type Number
3765              */
3766             numberPoints: 100
3767 
3768             /**#@-*/
3769         },
3770 
3771         /*special turtle options */
3772         turtle: {
3773             /**#@+
3774              * @visprop
3775              */
3776 
3777             strokeWidth: 1,
3778             fillColor: 'none',
3779             strokeColor: '#000000',
3780 
3781             /**
3782              * Attributes for the turtle arrow.
3783              *
3784              * @type Curve
3785              * @name Turtle#arrow
3786              */
3787             arrow: {
3788                 strokeWidth: 2,
3789                 withLabel: false,
3790                 strokeColor: '#ff0000'
3791             }
3792             /**#@-*/
3793         },
3794 
3795         /**
3796          * Abbreviations of properties. Setting the shortcut means setting abbreviated properties
3797          * to the same value.
3798          * It is used in {@link JXG.GeometryElement#setAttribute} and in
3799          * the constructor {@link JXG.GeometryElement}.
3800          * Attention: In Options.js abbreviations are not allowed.
3801          */
3802         shortcuts: {
3803             color: ['strokeColor', 'fillColor'],
3804             opacity: ['strokeOpacity', 'fillOpacity'],
3805             highlightColor: ['highlightStrokeColor', 'highlightFillColor'],
3806             highlightOpacity: ['highlightStrokeOpacity', 'highlightFillOpacity'],
3807             strokeWidth: ['strokeWidth', 'highlightStrokeWidth']
3808         }
3809 
3810     };
3811 
3812     /**
3813      * Holds all possible properties and the according validators for geometry elements. A validator is either a function
3814      * which takes one parameter and returns true, if the value is valid for the property, or it is false if no validator
3815      * is required.
3816      */
3817     JXG.Validator = (function () {
3818         var i,
3819             validatePixel = function (v) {
3820                 return (/^[0-9]+px$/).test(v);
3821             },
3822             validateDisplay = function (v) {
3823                 return (v  === 'html' || v === 'internal');
3824             },
3825             validateColor = function (v) {
3826                 // for now this should do it...
3827                 return Type.isString(v);
3828             },
3829             validatePointFace = function (v) {
3830                 return Type.exists(JXG.normalizePointFace(v));
3831             },
3832             validateInteger = function (v) {
3833                 return (Math.abs(v - Math.round(v)) < Mat.eps);
3834             },
3835             validatePositiveInteger = function (v) {
3836                 return validateInteger(v) && v > 0;
3837             },
3838             validateScreenCoords = function (v) {
3839                 return v.length >= 2 && validateInteger(v[0]) && validateInteger(v[1]);
3840             },
3841             validateRenderer = function (v) {
3842                 return (v === 'vml' || v === 'svg' || v === 'canvas' || v === 'no');
3843             },
3844             validatePositive = function (v) {
3845                 return v > 0;
3846             },
3847             validateNotNegative = function (v) {
3848                 return v >= 0;
3849             },
3850             v = {},
3851             validators = {
3852                 attractorDistance: validateNotNegative,
3853                 color: validateColor,
3854                 defaultDistance: Type.isNumber,
3855                 display: validateDisplay,
3856                 doAdvancedPlot: false,
3857                 draft: false,
3858                 drawLabels: false,
3859                 drawZero: false,
3860                 face: validatePointFace,
3861                 factor: Type.isNumber,
3862                 fillColor: validateColor,
3863                 fillOpacity: Type.isNumber,
3864                 firstArrow: false,
3865                 fontSize: validateInteger,
3866                 dash: validateInteger,
3867                 gridX: Type.isNumber,
3868                 gridY: Type.isNumber,
3869                 hasGrid: false,
3870                 highlightFillColor: validateColor,
3871                 highlightFillOpacity: Type.isNumber,
3872                 highlightStrokeColor: validateColor,
3873                 highlightStrokeOpacity: Type.isNumber,
3874                 insertTicks: false,
3875                 //: validateScreenCoords,
3876                 lastArrow: false,
3877                 majorHeight: validateInteger,
3878                 minorHeight: validateInteger,
3879                 minorTicks: validateNotNegative,
3880                 minTicksDistance: validatePositiveInteger,
3881                 numberPointsHigh: validatePositiveInteger,
3882                 numberPointsLow: validatePositiveInteger,
3883                 opacity: Type.isNumber,
3884                 radius: Type.isNumber,
3885                 RDPsmoothing: false,
3886                 renderer: validateRenderer,
3887                 right: validatePixel,
3888                 showCopyright: false,
3889                 showInfobox: false,
3890                 showNavigation: false,
3891                 size: validateInteger,
3892                 snapSizeX: validatePositive,
3893                 snapSizeY: validatePositive,
3894                 snapWidth: Type.isNumber,
3895                 snapToGrid: false,
3896                 snatchDistance: validateNotNegative,
3897                 straightFirst: false,
3898                 straightLast: false,
3899                 stretch: false,
3900                 strokeColor: validateColor,
3901                 strokeOpacity: Type.isNumber,
3902                 strokeWidth: validateInteger,
3903                 takeFirst: false,
3904                 takeSizeFromFile: false,
3905                 to10: false,
3906                 toOrigin: false,
3907                 translateTo10: false,
3908                 translateToOrigin: false,
3909                 useASCIIMathML: false,
3910                 useDirection: false,
3911                 useMathJax: false,
3912                 withLabel: false,
3913                 withTicks: false,
3914                 zoom: false
3915             };
3916 
3917         // this seems like a redundant step but it makes sure that
3918         // all properties in the validator object have lower case names
3919         // and the validator object is easier to read.
3920         for (i in validators) {
3921             if (validators.hasOwnProperty(i)) {
3922                 v[i.toLowerCase()] = validators[i];
3923             }
3924         }
3925 
3926         return v;
3927     }());
3928 
3929     /**
3930      * All point faces can be defined with more than one name, e.g. a cross faced point can be given
3931      * by face equal to 'cross' or equal to 'x'. This method maps all possible values to fixed ones to
3932      * simplify if- and switch-clauses regarding point faces. The translation table is as follows:
3933      * <table>
3934      * <tr><th>Input</th><th>Output</th></tr>
3935      * <tr><td>cross, x</td><td>x</td></tr>
3936      * <tr><td>circle, o</td><td>o</td></tr>
3937      * <tr><td>square, []</td><td>[]</td></tr>
3938      * <tr><td>plus, +</td><td>+</td></tr>
3939      * <tr><td>diamond, <></td><td><></td></tr>
3940      * <tr><td>triangleup, a, ^</td><td>A</td></tr>
3941      * <tr><td>triangledown, v</td><td>v</td></tr>
3942      * <tr><td>triangleleft, <</td><td><</td></tr>
3943      * <tr><td>triangleright, ></td><td>></td></tr>
3944      * </table>
3945      * @param {String} s A string which should determine a valid point face.
3946      * @returns {String} Returns a normalized string or undefined if the given string is not a valid
3947      * point face.
3948      */
3949     JXG.normalizePointFace = function (s) {
3950         var map = {
3951             cross: 'x',
3952             x: 'x',
3953             circle: 'o',
3954             o: 'o',
3955             square: '[]',
3956             '[]': '[]',
3957             plus: '+',
3958             '+': '+',
3959             diamond: '<>',
3960             '<>': '<>',
3961             triangleup: '^',
3962             a: '^',
3963             '^': '^',
3964             triangledown: 'v',
3965             v: 'v',
3966             triangleleft: '<',
3967             '<': '<',
3968             triangleright: '>',
3969             '>': '>'
3970         };
3971 
3972         return map[s];
3973     };
3974 
3975 
3976     /**
3977      * Apply the options stored in this object to all objects on the given board.
3978      * @param {JXG.Board} board The board to which objects the options will be applied.
3979      */
3980     JXG.useStandardOptions = function (board) {
3981         var el, t, p, copyProps,
3982             o = JXG.Options,
3983             boardHadGrid = board.hasGrid;
3984 
3985         board.options.grid.hasGrid = o.grid.hasGrid;
3986         board.options.grid.gridX = o.grid.gridX;
3987         board.options.grid.gridY = o.grid.gridY;
3988         board.options.grid.gridColor = o.grid.gridColor;
3989         board.options.grid.gridOpacity = o.grid.gridOpacity;
3990         board.options.grid.gridDash = o.grid.gridDash;
3991         board.options.grid.snapToGrid = o.grid.snapToGrid;
3992         board.options.grid.snapSizeX = o.grid.SnapSizeX;
3993         board.options.grid.snapSizeY = o.grid.SnapSizeY;
3994         board.takeSizeFromFile = o.takeSizeFromFile;
3995 
3996         copyProps = function (p, o) {
3997             p.visProp.fillcolor = o.fillColor;
3998             p.visProp.highlightfillcolor = o.highlightFillColor;
3999             p.visProp.strokecolor = o.strokeColor;
4000             p.visProp.highlightstrokecolor = o.highlightStrokeColor;
4001         };
4002 
4003         for (el in board.objects) {
4004             if (board.objects.hasOwnProperty(el)) {
4005                 p = board.objects[el];
4006                 if (p.elementClass === Const.OBJECT_CLASS_POINT) {
4007                     copyProps(p, o.point);
4008                 } else if (p.elementClass === Const.OBJECT_CLASS_LINE) {
4009                     copyProps(p, o.line);
4010 
4011                     for (t = 0; t < p.ticks.length; t++) {
4012                         p.ticks[t].majorTicks = o.line.ticks.majorTicks;
4013                         p.ticks[t].minTicksDistance = o.line.ticks.minTicksDistance;
4014                         p.ticks[t].visProp.minorheight = o.line.ticks.minorHeight;
4015                         p.ticks[t].visProp.majorheight = o.line.ticks.majorHeight;
4016                     }
4017                 } else if (p.elementClass === Const.OBJECT_CLASS_CIRCLE) {
4018                     copyProps(p, o.circle);
4019                 } else if (p.type === Const.OBJECT_TYPE_ANGLE) {
4020                     copyProps(p, o.angle);
4021                 } else if (p.type === Const.OBJECT_TYPE_ARC) {
4022                     copyProps(p, o.arc);
4023                 } else if (p.type === Const.OBJECT_TYPE_POLYGON) {
4024                     copyProps(p, o.polygon);
4025                 } else if (p.type === Const.OBJECT_TYPE_CONIC) {
4026                     copyProps(p, o.conic);
4027                 } else if (p.type === Const.OBJECT_TYPE_CURVE) {
4028                     copyProps(p, o.curve);
4029                 } else if (p.type === Const.OBJECT_TYPE_SECTOR) {
4030                     p.arc.visProp.fillcolor = o.sector.fillColor;
4031                     p.arc.visProp.highlightfillcolor = o.sector.highlightFillColor;
4032                     p.arc.visProp.fillopacity = o.sector.fillOpacity;
4033                     p.arc.visProp.highlightfillopacity = o.sector.highlightFillOpacity;
4034                 }
4035             }
4036         }
4037 
4038         board.fullUpdate();
4039         if (boardHadGrid && !board.hasGrid) {
4040             board.removeGrids(board);
4041         } else if (!boardHadGrid && board.hasGrid) {
4042             board.create('grid', []);
4043         }
4044     };
4045 
4046     /**
4047      * Converts all color values to greyscale and calls useStandardOption to put them onto the board.
4048      * @param {JXG.Board} board The board to which objects the options will be applied.
4049      * @see #useStandardOptions
4050      */
4051     JXG.useBlackWhiteOptions = function (board) {
4052         var o = JXG.Options;
4053         o.point.fillColor = Color.rgb2bw(o.point.fillColor);
4054         o.point.highlightFillColor = Color.rgb2bw(o.point.highlightFillColor);
4055         o.point.strokeColor = Color.rgb2bw(o.point.strokeColor);
4056         o.point.highlightStrokeColor = Color.rgb2bw(o.point.highlightStrokeColor);
4057 
4058         o.line.fillColor = Color.rgb2bw(o.line.fillColor);
4059         o.line.highlightFillColor = Color.rgb2bw(o.line.highlightFillColor);
4060         o.line.strokeColor = Color.rgb2bw(o.line.strokeColor);
4061         o.line.highlightStrokeColor = Color.rgb2bw(o.line.highlightStrokeColor);
4062 
4063         o.circle.fillColor = Color.rgb2bw(o.circle.fillColor);
4064         o.circle.highlightFillColor = Color.rgb2bw(o.circle.highlightFillColor);
4065         o.circle.strokeColor = Color.rgb2bw(o.circle.strokeColor);
4066         o.circle.highlightStrokeColor = Color.rgb2bw(o.circle.highlightStrokeColor);
4067 
4068         o.arc.fillColor = Color.rgb2bw(o.arc.fillColor);
4069         o.arc.highlightFillColor = Color.rgb2bw(o.arc.highlightFillColor);
4070         o.arc.strokeColor = Color.rgb2bw(o.arc.strokeColor);
4071         o.arc.highlightStrokeColor = Color.rgb2bw(o.arc.highlightStrokeColor);
4072 
4073         o.polygon.fillColor = Color.rgb2bw(o.polygon.fillColor);
4074         o.polygon.highlightFillColor  = Color.rgb2bw(o.polygon.highlightFillColor);
4075 
4076         o.sector.fillColor = Color.rgb2bw(o.sector.fillColor);
4077         o.sector.highlightFillColor  = Color.rgb2bw(o.sector.highlightFillColor);
4078 
4079         o.curve.strokeColor = Color.rgb2bw(o.curve.strokeColor);
4080         o.grid.gridColor = Color.rgb2bw(o.grid.gridColor);
4081 
4082         JXG.useStandardOptions(board);
4083     };
4084 
4085     // needs to be exported
4086     JXG.Options.normalizePointFace = JXG.normalizePointFace;
4087 
4088     return JXG.Options;
4089 });
4090