jsxgraph 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +1 -1
  2. package/distrib/README.md +1 -1
  3. package/distrib/geogebra.min.js +3 -3
  4. package/distrib/geonext.min.js +3 -3
  5. package/distrib/index.d.ts +650 -447
  6. package/distrib/intergeo.min.js +3 -3
  7. package/distrib/jsxgraph.css +4 -13
  8. package/distrib/jsxgraphcore.js +9 -25
  9. package/distrib/jsxgraphsrc.js +2544 -2060
  10. package/distrib/sketch.min.js +3 -3
  11. package/package.json +3 -2
  12. package/src/base/board.js +99 -59
  13. package/src/base/chart.js +1 -1
  14. package/src/base/circle.js +1 -1
  15. package/src/base/composition.js +1 -1
  16. package/src/base/constants.js +14 -14
  17. package/src/base/coords.js +3 -3
  18. package/src/base/coordselement.js +4 -4
  19. package/src/base/curve.js +1 -1
  20. package/src/base/element.js +13 -14
  21. package/src/base/foreignobject.js +5 -1
  22. package/src/base/group.js +1 -1
  23. package/src/base/image.js +1 -1
  24. package/src/base/line.js +1 -1
  25. package/src/base/point.js +7 -18
  26. package/src/base/polygon.js +1 -1
  27. package/src/base/text.js +8 -7
  28. package/src/base/ticks.js +9 -2
  29. package/src/base/transformation.js +1 -1
  30. package/src/base/turtle.js +1 -1
  31. package/src/element/arc.js +1 -1
  32. package/src/element/button.js +1 -1
  33. package/src/element/checkbox.js +1 -1
  34. package/src/element/comb.js +1 -1
  35. package/src/element/composition.js +1 -1
  36. package/src/element/conic.js +3 -3
  37. package/src/element/input.js +1 -1
  38. package/src/element/locus.js +1 -1
  39. package/src/element/measure.js +9 -4
  40. package/src/element/sector.js +5 -5
  41. package/src/element/slider.js +17 -12
  42. package/src/element/slopetriangle.js +1 -1
  43. package/src/jsxgraph.js +9 -3
  44. package/src/jxg.js +3 -3
  45. package/src/loadjsxgraph.js +1 -1
  46. package/src/math/bst.js +1 -1
  47. package/src/math/clip.js +550 -345
  48. package/src/math/complex.js +1 -1
  49. package/src/math/extrapolate.js +1 -1
  50. package/src/math/geometry.js +5 -5
  51. package/src/math/ia.js +69 -69
  52. package/src/math/math.js +1 -1
  53. package/src/math/metapost.js +1 -1
  54. package/src/math/nlp.js +4 -4
  55. package/src/math/numerics.js +2 -1
  56. package/src/math/plot.js +4 -4
  57. package/src/math/poly.js +1 -1
  58. package/src/math/probfuncs.js +2 -1
  59. package/src/math/qdt.js +11 -11
  60. package/src/math/statistics.js +10 -10
  61. package/src/math/symbolic.js +1 -1
  62. package/src/options.js +72 -31
  63. package/src/parser/ca.js +1297 -1291
  64. package/src/parser/datasource.js +1 -1
  65. package/src/parser/geonext.js +6 -6
  66. package/src/parser/jessiecode.js +266 -73
  67. package/src/parser/jessiescript.js +1 -1
  68. package/src/reader/cinderella.js +1 -1
  69. package/src/reader/file.js +1 -1
  70. package/src/reader/geogebra.js +1 -1
  71. package/src/reader/geonext.js +1 -1
  72. package/src/reader/graph.js +1 -1
  73. package/src/reader/intergeo.js +1 -1
  74. package/src/reader/sketch.js +1 -1
  75. package/src/renderer/abstract.js +4 -1
  76. package/src/renderer/canvas.js +9 -5
  77. package/src/renderer/no.js +2 -1
  78. package/src/renderer/svg.js +10 -13
  79. package/src/renderer/vml.js +1 -1
  80. package/src/server/server.js +1 -1
  81. package/src/utils/base64.js +2 -2
  82. package/src/utils/color.js +7 -7
  83. package/src/utils/dump.js +20 -5
  84. package/src/utils/env.js +13 -54
  85. package/src/utils/event.js +1 -1
  86. package/src/utils/expect.js +1 -1
  87. package/src/utils/type.js +10 -8
  88. package/src/utils/xml.js +1 -1
  89. package/src/utils/zip.js +1 -1
  90. package/CHANGELOG.md +0 -1366
