1 /*
  2     Copyright 2008-2012
  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: you can redistribute it and/or modify
 13     it under the terms of the GNU Lesser General Public License as published by
 14     the Free Software Foundation, either version 3 of the License, or
 15     (at your option) any later version.
 16 
 17     JSXGraph is distributed in the hope that it will be useful,
 18     but WITHOUT ANY WARRANTY; without even the implied warranty of
 19     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 20     GNU Lesser General Public License for more details.
 21 
 22     You should have received a copy of the GNU Lesser General Public License
 23     along with JSXGraph.  If not, see <http://www.gnu.org/licenses/>.
 24 */
 25 /**
 26  * Options Namespace
 27  * @description These are the default options of the board and of all geometry elements.
 28  */
 29 JXG.Options = {
 30     /* Options that are used directly within the board class */
 31     showCopyright : true,
 32     showNavigation : true,
 33     takeSizeFromFile : false, // If true, the construction - when read from a file or string - the size of the div can be changed.
 34     renderer: 'svg',
 35     takeFirst : false, // if true the first element with hasPoint==true is taken.
 36     animationDelay: 35,
 37 
 38     /* zoom options */
 39     zoom : {
 40         factorX : 1.25,
 41         factorY : 1.25,
 42         wheel: false,
 43         needShift: false,
 44         eps: 0.1
 45     },
 46     
 47     pan: {
 48         needShift: true,
 49         needTwoFingers: true,
 50         enabled: true
 51     },
 52 
 53     jc : {
 54         enabled: true,
 55         compile: true
 56     },
 57 
 58     /* navbar options */
 59     navbar: {
 60         strokeColor: '#aaaaaa',
 61         fillColor: '#f5f5f5',
 62         padding: '2px',
 63         position: 'absolute',
 64         fontSize: '10px',
 65         cursor: 'pointer',
 66         zIndex: '100',
 67         right: '5px',
 68         bottom: '5px'
 69     },
 70 
 71     /**
 72      * Generic options 
 73      */
 74     
 75     /* geometry element options */
 76     elements : {
 77         // the following tag is a meta tag: http://code.google.com/p/jsdoc-toolkit/wiki/MetaTags
 78 
 79         /**#@+
 80          * @visprop
 81          */
 82 
 83         /**
 84          * The stroke color of the given geometry element.
 85          * @type String
 86          * @name JXG.GeometryElement#strokeColor
 87          * @see JXG.GeometryElement#highlightStrokeColor
 88          * @see JXG.GeometryElement#strokeWidth
 89          * @see JXG.GeometryElement#strokeOpacity
 90          * @see JXG.GeometryElement#highlightStrokeOpacity
 91          * @default {@link JXG.Options.elements.color#strokeColor}
 92          */
 93         strokeColor: '#0000ff',
 94 
 95         /**
 96          * The stroke color of the given geometry element when the user moves the mouse over it.
 97          * @type String
 98          * @name JXG.GeometryElement#highlightStrokeColor
 99          * @see JXG.GeometryElement#strokeColor
100          * @see JXG.GeometryElement#strokeWidth
101          * @see JXG.GeometryElement#strokeOpacity
102          * @see JXG.GeometryElement#highlightStrokeOpacity
103          * @default {@link JXG.Options.elements.color#highlightStrokeColor}
104          */
105         highlightStrokeColor: '#C3D9FF',
106 
107         /**
108          * The fill color of this geometry element.
109          * @type String
110          * @name JXG.GeometryElement#fillColor
111          * @see JXG.GeometryElement#highlightFillColor
112          * @see JXG.GeometryElement#fillOpacity
113          * @see JXG.GeometryElement#highlightFillOpacity
114          * @default {@link JXG.Options.elements.color#fillColor}
115          */
116         fillColor: 'red',
117 
118         /**
119          * The fill color of the given geometry element when the mouse is pointed over it.
120          * @type String
121          * @name JXG.GeometryElement#highlightFillColor
122          * @see JXG.GeometryElement#fillColor
123          * @see JXG.GeometryElement#fillOpacity
124          * @see JXG.GeometryElement#highlightFillOpacity
125          * @default {@link JXG.Options.elements.color#highlightFillColor}
126          */
127         highlightFillColor: 'none',
128 
129         /**
130          * Opacity for element's stroke color.
131          * @type number
132          * @name JXG.GeometryElement#strokeOpacity
133          * @see JXG.GeometryElement#strokeColor
134          * @see JXG.GeometryElement#highlightStrokeColor
135          * @see JXG.GeometryElement#strokeWidth
136          * @see JXG.GeometryElement#highlightStrokeOpacity
137          * @default {@link JXG.Options.elements#strokeOpacity}
138          */
139         strokeOpacity: 1,
140 
141         /**
142          * Opacity for stroke color when the object is highlighted.
143          * @type number
144          * @name JXG.GeometryElement#highlightStrokeOpacity
145          * @see JXG.GeometryElement#strokeColor
146          * @see JXG.GeometryElement#highlightStrokeColor
147          * @see JXG.GeometryElement#strokeWidth
148          * @see JXG.GeometryElement#strokeOpacity
149          * @default {@link JXG.Options.elements#highlightStrokeOpacity}
150          */
151         highlightStrokeOpacity: 1,
152 
153         /**
154          * Opacity for fill color.
155          * @type number
156          * @name JXG.GeometryElement#fillOpacity
157          * @see JXG.GeometryElement#fillColor
158          * @see JXG.GeometryElement#highlightFillColor
159          * @see JXG.GeometryElement#highlightFillOpacity
160          * @default {@link JXG.Options.elements.color#fillOpacity}
161          */
162         fillOpacity: 1,
163 
164         /**
165          * Opacity for fill color when the object is highlighted.
166          * @type number
167          * @name JXG.GeometryElement#highlightFillOpacity
168          * @see JXG.GeometryElement#fillColor
169          * @see JXG.GeometryElement#highlightFillColor
170          * @see JXG.GeometryElement#fillOpacity
171          * @default {@link JXG.Options.elements.color#highlightFillOpacity}
172          */
173         highlightFillOpacity: 1,
174 
175         /**
176          * Width of the element's stroke.
177          * @type number
178          * @name JXG.GeometryElement#strokeWidth
179          * @see JXG.GeometryElement#strokeColor
180          * @see JXG.GeometryElement#highlightStrokeColor
181          * @see JXG.GeometryElement#strokeOpacity
182          * @see JXG.GeometryElement#highlightStrokeOpacity
183          * @default {@link JXG.Options.elements#strokeWidth}
184          */
185         strokeWidth: 2,
186 
187         /**
188          * Width of the element's stroke when the mouse is pointed over it.
189          * @type number
190          * @name JXG.GeometryElement#highlightStrokeWidth
191          * @see JXG.GeometryElement#strokeColor
192          * @see JXG.GeometryElement#highlightStrokeColor
193          * @see JXG.GeometryElement#strokeOpacity
194          * @see JXG.GeometryElement#highlightStrokeOpacity
195          * @see JXG.GeometryElement#highlightFillColor
196          * @default {@link JXG.Options.elements#strokeWidth}
197          */
198         highlightStrokeWidth: 2,
199 
200 
201         /**
202          * If true the element is fixed and can not be dragged around. The element
203          * will be repositioned on zoom and moveOrigin events.
204          * @type Boolean
205          * @default false
206          * @name JXG.GeometryElement#fixed
207          */
208         fixed: false,
209 
210         /**
211          * If true the element is fixed and can not be dragged around. The element
212          * will even stay at its position on zoom and moveOrigin events.
213          * Only free elements like points, texts, curves can be frozen.
214          * @type Boolean
215          * @default false
216          * @name JXG.GeometryElement#frozen
217          */
218         frozen: false,
219 
220         /**
221          * If true a label will display the element's name.
222          * @type Boolean
223          * @default false
224          * @name JXG.GeometryElement#withLabel
225          */
226         withLabel: false,
227 
228         /**
229          * If false the element won't be visible on the board, otherwise it is shown.
230          * @type boolean
231          * @name JXG.GeometryElement#visible
232          * @see JXG.GeometryElement#hideElement
233          * @see JXG.GeometryElement#showElement
234          * @default true
235          */
236         visible: true,
237 
238         /**
239          * A private element will be inaccessible in certain environments, e.g. a graphical user interface.
240          * @default false
241          */
242         priv: false,
243 
244         /**
245          * Display layer which will contain the element.
246          * @see JXG.Options#layer
247          * @default See {@link JXG.Options#layer}
248          */
249         layer: 0,
250 
251 
252         /**
253          * Determines the elements border-style.
254          * Possible values are:
255          * <ul><li>0 for a solid line</li>
256          * <li>1 for a dotted line</li>
257          * <li>2 for a line with small dashes</li>
258 
259 
260          * <li>3 for a line with medium dashes</li>
261          * <li>4 for a line with big dashes</li>
262          * <li>5 for a line with alternating medium and big dashes and large gaps</li>
263          * <li>6 for a line with alternating medium and big dashes and small gaps</li></ul>
264          * @type Number
265          * @name JXG.GeometryElement#dash
266          * @default 0
267          */
268         dash: 0,
269 
270         /**
271          * If true the element will get a shadow.
272          * @type boolean
273          * @name JXG.GeometryElement#shadow
274          * @default false
275          */
276         shadow: false,
277 
278         /**
279          * If true the element will be traced, i.e. on every movement the element will be copied
280          * to the background. Use {@link JXG.GeometryElement#clearTrace} to delete the trace elements.
281          * @see JXG.GeometryElement#clearTrace
282          * @see JXG.GeometryElement#traces
283          * @see JXG.GeometryElement#numTraces
284          * @type Boolean
285          * @default false
286          * @name JXG.GeometryElement#trace
287          */
288         trace: false,
289 
290         /**
291          * Extra visual properties for traces of an element
292          * @type Object
293          * @see JXG.GeometryElement#trace
294          * @name JXG.GeometryElement#traceAttributes
295          */
296         traceAttributes: {},
297         
298         /**
299          * 
300          * @type Boolean
301          * @default true
302          * @name JXG.GeometryElement#highlight
303          */
304         highlight: true,
305         
306         /**
307          * If this is set to true, the element is updated in every update
308          * call of the board. If set to false, the element is updated only after
309          * zoom events or more generally, when the bounding box has been changed.
310          * Examples for the latter behaviour should be axes.
311          * @type Boolean
312          * @default true
313          * @see JXG.GeometryElement#needsRegularUpdate
314          * @name JXG.GeometryElement#needsRegularUpdate
315          */
316         needsRegularUpdate: true,
317 
318         /**
319          * Snaps the element or its parents to the grid. Currently only relevant for points, circles,
320          * and lines. Points are snapped to grid directly, on circles and lines it's only the parent
321          * points that are snapped
322          * @type Boolean
323          * @default false
324          * @name JXG.GeometryElement#snapToGrid
325          */
326         snapToGrid: false,
327 
328         /**
329          * Determines whether two-finger manipulation of this object may change its size.
330          * If set to false, the object is only rotated and translated.
331          * @type Boolean
332          * @default true
333          * @name JXG.GeometryElement#scalable
334          */
335         scalable: true,
336 
337         /*draft options */
338         draft : {
339             /**
340              * If true the element will be drawn in grey scale colors to visualize that it's only a draft.
341              * @type boolean
342              * @name JXG.GeometryElement#draft
343              * @default {@link JXG.Options.elements.draft#draft}
344              */
345             draft : false,
346             strokeColor : '#565656',
347             fillColor : '#565656',
348             strokeOpacity : 0.8,
349             fillOpacity : 0.8,
350             strokeWidth : 1
351         }
352         // close the meta tag
353         /**#@-*/
354     },
355 
356     ticks : {
357         /**#@+
358          * @visprop
359          */
360 
361         /**
362          * Draw labels yes/no
363          * @type Boolean
364          * @name JXG.Ticks#drawLabels
365          * @default false
366          */
367         drawLabels: false,
368         label:{},
369        
370         /**
371          * Draw the zero tick, that lies at line.point1?
372          * @type Boolean
373          * @name JXG.Ticks#drawZero
374          * @default false
375          */
376         drawZero: false,
377 
378         /**
379          * If the distance between two ticks is too big we could insert new ticks. If insertTicks
380          * is <tt>true</tt>, we'll do so, otherwise we leave the distance as is.
381          * This option is ignored if equidistant is false.
382          * @type Boolean
383          * @name JXG.Ticks#insertTicks
384          * @see JXG.Ticks#equidistant
385          * @see JXG.Ticks#maxTicksDistance
386          * @default false
387          */
388         insertTicks: false,
389         minTicksDistance: 50,
390 
391         /**
392          * Total height of a minor tick. If negative the full height of the board is taken.
393          * @type Number
394          * @name JXG.Ticks#minorHeight
395          */
396         minorHeight: 4,
397 
398         /**
399          * Total height of a major tick. If negative the full height of the board is taken.
400          * @type Number
401          * @name JXG.Ticks#majorHeight
402          */
403         majorHeight: 10,
404 
405         /**
406          * The number of minor ticks between two major ticks.
407          * @type Number
408          * @name JXG.Ticks#minorTicks
409          */
410         minorTicks: 4,
411 
412         /**
413          * Scale the ticks but not the tick labels.
414          * @type Number
415          * @default 1
416          * @name JXG.Ticks#scale
417          * @see JXG.Ticks#scaleSymbol
418          */
419         scale: 1,
420 
421         /**
422          * A string that is appended to every tick, used to represent the scale
423          * factor given in {@link JXG.Ticks#scaleSymbol}.
424          * @type String
425          * @default ''
426          * @name JXG.Ticks#scaleSymbol
427          * @see JXG.Ticks#scale
428          */
429         scaleSymbol: '',
430 
431         /**
432          * User defined labels for special ticks. Instead of the i-th tick's position, the i-th string stored in this array
433          * is shown. If the number of strings in this array is less than the number of special ticks, the tick's position is
434          * shown as a fallback.
435          * @type Array
436          * @name JXG.Ticks#labels
437          * @default []
438          */
439         labels: [],
440 
441         /**
442          * The default distance between two ticks. Please be aware that this value does not have
443          * to be used if {@link JXG.Ticks#insertTicks} is set to true.
444          * @type Boolean
445          * @name JXG.Ticks#ticksDistance
446          * @see JXG.Ticks#equidistant
447          * @see JXG.Ticks#insertTicks
448          * @default 1
449          */
450         ticksDistance: 1,
451         strokeOpacity: 1,
452         strokeWidth: 1,
453         strokeColor: 'black',
454         highlightStrokeColor: '#888888'
455         // close the meta tag
456         /**#@-*/
457     },
458 
459     /* precision options */
460     precision : {
461         touch    : 30,
462         touchMax : 100,
463         mouse    : 4,
464         epsilon  : 0.0001,
465         hasPoint : 4
466     },
467 
468     /* Default ordering of the layers */
469     layer : {
470         numlayers: 20, // only important in SVG
471         text  : 9,
472         point : 9,   
473         glider : 9,   
474         arc   : 8,
475         line  : 7,
476         circle: 6, 
477         curve : 5,
478 		turtle : 5,
479         polygon: 3,
480         sector: 3,
481         angle : 3, 
482         integral : 3,
483         axis : 2,
484         grid  : 1,
485         image : 0,
486         trace: 0
487     },
488 
489     /**
490      * element type specific options 
491      */ 
492     /* special angle options */
493     angle : {
494         withLabel: true,
495 
496         /**
497          * Radius of the sector, displaying the angle.
498          * @type Number
499          * @default 0.5
500          * @name Angle#radius
501          * @visprop
502          */
503         radius : 0.5,
504         
505         /**
506          * Display type of the angle field. Possible values are 
507          * 'sector' or 'sectordot' or 'square' or 'none'.
508          * @type String
509          * @default sector
510          * @name Angle#type
511          * @visprop
512          */
513         type : 'sector',  
514                 
515         /**
516          * Display type of the angle field in case of a right angle. Possible values are 
517          * 'sector' or 'sectordot' or 'square' or 'none'.
518          * @type String
519          * @default square
520          * @name Angle#orthoType
521          * @see Angle#orthoSensitivity
522          * @visprop
523          */
524         orthoType: 'square',         
525 
526         /**
527          * Sensitivity (in degrees) to declare an angle as right angle.
528          * If the angle measure is inside this distance from a rigth angle, the orthoType
529          * of the angle is used for display.
530          * @type Number
531          * @default 1.0
532          * @name Angle#orthoSensitivity
533          * @see Angle#orthoType
534          * @visprop
535          */
536         orthoSensitivity: 1.0,     
537         fillColor : '#FF7F00',
538         highlightFillColor : '#FF7F00',
539         strokeColor : '#FF7F00',
540         fillOpacity : 0.3,
541         highlightFillOpacity : 0.3,
542         radiuspoint: {
543             withLabel: false,
544             visible: false,
545             name: ''
546         },
547         pointsquare: {
548             withLabel: false,
549             visible: false,
550             name: ''
551         },
552         dot: {
553             visible: false,
554             strokeColor: 'none',
555             fillColor: 'black',
556             size: 2,
557             face: 'o',
558             withLabel: false,
559             name: ''
560         },
561         label: {
562             position: 'top',
563             offset: [0,0],
564             strokeColor: '#0000FF'
565         }
566     },
567 
568     /* special arc options */
569     arc : {
570         label: {},
571         firstArrow : false,
572         lastArrow : false,
573         fillColor : 'none',
574         highlightFillColor : 'none',
575         strokeColor : '#0000ff',
576         highlightStrokeColor : '#C3D9FF',
577         useDirection: false
578     },
579     
580     inequality: {
581         fillColor: 'red',
582         fillOpacity: 0.2,
583         strokeColor: 'none',
584 
585         /**
586          * By default an inequality is less (or equal) than. Set inverse to <tt>true</tt> will consider the inequality
587          * greater (or equal) than.
588          * @type Boolean
589          * @default false
590          * @name Inequality#inverse
591          * @visprop
592          */
593         inverse: false
594     },
595 
596     /* special axis options */
597     axis: {
598         needsRegularUpdate : false,         // Axes only updated after zooming and moving of the origin.
599         strokeWidth: 1,
600         strokeColor : '#666666',
601         highlightStrokeWidth: 1,
602         highlightStrokeColor : '#888888',
603         withTicks: true,
604         straightFirst : true,
605         straightLast : true,
606         lastArrow: true,
607         withLabel: false, 
608         scalable: false,
609         /* line ticks options */
610         ticks : {
611             label: { 
612                 offset:[4,-12+3]     // This seems to be a good offset for 12 point fonts
613             },
614             needsRegularUpdate : false,            
615             strokeWidth: 1,
616             strokeColor : '#666666',
617             highlightStrokeColor : '#888888',
618             drawLabels : true,
619             drawZero : false,
620             insertTicks : true,
621             minTicksDistance : 10,
622             minorHeight : 4,          // if <0: full width and height
623             majorHeight : -1,         // if <0: full width and height
624             minorTicks : 4,
625             ticksDistance: 1,         // TODO doc
626             strokeOpacity : 0.25
627         },
628         point1 : {                  // Default values for point1 if created by line
629             needsRegularUpdate : false
630         },
631         point2 : {                  // Default values for point2 if created by line
632             needsRegularUpdate : false
633         },
634         label: {
635             position: 'lft',
636             offset: [10,-20]
637         }
638     },
639     
640     /* special options for bisector of 3 points */
641     bisector : {
642         strokeColor: '#000000', // Bisector line
643         point : {               // Bisector point
644             visible: false,
645             fixed: false,
646             withLabel: false,
647             name: ''
648         }
649     },
650 
651     /* special options for the 2 bisectors of 2 lines */
652     bisectorlines : {
653         line1 : {               // 
654             strokeColor: 'black'
655         },
656         line2 : {               // 
657             strokeColor: 'black'
658         }
659     },
660 
661     /* special chart options */
662     chart: {
663         chartStyle: 'line',
664         colors: ['#B02B2C','#3F4C6B','#C79810','#D15600','#FFFF88','#C3D9FF','#4096EE','#008C00'],
665         highlightcolors: null,
666         fillcolor: null,
667         highlightonsector: false,
668         highlightbysize: false
669     },
670 
671     /*special circle options */
672     circle : {
673         hasInnerPoints: false,
674         fillColor : 'none',
675         highlightFillColor : 'none',
676         strokeColor : '#0000ff',
677         highlightStrokeColor : '#C3D9FF',
678         center: {
679             visible: false,
680             withLabel: false,
681             fixed: false,
682             name: ''
683         },
684         label: {
685             position: 'urt'
686         }
687     },
688 
689     /* special options for circumcircle of 3 points */
690     circumcircle : {
691         fillColor : 'none',
692         highlightFillColor : 'none',
693         strokeColor : '#0000ff',
694         highlightStrokeColor : '#C3D9FF',
695         center : {               // center point
696             visible: false,
697             fixed: false,
698             withLabel: false,
699             name: ''
700         }
701     },
702 
703     circumcirclearc : {
704         fillColor : 'none',
705         highlightFillColor : 'none',
706         strokeColor : '#0000ff',
707         highlightStrokeColor : '#C3D9FF',
708         center: {
709             visible: false,
710             withLabel: false,
711             fixed: false,
712             name: ''
713         }
714     },
715 
716     /* special options for circumcircle sector of 3 points */
717     circumcirclesector: {
718         useDirection: true,
719         fillColor: '#00FF00',
720         highlightFillColor: '#00FF00',
721         fillOpacity: 0.3,
722         highlightFillOpacity: 0.3,
723         strokeColor : '#0000ff',
724         highlightStrokeColor : '#C3D9FF',
725         point: {
726             visible: false,
727             fixed: false,
728             withLabel: false,
729             name: ''
730         }
731     },
732     
733     /* special conic options */
734     conic : {
735         fillColor : 'none',
736         highlightFillColor : 'none',
737         strokeColor : '#0000ff',
738         highlightStrokeColor : '#C3D9FF',
739         foci: {
740             // points
741             fixed: false,
742             visible: false,
743             withLabel: false,
744             name: ''
745         }
746     },
747 
748     /* special curve options */
749     curve : {
750         strokeWidth : 1,
751         strokeColor : '#0000ff',
752         fillColor: 'none',
753         fixed: true,
754         
755         /**#@+
756          * @visprop
757          */
758 
759        /**
760         * The data points of the curve are not connected with straight lines but with bezier curves.
761         * @name JXG.Curve#handDrawing
762         * @type Boolean
763         * @default false
764         */
765         handDrawing: false,
766 
767         /**
768          * The curveType is set in @see generateTerm and used in {@link JXG.Curve#updateCurve}.
769          * Possible values are <ul>
770          * <li>'none'</li>
771          * <li>'plot': Data plot</li>
772          * <li>'parameter': we can not distinguish function graphs and parameter curves</li>
773          * <li>'functiongraph': function graph</li>
774          * <li>'polar'</li>
775          * <li>'implicit' (not yet)</li></ul>
776          * Only parameter and plot are set directly. Polar is set with setProperties only.
777          * @name JXG.Curve#curveType
778          */
779         curveType: null,
780         RDPsmoothing : false,     // Apply the Ramer-Douglas-Peuker algorithm
781         numberPointsHigh : 1600,  // Number of points on curves after mouseUp
782         numberPointsLow : 400,    // Number of points on curves after mousemove
783         doAdvancedPlot : true,    // Use the algorithm by Gillam and Hohenwarter
784                                  // It is much slower, but the result is better
785         
786         label: {
787             position: 'lft'
788         }
789 
790         /**#@-*/
791     },
792 
793     glider: {
794         label:{}
795     },
796 
797     /* special grid options */
798     grid : {
799         /**#@+
800          * @visprop
801          */
802 
803         /* grid styles */
804         needsRegularUpdate : false,
805         hasGrid : false,
806         gridX : 1,
807         gridY : 1,
808         strokeColor : '#C0C0C0',
809         strokeOpacity : '0.5',
810         strokeWidth: 1,
811         dash : 0,    // dashed grids slow down the iPad considerably
812         /* snap to grid options */
813         
814         /**
815          * @deprecated
816          */
817         snapToGrid : false,
818         /**
819          * @deprecated
820          */
821         snapSizeX : 10,
822         /**
823          * @deprecated
824          */
825         snapSizeY : 10
826 
827         /**#@-*/
828     },
829 
830     /* special grid options */
831     image : {
832         imageString : null,
833         fillOpacity: 1.0,
834         cssClass : 'JXGimage',
835         highlightCssClass : 'JXGimageHighlight',
836         rotate: 0
837     },
838     
839     /* special options for incircle of 3 points */
840     incircle : {
841         fillColor : 'none',
842         highlightFillColor : 'none',
843         strokeColor : '#0000ff',
844         highlightStrokeColor : '#C3D9FF',
845         center : {               // center point
846             visible: false,
847             fixed: false,
848             withLabel: false,
849             name: ''
850         }
851     },
852 
853     infobox : {
854         /**#@+
855          * @visprop
856          */
857 
858         fontSize : 12,
859         isLabel: false,
860         strokeColor : '#bbbbbb',
861         display : 'html',                    // 'html' or 'internal'
862         anchorX: 'left',                     //  'left', 'middle', or 'right': horizontal alignment of the text.
863         anchorY: 'middle',                   //  'top', 'middle', or 'bottom': vertical alignment of the text.
864         cssClass : 'JXGinfobox',
865         rotate: 0,                           // works for non-zero values only in combination with display=='internal'
866 		visible: true
867 
868         /**#@-*/
869     },
870 
871 
872     /* special options for integral */
873     integral: {
874         withLabel: true,    // Show integral value as text
875         strokeWidth: 0,
876         strokeOpacity: 0,
877         fillOpacity: 0.8,
878         curveLeft: {    // Start point
879             visible: true,
880             layer: 9
881         },
882         baseLeft: {    // Start point
883             visible: false,
884             fixed: false,
885             withLabel: false,
886             name: ''
887         },
888         curveRight: {      // End point
889             visible: true,
890             layer: 9
891         },
892         baseRight: {      // End point
893             visible: false,
894             fixed: false,
895             withLabel: false,
896             name: ''
897         },
898         label: {
899             fontSize: 20
900         }
901     },
902 
903     /* special intersection point options */
904     intersection: {
905         /**#@+
906          * @visprop
907          */
908         /**
909          * Used in {@link JXG.Intersection}.
910          * This flag sets the behaviour of intersection points of e.g.
911          * two segments. If true, the intersection is treated as intersection of lines. If false
912          * the intersection point exists if the segments intersect setwise.
913          * @name JXG.Intersection.alwaysIntersect
914          * @type Boolean
915          * @default true       
916          */  
917          alwaysIntersect: true
918         /**#@-*/
919     },
920     
921     /* special legend options */
922     label: {
923         /**#@+
924          * @visprop
925          */
926         strokeColor : '#552222',
927         highlightStrokeOpacity:1,
928         highlightStrokeColor: '#C3D9FF',
929         
930         fixed: true,
931         /**
932          * Possible string values for the position of a label for
933          * label anchor points are:
934          * 'lft'|'rt'|'top'|'bot'|'ulft'|'urt'|'llft'|'lrt'
935          * This is relevant for non-points: line, circle, curve.
936          * @type String
937          * @default 'urt'
938          * @name JXG.GeometryElement#label.position
939          */
940         position: 'urt',
941         
942         /**
943         *  Label offset from label anchor 
944         *  The label anchor is determined by JXG.GeometryElement#label.position
945         * @type Array
946         * @default [10,10]
947         * @name JXG.GeometryElement#label.offset
948         **/
949         offset: [10, 10]
950 
951         /**#@-*/
952     },
953         
954     /* special legend options */
955     legend: {
956         /**
957          * @visprop
958          */
959         style: 'vertical',
960         labels: ['1','2','3','4','5','6','7','8'],
961         colors: ['#B02B2C','#3F4C6B','#C79810','#D15600','#FFFF88','#C3D9FF','#4096EE','#008C00']
962     },
963 
964     /* special line options */
965     line : {
966         /**#@+
967          * @visprop
968          */
969 
970         firstArrow : false,
971         lastArrow : false,
972         straightFirst : true,
973         straightLast : true,
974         fillColor : 'none',               // Important for VML on IE
975         highlightFillColor : 'none',  // Important for VML on IE
976         strokeColor : '#0000ff',
977         highlightStrokeColor : '#888888',
978         withTicks: false,
979 
980         /**#@-*/
981 
982         point1 : {                  // Default values for point1 if created by line
983             visible: false, 
984             withLabel: false, 
985             fixed: false,
986             name: ''
987         },
988         point2 : {                  // Default values for point2 if created by line
989             visible: false, 
990             withLabel: false, 
991             fixed: false,
992             name: ''
993         },
994         ticks : {
995             drawLabels : true,
996             label: { 
997                 offset: [4,-12+3] // This seems to be a good offset for 12 point fonts
998             },
999             drawZero : false,
1000             insertTicks : false,
1001             minTicksDistance : 50,
1002             maxTicksDistance : 300,
1003             minorHeight : 4,          // if <0: full width and height
1004             majorHeight : -1,         // if <0: full width and height
1005             minorTicks : 4,
1006             defaultDistance : 1,
1007             strokeOpacity : 0.3
1008         },
1009         
1010         label: {
1011             position:'llft'
1012         }
1013     },
1014 
1015     /* special options for locus curves */
1016     locus : {
1017         /**#@+
1018          * @visprop
1019          */
1020 
1021         translateToOrigin: false,
1022         translateTo10: false,
1023         stretch: false,
1024         toOrigin: null,
1025         to10: null
1026 
1027         /**#@-*/
1028     },
1029     
1030     /* special options for normal lines */
1031     normal : {
1032         strokeColor: '#000000', //  normal line
1033         point : {
1034             visible: false,
1035             fixed: false,
1036             withLabel: false,
1037             name: ''
1038         }
1039     },
1040 
1041     /* special options for orthogonal projectionn points */
1042     orthogonalprojection : {
1043     }, 
1044     
1045     /* special options for parallel lines */
1046     parallel : {
1047         strokeColor: '#000000', // Parallel line
1048         point : {
1049             visible: false,
1050             fixed: false,
1051             withLabel: false,
1052             name: ''
1053         }
1054     },
1055 
1056     /* special perpendicular options */
1057     perpendicular : {
1058         strokeColor: '#000000', // Perpendicular line
1059         straightFirst: true,
1060         straightLast: true
1061     },
1062 
1063     /* special perpendicular options */
1064     perpendicularsegment : {
1065         strokeColor: '#000000', // Perpendicular segment
1066         straightFirst: false,
1067         straightLast: false,
1068         point : {               // Perpendicular point
1069             visible: false,
1070             fixed: true,
1071             withLabel: false,
1072             name: ''
1073         }
1074     },
1075 
1076     /* special point options */
1077     point : {
1078         /**#@+
1079          * @visprop
1080          */
1081 
1082     	withLabel: true,
1083         label: {},
1084 
1085         /**
1086          * This attribute was used to determined the point layout. It was derived from GEONExT and was
1087          * replaced by {@link JXG.Point#face} and {@link JXG.Point#size}.
1088          * @see JXG.Point#face
1089          * @see JXG.Point#size
1090          * @type Number
1091          * @default JXG.Options.point#style
1092          * @name JXG.Point#style
1093          * @deprecated
1094          */
1095         style : 5,
1096 
1097         /**
1098          * There are different point styles which differ in appearance.
1099          * Posssible values are
1100          * <table><tr><th>Value</th></tr>
1101          * <tr><td>cross</td></tr>
1102          * <tr><td>circle</td></tr>
1103          * <tr><td>square</td></tr>
1104          * <tr><td>plus</td></tr>
1105          * <tr><td>diamond</td></tr>
1106          * <tr><td>triangleUp</td></tr>
1107          * <tr><td>triangleDown</td></tr>
1108          * <tr><td>triangleLeft</td></tr>
1109          * <tr><td>triangleRight</td></tr>
1110          * </table>
1111          * @type string
1112          * @see JXG.Point#setStyle
1113          * @default circle
1114          * @name JXG.Point#face
1115          */
1116         face : 'o',
1117 
1118         /**
1119          * Determines the size of a point.
1120          * Means radius resp. half the width of a point (depending on the face).
1121          * @see JXG.Point#face
1122          * @type number
1123          * @see JXG.Point#setStyle
1124          * @default 3
1125          * @name JXG.Point#size
1126          */
1127         size : 3,
1128         fillColor : '#ff0000',
1129         highlightFillColor : '#EEEEEE',
1130         strokeWidth: 2,
1131         strokeColor : '#ff0000',
1132         highlightStrokeColor : '#C3D9FF',
1133         zoom: false,             // Change the point size on zoom
1134 
1135         /**
1136          * If true, the infobox is shown on mouse over, else not.
1137          * @name JXG.Point#showInfobox
1138          * @type Boolean
1139          * @default true
1140          */
1141         showInfobox: true,
1142 
1143         /**
1144          * Truncating rule for the digits in the infobox.
1145          * 'auto': done automatically by JXG#autoDigits
1146          * 'none': no truncation
1147          * number: use String.toFixed();
1148          * @name JXG.Point#showInfobox
1149          * @type String, Number
1150          * @default true
1151          */
1152         infoboxDigits: 'auto',
1153 
1154         draft: false,
1155         
1156         /**
1157          * List of attractor elements. If the distance of the point is less than
1158          * attractorDistance the point is made to glider of this element.
1159          * @type array
1160          * @name JXG.Point#attractors
1161          * @default empty
1162          */
1163         attractors: [],
1164         
1165         /**
1166          * If the distance of the point to one of its attractors is less 
1167          * than this number the point will be a glider on this 
1168          * attracting element. 
1169          * If set to zero nothing happens.
1170          * @type number
1171          * @name JXG.Point#attractorDistance
1172          * @default 0
1173          */
1174         attractorDistance: 0.0,
1175         
1176         /**
1177          * If the distance of the point to one of its attractors is at least 
1178          * this number the point will be released from being a glider on the
1179          * attracting element. 
1180          * If set to zero nothing happens.
1181          * @type number
1182          * @name JXG.Point#snatchDistance
1183          * @default 0
1184          */
1185         snatchDistance: 0.0,
1186         
1187         /**
1188          * If set to true, the point will snap to a grid defined by
1189          * {@link JXG.Point#snapSizeX} and {@link JXG.Point#snapSizeY}.
1190          * @see JXG.Point#snapSizeX
1191          * @see JXG.Point#snapSizeY
1192          * @type Boolean
1193          * @name JXG.Point#snapToGrid
1194          * @default false
1195          */
1196         snapToGrid: false,
1197 
1198         /**
1199          * Defines together with {@link JXG.Point#snapSizeY} the grid the point snaps on to.
1200          * The point will only snap on values multiple to snapSizeX in x and snapSizeY in y direction.
1201          * If this value is equal to or less than <tt>0</tt>, it will use the grid displayed by the major ticks
1202          * of the default ticks of the default x axes of the board.
1203          * @see JXG.Point#snapToGrid
1204          * @see JXG.Point#snapSizeY
1205          * @see JXG.Board#defaultAxes
1206          * @type Number
1207          * @name JXG.Point#snapSizeX
1208          * @default 1
1209          */
1210         snapSizeX: 1,
1211 
1212         /**
1213          * Defines together with {@link JXG.Point#snapSizeX} the grid the point snaps on to.
1214          * The point will only snap on values multiple to snapSizeX in x and snapSizeY in y direction.
1215          * If this value is equal to or less than <tt>0</tt>, it will use the grid displayed by the major ticks
1216          * of the default ticks of the default y axes of the board.
1217          * @see JXG.Point#snapToGrid
1218          * @see JXG.Point#snapSizeX
1219          * @see JXG.Board#defaultAxes
1220          * @type Number
1221          * @name JXG.Point#snapSizeY
1222          * @default 1
1223          */
1224         snapSizeY: 1,
1225 
1226         /**
1227          * If set to true, the point will snap to the nearest point in distance of 
1228          * {@link JXG.Point#attractorDistance}.
1229          * @see JXG.Point#attractorDistance
1230          * @type Boolean
1231          * @name JXG.Point#snapToPoints
1232          * @default false
1233          */
1234         snapToPoints: false
1235 
1236         /**#@-*/
1237     },
1238 
1239     /* special polygon options */
1240     polygon : {
1241         /**#@+
1242          * @visprop
1243          */
1244 
1245         /**
1246          * If <tt>true</tt>, moving the mouse over inner points triggers hasPoint.
1247          * @see JXG.GeometryElement#hasPoint
1248          * @name JXG.Polygon#hasInnerPoints
1249          * @type Boolean
1250          * @default false
1251          */
1252         hasInnerPoints: false,
1253         fillColor : '#00FF00',
1254         highlightFillColor : '#00FF00',
1255         fillOpacity : 0.3,
1256         highlightFillOpacity : 0.3,
1257 
1258         /**
1259          * Is the polygon bordered by lines?
1260          * @type Boolean
1261          * @name JXG.Polygon#withLines
1262          * @default true
1263          */
1264         withLines: true,
1265 
1266         /**#@-*/
1267 
1268         borders: {
1269             withLabel: false,
1270 		    strokeWidth: 1,
1271 		    highlightStrokeWidth: 1,
1272             // Polygon layer + 1
1273             layer: 5
1274         },
1275         
1276         /**
1277          *  Points for regular polygons
1278          */ 
1279         vertices : {
1280             withLabel: true,
1281             strokeColor: '#ff0000',
1282             fillColor: '#ff0000',
1283             fixed: true
1284         },
1285         
1286         label: {
1287             offset: [0,0]
1288         }
1289     },
1290 
1291     /* special prescribed angle options */
1292     prescribedangle : {
1293         anglepoint: {
1294             size: 2,
1295             visible: false,
1296             withLabel: false
1297         }
1298     },
1299     
1300     /* special options for riemann sums */
1301     riemannsum: {
1302         withLabel:false,
1303         fillOpacity:0.3,
1304         fillColor:'#ffff00'
1305     },
1306 
1307     /* special sector options */
1308     sector : {
1309         fillColor: '#00FF00',
1310         highlightFillColor: '#00FF00',
1311         fillOpacity: 0.3,
1312         highlightFillOpacity: 0.3,
1313         label: {
1314             offset:[0,0]
1315         }
1316     },
1317 
1318     /* special segment options */
1319     segment: {
1320         label: {
1321             position: 'top'
1322         }
1323     },
1324     
1325     semicircle : {
1326         midpoint: {
1327             visible: false,
1328             withLabel: false,
1329             fixed: false,
1330             name: ''
1331         }
1332     },
1333 
1334     /* special slider options */
1335     slider : {
1336         /**#@+
1337          * @visprop
1338          */
1339 
1340         /**
1341          * The slider only returns multiples of this value, e.g. for discrete values set this property to <tt>1</tt>. For
1342          * continuous results set this to <tt>-1</tt>.
1343          * @memberOf Slider.prototype
1344          * @name snapWidth
1345          * @type Number
1346          */
1347         snapWidth: -1,      // -1 = deactivated
1348 
1349         /**
1350          * The precision of the slider value displayed in the optional text.
1351          * @memberOf Slider.prototype
1352          * @name precision
1353          * @type Number
1354          */
1355         precision: 2,
1356         firstArrow : false,
1357         lastArrow : false,
1358         withTicks: true,
1359         withLabel: true,
1360 
1361         layer: 9,
1362         showInfobox: false,
1363         name : '',
1364         visible: true,
1365         strokeColor : '#000000',
1366         highlightStrokeColor : '#888888',
1367         fillColor : '#ffffff',
1368         highlightFillColor : 'none',
1369         size: 6,
1370 
1371         /**#@-*/
1372             
1373         point1: {
1374             needsRegularUpdate : false,
1375             showInfobox: false,
1376             withLabel: false,
1377             visible: false,
1378             fixed: true,
1379             name: ''
1380         },
1381         point2: {
1382             needsRegularUpdate : false,
1383             showInfobox: false,
1384             withLabel: false,
1385             visible: false,
1386             fixed: true,
1387             name: ''
1388         },
1389         baseline: {
1390             needsRegularUpdate : false,
1391             name : '',
1392             strokeWidth: 1,
1393             strokeColor : '#000000',
1394             highlightStrokeColor : '#888888'
1395         },
1396         /* line ticks options */
1397         ticks : {
1398             needsRegularUpdate : false,
1399             drawLabels : false,
1400             drawZero : true,
1401             insertTicks : true,
1402             minorHeight : 4,          // if <0: full width and height
1403             majorHeight : 10,        // if <0: full width and height
1404             minorTicks : 0,
1405             defaultDistance : 1,
1406             strokeOpacity : 1,
1407             strokeWidth: 1,
1408             strokeColor : '#000000'
1409         }, 
1410         highline: {
1411             strokeWidth: 3,
1412             name : '',
1413             strokeColor : '#000000',
1414             highlightStrokeColor : '#888888'
1415         },
1416         label: {
1417             strokeColor: '#000000'
1418         }
1419     },
1420     
1421     /* special text options */
1422     text : {
1423         /**#@+
1424          * @visprop
1425          */
1426 
1427         fontSize : 12,
1428         digits: 2,
1429         isLabel: false,
1430         strokeColor : '#552222',
1431         useASCIIMathML : false,
1432         useMathJax : false,
1433         display : 'html',                    // 'html' or 'internal'
1434         anchorX: 'left',                     //  'left', 'middle', or 'right': horizontal alignment of the text.
1435         anchorY: 'middle',                     //  'top', 'middle', or 'bottom': vertical alignment of the text.
1436         cssClass : 'JXGtext',
1437         highlightCssClass : 'JXGtext',
1438         withLabel: false,
1439         rotate: 0,                        // works for non-zero values only in combination with display=='internal'
1440 		visible: true
1441 
1442         /**#@-*/
1443     },
1444     
1445     /* special options for trace curves */
1446     tracecurve : {
1447         /**#@+
1448          * @visprop
1449          */
1450         strokeColor: '#000000',
1451         fillColor: 'none',
1452         numberPoints: 100
1453 
1454         /**#@-*/
1455     },
1456 
1457     /*special turtle options */
1458     turtle : {
1459         strokeWidth : 1,
1460 		fillColor: 'none',
1461 		strokeColor: '#000000',
1462 		arrow : {
1463 			strokeWidth: 2,
1464 			withLabel: false,
1465 			strokeColor: '#ff0000'
1466 		}
1467     },
1468 
1469 
1470     /**
1471       * Abbreviations of properties. Setting the shortcut means setting abbreviated properties
1472       * to the same value.
1473       * It is used in JXG.GeometryElement#setProperty and in
1474       * the constructor JXG.GeometryElement.
1475       * Attention: In Options.js abbreviations are not allowed.
1476       */
1477     shortcuts : {
1478         color: ['strokeColor', 'fillColor'],
1479         opacity: ['strokeOpacity', 'fillOpacity'],
1480         highlightColor: ['highlightStrokeColor', 'highlightFillColor'],
1481         highlightOpacity: ['highlightStrokeOpacity', 'highlightFillOpacity'],
1482         strokeWidth: ['strokeWidth', 'highlightStrokeWidth']
1483     }
1484     
1485 };
1486 
1487 /**
1488  * Holds all possible properties and the according validators for geometry elements. A validator is either a function
1489  * which takes one parameter and returns true, if the value is valid for the property, or it is false if no validator
1490  * is required.
1491  */
1492 JXG.Validator = (function () {
1493     var validatePixel = function (v) {
1494             return /^[0-9]+px$/.test(v);
1495         },
1496         validateDisplay = function (v) {
1497             return (v  in {html: 0, internal: 0});
1498         },
1499         validateColor = function (v) {
1500             // for now this should do it...
1501             return JXG.isString(v);
1502         },
1503         validatePointFace = function (v) {
1504             return JXG.exists(JXG.Point.prototype.normalizeFace.call(this, v));
1505         },
1506         validateInteger = function (v) {
1507             return (Math.abs(v - Math.round(v)) < JXG.Math.eps);
1508         },
1509         validatePositiveInteger = function (v) {
1510             return validateInteger(v) && v > 0;
1511         },
1512         validateScreenCoords = function (v) {
1513             return v.length >= 2 && validateInteger(v[0]) && validateInteger(v[1]);
1514         },
1515         validateRenderer = function (v) {
1516             return (v in {vml: 0, svg: 0, canvas: 0});
1517         },
1518         validatePositive = function (v) {
1519             return v > 0;
1520         },
1521         validateNotNegative = function (v) {
1522             return !(v < 0);
1523         },
1524     i, v = {},
1525     validators = {
1526         attractorDistance: validateNotNegative,
1527         color: validateColor,
1528         defaultDistance: JXG.isNumber,
1529         display : validateDisplay,
1530         doAdvancedPlot: false,
1531         draft : false,
1532         drawLabels : false,
1533         drawZero : false,
1534         face : validatePointFace,
1535         factor : JXG.isNumber,
1536         fillColor: validateColor,
1537         fillOpacity : JXG.isNumber,
1538         firstArrow : false,
1539         fontSize : validateInteger,
1540         dash : validateInteger,
1541         gridX : JXG.isNumber,
1542         gridY : JXG.isNumber,
1543         hasGrid : false,
1544         highlightFillColor: validateColor,
1545         highlightFillOpacity: JXG.isNumber,
1546         highlightStrokeColor: validateColor,
1547         highlightStrokeOpacity: JXG.isNumber,
1548         insertTicks : false,
1549         //: validateScreenCoords,
1550         lastArrow : false,
1551         majorHeight : validateInteger,
1552         maxTicksDistance : validatePositiveInteger,
1553         minorHeight : validateInteger,
1554         minorTicks : validatePositiveInteger,
1555         minTicksDistance : validatePositiveInteger,
1556         numberPointsHigh : validatePositiveInteger,
1557         numberPointsLow : validatePositiveInteger,
1558         opacity : JXG.isNumber,
1559         radius : JXG.isNumber,
1560         RDPsmoothing : false,
1561         renderer: validateRenderer,
1562         right: validatePixel,
1563         showCopyright : false,
1564         showInfobox: false,
1565         showNavigation : false,
1566         size : validateInteger,
1567         snapSizeX : validatePositive,
1568         snapSizeY : validatePositive,
1569         snapWidth : JXG.isNumber,
1570         snapToGrid : false,
1571         snatchDistance: validateNotNegative,
1572         straightFirst : false,
1573         straightLast : false,
1574         stretch: false,
1575         strokeColor : validateColor,
1576         strokeOpacity: JXG.isNumber,
1577         strokeWidth : validateInteger,
1578         takeFirst : false,
1579         takeSizeFromFile : false,
1580         to10: false,
1581         toOrigin: false,
1582         translateTo10: false,
1583         translateToOrigin: false,
1584         useASCIIMathML : false,
1585         useDirection: false,
1586         useMathJax : false,
1587         withLabel: false,
1588         withTicks: false,
1589         zoom: false
1590     };
1591 
1592     // this seems like a redundant step but it makes sure that
1593     // all properties in the validator object have lower case names
1594     // and the validator object is easier to read.
1595     for (i in validators) {
1596         v[i.toLowerCase()] = validators[i];
1597     }
1598 
1599     return v;
1600 })();
1601 
1602 
1603 /**
1604  * Apply the options stored in this object to all objects on the given board.
1605  * @param {JXG.Board} board The board to which objects the options will be applied.
1606  */
1607 JXG.useStandardOptions = function(board) {
1608     var o = JXG.Options,
1609         boardHadGrid = board.hasGrid,
1610         el, t, p, copyProps;
1611 
1612     board.options.grid.hasGrid = o.grid.hasGrid;
1613     board.options.grid.gridX = o.grid.gridX;
1614     board.options.grid.gridY = o.grid.gridY;
1615     board.options.grid.gridColor = o.grid.gridColor;
1616     board.options.grid.gridOpacity = o.grid.gridOpacity;
1617     board.options.grid.gridDash = o.grid.gridDash;
1618     board.options.grid.snapToGrid = o.grid.snapToGrid;
1619     board.options.grid.snapSizeX = o.grid.SnapSizeX;
1620     board.options.grid.snapSizeY = o.grid.SnapSizeY;
1621     board.takeSizeFromFile = o.takeSizeFromFile;
1622 
1623     copyProps = function(p, o) {
1624             p.visProp.fillcolor = o.fillColor;
1625             p.visProp.highlightfillcolor = o.highlightFillColor;
1626             p.visProp.strokecolor = o.strokeColor;
1627             p.visProp.highlightstrokecolor = o.highlightStrokeColor;
1628     };
1629     
1630     for(el in board.objects) {
1631         p = board.objects[el];
1632         if(p.elementClass == JXG.OBJECT_CLASS_POINT) {
1633             copyProps(p, o.point);
1634         }
1635         else if(p.elementClass == JXG.OBJECT_CLASS_LINE) {
1636             copyProps(p, o.line);
1637             for(t in p.ticks) {
1638                 t.majorTicks = o.line.ticks.majorTicks;
1639                 t.minTicksDistance = o.line.ticks.minTicksDistance;
1640                 t.visProp.minorheight = o.line.ticks.minorHeight;
1641                 t.visProp.majorheight = o.line.ticks.majorHeight;
1642             }
1643         }
1644         else if(p.elementClass == JXG.OBJECT_CLASS_CIRCLE) {
1645             copyProps(p, o.circle);
1646         }
1647         else if(p.type == JXG.OBJECT_TYPE_ANGLE) {
1648             copyProps(p, o.angle);
1649         }
1650         else if(p.type == JXG.OBJECT_TYPE_ARC) {
1651             copyProps(p, o.arc);
1652         }
1653         else if(p.type == JXG.OBJECT_TYPE_POLYGON) {
1654             copyProps(p, o.polygon);
1655         }
1656         else if(p.type == JXG.OBJECT_TYPE_CONIC) {
1657             copyProps(p, o.conic);
1658         }
1659         else if(p.type == JXG.OBJECT_TYPE_CURVE) {
1660             copyProps(p, o.curve);
1661         }
1662         else if(p.type == JXG.OBJECT_TYPE_SECTOR) {
1663             p.arc.visProp.fillcolor = o.sector.fillColor;
1664             p.arc.visProp.highlightfillcolor = o.sector.highlightFillColor;
1665             p.arc.visProp.fillopacity = o.sector.fillOpacity;
1666             p.arc.visProp.highlightfillopacity = o.sector.highlightFillOpacity;
1667         }
1668     }
1669 
1670     board.fullUpdate();
1671     if(boardHadGrid && !board.hasGrid) {
1672         board.removeGrids(board);
1673     } else if(!boardHadGrid && board.hasGrid) {
1674         board.create('grid', []);
1675     }
1676 };
1677 
1678 /**
1679  * Converts all color values to greyscale and calls useStandardOption to put them onto the board.
1680  * @param {JXG.Board} board The board to which objects the options will be applied.
1681  * @see #useStandardOptions
1682  */
1683 JXG.useBlackWhiteOptions = function(board) {
1684     var o = JXG.Options;
1685     o.point.fillColor = JXG.rgb2bw(o.point.fillColor);
1686     o.point.highlightFillColor = JXG.rgb2bw(o.point.highlightFillColor);
1687     o.point.strokeColor = JXG.rgb2bw(o.point.strokeColor);
1688     o.point.highlightStrokeColor = JXG.rgb2bw(o.point.highlightStrokeColor);
1689 
1690     o.line.fillColor = JXG.rgb2bw(o.line.fillColor);
1691     o.line.highlightFillColor = JXG.rgb2bw(o.line.highlightFillColor);
1692     o.line.strokeColor = JXG.rgb2bw(o.line.strokeColor);
1693     o.line.highlightStrokeColor = JXG.rgb2bw(o.line.highlightStrokeColor);
1694 
1695     o.circle.fillColor = JXG.rgb2bw(o.circle.fillColor);
1696     o.circle.highlightFillColor = JXG.rgb2bw(o.circle.highlightFillColor);
1697     o.circle.strokeColor = JXG.rgb2bw(o.circle.strokeColor);
1698     o.circle.highlightStrokeColor = JXG.rgb2bw(o.circle.highlightStrokeColor);
1699 
1700     o.arc.fillColor = JXG.rgb2bw(o.arc.fillColor);
1701     o.arc.highlightFillColor = JXG.rgb2bw(o.arc.highlightFillColor);
1702     o.arc.strokeColor = JXG.rgb2bw(o.arc.strokeColor);
1703     o.arc.highlightStrokeColor = JXG.rgb2bw(o.arc.highlightStrokeColor);
1704 
1705     o.polygon.fillColor = JXG.rgb2bw(o.polygon.fillColor);
1706     o.polygon.highlightFillColor  = JXG.rgb2bw(o.polygon.highlightFillColor);
1707 
1708     o.sector.fillColor = JXG.rgb2bw(o.sector.fillColor);
1709     o.sector.highlightFillColor  = JXG.rgb2bw(o.sector.highlightFillColor);
1710 
1711     o.curve.strokeColor = JXG.rgb2bw(o.curve.strokeColor);
1712     o.grid.gridColor = JXG.rgb2bw(o.grid.gridColor);
1713 
1714     JXG.useStandardOptions(board);
1715 };
1716