1 /*global JXG:true, define: true*/ 2 3 import JXG from "./jxg.js"; 4 import Options from "./options.js"; 5 6 JXG.extend(Options, { 7 // infobox: { 8 // strokeColor: 'black' 9 // }, 10 11 axes3d: { 12 /**#@+ 13 * @visprop 14 */ 15 16 /** 17 * Position of the main axes in a View3D element. Possible values are 18 * 'center' and 'border'. 19 * 20 * @type String 21 * @name View3D#axesPosition 22 * @default 'center' 23 */ 24 axesPosition: "center", // Possible values: 'center', otherwise: border 25 26 // Main axes 27 28 /** 29 * Attributes of the 3D x-axis. 30 * 31 * @type Line3D 32 * @name View3D#xAxis 33 */ 34 xAxis: { visible: true, point2: { name: "x" }, strokeColor: JXG.palette.red }, 35 36 /** 37 * Attributes of the 3D y-axis. 38 * 39 * @type Line3D 40 * @name View3D#yAxis 41 */ 42 yAxis: { visible: true, point2: { name: "y" }, strokeColor: JXG.palette.green }, 43 44 /** 45 * Attributes of the 3D z-axis. 46 * 47 * @type Line3D 48 * @name View3D#zAxis 49 */ 50 zAxis: { visible: true, point2: { name: "z" }, strokeColor: JXG.palette.blue }, 51 52 // Planes 53 /** 54 * Attributes of the 3D plane orthogonal to the x-axis at the "rear" of the cube. 55 * @type Plane3D 56 * @name View3D#xPlaneRear 57 */ 58 xPlaneRear: { visible: true, layer: 0, mesh3d: { layer: 1 } }, 59 /** 60 * Attributes of the 3D plane orthogonal to the y-axis at the "rear" of the cube. 61 * @type Plane3D 62 * @name View3D#yPlaneRear 63 */ 64 yPlaneRear: { visible: true, layer: 0, mesh3d: { layer: 1 } }, 65 /** 66 * Attributes of the 3D plane orthogonal to the z-axis at the "rear" of the cube. 67 * @type Plane3D 68 * @name View3D#zPlaneRear 69 */ 70 zPlaneRear: { visible: true, layer: 0, mesh3d: { layer: 1 } }, 71 72 /** 73 * Attributes of the 3D plane orthogonal to the x-axis at the "front" of the cube. 74 * @type Plane3D 75 * @name View3D#xPlaneFront 76 */ 77 xPlaneFront: { visible: false, layer: 0, mesh3d: { layer: 1 } }, 78 /** 79 * Attributes of the 3D plane orthogonal to the y-axis at the "front" of the cube. 80 * @type Plane3D 81 * @name View3D#yPlaneFront 82 */ 83 yPlaneFront: { visible: false, layer: 0, mesh3d: { layer: 1 } }, 84 /** 85 * Attributes of the 3D plane orthogonal to the z-axis at the "front" of the cube. 86 * @type Plane3D 87 * @name View3D#zPlaneFront 88 */ 89 zPlaneFront: { visible: false, layer: 0, mesh3d: { layer: 1 } }, 90 91 // Axes on the planes 92 /** 93 * Attributes of the 3D y-axis on the 3D plane orthogonal to the x-axis at the "rear" of the cube. 94 * @type Plane3D 95 * @name View3D#xPlaneRearYAxis 96 */ 97 xPlaneRearYAxis: { 98 visible: "inherit", 99 strokeColor: "#888888", 100 strokeWidth: 1 101 }, 102 /** 103 * Attributes of the 3D z-axis on the 3D plane orthogonal to the x-axis at the "rear" of the cube. 104 * @type Plane3D 105 * @name View3D#xPlaneRearZAxis 106 */ 107 xPlaneRearZAxis: { 108 visible: "inherit", 109 strokeColor: "#888888", 110 strokeWidth: 1 111 }, 112 /** 113 * Attributes of the 3D y-axis on the 3D plane orthogonal to the x-axis at the "front" of the cube. 114 * @type Plane3D 115 * @name View3D#xPlaneFrontYAxis 116 */ 117 xPlaneFrontYAxis: { 118 visible: "inherit", 119 strokeColor: "#888888", 120 strokeWidth: 1 121 }, 122 /** 123 * Attributes of the 3D z-axis on the 3D plane orthogonal to the x-axis at the "front" of the cube. 124 * @type Plane3D 125 * @name View3D#xPlaneFrontZAxis 126 */ 127 xPlaneFrontZAxis: { 128 visible: "inherit", 129 strokeColor: "#888888", 130 strokeWidth: 1 131 }, 132 133 /** 134 * Attributes of the 3D x-axis on the 3D plane orthogonal to the y-axis at the "rear" of the cube. 135 * @type Plane3D 136 * @name View3D#yPlaneRearXAxis 137 */ 138 yPlaneRearXAxis: { 139 visible: "inherit", 140 strokeColor: "#888888", 141 strokeWidth: 1 142 }, 143 /** 144 * Attributes of the 3D z-axis on the 3D plane orthogonal to the y-axis at the "rear" of the cube. 145 * @type Plane3D 146 * @name View3D#yPlaneRearZAxis 147 */ 148 yPlaneRearZAxis: { 149 visible: "inherit", 150 strokeColor: "#888888", 151 strokeWidth: 1 152 }, 153 /** 154 * Attributes of the 3D x-axis on the 3D plane orthogonal to the y-axis at the "front" of the cube. 155 * @type Plane3D 156 * @name View3D#yPlaneFrontXAxis 157 */ 158 yPlaneFrontXAxis: { 159 visible: "inherit", 160 strokeColor: "#888888", 161 strokeWidth: 1 162 }, 163 /** 164 * Attributes of the 3D z-axis on the 3D plane orthogonal to the y-axis at the "front" of the cube. 165 * @type Plane3D 166 * @name View3D#yPlaneFrontZAxis 167 */ 168 yPlaneFrontZAxis: { 169 visible: "inherit", 170 strokeColor: "#888888", 171 strokeWidth: 1 172 }, 173 174 /** 175 * Attributes of the 3D x-axis on the 3D plane orthogonal to the z-axis at the "rear" of the cube. 176 * @type Plane3D 177 * @name View3D#zPlaneRearXAxis 178 */ 179 zPlaneRearXAxis: { 180 visible: "inherit", 181 strokeColor: "#888888", 182 strokeWidth: 1 183 }, 184 /** 185 * Attributes of the 3D y-axis on the 3D plane orthogonal to the z-axis at the "rear" of the cube. 186 * @type Plane3D 187 * @name View3D#zPlaneRearYAxis 188 */ 189 zPlaneRearYAxis: { 190 visible: "inherit", 191 strokeColor: "#888888", 192 strokeWidth: 1 193 }, 194 /** 195 * Attributes of the 3D x-axis on the 3D plane orthogonal to the z-axis at the "front" of the cube. 196 * @type Plane3D 197 * @name View3D#zPlaneFrontXAxis 198 */ 199 zPlaneFrontXAxis: { 200 visible: "inherit", 201 strokeColor: "#888888", 202 strokeWidth: 1 203 }, 204 /** 205 * Attributes of the 3D y-axis on the 3D plane orthogonal to the z-axis at the "front" of the cube. 206 * @type Plane3D 207 * @name View3D#zPlaneFrontYAxis 208 */ 209 zPlaneFrontYAxis: { 210 visible: "inherit", 211 strokeColor: "#888888", 212 strokeWidth: 1 213 } 214 215 /**#@-*/ 216 }, 217 218 axis3d: { 219 highlight: false, 220 fixed: true, 221 strokecolor: "black", 222 strokeWidth: 1, 223 tabindex: null, 224 225 point1: { visible: false, name: "" }, 226 point2: { visible: false, name: "", label: { visible: true } } 227 }, 228 229 curve3d: { 230 /**#@+ 231 * @visprop 232 */ 233 234 highlight: false, 235 tabindex: -1, 236 strokeWidth: 1, 237 numberPointsHigh: 200 238 239 /**#@-*/ 240 }, 241 242 intersectionline3d: { 243 point1: { visible: false, name: "" }, // Used in point/point 244 point2: { visible: false, name: "" } 245 }, 246 247 line3d: { 248 strokeWidth: 1, 249 strokeColor: "black", 250 fixed: true, 251 tabindex: null, 252 gradient: "linear", 253 gradientSecondColor: "#ffffff", 254 255 point: { visible: false, name: "" }, // Used in cases of point/direction/range 256 point1: { visible: false, name: "" }, // Used in point/point 257 point2: { visible: false, name: "" } 258 }, 259 260 mesh3d: { 261 /**#@+ 262 * @visprop 263 */ 264 265 strokeWidth: 1, 266 strokeColor: "#9a9a9a", 267 strokeOpacity: 0.6, 268 highlight: false, 269 fillColor: "#9a9a9a", 270 fillOpacity: 0.1, 271 tabindex: null, 272 273 visible: "inherit" 274 /**#@-*/ 275 }, 276 277 plane3d: { 278 strokeWidth: 0, 279 strokeColor: "black", 280 strokeOpacity: 1, 281 highlight: false, 282 tabindex: null, 283 284 gradient: "linear", 285 gradientSecondColor: "#ffffff", 286 gradientAngle: Math.PI, 287 fillColor: "#a7a7a7", 288 fillOpacity: 0.6, 289 290 point: { visible: false, name: "", fixed: true } 291 }, 292 293 point3d: { 294 infoboxDigits: "auto", 295 strokeWidth: 0, 296 gradient: "radial", 297 gradientSecondColor: "#555555", 298 fillColor: "yellow", 299 highlightStrokeColor: "#555555" 300 }, 301 302 polygon3d: { 303 /**#@+ 304 * @visprop 305 */ 306 307 highlight: false, 308 tabindex: -1, 309 strokeWidth: 1, 310 fillColor: 'none' 311 312 /**#@-*/ 313 }, 314 315 sphere3d: { 316 /**#@+ 317 * @visprop 318 */ 319 320 highlight: false, 321 322 strokeWidth: 1, 323 strokeColor: '#00ff80', 324 fillColor: 'white', 325 gradient: 'radial', 326 gradientSecondColor: '#00ff80', 327 gradientFX: 0.7, 328 gradientFY: 0.3, 329 fillOpacity: 0.4 330 331 /**#@-*/ 332 }, 333 334 surface3d: { 335 /**#@+ 336 * @visprop 337 */ 338 339 highlight: false, 340 tabindex: -1, 341 strokeWidth: 1, 342 343 /** 344 * Number of intervals the mesh is divided into in direction of parameter u. 345 * @type Number 346 * @name ParametricSurface3D#stepsU 347 */ 348 stepsU: 30, 349 350 /** 351 * Number of intervals the mesh is divided into in direction of parameter v. 352 * @type Number 353 * @name ParametricSurface3D#stepsV 354 */ 355 stepsV: 30 356 357 /**#@-*/ 358 }, 359 360 vectorfield3d: { 361 /**#@+ 362 * @visprop 363 */ 364 365 /** 366 * Scaling factor of the vectors. This in contrast to slope fields, where this attribute sets the vector to the given length. 367 * @name scale 368 * @memberOf Vectorfield3D.prototype 369 * @type {Number|Function} 370 * @see Slopefield.scale 371 * @default 1 372 */ 373 scale: 1, 374 375 /** 376 * Customize arrow heads of vectors. Be careful! If enabled this will slow down the performance. 377 * Fields are: 378 * <ul> 379 * <li> enabled: Boolean 380 * <li> size: length of the arrow head legs (in pixel) 381 * <li> angle: angle of the arrow head legs In radians. 382 * </ul> 383 * @name arrowhead 384 * @memberOf Vectorfield3D.prototype 385 * @type {Object} 386 * @default <tt>{enabled: true, size: 5, angle: Math.PI * 0.125}</tt> 387 */ 388 arrowhead: { 389 enabled: true, 390 size: 5, 391 angle: Math.PI * 0.125 392 } 393 394 /**#@-*/ 395 }, 396 397 view3d: { 398 /**#@+ 399 * @visprop 400 */ 401 402 needsRegularUpdate: true, 403 404 /** 405 * Choose the projection type to be used: `parallel` or `central`. 406 * <ul> 407 * <li> `parallel` is parallel projection, also called orthographic projection 408 * <li> `central` is central projection, also called perspective projection 409 * </ul> 410 * 411 * 412 * @name View3D#projection 413 * @type String 414 * @default 'parallel' 415 */ 416 projection: 'parallel', 417 418 /** 419 * Allow vertical dragging of objects, i.e. in direction of the z-axis. 420 * Subobjects are 421 * <ul> 422 * <li>enabled: true 423 * <li>key: 'shift' 424 * </ul> 425 * <p> 426 * Possible values for attribute <i>key</i>: 'shift' or 'ctrl'. 427 * 428 * @name View3D#verticalDrag 429 * @type Object 430 * @default <tt>{enabled: true, key: 'shift'}</tt> 431 */ 432 verticalDrag: { 433 enabled: true, 434 key: 'shift' 435 }, 436 437 /** 438 * Specify the user handling of the azimuth. 439 * <ul> 440 * <li><tt>pointer</tt> sub-attributes: 441 * <ul> 442 * <li><tt>enabled</tt>: Boolean that specifies whether pointer navigation is allowed by azimuth. 443 * <li><tt>speed</tt>: Number indicating how many passes the range of the az_slider makes when the cursor crosses the entire board once in the horizontal direction. 444 * <li><tt>outside</tt>: Boolean that specifies whether the pointer navigation is continued when the cursor leaves the board. 445 * <li><tt>button</tt>: Which button of the pointer should be used? (<tt>'-1'</tt> (=no button), <tt>'0'</tt> or <tt>'2'</tt>) 446 * <li><tt>key</tt>: Should an additional key be pressed? (<tt>'none'</tt>, <tt>'shift'</tt> or <tt>'ctrl'</tt>) 447 * </ul> 448 * <li><tt>keyboard</tt> sub-attributes: 449 * <ul> 450 * <li><tt>enabled</tt>: Boolean that specifies whether the keyboard (arrow keys) can be used to navigate the board. 451 * <li><tt>step</tt>: Size of the step per keystroke. 452 * <li><tt>key</tt>: Should an additional key be pressed? (<tt>'none'</tt>, <tt>'shift'</tt> or <tt>'ctrl'</tt>) 453 * </ul> 454 * <li><tt>continuous</tt>: Boolean that specifies whether the az_slider starts again from the beginning when its end is reached. 455 * <li><tt>slider</tt> attributes of the az_slider ({@link Slider}) with additional 456 * <ul> 457 * <li><tt>min</tt>: Minimum value. 458 * <li><tt>max</tt>: Maximum value. 459 * <li><tt>start</tt>: Start value. 460 * </ul> 461 * </ul> 462 * 463 * @name View3D#az 464 * @type Object 465 * @default <pre>{ 466 * pointer: {enabled: true, speed: 1, outside: true, button: -1, key: 'none'}, 467 * keyboard: {enabled: true, step: 10, key: 'ctrl'}, 468 * continuous: true, 469 * slider: { 470 * visible: true, 471 * style: 6, 472 * point1: {frozen: true}, 473 * point2: {frozen: true}, 474 * min: 0, 475 * max: 2 * Math.PI, 476 * start: 1.0 477 * }, 478 * }</pre> 479 */ 480 az: { 481 pointer: { 482 enabled: true, 483 speed: 1, 484 outside: true, 485 button: -1, 486 key: 'none' 487 }, 488 keyboard: { 489 enabled: true, 490 step: 10, 491 key: 'ctrl' 492 }, 493 continuous: true, 494 slider: { 495 visible: 'inherit', 496 style: 6, 497 point1: { frozen: true }, 498 point2: { frozen: true }, 499 min: 0, 500 max: 2 * Math.PI, 501 start: 1.0 502 } 503 }, 504 505 /** 506 * Specify the user handling of the elevation. 507 * <ul> 508 * <li><tt>pointer</tt> sub-attributes: 509 * <ul> 510 * <li><tt>enabled</tt>: Boolean that specifies whether pointer navigation is allowed by elevation. 511 * <li><tt>speed</tt>: Number indicating how many passes the range of the el_slider makes when the cursor crosses the entire board once in the horizontal direction. 512 * <li><tt>outside</tt>: Boolean that specifies whether the pointer navigation is continued when the cursor leaves the board. 513 * <li><tt>button</tt>: Which button of the pointer should be used? (<tt>'-1'</tt> (=no button), <tt>'0'</tt> or <tt>'2'</tt>) 514 * <li><tt>key</tt>: Should an additional key be pressed? (<tt>'none'</tt>, <tt>'shift'</tt> or <tt>'ctrl'</tt>) 515 * </ul> 516 * <li><tt>keyboard</tt> sub-attributes: 517 * <ul> 518 * <li><tt>enabled</tt>: Boolean that specifies whether the keyboard (arrow keys) can be used to navigate the board. 519 * <li><tt>step</tt>: Size of the step per keystroke. 520 * <li><tt>key</tt>: Should an additional key be pressed? (<tt>'none'</tt>, <tt>'shift'</tt> or <tt>'ctrl'</tt>) 521 * </ul> 522 * <li><tt>continuous</tt>: Boolean that specifies whether the el_slider starts again from the beginning when its end is reached. 523 * <li><tt>slider</tt> attributes of the el_slider ({@link Slider}) with additional 524 * <ul> 525 * <li><tt>min</tt>: Minimum value. 526 * <li><tt>max</tt>: Maximum value. 527 * <li><tt>start</tt>: Start value. 528 * </ul> 529 * </ul> 530 * 531 * @name View3D#el 532 * @type Object 533 * @default <pre>{ 534 * pointer: {enabled: true, speed: 1, outside: true, button: -1, key: 'none'}, 535 * keyboard: {enabled: true, step: 10, key: 'ctrl'}, 536 * continuous: true, 537 * slider: { 538 * visible: true, 539 * style: 6, 540 * point1: {frozen: true}, 541 * point2: {frozen: true}, 542 * min: 0, 543 * max: 2 * Math.PI, 544 * start: 0.3 545 * }, 546 * }<pre> 547 */ 548 el: { 549 pointer: { 550 enabled: true, 551 speed: 1, 552 outside: true, 553 button: -1, 554 key: 'none' 555 }, 556 keyboard: { 557 enabled: true, 558 step: 10, 559 key: 'ctrl' 560 }, 561 continuous: true, 562 slider: { 563 visible: 'inherit', 564 style: 6, 565 point1: { frozen: true }, 566 point2: { frozen: true }, 567 min: 0, 568 max: 2 * Math.PI, 569 start: 0.3 570 } 571 }, 572 573 /** 574 * Specify the user handling of the bank angle. 575 * <ul> 576 * <li><tt>pointer</tt> sub-attributes: 577 * <ul> 578 * <li><tt>enabled</tt>: Boolean that specifies whether pointer navigation is allowed by elevation. 579 * <li><tt>speed</tt>: Number indicating how many passes the range of the el_slider makes when the cursor crosses the entire board once in the horizontal direction. 580 * <li><tt>outside</tt>: Boolean that specifies whether the pointer navigation is continued when the cursor leaves the board. 581 * <li><tt>button</tt>: Which button of the pointer should be used? (<tt>'-1'</tt> (=no button), <tt>'0'</tt> or <tt>'2'</tt>) 582 * <li><tt>key</tt>: Should an additional key be pressed? (<tt>'none'</tt>, <tt>'shift'</tt> or <tt>'ctrl'</tt>) 583 * </ul> 584 * <li><tt>keyboard</tt> sub-attributes: 585 * <ul> 586 * <li><tt>enabled</tt>: Boolean that specifies whether the keyboard (arrow keys) can be used to navigate the board. 587 * <li><tt>step</tt>: Size of the step per keystroke. 588 * <li><tt>key</tt>: Should an additional key be pressed? (<tt>'none'</tt>, <tt>'shift'</tt> or <tt>'ctrl'</tt>) 589 * </ul> 590 * <li><tt>continuous</tt>: Boolean that specifies whether the el_slider starts again from the beginning when its end is reached. 591 * <li><tt>slider</tt> attributes of the el_slider ({@link Slider}) with additional 592 * <ul> 593 * <li><tt>min</tt>: Minimum value. 594 * <li><tt>max</tt>: Maximum value. 595 * <li><tt>start</tt>: Start value. 596 * </ul> 597 * </ul> 598 * 599 * @name View3D#bank 600 * @type Object 601 * @default <pre>{ 602 * pointer: {enabled: true, speed: 1, outside: true, button: -1, key: 'none'}, 603 * keyboard: {enabled: true, step: 10, key: 'ctrl'}, 604 * continuous: true, 605 * slider: { 606 * visible: true, 607 * style: 6, 608 * point1: {frozen: true}, 609 * point2: {frozen: true}, 610 * min: 0, 611 * max: 2 * Math.PI, 612 * start: 0.3 613 * }, 614 * }<pre> 615 */ 616 bank: { 617 pointer: { 618 enabled: true, 619 speed: 0.08, 620 outside: true, 621 button: -1, 622 key: 'none' 623 }, 624 keyboard: { 625 enabled: true, 626 step: 10, 627 key: 'ctrl' 628 }, 629 continuous: true, 630 slider: { 631 visible: 'inherit', 632 style: 6, 633 point1: { frozen: true }, 634 point2: { frozen: true }, 635 min: -Math.PI, 636 max: Math.PI, 637 start: 0.0 638 } 639 }, 640 641 trackball: { 642 enabled: false, 643 outside: true, 644 button: -1, 645 key: 'none' 646 }, 647 648 /** 649 * Distance of the camera to the center of the view. 650 * If set to 'auto', r will be calculated automatically. 651 * 652 * @type {Number|String} 653 * @default 'auto' 654 */ 655 r: 'auto', 656 657 /** 658 * Field of View defines the angle of view (in radians) of the camera, determining how much of the scene is captured within the frame. 659 * 660 * @type Number 661 * @default 2/5*Math.PI 662 */ 663 fov: 1 / 5 * 2 * Math.PI, 664 665 /** 666 * When this option is enabled, points closer to the screen are drawn 667 * over points further from the screen within each layer. 668 * 669 * @name View3D#depthOrderPoints 670 * @default false 671 */ 672 depthOrderPoints: false, 673 674 /** 675 * Fixed values for the view, which can be changed using keyboard keys `picture-up` and `picture-down`. 676 * Array of the form: [[el0, az0, r0], [el1, az1, r1, ...[eln, azn, rn]] 677 * 678 * @name View3D#values 679 * @type Array 680 * @default <tt>{[[0, 1.57], [0.78, 0.62], [0, 0], [5.49, 0.62], [4.71, 0], [3.93, 0.62], [3.14, 0], [2.36, 0.62], [1.57, 1.57]]}<tt> 681 */ 682 values: [ 683 [0, 1.57], 684 [0.78, 0.62], 685 [0, 0], 686 [5.49, 0.62], 687 [4.71, 0], 688 [3.93, 0.62], 689 [3.14, 0], 690 [2.36, 0.62], 691 [1.57, 1.57] 692 ], 693 694 /** 695 * @class 696 * @ignore 697 */ 698 _currentView: -1 699 700 /**#@-*/ 701 } 702 }); 703 704 export default JXG.Options; 705