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