package/src/math/qdt.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -10,20 +10,20 @@
10
10
  This file is part of JSXGraph.
11
11
 
12
12
  JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
13
-
13
+
14
14
  You can redistribute it and/or modify it under the terms of the
15
-
15
+
16
16
  * GNU Lesser General Public License as published by
17
17
  the Free Software Foundation, either version 3 of the License, or
18
18
  (at your option) any later version
19
19
  OR
20
20
  * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
21
-
21
+
22
22
  JSXGraph is distributed in the hope that it will be useful,
23
23
  but WITHOUT ANY WARRANTY; without even the implied warranty of
24
24
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
25
  GNU Lesser General Public License for more details.
26
-
26
+
27
27
  You should have received a copy of the GNU Lesser General Public License and
28
28
  the MIT License along with JSXGraph. If not, see <http://www.gnu.org/licenses/>
29
29
  and <http://opensource.org/licenses/MIT/>.
@@ -44,7 +44,7 @@ define(['math/math', 'utils/type'], function (Mat, Type) {
44
44
 
45
45
  /**
46
46
  * Instantiate a new quad tree.
47
- *
47
+ *
48
48
  * @name JXG.Math.Quadtree
49
49
  * @exports Mat.Quadtree as JXG.Math.Quadtree
50
50
  * @param {Array} bbox Bounding box of the new quad (sub)tree.
@@ -90,7 +90,7 @@ define(['math/math', 'utils/type'], function (Mat, Type) {
90
90
  * @type JXG.Math.Quadtree
91
91
  */
92
92
  this.southEast = null;
93
-
93
+
94
94
  /**
95
95
  * In a subdivided quad tree this represents the bottom left subtree.
96
96
  * @name JXG.Math.Quadtree#southWest
@@ -155,10 +155,10 @@ define(['math/math', 'utils/type'], function (Mat, Type) {
155
155
  mx = this.xlb + (this.xub - this.xlb) / 2,
156
156
  my = this.ylb + (this.yub - this.ylb) / 2;
157
157
 
158
- this.northWest = new Quadtree([this.xlb, this.yub, mx, my]);
159
- this.northEast = new Quadtree([mx, this.yub, this.xub, my]);
160
- this.southEast = new Quadtree([this.xlb, my, mx, this.ylb]);
161
- this.southWest = new Quadtree([mx, my, this.xub, this.ylb]);
158
+ this.northWest = new Mat.Quadtree([this.xlb, this.yub, mx, my]);
159
+ this.northEast = new Mat.Quadtree([mx, this.yub, this.xub, my]);
160
+ this.southEast = new Mat.Quadtree([this.xlb, my, mx, this.ylb]);
161
+ this.southWest = new Mat.Quadtree([mx, my, this.xub, this.ylb]);
162
162
 
163
163
  for (i = 0; i < l; i += 1) {
164
164
  this.northWest.insert(this.points[i]);
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -131,10 +131,10 @@ define(['jxg', 'math/math', 'utils/type'], function (JXG, Mat, Type) {
131
131
  },
132
132
 
133
133
  /**
134
- * The P-th percentile ( 0 < P ≤ 100 ) of a list of N ordered values (sorted from least to greatest)
135
- * is the smallest value in the list such that no more than P percent of the data is strictly less
134
+ * The P-th percentile ( 0 < P ≤ 100 ) of a list of N ordered values (sorted from least to greatest)
135
+ * is the smallest value in the list such that no more than P percent of the data is strictly less
136
136
  * than the value and at least P percent of the data is less than or equal to that value. See {@link https://en.wikipedia.org/wiki/Percentile}.
137
- *
137
+ *
138
138
  * Here, the <i>linear interpolation between closest ranks</i> method is used.
139
139
  * @param {Array} arr The set of values, need not be ordered.
140
140
  * @param {Number|Array} percentile One or several percentiles
@@ -285,7 +285,7 @@ define(['jxg', 'math/math', 'utils/type'], function (JXG, Mat, Type) {
285
285
  } else {
286
286
  len = arr.length;
287
287
  res = [];
288
-
288
+
289
289
  for (i = 0; i < len; i++) {
290
290
  res[i] = Math.abs(arr[i]);
291
291
  }
@@ -540,7 +540,7 @@ define(['jxg', 'math/math', 'utils/type'], function (JXG, Mat, Type) {
540
540
  * () => JXG.Math.Statistics.TheilSenRegression(a.map(el => el.coords))
541
541
  * ],
542
542
  * {strokeWidth:1, strokeColor:'black'});
543
- *
543
+ *
544
544
  * </pre><div id="JXG0a28be85-91c5-44d3-aae6-114e81217cf0" class="jxgbox" style="width: 300px; height: 300px;"></div>
545
545
  * <script type="text/javascript">
546
546
  * (function() {
@@ -551,16 +551,16 @@ define(['jxg', 'math/math', 'utils/type'], function (JXG, Mat, Type) {
551
551
  * a[0]=board.create('point', [0,0]);
552
552
  * a[1]=board.create('point', [3,0]);
553
553
  * a[2]=board.create('point', [0,3]);
554
- *
554
+ *
555
555
  * board.create('line', [
556
556
  * () => JXG.Math.Statistics.TheilSenRegression(a.map(el => el.coords))
557
557
  * ],
558
558
  * {strokeWidth:1, strokeColor:'black'});
559
- *
559
+ *
560
560
  * })();
561
- *
561
+ *
562
562
  * </script><pre>
563
- *
563
+ *
564
564
  */
565
565
  TheilSenRegression: function (coords) {
566
566
  var i, j,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
package/src/options.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -360,7 +360,7 @@ define([
360
360
  * @type Object
361
361
  */
362
362
  fullscreen: {
363
- symbol: '\u26f6', // '\u25a1'
363
+ symbol: '\u25a1', // '\u26f6' (not supported by MacOS), // '\u25a1'
364
364
  id: null
365
365
  },
366
366
 
@@ -546,13 +546,13 @@ define([
546
546
  * factorY: 1.25, // vertical zoom factor (multiplied to {@link JXG.Board#zoomY})
547
547
  * wheel: true, // allow zooming by mouse wheel or
548
548
  * // by pinch-to-toom gesture on touch devices
549
- * needShift: true, // mouse wheel zooming needs pressing of the shift key
550
- * min: 0.001 // minimal values of {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}, limits zoomOut
551
- * max: 1000.0 // maximal values of {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}, limits zoomIn
549
+ * needShift: true, // mouse wheel zooming needs pressing of the shift key
550
+ * min: 0.001, // minimal values of {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}, limits zoomOut
551
+ * max: 1000.0, // maximal values of {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}, limits zoomIn
552
552
  *
553
- * pinchHorizontal: true // Allow pinch-to-zoom to zoom only horizontal axis
554
- * pinchVertical: true // Allow pinch-to-zoom to zoom only vertical axis
555
- * pinchSensitivity: 7 // Sensitivity (in degrees) for recognizing horizontal or vertical pinch-to-zoom gestures.
553
+ * pinchHorizontal: true, // Allow pinch-to-zoom to zoom only horizontal axis
554
+ * pinchVertical: true, // Allow pinch-to-zoom to zoom only vertical axis
555
+ * pinchSensitivity: 7 // Sensitivity (in degrees) for recognizing horizontal or vertical pinch-to-zoom gestures.
556
556
  * }
557
557
  * </pre>
558
558
  *
@@ -652,11 +652,11 @@ define([
652
652
  * panCtrl: false
653
653
  * }
654
654
  * });
655
- *
655
+ *
656
656
  * })();
657
- *
657
+ *
658
658
  * </script><pre>
659
- *
659
+ *
660
660
  *
661
661
  * @see JXG.Board#keyDownListener
662
662
  * @see JXG.Board#keyFocusInListener
@@ -704,11 +704,11 @@ define([
704
704
  * axis: true,
705
705
  * resize: {enabled: true, throttle: 200}
706
706
  * });
707
- *
707
+ *
708
708
  * })();
709
- *
709
+ *
710
710
  * </script><pre>
711
- *
711
+ *
712
712
  *
713
713
  */
714
714
  resize: {
@@ -753,11 +753,11 @@ define([
753
753
  * axis: true,
754
754
  * moveTarget: document
755
755
  * });
756
- *
756
+ *
757
757
  * })();
