jsxgraph 1.9.0 → 1.9.2

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 (113) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/distrib/docs.zip +0 -0
  3. package/distrib/geogebra.min.js +2 -2
  4. package/distrib/geonext.min.js +3 -3
  5. package/distrib/index.d.ts +1 -1
  6. package/distrib/intergeo.min.js +2 -2
  7. package/distrib/jsxgraph.css +1 -1
  8. package/distrib/jsxgraph.zip +0 -0
  9. package/distrib/jsxgraphcore.js +3 -3
  10. package/distrib/jsxgraphcore.mjs +3 -3
  11. package/distrib/jsxgraphcore.mjs.map +1 -1
  12. package/distrib/jsxgraphsrc.js +7680 -6865
  13. package/distrib/jsxgraphsrc.mjs +7964 -7150
  14. package/distrib/jsxgraphsrc.mjs.map +1 -1
  15. package/distrib/sketch.min.js +3 -3
  16. package/distrib/themes/mono_thin.js +1 -1
  17. package/package.json +4 -4
  18. package/src/3d/box3d.js +6 -3
  19. package/src/3d/circle3d.js +11 -10
  20. package/src/3d/curve3d.js +3 -1
  21. package/src/3d/element3d.js +1 -1
  22. package/src/3d/linspace3d.js +20 -57
  23. package/src/3d/point3d.js +7 -1
  24. package/src/3d/polygon3d.js +2 -1
  25. package/src/3d/sphere3d.js +48 -44
  26. package/src/3d/surface3d.js +2 -1
  27. package/src/3d/view3d.js +1505 -1068
  28. package/src/base/board.js +177 -56
  29. package/src/base/chart.js +5 -6
  30. package/src/base/circle.js +4 -2
  31. package/src/base/composition.js +1 -1
  32. package/src/base/constants.js +2 -2
  33. package/src/base/coords.js +1 -1
  34. package/src/base/coordselement.js +1 -1
  35. package/src/base/curve.js +2 -1
  36. package/src/base/element.js +39 -31
  37. package/src/base/foreignobject.js +1 -1
  38. package/src/base/group.js +1 -1
  39. package/src/base/image.js +1 -1
  40. package/src/base/line.js +94 -106
  41. package/src/base/point.js +1 -1
  42. package/src/base/polygon.js +2 -2
  43. package/src/base/text.js +6 -2
  44. package/src/base/ticks.js +1 -1
  45. package/src/base/transformation.js +1 -1
  46. package/src/base/turtle.js +1 -1
  47. package/src/element/arc.js +1 -1
  48. package/src/element/button.js +63 -13
  49. package/src/element/checkbox.js +7 -3
  50. package/src/element/comb.js +1 -1
  51. package/src/element/composition.js +1 -1
  52. package/src/element/conic.js +1 -1
  53. package/src/element/grid.js +7 -7
  54. package/src/element/input.js +10 -7
  55. package/src/element/locus.js +1 -1
  56. package/src/element/measure.js +1 -1
  57. package/src/element/sector.js +1 -1
  58. package/src/element/slider.js +43 -40
  59. package/src/element/slopetriangle.js +1 -1
  60. package/src/element/smartlabel.js +1 -1
  61. package/src/element/vectorfield.js +1 -1
  62. package/src/index.d.ts +1 -1
  63. package/src/jsxgraph.js +6 -4
  64. package/src/jxg.js +1 -1
  65. package/src/math/bqdt.js +1 -1
  66. package/src/math/clip.js +1 -1
  67. package/src/math/complex.js +1 -1
  68. package/src/math/extrapolate.js +1 -1
  69. package/src/math/geometry.js +87 -65
  70. package/src/math/ia.js +12 -12
  71. package/src/math/implicitplot.js +1 -1
  72. package/src/math/math.js +48 -6
  73. package/src/math/metapost.js +1 -1
  74. package/src/math/nlp.js +1 -1
  75. package/src/math/numerics.js +1 -1
  76. package/src/math/plot.js +25 -26
  77. package/src/math/poly.js +1 -1
  78. package/src/math/probfuncs.js +1 -1
  79. package/src/math/qdt.js +1 -1
  80. package/src/math/statistics.js +1 -1
  81. package/src/math/symbolic.js +1 -1
  82. package/src/options.js +49 -4
  83. package/src/options3d.js +82 -5
  84. package/src/parser/datasource.js +1 -1
  85. package/src/parser/geonext.js +1 -1
  86. package/src/parser/jessiecode.js +12 -11
  87. package/src/parser/jessiescript.js +1 -1
  88. package/src/parser/prefix.js +9 -2
  89. package/src/reader/cinderella.js +1 -1
  90. package/src/reader/file.js +1 -1
  91. package/src/reader/geogebra.js +1 -1
  92. package/src/reader/geonext.js +1 -1
  93. package/src/reader/graph.js +1 -1
  94. package/src/reader/intergeo.js +1 -1
  95. package/src/reader/sketch.js +107 -1
  96. package/src/renderer/abstract.js +1 -1
  97. package/src/renderer/canvas.js +1 -1
  98. package/src/renderer/no.js +1 -1
  99. package/src/renderer/svg.js +17 -7
  100. package/src/renderer/vml.js +1 -1
  101. package/src/server/server.js +1 -1
  102. package/src/themes/mono_thin.js +1 -1
  103. package/src/unused/bst.js +1 -1
  104. package/src/unused/heap.js +1 -1
  105. package/src/utils/base64.js +1 -1
  106. package/src/utils/color.js +1 -1
  107. package/src/utils/dump.js +1 -1
  108. package/src/utils/env.js +3 -3
  109. package/src/utils/event.js +1 -1
  110. package/src/utils/expect.js +1 -1
  111. package/src/utils/type.js +30 -18
  112. package/src/utils/xml.js +1 -1
  113. package/src/utils/zip.js +1 -1
