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