758
- *
758
+ *
759
759
  * </script><pre>
760
- *
760
+ *
761
761
  *
762
762
  */
763
763
  moveTarget: null,
@@ -1588,9 +1588,9 @@ define([
1588
1588
  * }
1589
1589
  * },
1590
1590
  * });
1591
- *
1591
+ *
1592
1592
  * })();
1593
- *
1593
+ *
1594
1594
  * </script><pre>
1595
1595
  *
1596
1596
  * @name Ticks#beautifulScientificTickLabels
@@ -1757,14 +1757,28 @@ define([
1757
1757
 
1758
1758
  /**
1759
1759
  * If a label exceeds {@link Ticks#maxLabelLength} this determines the precision used to shorten the tick label.
1760
+ * Replaced by the digits attribute.
1760
1761
  *
1761
1762
  * @type Number
1762
1763
  * @name Ticks#precision
1763
1764
  * @see Ticks#maxLabelLength
1765
+ * @see Ticks#digits
1766
+ * @deprecated
1764
1767
  * @default 3
1765
1768
  */
1766
1769
  precision: 3,
1767
1770
 
1771
+ /**
1772
+ * If a label exceeds {@link Ticks#maxLabelLength} this determines the number of digits used to shorten the tick label.
1773
+ *
1774
+ * @type Number
1775
+ * @name Ticks#digits
1776
+ * @see Ticks#maxLabelLength
1777
+ * @deprecated
1778
+ * @default 3
1779
+ */
1780
+ digits: 3,
1781
+
1768
1782
  /**
1769
1783
  * The default distance between two ticks. Please be aware that this value does not have
1770
1784
  * to be used if {@link Ticks#insertTicks} is set to true.
@@ -2509,7 +2523,7 @@ define([
2509
2523
  strokeColor: Color.palette.red,
2510
2524
  highlightFillColor: '#c3d9ff',
2511
2525
  highlightStrokeColor: '#c3d9ff',
2512
-
2526
+
2513
2527
  name: ''
2514
2528
  },
2515
2529
 
@@ -4054,7 +4068,7 @@ define([
4054
4068
  snatchDistance: 0.0,
4055
4069
 
4056
4070
  /**
4057
- * If set to true, the point will snap to a grid of integer multiples of
4071
+ * If set to true, the point will snap to a grid of integer multiples of
4058
4072
  * {@link Point#snapSizeX} and {@link Point#snapSizeY} (in user coordinates).
4059
4073
  * <p>
4060
4074
  * The coordinates of the grid points are either integer multiples of snapSizeX and snapSizeY
@@ -4536,13 +4550,27 @@ define([
4536
4550
 
4537
4551
  /**
4538
4552
  * The precision of the slider value displayed in the optional text.
4553
+ * Replaced by the attribute "digits".
4554
+ *
4539
4555
  * @memberOf Slider.prototype
4540
4556
  * @name precision
4541
4557
  * @type Number
4558
+ * @deprecated
4559
+ * @see Slider#digits
4542
4560
  * @default 2
4543
4561
  */
4544
4562
  precision: 2,
4545
4563
 
4564
+ /**
4565
+ * The number of digits of the slider value displayed in the optional text.
4566
+ *
4567
+ * @memberOf Slider.prototype
4568
+ * @name digits
4569
+ * @type Number
4570
+ * @default 2
4571
+ */
4572
+ digits: 2,
4573
+
4546
4574
  firstArrow: false,
4547
4575
  lastArrow: false,
4548
4576
 
@@ -4678,7 +4706,7 @@ define([
4678
4706
 
4679
4707
  // Label drawing
4680
4708
  drawLabels: false,
4681
- precision: 2,
4709
+ digits: 2,
4682
4710
  includeBoundaries: 1,
4683
4711
  drawZero: true,
4684
4712
  label: {
@@ -4949,13 +4977,26 @@ define([
4949
4977
 
4950
4978
  /**
4951
4979
  * The precision of the tape measure value displayed in the optional text.
4980
+ * Replaced by the attribute digits
4981
+ *
4952
4982
  * @memberOf Tapemeasure.prototype
4953
4983
  * @name precision
4954
4984
  * @type Number
4985
+ * @deprecated
4986
+ * @see Tapemeasure#digits
4955
4987
  * @default 2
4956
4988
  */
4957
4989
  precision: 2,
4958
4990
 
4991
+ /**
4992
+ * The precision of the tape measure value displayed in the optional text.
4993
+ * @memberOf Tapemeasure.prototype
4994
+ * @name precision
4995
+ * @type Number
4996
+ * @default 2
4997
+ */
4998
+ digits: 2,
4999
+
4959
5000
  /**
4960
5001
  * Attributes for first helper point defining the tape measure position.
4961
5002
  *
@@ -5067,11 +5108,11 @@ define([
5067
5108
  * var board = JXG.JSXGraph.initBoard('JXG2da7e972-ac62-416b-a94b-32559c9ec9f9',
5068
5109
  * {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
5069
5110
  * var txt = board.create('text', [2, 2, "hello"], {fontSize: 8, fontUnit: 'vmin'});
5070
- *
5111
+ *
5071
5112
  * })();
5072
- *
5113
+ *
5073
5114
  * </script><pre>
5074
- *
5115
+ *
5075
5116
  */
5076
5117
  fontUnit: 'px',
5077
5118
 
@@ -5473,7 +5514,7 @@ define([
5473
5514
  * text1 = board.create('text', [5, 1, function(){
5474
5515
  * return '\\(a(t)= { 1 \\over ' + a.Value().toFixed(3) + '}\\)';
5475
5516
  * }], {fontSize: 15, fixed:true, strokeColor:'red', anchorY: 'top', parse: false});
5476
- *
5517
+ *
5477
5518
  * </pre><div id="JXGf8bd01db-fb6a-4a5c-9e7f-8823f7aa5ac6" class="jxgbox" style="width: 300px; height: 300px;"></div>
5478
5519
  * <script type="text/javascript">
5479
5520
  * (function() {
@@ -5485,12 +5526,12 @@ define([
5485
5526
  * suffixlabel:'\\(t_1=\\)',
5486
5527
  * unitLabel: ' \\(\\text{ ms}\\)',
5487
5528
  * snapWidth:0.01}),
5488
- *
5529
+ *
5489
5530
  * func = board.create('functiongraph',[function(x){return (a.Value()*x*x)}], {strokeColor: "red"});
5490
5531
  * text1 = board.create('text', [5, 1, function(){
5491
5532
  * return '\\(a(t)= { 1 \\over ' + a.Value().toFixed(3) + '}\\)';
5492
5533
  * }], {fontSize: 15, fixed:true, strokeColor:'red', anchorY: 'top', parse: false});
5493
- *
5534
+ *
5494
5535
  * })();
5495
5536
  *
5496
5537
  * </script><pre>
@@ -5529,7 +5570,7 @@ define([
5529
5570
  * text1 = board.create('text', [5, 1, function(){
5530
5571
  * return 'a(t)= { 1 \\over ' + a.Value().toFixed(3) + '}';
5531
5572
  * }], {fontSize: 15, fixed:true, strokeColor:'red', anchorY: 'top'});
5532
- *
5573
+ *
5533
5574
  * </pre>
5534
5575
  * <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.10/dist/katex.min.css" integrity="sha384-0cCFrwW/0bAk1Z/6IMgIyNU3kfTcNirlObr4WjrUU7+hZeD6ravdYJ3kPWSeC31M" crossorigin="anonymous">
5535
5576
  * <script src="https://cdn.jsdelivr.net/npm/katex@0.13.10/dist/katex.min.js" integrity="sha384-dtFDxK2tSkECx/6302Z4VN2ZRqt6Gis+b1IwCjJPrn0kMYFQT9rbtyQWg5NFWAF7" crossorigin="anonymous"></script>
@@ -5543,12 +5584,12 @@ define([
5543
5584
  * suffixlabel:'t_1=',
5544
5585
  * unitLabel: ' \\text{ ms}',
5545
5586
  * snapWidth:0.01});
5546
- *
5587
+ *
5547
5588
  * func = board.create('functiongraph',[function(x){return (a.Value()*x*x)}], {strokeColor: "red"});
5548
5589
  * text1 = board.create('text', [5, 1, function(){
5549
5590
  * return 'a(t)= { 1 \\over ' + a.Value().toFixed(3) + '}';
5550
5591
  * }], {fontSize: 15, fixed:true, strokeColor:'red', anchorY: 'top'});
5551
- *
5592
+ *
5552
5593
  * })();
5553
5594
  *
5554
5595
  * </script><pre>