package/src/base/line.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -330,7 +330,9 @@ JXG.extend(
330
330
  // Compute the actual length of the segment
331
331
  d = this.point1.Dist(this.point2);
332
332
  // Determine the length the segment ought to have
333
- d_new = Math.abs(this.fixedLength());
333
+ d_new = (Type.evaluate(this.visProp.nonnegativeonly)) ?
334
+ Math.max(0.0, this.fixedLength()) :
335
+ Math.abs(this.fixedLength());
334
336
 
335
337
  // Distances between the two points and their respective
336
338
  // position before the update
@@ -1010,6 +1012,8 @@ JXG.extend(
1010
1012
  }
1011
1013
 
1012
1014
  this.fixedLength = Type.createFunction(l, this.board);
1015
+ this.hasFixedLength = true;
1016
+ this.addParentsFromJCFunctions([this.fixedLength]);
1013
1017
  this.board.update();
1014
1018
 
1015
1019
  return this;
@@ -1475,15 +1479,22 @@ JXG.createSegment = function (board, parents, attributes) {
1475
1479
  el = board.create("line", parents.slice(0, 2), attr);
1476
1480
 
1477
1481
  if (parents.length === 3) {
1478
- el.hasFixedLength = true;
1482
+ try {
1483
+ el.hasFixedLength = true;
1484
+ el.fixedLengthOldCoords = [];
1485
+ el.fixedLengthOldCoords[0] = new Coords(
1486
+ Const.COORDS_BY_USER,
1487
+ el.point1.coords.usrCoords.slice(1, 3),
1488
+ board
1489
+ );
1490
+ el.fixedLengthOldCoords[1] = new Coords(
1491
+ Const.COORDS_BY_USER,
1492
+ el.point2.coords.usrCoords.slice(1, 3),
1493
+ board
1494
+ );
1479
1495
 
1480
- if (Type.isNumber(parents[2])) {
1481
- el.fixedLength = function () {
1482
- return parents[2];
1483
- };
1484
- } else if (Type.isFunction(parents[2])) {
1485
- el.fixedLength = Type.createFunction(parents[2], this.board);
1486
- } else {
1496
+ el.setFixedLength(parents[2]);
1497
+ } catch (err) {
1487
1498
  throw new Error(
1488
1499
  "JSXGraph: Can't create segment with third parent type '" +
1489
1500
  typeof parents[2] +
@@ -1491,22 +1502,25 @@ JXG.createSegment = function (board, parents, attributes) {
1491
1502
  "\nPossible third parent types: number or function"
1492
1503
  );
1493
1504
  }
1505
+ // if (Type.isNumber(parents[2])) {
1506
+ // el.fixedLength = function () {
1507
+ // return parents[2];
1508
+ // };
1509
+ // } else if (Type.isFunction(parents[2])) {
1510
+ // el.fixedLength = Type.createFunction(parents[2], this.board);
1511
+ // } else {
1512
+ // throw new Error(
1513
+ // "JSXGraph: Can't create segment with third parent type '" +
1514
+ // typeof parents[2] +
1515
+ // "'." +
1516
+ // "\nPossible third parent types: number or function"
1517
+ // );
1518
+ // }
1494
1519
 
1495
1520
  el.getParents = function () {
1496
1521
  return this.parents.concat(this.fixedLength());
1497
1522
  };
1498
1523
 
1499
- el.fixedLengthOldCoords = [];
1500
- el.fixedLengthOldCoords[0] = new Coords(
1501
- Const.COORDS_BY_USER,
1502
- el.point1.coords.usrCoords.slice(1, 3),
1503
- board
1504
- );
1505
- el.fixedLengthOldCoords[1] = new Coords(
1506
- Const.COORDS_BY_USER,
1507
- el.point2.coords.usrCoords.slice(1, 3),
1508
- board
1509
- );
1510
1524
  }
1511
1525
 
1512
1526
  el.elType = "segment";
@@ -1918,8 +1932,13 @@ JXG.createAxis = function (board, parents, attributes) {
1918
1932
  JXG.registerElement("axis", JXG.createAxis);
1919
1933
 
1920
1934
  /**
1921
- * @class With the element tangent the slope of a line, circle, or curve in a certain point can be visualized. A tangent is always constructed
1922
- * by a glider on a line, circle, or curve and describes the tangent in the glider point on that line, circle, or curve.
1935
+ * @class With the element tangent the slope of a line, circle, conic, turtle, or curve in a certain point can be visualized. A tangent is always constructed
1936
+ * by a point on a line, circle, or curve and describes the tangent in the point on that line, circle, or curve.
1937
+ * <p>
1938
+ * If the point is not on the object (line, circle, conic, curve, turtle) the output depends on the type of the object.
1939
+ * For conics and circles, the polar line will be constructed. For function graphs,
1940
+ * the tangent of the vertical projection of the point to the function graph is constructed. For all other objects, the tangent
1941
+ * in the orthogonal projection of the point to the object will be constructed.
1923
1942
  * @pseudo
1924
1943
  * @name Tangent
1925
1944
  * @augments JXG.Line
@@ -1927,6 +1946,7 @@ JXG.registerElement("axis", JXG.createAxis);
1927
1946
  * @type JXG.Line
1928
1947
  * @throws {Exception} If the element cannot be constructed with the given parent objects an exception is thrown.
1929
1948
  * @param {Glider} g A glider on a line, circle, or curve.
1949
+ * @param {JXG.GeometryElement} [c] Optional element for which the tangent is constructed
1930
1950
  * @example
1931
1951
  * // Create a tangent providing a glider on a function graph
1932
1952
  * var c1 = board.create('curve', [function(t){return t},function(t){return t*t*t;}]);
@@ -1944,12 +1964,13 @@ JXG.createTangent = function (board, parents, attributes) {
1944
1964
  var p, c, j, el, tangent, attr,
1945
1965
  getCurveTangentDir;
1946
1966
 
1947
- // One argument: glider on line, circle or curve
1948
1967
  if (parents.length === 1) {
1968
+ // One argument: glider on line, circle or curve
1949
1969
  p = parents[0];
1950
1970
  c = p.slideObject;
1951
- // Two arguments: (point,F"|conic) or (line|curve|circle|conic,point). // Not yet: curve!
1971
+
1952
1972
  } else if (parents.length === 2) {
1973
+ // Two arguments: (point,line|curve|circle|conic) or (line|curve|circle|conic,point).
1953
1974
  // In fact, for circles and conics it is the polar
1954
1975
  if (Type.isPoint(parents[0])) {
1955
1976
  p = parents[0];
@@ -1964,7 +1985,7 @@ JXG.createTangent = function (board, parents, attributes) {
1964
1985
  "' and '" +
1965
1986
  typeof parents[1] +
1966
1987
  "'." +
1967
- "\nPossible parent types: [glider], [point,line|curve|circle|conic]"
1988
+ "\nPossible parent types: [glider|point], [point,line|curve|circle|conic]"
1968
1989
  );
1969
1990
  }
1970
1991
  } else {
@@ -1974,7 +1995,7 @@ JXG.createTangent = function (board, parents, attributes) {
1974
1995
  "' and '" +
1975
1996
  typeof parents[1] +
1976
1997
  "'." +
1977
- "\nPossible parent types: [glider], [point,line|curve|circle|conic]"
1998
+ "\nPossible parent types: [glider|point], [point,line|curve|circle|conic]"
1978
1999
  );
1979
2000
  }
1980
2001
 
@@ -1992,17 +2013,22 @@ JXG.createTangent = function (board, parents, attributes) {
1992
2013
  [
1993
2014
  function () {
1994
2015
  var g = c.X,
1995
- f = c.Y;
1996
- return (
1997
- -p.X() * Numerics.D(f)(p.position) +
1998
- p.Y() * Numerics.D(g)(p.position)
1999
- );
2000
- },
2001
- function () {
2002
- return Numerics.D(c.Y)(p.position);
2003
- },
2004
- function () {
2005
- return -Numerics.D(c.X)(p.position);
2016
+ f = c.Y,
2017
+ t;
2018
+
2019
+ if (p.type === Const.OBJECT_TYPE_GLIDER) {
2020
+ t = p.position;
2021
+ } else if (Type.evaluate(c.visProp.curvetype) === 'functiongraph') {
2022
+ t = p.X();
2023
+ } else {
2024
+ t = Geometry.projectPointToCurve(p, c, board)[1];
2025
+ }
2026
+
2027
+ return [
2028
+ -p.X() * Numerics.D(f)(t) + p.Y() * Numerics.D(g)(t),
2029
+ Numerics.D(c.Y)(t),
2030
+ -Numerics.D(c.X)(t)
2031
+ ];
2006
2032
  }
2007
2033
  ],
2008
2034
  attr
@@ -2070,12 +2096,10 @@ JXG.createTangent = function (board, parents, attributes) {
2070
2096
  B = points[i + 1].usrCoords;
2071
2097
  C = points[i + 2].usrCoords;
2072
2098
  D = points[i + 3].usrCoords;
2073
- dx =
2074
- (1 - t) * (1 - t) * (B[1] - A[1]) +
2099
+ dx = (1 - t) * (1 - t) * (B[1] - A[1]) +
2075
2100
  2 * (1 - t) * t * (C[1] - B[1]) +
2076
2101
  t * t * (D[1] - C[1]);
2077
- dy =
2078
- (1 - t) * (1 - t) * (B[2] - A[2]) +
2102
+ dy = (1 - t) * (1 - t) * (B[2] - A[2]) +
2079
2103
  2 * (1 - t) * t * (C[2] - B[2]) +
2080
2104
  t * t * (D[2] - C[2]);
2081
2105
  d = Mat.hypot(dx, dy);
@@ -2092,21 +2116,28 @@ JXG.createTangent = function (board, parents, attributes) {
2092
2116
  return p2[2] - p1[2];
2093
2117
  case 2:
2094
2118
  return p1[1] - p2[1];
2119
+ default:
2120
+ return [
2121
+ p1[2] * p2[1] - p1[1] * p2[2],
2122
+ p2[2] - p1[2],
2123
+ p1[1] - p2[1]
2124
+ ];
2095
2125
  }
2096
- return 0;
2097
2126
  };
2098
2127
 
2099
2128
  tangent = board.create(
2100
2129
  "line",
2101
2130
  [
2102
2131
  function () {
2103
- return getCurveTangentDir(p.position, c, 0);
2104
- },
2105
- function () {
2106
- return getCurveTangentDir(p.position, c, 1);
2107
- },
2108
- function () {
2109
- return getCurveTangentDir(p.position, c, 2);
2132
+ var t;
2133
+
2134
+ if (p.type === Const.OBJECT_TYPE_GLIDER) {
2135
+ t = p.position;
2136
+ } else {
2137
+ t = Geometry.projectPointToCurve(p, c, board)[1];
2138
+ }
2139
+
2140
+ return getCurveTangentDir(t, c);
2110
2141
  }
2111
2142
  ],
2112
2143
  attr
@@ -2121,33 +2152,14 @@ JXG.createTangent = function (board, parents, attributes) {
2121
2152
  "line",
2122
2153
  [
2123
2154
  function () {
2124
- var i = Math.floor(p.position);
2125
-
2126
- // run through all curves of this turtle
2127
- for (j = 0; j < c.objects.length; j++) {
2128
- el = c.objects[j];
2129
-
2130
- if (el.type === Const.OBJECT_TYPE_CURVE) {
2131
- if (i < el.numberPoints) {
2132
- break;
2133
- }
2134
-
2135
- i -= el.numberPoints;
2136
- }
2137
- }
2138
-
2139
- if (i === el.numberPoints - 1) {
2140
- i--;
2141
- }
2142
-
2143
- if (i < 0) {
2144
- return 1;
2155
+ var i, t;
2156
+ if (p.type === Const.OBJECT_TYPE_GLIDER) {
2157
+ t = p.position;
2158
+ } else {
2159
+ t = Geometry.projectPointToTurtle(p, c, board)[1];
2145
2160
  }
2146
2161
 
2147
- return el.Y(i) * el.X(i + 1) - el.X(i) * el.Y(i + 1);
2148
- },
2149
- function () {
2150
- var i = Math.floor(p.position);
2162
+ i = Math.floor(t);
2151
2163
 
2152
2164
  // run through all curves of this turtle
2153
2165
  for (j = 0; j < c.objects.length; j++) {
@@ -2162,37 +2174,19 @@ JXG.createTangent = function (board, parents, attributes) {
2162
2174
  }
2163
2175
  }
2164
2176
 
2165
- if (i === el.numberPoints - 1) {
2166
- i--;
2167
- }
2168
- if (i < 0) {
2169
- return 0;
2170
- }
2171
-
2172
- return el.Y(i + 1) - el.Y(i);
2173
- },
2174
- function () {
2175
- var i = Math.floor(p.position);
2176
-
2177
- // run through all curves of this turtle
2178
- for (j = 0; j < c.objects.length; j++) {
2179
- el = c.objects[j];
2180
- if (el.type === Const.OBJECT_TYPE_CURVE) {
2181
- if (i < el.numberPoints) {
2182
- break;
2183
- }
2184
- i -= el.numberPoints;
2185
- }
2186
- }
2187
2177
  if (i === el.numberPoints - 1) {
2188
2178
  i--;
2189
2179
  }
2190
2180
 
2191
2181
  if (i < 0) {
2192
- return 0;
2182
+ return [1, 0, 0];
2193
2183
  }
2194
2184
 
2195
- return el.X(i) - el.X(i + 1);
2185
+ return [
2186
+ el.Y(i) * el.X(i + 1) - el.X(i) * el.Y(i + 1),
2187
+ el.Y(i + 1) - el.Y(i),
2188
+ el.X(i) - el.X(i + 1)
2189
+ ];
2196
2190
  }
2197
2191
  ],
2198
2192
  attr
@@ -2211,13 +2205,7 @@ JXG.createTangent = function (board, parents, attributes) {
2211
2205
  "line",
2212
2206
  [
2213
2207
  function () {
2214
- return Mat.matVecMult(c.quadraticform, p.coords.usrCoords)[0];
2215
- },
2216
- function () {
2217
- return Mat.matVecMult(c.quadraticform, p.coords.usrCoords)[1];
2218
- },
2219
- function () {
2220
- return Mat.matVecMult(c.quadraticform, p.coords.usrCoords)[2];
2208
+ return Mat.matVecMult(c.quadraticform, p.coords.usrCoords);
2221
2209
  }
2222
2210
  ],
2223
2211
  attr
package/src/base/point.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1533,7 +1533,7 @@ JXG.createParallelogram = function (board, parents, attributes) {
1533
1533
  );
1534
1534
  }
1535
1535
 
1536
- attr_pp = Type.copyAttributes(attributes, board.options, "parallelogram", ["parallelpoint"]);
1536
+ attr_pp = Type.copyAttributes(attributes, board.options, "parallelogram", "parallelpoint");
1537
1537
  pp = board.create('parallelpoint', points, attr_pp);
1538
1538
  attr = Type.copyAttributes(attributes, board.options, "parallelogram");
1539
1539
  el = board.create('polygon', [points[0], points[1], pp, points[2]], attr);
package/src/base/text.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1142,7 +1142,8 @@ JXG.extend(
1142
1142
  getNumberOfConflicts: function (x, y, w, h) {
1143
1143
  var count = 0,
1144
1144
  i, obj, le,
1145
- savePointPrecision;
1145
+ savePointPrecision,
1146
+ saveHasInnerPoints;
1146
1147
 
1147
1148
  // Set the precision of hasPoint to half the max if label isn't too long
1148
1149
  savePointPrecision = this.board.options.precision.hasPoint;
@@ -1152,6 +1153,8 @@ JXG.extend(
1152
1153
  // Make it compatible with the objects' visProp.precision attribute
1153
1154
  for (i = 0, le = this.board.objectsList.length; i < le; i++) {
1154
1155
  obj = this.board.objectsList[i];
1156
+ saveHasInnerPoints = obj.visProp.hasinnerpoints;
1157
+ obj.visProp.hasinnerpoints = false;
1155
1158
  if (
1156
1159
  obj.visPropCalc.visible &&
1157
1160
  obj.elType !== "axis" &&
@@ -1162,6 +1165,7 @@ JXG.extend(
1162
1165
  ) {
1163
1166
  count++;
1164
1167
  }
1168
+ obj.visProp.hasinnerpoints = saveHasInnerPoints;
1165
1169
  }
1166
1170
  this.board.options.precision.hasPoint = savePointPrecision;
1167
1171
 
package/src/base/ticks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -52,9 +52,12 @@ var priv = {
52
52
  /**
53
53
  * @class This element is used to provide a constructor for special texts containing a
54
54
  * form button element.
55
- * <p>
56
55
  * For this element, the attribute "display" has to have the value 'html' (which is the default).
57
- * <p>
56
+ *
57
+ * <p><b>Setting a CSS class:</b> The attribute <tt>cssClass</tt> affects the HTML div element that contains the button element. To change the CSS properties of the HTML button element a selector of the form
58
+ * <tt>.mybutton > button { ... }</tt> has to be used. See the example below.
59
+ *
60
+ * <p><b>Access the button element with JavaScript:</b>
58
61
  * The underlying HTML button element can be accessed through the sub-object 'rendNodeButton', e.g. to
59
62
  * add event listeners.
60
63
  *
@@ -158,15 +161,15 @@ var priv = {
158
161
  * </script><pre>
159
162
  *
160
163
  * @example
161
- * var i1 = board.create('input', [-3, 4, 'sin(x)', 'f(x)='], {cssStyle: 'width:4em', maxlength: 2});
162
- * var c1 = board.create('checkbox', [-3, 2, 'label 1'], {});
163
- * var b1 = board.create('button', [-3, -1, 'Change texts', function () {
164
- * i1.setText('g(x)');
165
- * i1.set('cos(x)');
166
- * c1.setText('label 2');
167
- * b1.setText('Texts are changed');
168
- * }],
169
- * {cssStyle: 'width:400px'});
164
+ * var i1 = board.create('input', [-3, 4, 'sin(x)', 'f(x)='], {cssStyle: 'width:4em', maxlength: 2});
165
+ * var c1 = board.create('checkbox', [-3, 2, 'label 1'], {});
166
+ * var b1 = board.create('button', [-3, -1, 'Change texts', function () {
167
+ * i1.setText('g(x)');
168
+ * i1.set('cos(x)');
169
+ * c1.setText('label 2');
170
+ * b1.setText('Texts are changed');
171
+ * }],
172
+ * {cssStyle: 'width:200px'});
170
173
  *
171
174
  * </pre><div id="JXG11cac8ff-2354-47e7-9da4-eb928e53de05" class="jxgbox" style="width: 300px; height: 300px;"></div>
172
175
  * <script type="text/javascript">
@@ -181,7 +184,54 @@ var priv = {
181
184
  * c1.setText('label 2');
182
185
  * b1.setText('Texts are changed');
183
186
  * }],
184
- * {cssStyle: 'width:400px'});
187
+ * {cssStyle: 'width:200px'});
188
+ *
189
+ * })();
190
+ *
191
+ * </script><pre>
192
+ *
193
+ * @example
194
+ * // Set the CSS class of the button
195
+ *
196
+ * // CSS:
197
+ * &lt;style&gt;
198
+ * .mybutton > button {
199
+ * background-color: #04AA6D;
200
+ * border: none;
201
+ * color: white;
202
+ * padding: 1px 3px;
203
+ * text-align: center;
204
+ * text-decoration: none;
205
+ * display: inline-block;
206
+ * font-size: 16px;
207
+ * }
208
+ * &lt;/style&gt;
209
+ *
210
+ * // JavaScript:
211
+ * var button = board.create('button',
212
+ * [1, 4, 'answers', function () {}],
213
+ * {cssClass:'mybutton', highlightCssClass: 'mybutton'});
214
+ *
215
+ * </pre>
216
+ * <style>
217
+ * .mybutton > button {
218
+ * background-color: #04AA6D;
219
+ * border: none;
220
+ * color: white;
221
+ * padding: 1px 3px;
222
+ * text-align: center;
223
+ * text-decoration: none;
224
+ * display: inline-block;
225
+ * font-size: 16px;
226
+ * }
227
+ * </style>
228
+ * <div id="JXG2da6cf73-8c2e-495c-bd31-42de43b71cf8" class="jxgbox" style="width: 300px; height: 300px;"></div>
229
+ * <script type="text/javascript">
230
+ * (function() {
231
+ * var board = JXG.JSXGraph.initBoard('JXG2da6cf73-8c2e-495c-bd31-42de43b71cf8',
232
+ * {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
233
+ * var button = board.create('button', [1, 4, 'answers', function () {
234
+ * }], {cssClass:'mybutton', highlightCssClass: 'mybutton'});
185
235
  *
186
236
  * })();
187
237
  *
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -54,9 +54,13 @@ var priv = {
54
54
  /**
55
55
  * @class This element is used to provide a constructor for special texts containing a
56
56
  * form checkbox element.
57
- * <p>
58
57
  * For this element, the attribute "display" has to have the value 'html' (which is the default).
59
- * <p>
58
+ *
59
+ * <p><b>Setting a CSS class:</b> The attribute <tt>cssClass</tt> affects the HTML div element that contains the checkbox element. To change the CSS properties of the HTML checkbox element a selector of the form
60
+ * <tt>.mycheck > checkbox { ... }</tt> has to be used. See the analog example for buttons:
61
+ * {@link Button}.
62
+ *
63
+ * <p><b>Access the checkbox element with JavaScript:</b>
60
64
  * The underlying HTML checkbox element can be accessed through the sub-object 'rendNodeCheck', e.g. to
61
65
  * add event listeners.
62
66
  *
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2018-2023
2
+ Copyright 2018-2024
3
3
  Alfred Wassermann,
4
4
  Tigran Saluev
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -216,10 +216,10 @@ import Const from "../base/constants.js";
216
216
  * </script><pre>
217
217
  */
218
218
  JXG.createGrid = function (board, parents, attributes) {
219
- const eps = Mat.eps, // to avoid rounding errors
220
- maxLines = 5000; // maximum number of vertical or horizontal grid elements (abort criterion for performance reasons)
219
+ var eps = Mat.eps, // to avoid rounding errors
220
+ maxLines = 5000, // maximum number of vertical or horizontal grid elements (abort criterion for performance reasons)
221
221
 
222
- var majorGrid, // main object which will be returned as grid
222
+ majorGrid, // main object which will be returned as grid
223
223
  minorGrid, // sub-object
224
224
  parentAxes, // {Array} array of user defined axes (allowed length 0, 1 or 2)
225
225
 
@@ -913,9 +913,9 @@ JXG.createGrid = function (board, parents, attributes) {
913
913
 
914
914
  } else {
915
915
  if ((
916
- YdisTo0 - minorRadius[1] - majorRadius[1] < eps ||
917
- YdisFrom0 - minorRadius[1] - majorRadius[1] < eps
918
- )) {
916
+ YdisTo0 - minorRadius[1] - majorRadius[1] < eps ||
917
+ YdisFrom0 - minorRadius[1] - majorRadius[1] < eps
918
+ )) {
919
919
  // if major grid elements (on 0 or axes) are not existing, minor grid elements have to exist. Otherwise:
920
920
  if ((
921
921
  majorDrawZeroOrigin ||
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -59,13 +59,16 @@ var priv = {
59
59
  /**
60
60
  * @class This element is used to provide a constructor for special texts containing a
61
61
  * HTML form input element.
62
- * <p>
63
- * If the width of element is set with the attribute "cssStyle", the width of the
64
- * label must be added.
65
- * <p>
66
62
  * For this element, the attribute "display" has to have the value 'html' (which is the default).
67
- * <p>
68
- * The underlying HTML input field can be accessed through the sub-object 'rendNodeInput', e.g. to
63
+ * If the width of element is set with the attribute "cssStyle", the width of the
64
+ * label must be added because cssStyle affects the surrounding div element.
65
+ *
66
+ * <p><b>Setting a CSS class:</b> The attribute <tt>cssClass</tt> affects the HTML div element that contains the input element. To change the CSS properties of the HTML input element a selector of the form
67
+ * <tt>.myinput > input { ... }</tt> has to be used. See the analog example for buttons:
68
+ * {@link Button}.
69
+ *
70
+ * <p><b>Access the input element with JavaScript:</b>
71
+ * The underlying HTML button element can be accessed through the sub-object 'rendNodeInput', e.g. to
69
72
  * add event listeners.
70
73
  *
71
74
  * @pseudo
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2023
2
+ Copyright 2008-2024
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,