jsxgraph 1.6.0 → 1.6.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 (211) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/distrib/docs/files.html +2 -2
  3. package/distrib/docs/index.html +2 -2
  4. package/distrib/docs/static/jsxgraph.css +24 -22
  5. package/distrib/docs/static/jsxgraphcore.js +2 -2
  6. package/distrib/docs/symbols/Angle.html +2 -2
  7. package/distrib/docs/symbols/Arc.html +2 -2
  8. package/distrib/docs/symbols/Arrow.html +2 -2
  9. package/distrib/docs/symbols/Arrowparallel.html +2 -2
  10. package/distrib/docs/symbols/Axis.html +2 -2
  11. package/distrib/docs/symbols/Bisector.html +2 -2
  12. package/distrib/docs/symbols/Bisectorlines.html +2 -2
  13. package/distrib/docs/symbols/Boxplot.html +2 -2
  14. package/distrib/docs/symbols/Button.html +4 -4
  15. package/distrib/docs/symbols/Cardinalspline.html +2 -2
  16. package/distrib/docs/symbols/Chart.html +2 -2
  17. package/distrib/docs/symbols/Checkbox.html +17 -17
  18. package/distrib/docs/symbols/Circle.html +2 -2
  19. package/distrib/docs/symbols/Circumcenter.html +4 -4
  20. package/distrib/docs/symbols/Circumcircle.html +2 -2
  21. package/distrib/docs/symbols/CircumcircleArc.html +2 -2
  22. package/distrib/docs/symbols/CircumcircleSector.html +2 -2
  23. package/distrib/docs/symbols/Comb.html +5 -5
  24. package/distrib/docs/symbols/Conic.html +2 -2
  25. package/distrib/docs/symbols/Constants.html +2 -2
  26. package/distrib/docs/symbols/Curve.html +2 -2
  27. package/distrib/docs/symbols/Curve3D.html +2 -2
  28. package/distrib/docs/symbols/CurveDifference.html +2 -2
  29. package/distrib/docs/symbols/CurveIntersection.html +2 -2
  30. package/distrib/docs/symbols/CurveUnion.html +2 -2
  31. package/distrib/docs/symbols/Derivative.html +2 -2
  32. package/distrib/docs/symbols/Ellipse.html +2 -2
  33. package/distrib/docs/symbols/ForeignObject.html +4 -4
  34. package/distrib/docs/symbols/Functiongraph.html +2 -2
  35. package/distrib/docs/symbols/Functiongraph3D.html +2 -2
  36. package/distrib/docs/symbols/Glider.html +4 -4
  37. package/distrib/docs/symbols/Grid.html +2 -2
  38. package/distrib/docs/symbols/Group.html +2 -2
  39. package/distrib/docs/symbols/Hatch.html +2 -2
  40. package/distrib/docs/symbols/Hyperbola.html +2 -2
  41. package/distrib/docs/symbols/Image.html +4 -4
  42. package/distrib/docs/symbols/Incenter.html +4 -4
  43. package/distrib/docs/symbols/Incircle.html +2 -2
  44. package/distrib/docs/symbols/Inequality.html +2 -2
  45. package/distrib/docs/symbols/Input.html +4 -4
  46. package/distrib/docs/symbols/Integral.html +2 -2
  47. package/distrib/docs/symbols/Intersection.html +4 -4
  48. package/distrib/docs/symbols/JXG.AbstractRenderer.html +2 -2
  49. package/distrib/docs/symbols/JXG.Board.html +144 -11
  50. package/distrib/docs/symbols/JXG.Board.infobox.html +2 -2
  51. package/distrib/docs/symbols/JXG.C.html +2 -2
  52. package/distrib/docs/symbols/JXG.CA.html +2 -2
  53. package/distrib/docs/symbols/JXG.CanvasRenderer.html +2 -2
  54. package/distrib/docs/symbols/JXG.Chart.html +2 -2
  55. package/distrib/docs/symbols/JXG.Circle.html +2 -2
  56. package/distrib/docs/symbols/JXG.Complex.html +2 -2
  57. package/distrib/docs/symbols/JXG.Composition.html +2 -2
  58. package/distrib/docs/symbols/JXG.Coords.html +2 -2
  59. package/distrib/docs/symbols/JXG.CoordsElement.html +54 -2
  60. package/distrib/docs/symbols/JXG.Curve.html +2 -2
  61. package/distrib/docs/symbols/JXG.Curve3D.html +2 -2
  62. package/distrib/docs/symbols/JXG.Dump.html +2 -2
  63. package/distrib/docs/symbols/JXG.EventEmitter.html +2 -2
  64. package/distrib/docs/symbols/JXG.ForeignObject.html +3 -3
  65. package/distrib/docs/symbols/JXG.GeometryElement.html +2 -2
  66. package/distrib/docs/symbols/JXG.GeometryElement3D.html +2 -2
  67. package/distrib/docs/symbols/JXG.GeonextParser.html +2 -2
  68. package/distrib/docs/symbols/JXG.Group.html +2 -2
  69. package/distrib/docs/symbols/JXG.Image.html +3 -3
  70. package/distrib/docs/symbols/JXG.JSXGraph.html +2 -2
  71. package/distrib/docs/symbols/JXG.JessieCode.html +2 -2
  72. package/distrib/docs/symbols/JXG.Legend.html +2 -2
  73. package/distrib/docs/symbols/JXG.Line.html +2 -2
  74. package/distrib/docs/symbols/JXG.Line3D.html +2 -2
  75. package/distrib/docs/symbols/JXG.Math.Clip.html +2 -2
  76. package/distrib/docs/symbols/JXG.Math.Extrapolate.html +2 -2
  77. package/distrib/docs/symbols/JXG.Math.Geometry.html +2 -2
  78. package/distrib/docs/symbols/JXG.Math.IntervalArithmetic.html +2 -2
  79. package/distrib/docs/symbols/JXG.Math.Metapost.html +2 -2
  80. package/distrib/docs/symbols/JXG.Math.Nlp.html +2 -2
  81. package/distrib/docs/symbols/JXG.Math.Numerics.html +23 -15
  82. package/distrib/docs/symbols/JXG.Math.Plot.html +2 -2
  83. package/distrib/docs/symbols/JXG.Math.Poly.Monomial.html +2 -2
  84. package/distrib/docs/symbols/JXG.Math.Poly.Polynomial.html +2 -2
  85. package/distrib/docs/symbols/JXG.Math.Poly.Ring.html +2 -2
  86. package/distrib/docs/symbols/JXG.Math.Poly.html +2 -2
  87. package/distrib/docs/symbols/JXG.Math.ProbFuncs.html +2 -2
  88. package/distrib/docs/symbols/JXG.Math.Quadtree.html +122 -7
  89. package/distrib/docs/symbols/JXG.Math.Statistics.html +2 -2
  90. package/distrib/docs/symbols/JXG.Math.Symbolic.html +2 -2
  91. package/distrib/docs/symbols/JXG.Math.html +45 -2
  92. package/distrib/docs/symbols/JXG.NoRenderer.html +2 -2
  93. package/distrib/docs/symbols/JXG.Options.html +2 -2
  94. package/distrib/docs/symbols/JXG.Plane3D.html +2 -2
  95. package/distrib/docs/symbols/JXG.Point.html +3 -3
  96. package/distrib/docs/symbols/JXG.Point3D.html +2 -2
  97. package/distrib/docs/symbols/JXG.Polygon.html +2 -2
  98. package/distrib/docs/symbols/JXG.SVGRenderer.html +2 -2
  99. package/distrib/docs/symbols/JXG.Server.html +2 -2
  100. package/distrib/docs/symbols/JXG.Server.modules.html +2 -2
  101. package/distrib/docs/symbols/JXG.Surface3D.html +2 -2
  102. package/distrib/docs/symbols/JXG.Text.html +8 -8
  103. package/distrib/docs/symbols/JXG.Ticks.html +2 -2
  104. package/distrib/docs/symbols/JXG.Transformation.html +2 -2
  105. package/distrib/docs/symbols/JXG.Turtle.html +2 -2
  106. package/distrib/docs/symbols/JXG.Util.Base64.html +2 -2
  107. package/distrib/docs/symbols/JXG.Util.UTF8.html +2 -2
  108. package/distrib/docs/symbols/JXG.Util.Unzip.html +2 -2
  109. package/distrib/docs/symbols/JXG.Util.html +2 -2
  110. package/distrib/docs/symbols/JXG.VMLRenderer.html +2 -2
  111. package/distrib/docs/symbols/JXG.View3D.html +2 -2
  112. package/distrib/docs/symbols/JXG.XML.html +2 -2
  113. package/distrib/docs/symbols/Label.html +114 -4
  114. package/distrib/docs/symbols/Legend.html +2 -2
  115. package/distrib/docs/symbols/Line.html +2 -2
  116. package/distrib/docs/symbols/Line3D.html +2 -2
  117. package/distrib/docs/symbols/Locus.html +2 -2
  118. package/distrib/docs/symbols/MajorArc.html +2 -2
  119. package/distrib/docs/symbols/MajorSector.html +2 -2
  120. package/distrib/docs/symbols/Metapostspline.html +2 -2
  121. package/distrib/docs/symbols/Midpoint.html +4 -4
  122. package/distrib/docs/symbols/MinorArc.html +2 -2
  123. package/distrib/docs/symbols/MinorSector.html +2 -2
  124. package/distrib/docs/symbols/Mirrorelement.html +2 -2
  125. package/distrib/docs/symbols/Mirrorpoint.html +4 -4
  126. package/distrib/docs/symbols/NonReflexAngle.html +2 -2
  127. package/distrib/docs/symbols/Normal.html +2 -2
  128. package/distrib/docs/symbols/Orthogonalprojection.html +4 -4
  129. package/distrib/docs/symbols/OtherIntersection.html +4 -4
  130. package/distrib/docs/symbols/Parabola.html +2 -2
  131. package/distrib/docs/symbols/Parallel.html +2 -2
  132. package/distrib/docs/symbols/Parallelpoint.html +4 -4
  133. package/distrib/docs/symbols/ParametricSurface3D.html +2 -2
  134. package/distrib/docs/symbols/Perpendicular.html +2 -2
  135. package/distrib/docs/symbols/PerpendicularPoint.html +4 -4
  136. package/distrib/docs/symbols/PerpendicularSegment.html +2 -2
  137. package/distrib/docs/symbols/Point.html +4 -4
  138. package/distrib/docs/symbols/Point3D.html +2 -2
  139. package/distrib/docs/symbols/PolarLine.html +2 -2
  140. package/distrib/docs/symbols/PolePoint.html +4 -4
  141. package/distrib/docs/symbols/Polygon.html +2 -2
  142. package/distrib/docs/symbols/PolygonalChain.html +2 -2
  143. package/distrib/docs/symbols/RadicalAxis.html +2 -2
  144. package/distrib/docs/symbols/Reflection.html +2 -2
  145. package/distrib/docs/symbols/ReflexAngle.html +2 -2
  146. package/distrib/docs/symbols/RegularPolygon.html +2 -2
  147. package/distrib/docs/symbols/Riemannsum.html +7 -3
  148. package/distrib/docs/symbols/Sector.html +2 -2
  149. package/distrib/docs/symbols/Segment.html +2 -2
  150. package/distrib/docs/symbols/Semicircle.html +2 -2
  151. package/distrib/docs/symbols/Slider.html +145 -4
  152. package/distrib/docs/symbols/Slopefield.html +2 -2
  153. package/distrib/docs/symbols/Slopetriangle.html +2 -2
  154. package/distrib/docs/symbols/Smartlabel.html +4 -4
  155. package/distrib/docs/symbols/Spline.html +2 -2
  156. package/distrib/docs/symbols/Stepfunction.html +2 -2
  157. package/distrib/docs/symbols/Tangent.html +2 -2
  158. package/distrib/docs/symbols/Tapemeasure.html +2 -2
  159. package/distrib/docs/symbols/Text.html +4 -4
  160. package/distrib/docs/symbols/Ticks.html +2 -2
  161. package/distrib/docs/symbols/Tracecurve.html +2 -2
  162. package/distrib/docs/symbols/Transformation.html +2 -2
  163. package/distrib/docs/symbols/Turtle.html +2 -2
  164. package/distrib/docs/symbols/Vectorfield.html +2 -2
  165. package/distrib/docs/symbols/View3D.html +2 -2
  166. package/distrib/docs/symbols/_global_.html +2 -2
  167. package/distrib/docs/symbols/src/src_3d_view3d.js.html +29 -30
  168. package/distrib/docs/symbols/src/src_base_board.js.html +5020 -4930
  169. package/distrib/docs/symbols/src/src_base_constants.js.html +1 -1
  170. package/distrib/docs/symbols/src/src_base_coordselement.js.html +1829 -1789
  171. package/distrib/docs/symbols/src/src_base_curve.js.html +783 -778
  172. package/distrib/docs/symbols/src/src_base_text.js.html +345 -358
  173. package/distrib/docs/symbols/src/src_element_checkbox.js.html +30 -30
  174. package/distrib/docs/symbols/src/src_element_slider.js.html +391 -377
  175. package/distrib/docs/symbols/src/src_math_numerics.js.html +1226 -1190
  176. package/distrib/docs/symbols/src/src_math_qdt.js.html +318 -194
  177. package/distrib/docs/symbols/src/src_options.js.html +7137 -7034
  178. package/distrib/docs/symbols/src/src_renderer_abstract.js.html +1168 -1167
  179. package/distrib/docs/symbols/src/src_renderer_canvas.js.html +1 -1
  180. package/distrib/docs/symbols/src/src_renderer_svg.js.html +489 -494
  181. package/distrib/docs/symbols/src/src_utils_env.js.html +127 -90
  182. package/distrib/docs.zip +0 -0
  183. package/distrib/geogebra.min.js +1 -1
  184. package/distrib/geonext.min.js +1 -1
  185. package/distrib/intergeo.min.js +1 -1
  186. package/distrib/jsxgraph.css +24 -22
  187. package/distrib/jsxgraph.zip +0 -0
  188. package/distrib/jsxgraphcore.js +2 -2
  189. package/distrib/jsxgraphcore.mjs +2 -2
  190. package/distrib/jsxgraphcore.mjs.map +1 -1
  191. package/distrib/jsxgraphsrc.js +707 -276
  192. package/distrib/jsxgraphsrc.mjs +707 -276
  193. package/distrib/jsxgraphsrc.mjs.map +1 -1
  194. package/distrib/sketch.min.js +1 -1
  195. package/package.json +1 -1
  196. package/src/3d/view3d.js +0 -1
  197. package/src/base/board.js +140 -50
  198. package/src/base/constants.js +1 -1
  199. package/src/base/coordselement.js +54 -14
  200. package/src/base/curve.js +6 -1
  201. package/src/base/text.js +13 -26
  202. package/src/element/checkbox.js +17 -17
  203. package/src/element/slider.js +16 -2
  204. package/src/math/heap.js +34 -4
  205. package/src/math/numerics.js +112 -76
  206. package/src/math/qdt.js +141 -17
  207. package/src/options.js +115 -12
  208. package/src/renderer/abstract.js +15 -14
  209. package/src/renderer/canvas.js +1 -1
  210. package/src/renderer/svg.js +0 -5
  211. package/src/utils/env.js +75 -38
@@ -59,7 +59,7 @@ return /******/ (function() { // webpackBootstrap
59
59
 
60
60
  var major = 1,
61
61
  minor = 6,
62
- patch = 0,
62
+ patch = 1,
63
63
  add = '', //'dev' 'beta'
64
64
  version = major + '.' + minor + '.' + patch + (add ? '-' + add : ''),
65
65
  constants;
@@ -829,6 +829,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
829
829
  newCoords, newPos,
830
830
  doRound = false,
831
831
  ev_sw,
832
+ snappedTo, snapValues,
832
833
  slide = this.slideObject,
833
834
  res, cu,
834
835
  slides = [],
@@ -957,20 +958,28 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
957
958
  }
958
959
  }
959
960
 
960
- // Snap the glider point of the slider into its appropiate position
961
- // First, recalculate the new value of this.position
962
- // Second, call update(fromParent==true) to make the positioning snappier.
963
- ev_sw = _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(this.visProp.snapwidth);
964
- if (
965
- _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(ev_sw) > 0.0 &&
966
- Math.abs(this._smax - this._smin) >= _math_math__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.eps
967
- ) {
968
- newPos = Math.max(Math.min(newPos, 1), 0);
969
-
970
- v = newPos * (this._smax - this._smin) + this._smin;
971
- v = Math.round(v / ev_sw) * ev_sw;
972
- newPos = (v - this._smin) / (this._smax - this._smin);
961
+ // Snap the glider to snap values.
962
+ snappedTo = this.findClosestSnapValue(newPos);
963
+ if(snappedTo !== null) {
964
+ snapValues = _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(this.visProp.snapvalues);
965
+ newPos = (snapValues[snappedTo] - this._smin) / (this._smax - this._smin);
973
966
  this.update(true);
967
+ } else {
968
+ // Snap the glider point of the slider into its appropiate position
969
+ // First, recalculate the new value of this.position
970
+ // Second, call update(fromParent==true) to make the positioning snappier.
971
+ ev_sw = _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(this.visProp.snapwidth);
972
+ if (
973
+ _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(ev_sw) > 0.0 &&
974
+ Math.abs(this._smax - this._smin) >= _math_math__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.eps
975
+ ) {
976
+ newPos = Math.max(Math.min(newPos, 1), 0);
977
+
978
+ v = newPos * (this._smax - this._smin) + this._smin;
979
+ v = Math.round(v / ev_sw) * ev_sw;
980
+ newPos = (v - this._smin) / (this._smax - this._smin);
981
+ this.update(true);
982
+ }
974
983
  }
975
984
 
976
985
  p1c = slide.point1.coords;
@@ -1117,6 +1126,37 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
1117
1126
  this.position = newPos;
1118
1127
  },
1119
1128
 
1129
+ /**
1130
+ * Find the closest entry in snapValues that is within snapValueDistance of pos.
1131
+ *
1132
+ * @param {Number} pos Value for which snapping is calculated.
1133
+ * @returns {Number} Index of the value to snap to, or null.
1134
+ * @private
1135
+ */
1136
+ findClosestSnapValue: function(pos) {
1137
+ var i, d,
1138
+ snapValues, snapValueDistance,
1139
+ snappedTo = null;
1140
+
1141
+ // Snap the glider to snap values.
1142
+ snapValues = _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(this.visProp.snapvalues);
1143
+ snapValueDistance = _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(this.visProp.snapvaluedistance);
1144
+
1145
+ if (_utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.isArray(snapValues) &&
1146
+ Math.abs(this._smax - this._smin) >= _math_math__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.eps &&
1147
+ snapValueDistance > 0.0) {
1148
+ for (i = 0; i < snapValues.length; i++) {
1149
+ d = Math.abs(pos * (this._smax - this._smin) + this._smin - snapValues[i]);
1150
+ if (d < snapValueDistance) {
1151
+ snapValueDistance = d;
1152
+ snappedTo = i;
1153
+ }
1154
+ }
1155
+ }
1156
+
1157
+ return snappedTo;
1158
+ },
1159
+
1120
1160
  /**
1121
1161
  * Update of a glider in case a parent element has been updated. That means the
1122
1162
  * relative position of the glider stays the same.
@@ -2502,7 +2542,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
2502
2542
  * @returns {JXG.CoordsElement} Reference to itself.
2503
2543
  */
2504
2544
  _anim: function (direction, stepCount) {
2505
- var dX, dY, alpha, startPoint, newX, radius, sp1c, sp2c, res, d;
2545
+ var dX, dY, alpha, startPoint, newX, radius, sp1c, sp2c, res;
2506
2546
 
2507
2547
  this.intervalCount += 1;
2508
2548
  if (this.intervalCount > stepCount) {
@@ -5895,7 +5935,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
5895
5935
  },
5896
5936
 
5897
5937
  /**
5898
- * The update function of the renderert
5938
+ * The update function of the renderer
5899
5939
  * is called.
5900
5940
  * @private
5901
5941
  */
@@ -6365,11 +6405,9 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
6365
6405
  * @param {Number} h width of the box in pixel
6366
6406
  * @return {Number} Number of overlapping elements
6367
6407
  */
6368
- getNumberofConflicts: function (x, y, w, h) {
6408
+ getNumberOfConflicts: function (x, y, w, h) {
6369
6409
  var count = 0,
6370
- i,
6371
- obj,
6372
- le,
6410
+ i, obj, le,
6373
6411
  savePointPrecision;
6374
6412
 
6375
6413
  // Set the precision of hasPoint to half the max if label isn't too long
@@ -6404,33 +6442,22 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
6404
6442
  * @returns {JXG.Text} Reference to the text object.
6405
6443
  */
6406
6444
  setAutoPosition: function () {
6407
- var x,
6408
- y,
6409
- cx,
6410
- cy,
6445
+ var x, y, cx, cy,
6411
6446
  anchorCoords,
6412
6447
  // anchorX, anchorY,
6413
6448
  w = this.size[0],
6414
6449
  h = this.size[1],
6415
- start_angle,
6416
- angle,
6450
+ start_angle, angle,
6417
6451
  optimum = {
6418
6452
  conflicts: Infinity,
6419
6453
  angle: 0,
6420
6454
  r: 0
6421
6455
  },
6422
- max_r,
6423
- delta_r,
6424
- conflicts,
6425
- offset,
6426
- r,
6456
+ max_r, delta_r,
6457
+ conflicts, offset, r,
6427
6458
  num_positions = 12,
6428
6459
  step = (2 * Math.PI) / num_positions,
6429
- j,
6430
- dx,
6431
- dy,
6432
- co,
6433
- si;
6460
+ j, dx, dy, co, si;
6434
6461
 
6435
6462
  if (
6436
6463
  this === this.board.infobox ||
@@ -6453,15 +6480,15 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
6453
6480
  dx = offset[0];
6454
6481
  dy = offset[1];
6455
6482
 
6456
- conflicts = this.getNumberofConflicts(cx + dx, cy - dy, w, h);
6483
+ conflicts = this.getNumberOfConflicts(cx + dx, cy - dy, w, h);
6457
6484
  if (conflicts === 0) {
6458
6485
  return this;
6459
6486
  }
6460
6487
  // console.log(this.id, conflicts, w, h);
6461
6488
  // r = Geometry.distance([0, 0], offset, 2);
6462
6489
 
6463
- r = 12;
6464
- max_r = 28;
6490
+ r = _utils_type__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.evaluate(this.visProp.autopositionmindistance);
6491
+ max_r = _utils_type__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.evaluate(this.visProp.autopositionmaxdistance);
6465
6492
  delta_r = 0.2 * r;
6466
6493
 
6467
6494
  start_angle = Math.atan2(dy, dx);
@@ -6470,7 +6497,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
6470
6497
  optimum.angle = start_angle;
6471
6498
  optimum.r = r;
6472
6499
 
6473
- while (optimum.conflicts > 0 && r < max_r) {
6500
+ while (optimum.conflicts > 0 && r <= max_r) {
6474
6501
  for (
6475
6502
  j = 1, angle = start_angle + step;
6476
6503
  j < num_positions && optimum.conflicts > 0;
@@ -6482,7 +6509,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
6482
6509
  x = cx + r * co;
6483
6510
  y = cy - r * si;
6484
6511
 
6485
- conflicts = this.getNumberofConflicts(x, y, w, h);
6512
+ conflicts = this.getNumberOfConflicts(x, y, w, h);
6486
6513
  if (conflicts < optimum.conflicts) {
6487
6514
  optimum.conflicts = conflicts;
6488
6515
  optimum.angle = angle;
@@ -16357,12 +16384,18 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16357
16384
  /**
16358
16385
  * Helper function to create curve which displays Riemann sums.
16359
16386
  * Compute coordinates for the rectangles showing the Riemann sum.
16387
+ * <p>
16388
+ * In case of type "simpson" and "trapezoidal", the horizontal line approximating the function value
16389
+ * is replaced by a parabola or a secant. IN case of "simpson",
16390
+ * the parabola is approximated visually by a polygonal chain of fixed step width.
16391
+ *
16360
16392
  * @param {Function,Array} f Function or array of two functions.
16361
16393
  * If f is a function the integral of this function is approximated by the Riemann sum.
16362
16394
  * If f is an array consisting of two functions the area between the two functions is filled
16363
16395
  * by the Riemann sum bars.
16364
16396
  * @param {Number} n number of rectangles.
16365
16397
  * @param {String} type Type of approximation. Possible values are: 'left', 'right', 'middle', 'lower', 'upper', 'random', 'simpson', or 'trapezoidal'.
16398
+ * "simpson" is Simpson's 1/3 rule.
16366
16399
  * @param {Number} start Left border of the approximation interval
16367
16400
  * @param {Number} end Right border of the approximation interval
16368
16401
  * @returns {Array} An array of two arrays containing the x and y coordinates for the rectangles showing the Riemann sum. This
@@ -16371,18 +16404,14 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16371
16404
  * @memberof JXG.Math.Numerics
16372
16405
  */
16373
16406
  riemann: function (gf, n, type, start, end) {
16374
- var i,
16375
- delta,
16407
+ var i, delta,
16408
+ k, a, b, c, f0, f1, f2, xx, h,
16409
+ steps = 30, // Fixed step width for Simpson's rule
16376
16410
  xarr = [],
16377
16411
  yarr = [],
16378
- j = 0,
16379
16412
  x = start,
16380
- y,
16381
16413
  sum = 0,
16382
- f,
16383
- g,
16384
- ylow,
16385
- yup;
16414
+ y, f, g;
16386
16415
 
16387
16416
  if (_utils_type__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.isArray(gf)) {
16388
16417
  g = gf[0];
@@ -16399,61 +16428,94 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16399
16428
 
16400
16429
  delta = (end - start) / n;
16401
16430
 
16402
- // Upper bar ends
16431
+ // "Upper" horizontal line defined by function
16403
16432
  for (i = 0; i < n; i++) {
16404
- y = this._riemannValue(x, f, type, delta);
16405
- xarr[j] = x;
16406
- yarr[j] = y;
16433
+ if (type === "simpson") {
16434
+ sum += this._riemannValue(x, f, type, delta) * delta;
16435
+
16436
+ h = delta * 0.5;
16437
+ f0 = f(x);
16438
+ f1 = f(x + h);
16439
+ f2 = f(x + 2 * h);
16440
+
16441
+ a = (f2 + f0 - 2 * f1) / (h * h) * 0.5;
16442
+ b = (f2 - f0) / (2 * h);
16443
+ c = f1;
16444
+ for (k = 0; k < steps; k++) {
16445
+ xx = k * delta / steps - h;
16446
+ xarr.push(x + xx + h);
16447
+ yarr.push(a * xx * xx + b * xx + c);
16448
+ }
16449
+ x += delta;
16450
+ y = f2;
16451
+ } else {
16452
+ y = this._riemannValue(x, f, type, delta);
16453
+ xarr.push(x);
16454
+ yarr.push(y);
16455
+
16456
+ x += delta;
16457
+ if (type === "trapezoidal") {
16458
+ f2 = f(x);
16459
+ sum += (y + f2) * 0.5 * delta;
16460
+ y = f2;
16461
+ } else {
16462
+ sum += y * delta;
16463
+ }
16407
16464
 
16408
- j += 1;
16409
- x += delta;
16410
- if (type === "trapezoidal") {
16411
- y = f(x);
16465
+ xarr.push(x);
16466
+ yarr.push(y);
16412
16467
  }
16413
- xarr[j] = x;
16414
- yarr[j] = y;
16415
-
16416
- j += 1;
16468
+ xarr.push(x);
16469
+ yarr.push(y);
16417
16470
  }
16418
16471
 
16419
- // Lower bar ends
16472
+ // "Lower" horizontal line
16473
+ // Go backwards
16420
16474
  for (i = 0; i < n; i++) {
16421
- if (g) {
16422
- y = this._riemannValue(x, g, type, -delta);
16423
- } else {
16424
- y = 0.0;
16425
- }
16426
- xarr[j] = x;
16427
- yarr[j] = y;
16428
-
16429
- j += 1;
16430
- x -= delta;
16431
- if (type === "trapezoidal" && g) {
16432
- y = g(x);
16433
- }
16434
- xarr[j] = x;
16435
- yarr[j] = y;
16436
-
16437
- // Add the area of the bar to 'sum'
16438
- if (type !== "trapezoidal") {
16439
- ylow = y;
16440
- yup = yarr[2 * (n - 1) - 2 * i];
16475
+ if (type === "simpson" && g) {
16476
+ sum -= this._riemannValue(x, g, type, -delta) * delta;
16477
+
16478
+ h = delta * 0.5;
16479
+ f0 = g(x);
16480
+ f1 = g(x - h);
16481
+ f2 = g(x - 2 * h);
16482
+
16483
+ a = (f2 + f0 - 2 * f1) / (h * h) * 0.5;
16484
+ b = (f2 - f0) / (2 * h);
16485
+ c = f1;
16486
+ for (k = 0; k < steps; k++) {
16487
+ xx = k * delta / steps - h;
16488
+ xarr.push(x - xx - h);
16489
+ yarr.push(a * xx * xx + b * xx + c);
16490
+ }
16491
+ x -= delta;
16492
+ y = f2;
16441
16493
  } else {
16442
- yup = 0.5 * (f(x + delta) + f(x));
16443
16494
  if (g) {
16444
- ylow = 0.5 * (g(x + delta) + g(x));
16495
+ y = this._riemannValue(x, g, type, -delta);
16445
16496
  } else {
16446
- ylow = 0.0;
16497
+ y = 0.0;
16498
+ }
16499
+ xarr.push(x);
16500
+ yarr.push(y);
16501
+
16502
+ x -= delta;
16503
+ if (g) {
16504
+ if (type === "trapezoidal") {
16505
+ f2 = g(x);
16506
+ sum -= (y + f2) * 0.5 * delta;
16507
+ y = f2;
16508
+ } else {
16509
+ sum -= y * delta;
16510
+ }
16447
16511
  }
16448
16512
  }
16449
- sum += (yup - ylow) * delta;
16513
+ xarr.push(x);
16514
+ yarr.push(y);
16450
16515
 
16451
16516
  // Draw the vertical lines
16452
- j += 1;
16453
- xarr[j] = x;
16454
- yarr[j] = yarr[2 * (n - 1) - 2 * i];
16455
-
16456
- j += 1;
16517
+ xarr.push(x);
16518
+ yarr.push(f(x));
16457
16519
  }
16458
16520
 
16459
16521
  return [xarr, yarr, sum];
@@ -16479,12 +16541,12 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16479
16541
  * @memberof JXG.Math.Numerics
16480
16542
  */
16481
16543
  riemannsum: function (f, n, type, start, end) {
16482
- _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.deprecated("Numerics.riemannsum()", "Numerics.riemann()");
16544
+ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.deprecated("Numerics.riemannsum()", "Numerics.riemann()[2]");
16483
16545
  return this.riemann(f, n, type, start, end)[2];
16484
16546
  },
16485
16547
 
16486
16548
  /**
16487
- * Solve initial value problems numerically using Runge-Kutta-methods.
16549
+ * Solve initial value problems numerically using <i>explicit</i> Runge-Kutta methods.
16488
16550
  * See {@link https://en.wikipedia.org/wiki/Runge-Kutta_methods} for more information on the algorithm.
16489
16551
  * @param {object,String} butcher Butcher tableau describing the Runge-Kutta method to use. This can be either a string describing
16490
16552
  * a Runge-Kutta method with a Butcher tableau predefined in JSXGraph like 'euler', 'heun', 'rk4' or an object providing the structure
@@ -16496,18 +16558,20 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16496
16558
  * c: &lt;Array&gt;
16497
16559
  * }
16498
16560
  * </pre>
16499
- * which corresponds to the Butcher tableau structure shown here: https://en.wikipedia.org/w/index.php?title=List_of_Runge%E2%80%93Kutta_methods&oldid=357796696
16500
- * @param {Array} x0 Initial value vector. If the problem is of one-dimensional, the initial value also has to be given in an array.
16561
+ * which corresponds to the Butcher tableau structure
16562
+ * shown here: https://en.wikipedia.org/w/index.php?title=List_of_Runge%E2%80%93Kutta_methods&oldid=357796696 .
16563
+ * <i>Default</i> is 'euler'.
16564
+ * @param {Array} x0 Initial value vector. Even if the problem is one-dimensional, the initial value has to be given in an array.
16501
16565
  * @param {Array} I Interval on which to integrate.
16502
- * @param {Number} N Number of evaluation points.
16566
+ * @param {Number} N Number of integration intervals, i.e. there are <i>N+1</i> evaluation points.
16503
16567
  * @param {function} f Function describing the right hand side of the first order ordinary differential equation, i.e. if the ode
16504
- * is given by the equation <pre>dx/dt = f(t, x(t)).</pre> So f has to take two parameters, a number <tt>t</tt> and a
16505
- * vector <tt>x</tt>, and has to return a vector of the same dimension as <tt>x</tt> has.
16568
+ * is given by the equation <pre>dx/dt = f(t, x(t))</pre>. So, f has to take two parameters, a number <tt>t</tt> and a
16569
+ * vector <tt>x</tt>, and has to return a vector of the same length as <tt>x</tt> has.
16506
16570
  * @returns {Array} An array of vectors describing the solution of the ode on the given interval I.
16507
16571
  * @example
16508
16572
  * // A very simple autonomous system dx(t)/dt = x(t);
16509
- * function f(t, x) {
16510
- * return x;
16573
+ * var f = function(t, x) {
16574
+ * return [x[0]];
16511
16575
  * }
16512
16576
  *
16513
16577
  * // Solve it with initial value x(0) = 1 on the interval [0, 2]
@@ -16518,7 +16582,8 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16518
16582
  * var dataX = [];
16519
16583
  * var dataY = [];
16520
16584
  * var h = 0.1; // (I[1] - I[0])/N = (2-0)/20
16521
- * for(var i=0; i&lt;data.length; i++) {
16585
+ * var i;
16586
+ * for(i=0; i&lt;data.length; i++) {
16522
16587
  * dataX[i] = i*h;
16523
16588
  * dataY[i] = data[i][0];
16524
16589
  * }
@@ -16526,7 +16591,7 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16526
16591
  * </pre><div class="jxgbox" id="JXGd2432d04-4ef7-4159-a90b-a2eb8d38c4f6" style="width: 300px; height: 300px;"></div>
16527
16592
  * <script type="text/javascript">
16528
16593
  * var board = JXG.JSXGraph.initBoard('JXGd2432d04-4ef7-4159-a90b-a2eb8d38c4f6', {boundingbox: [-1, 5, 5, -1], axis: true, showcopyright: false, shownavigation: false});
16529
- * function f(t, x) {
16594
+ * var f = function(t, x) {
16530
16595
  * // we have to copy the value.
16531
16596
  * // return x; would just return the reference.
16532
16597
  * return [x[0]];
@@ -16545,11 +16610,7 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16545
16610
  */
16546
16611
  rungeKutta: function (butcher, x0, I, N, f) {
16547
16612
  var e,
16548
- i,
16549
- j,
16550
- k,
16551
- l,
16552
- s,
16613
+ i, j, k, l, s,
16553
16614
  x = [],
16554
16615
  y = [],
16555
16616
  h = (I[1] - I[0]) / N,
@@ -16564,17 +16625,19 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16564
16625
  s = butcher.s;
16565
16626
 
16566
16627
  // don't change x0, so copy it
16567
- for (e = 0; e < dim; e++) {
16568
- x[e] = x0[e];
16569
- }
16628
+ // for (e = 0; e < dim; e++) {
16629
+ // x[e] = x0[e];
16630
+ // }
16631
+ x = x0.slice();
16570
16632
 
16571
- for (i = 0; i < N; i++) {
16633
+ for (i = 0; i <= N; i++) {
16572
16634
  // Optimization doesn't work for ODEs plotted using time
16573
16635
  // if((i % quotient == 0) || (i == N-1)) {
16574
- result[r] = [];
16575
- for (e = 0; e < dim; e++) {
16576
- result[r][e] = x[e];
16577
- }
16636
+ // result[r] = [];
16637
+ // for (e = 0; e < dim; e++) {
16638
+ // result[r][e] = x[e];
16639
+ // }
16640
+ result[r] = x.slice();
16578
16641
 
16579
16642
  r += 1;
16580
16643
  k = [];
@@ -16647,7 +16710,7 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16647
16710
  * @param {Function} f Function, whose root is to be found
16648
16711
  * @param {Number} x0 Start value
16649
16712
  * @param {Object} object Parent object in case f is method of it
16650
- * @returns {Array} [x_0, f(x_0), x_1, f(x_1)] in case that x_0 <= x_1
16713
+ * @returns {Array} [x_0, f(x_0), x_1, f(x_1)] in case that x_0 <= x_1
16651
16714
  * or [x_1, f(x_1), x_0, f(x_0)] in case that x_1 < x_0.
16652
16715
  *
16653
16716
  * @see JXG.Math.Numerics.fzero
@@ -19010,7 +19073,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19010
19073
  * Especially, on mobile devices this enhances the user experience.
19011
19074
  * However, it is recommended to allow dragging outside of the JSXGraph board only
19012
19075
  * in certain constructions where users may not "loose" points outside of the board.
19013
- * Then points may become unreachable.
19076
+ * In such a case, points may become unreachable.
19014
19077
  * <p>
19015
19078
  * A situation where dragging outside of the board is uncritical is for example if
19016
19079
  * only sliders are used to interact with the construction.
@@ -19022,9 +19085,18 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19022
19085
  * <li> document
19023
19086
  * </ul>
19024
19087
  * <p>
19088
+ * Since the introduction of this attribute "moveTarget", the value "document" has become sort of
19089
+ * default on touch devices like smartphones. However, it is no longer the case that the document listens to
19090
+ * move events, but there is the new feature "setPointerCapture", which is also implicitly enabled on certain devices.
19091
+ * In future versions, JSXGraph may adopt this new standard and distinguish only two cases:
19092
+ * <ul>
19093
+ * <li>null: no pointerCapture
19094
+ * <li>document: use pointerCapture
19095
+ * </ul>
19096
+ * <p>
19025
19097
  * This attribute is immutable.
19026
19098
  * It can be changed as follows:
19027
- *
19099
+ *
19028
19100
  * @example
19029
19101
  * board.setAttribute({moveTarget: null});
19030
19102
  * board.removeEventHandlers();
@@ -19107,9 +19179,9 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19107
19179
  * Allow user interaction by registering mouse, pointer, keyboard or touch events.
19108
19180
  * Decide if JSXGraph listens to these events. Keyboard events can then turned off
19109
19181
  * separately with the keyboard attribute.
19110
- *
19182
+ *
19111
19183
  * <p>This attribute is immutable. Please use
19112
- * {@link JXG.Board#addEventHandlers()} and
19184
+ * {@link JXG.Board#addEventHandlers()} and
19113
19185
  * {@link JXG.Board#removeEventHandlers()} directly.
19114
19186
  *
19115
19187
  * @name JXG.Board#registerEvents
@@ -19125,7 +19197,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19125
19197
  * Listen to fullscreen event.
19126
19198
  *
19127
19199
  * <p>This attribute is immutable. Please use
19128
- * {@link JXG.Board#addFullscreenEventHandlers()} and
19200
+ * {@link JXG.Board#addFullscreenEventHandlers()} and
19129
19201
  * {@link JXG.Board#removeEventHandlers()} directly.
19130
19202
  *
19131
19203
  * @name JXG.Board#registerFullscreenEvent
@@ -19139,14 +19211,14 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19139
19211
  /**
19140
19212
  * Listen to resize events, i.e. start "resizeObserver" or handle the resize event with
19141
19213
  * "resizeListener". This is independent from the mouse, touch, pointer events.
19142
- *
19214
+ *
19143
19215
  * <p>This attribute is immutable. Please use
19144
- * {@link JXG.Board#addResizeEventHandlers()} and
19216
+ * {@link JXG.Board#addResizeEventHandlers()} and
19145
19217
  * {@link JXG.Board#removeEventHandlers()} directly.
19146
19218
  * <p>
19147
19219
  * This attribute just starts a resizeObserver. If the resizeObserver reacts
19148
19220
  * to size changed is controled wuth {@link JXG.Board#resize}.
19149
- *
19221
+ *
19150
19222
  * @name JXG.Board#registerResizeEvent
19151
19223
  * @see JXG.Board#resize
19152
19224
  * @see JXG.Board#registerEvents
@@ -19163,7 +19235,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19163
19235
  * <p>
19164
19236
  * In case of 'canvas' it is advisable to call 'board.update()' after all elements have been
19165
19237
  * constructed. This ensures that all elements are drawn with their intended visual appearance.
19166
- *
19238
+ *
19167
19239
  * <p>
19168
19240
  * This attribute is immutable.
19169
19241
  *
@@ -22194,11 +22266,11 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
22194
22266
  width: 0.4,
22195
22267
 
22196
22268
  /**
22197
- * Angle under which comb elements are positioned.
22269
+ * Angle - given in radians - under which comb elements are positioned.
22198
22270
  *
22199
22271
  * @type Number
22200
22272
  * @name Comb#angle
22201
- * @default 60 degrees
22273
+ * @default Math.PI / 3 (i.e. &pi; /3 or 60^° degrees)
22202
22274
  */
22203
22275
  angle: Math.PI / 3,
22204
22276
 
@@ -23034,7 +23106,37 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
23034
23106
  *
23035
23107
  *
23036
23108
  */
23037
- autoPosition: false
23109
+ autoPosition: false,
23110
+
23111
+ /**
23112
+ * The auto position algorithm tries to put a label to a conflict-free
23113
+ * position around it's anchor element. For this, the algorithm tests 12 positions
23114
+ * around the anchor element starting at a distance from the anchor
23115
+ * defined here (in pixel).
23116
+ *
23117
+ * @name Label#autoPositionMinDistance
23118
+ * @see Label#autoPosition
23119
+ * @see Label#autoPositionMaxDistance
23120
+ * @type Number
23121
+ * @default 12
23122
+ *
23123
+ */
23124
+ autoPositionMinDistance: 12,
23125
+
23126
+ /**
23127
+ * The auto position algorithm tries to put a label to a conflict-free
23128
+ * position around it's anchor element. For this, the algorithm tests 12 positions
23129
+ * around the anchor element up to a distance from the anchor
23130
+ * defined here (in pixel).
23131
+ *
23132
+ * @name Label#autoPositionMaxDistance
23133
+ * @see Label#autoPosition
23134
+ * @see Label#autoPositionMinDistance
23135
+ * @type Number
23136
+ * @default 28
23137
+ *
23138
+ */
23139
+ autoPositionMaxDistance: 28
23038
23140
 
23039
23141
  /**#@-*/
23040
23142
  },
@@ -24336,6 +24438,70 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
24336
24438
  */
24337
24439
  snapWidth: -1, // -1 = deactivated
24338
24440
 
24441
+ /**
24442
+ * List of values to snap to. If the glider is within snapValueDistance
24443
+ * (in user coordinate units) of one of these points,
24444
+ * then the glider snaps to that point.
24445
+ *
24446
+ * @memberOf Slider.prototype
24447
+ * @name snapValues
24448
+ * @type Array
24449
+ * @see Slider#snapValueDistance
24450
+ * @default empty
24451
+ *
24452
+ * @example
24453
+ * var n = board.create('slider', [[-2, 3], [4, 3], [1, 5, 100]], {
24454
+ * name: 'n',
24455
+ * snapWidth: 1,
24456
+ * snapValues: [1, 22, 77, 100],
24457
+ * snapValueDistance: 5
24458
+ * });
24459
+ *
24460
+ * var k = board.create('slider', [[-2, -1], [4, -1], [-4, 0, 4]], {
24461
+ * name: 'k',
24462
+ * snapWidth: 0.1,
24463
+ * snapValues: [-3, -1, 1, 3],
24464
+ * snapValueDistance: 0.4
24465
+ * });
24466
+ *
24467
+ * </pre><div id="JXG9be68014-4e14-479a-82b4-e92d9b8f6eef" class="jxgbox" style="width: 300px; height: 300px;"></div>
24468
+ * <script type="text/javascript">
24469
+ * (function() {
24470
+ * var board = JXG.JSXGraph.initBoard('JXG9be68014-4e14-479a-82b4-e92d9b8f6eef',
24471
+ * {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
24472
+ * var n = board.create('slider', [[-2, 3], [4, 3], [1, 5, 100]], {
24473
+ * name: 'n',
24474
+ * snapWidth: 1,
24475
+ * snapValues: [1, 22, 77, 100],
24476
+ * snapValueDistance: 5
24477
+ * });
24478
+ *
24479
+ * var k = board.create('slider', [[-2, -1], [4, -1], [-4, 0, 4]], {
24480
+ * name: 'k',
24481
+ * snapWidth: 0.1,
24482
+ * snapValues: [-3, -1, 1, 3],
24483
+ * snapValueDistance: 0.4
24484
+ * });
24485
+ *
24486
+ * })();
24487
+ *
24488
+ * </script><pre>
24489
+ *
24490
+ */
24491
+ snapValues: [],
24492
+
24493
+ /**
24494
+ * If the difference between the slider value and one of the elements of snapValues is less
24495
+ * than this number (in user coordinate units), the slider will snap to that value.
24496
+ *
24497
+ * @memberOf Slider.prototype
24498
+ * @name snapValueDistance
24499
+ * @type Number
24500
+ * @see Slider#snapValues
24501
+ * @default 0.0
24502
+ */
24503
+ snapValueDistance: 0.0,
24504
+
24339
24505
  /**
24340
24506
  * The precision of the slider value displayed in the optional text.
24341
24507
  * Replaced by the attribute "digits".
@@ -32044,7 +32210,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
32044
32210
  /**
32045
32211
  * Cross browser mouse / pointer / touch coordinates retrieval relative to the documents's top left corner.
32046
32212
  * This method might be a bit outdated today, since pointer events and clientX/Y are omnipresent.
32047
- *
32213
+ *
32048
32214
  * @param {Object} [e] The browsers event object. If omitted, <tt>window.event</tt> will be used.
32049
32215
  * @param {Number} [index] If <tt>e</tt> is a touch event, this provides the index of the touch coordinates, i.e. it determines which finger.
32050
32216
  * @param {Object} [doc] The document object.
@@ -32409,10 +32575,16 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
32409
32575
  *
32410
32576
  */
32411
32577
  scaleJSXGraphDiv: function (wrap_id, inner_id, doc, scale) {
32412
- var len = doc.styleSheets.length, style, rule, w, h, b, wi, hi, bi,
32413
- scale_l, vshift_l, // scale_p, vshift_p,
32578
+ var len = doc.styleSheets.length, style, rule,
32579
+ w, h, b,
32580
+ wi, hi,
32581
+ wo, ho, inner,
32582
+ scale_l, vshift_l,
32414
32583
  f = scale,
32415
- rule_inner_l, // rule_inner_p,
32584
+ ratio,
32585
+ rule_inner_l,
32586
+ title = 'jsxgraph_fullscreen_css',
32587
+ found_css,
32416
32588
  pseudo_keys = [
32417
32589
  ":fullscreen",
32418
32590
  ":-webkit-full-screen",
@@ -32435,45 +32607,80 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
32435
32607
  h = b.height;
32436
32608
  w = b.width;
32437
32609
 
32438
- bi = doc.getElementById(inner_id).getBoundingClientRect();
32439
- hi = bi.height;
32440
- wi = bi.width;
32610
+ inner = doc.getElementById(inner_id);
32611
+ wo = inner._cssFullscreenStore.w;
32612
+ ho = inner._cssFullscreenStore.h;
32613
+ ratio = ho / wo;
32441
32614
 
32442
- if (wi / hi >= w / h) {
32443
- scale_l = (f * w) / wi;
32615
+ // Scale the div such that fits into the fullscreen.
32616
+ if (wo > w * f) {
32617
+ wo = w * f;
32618
+ ho = wo * ratio;
32619
+ }
32620
+ if (ho > h * f) {
32621
+ ho = h * f;
32622
+ wo = ho / ratio;
32623
+ }
32624
+
32625
+ wi = wo;
32626
+ hi = ho;
32627
+ // Compare this.setBoundingBox()
32628
+ if (ratio > 1) {
32629
+ // h > w
32630
+ if (ratio < h / w) {
32631
+ scale_l = w * f / wo;
32632
+ } else {
32633
+ scale_l = h * f / ho;
32634
+ }
32444
32635
  } else {
32445
- scale_l = (f * h) / hi;
32636
+ // h <= w
32637
+ if (ratio < h / w) {
32638
+ scale_l = w * f / wo;
32639
+ } else {
32640
+ scale_l = h * f / ho;
32641
+ }
32446
32642
  }
32447
32643
  vshift_l = (h - hi) * 0.5;
32448
32644
 
32449
32645
  // CSS rules to center the inner div horizontally and vertically.
32450
32646
  rule_inner_l =
32451
- "{margin:0 auto;transform:matrix(" +
32452
- scale_l +
32453
- ",0,0," +
32454
- scale_l +
32455
- ",0," +
32456
- vshift_l +
32457
- ");}";
32458
-
32459
- if (len === 0) {
32460
- // In case there is not a single CSS rule defined at all.
32647
+ "{" +
32648
+ "width:" + wi + "px !important;" +
32649
+ "height:" + hi + "px !important;" +
32650
+ "margin:0 auto;" +
32651
+ "transform:matrix(" + scale_l + ",0,0," + scale_l + ",0," + vshift_l + ");" +
32652
+ "}";
32653
+
32654
+ found_css = false;
32655
+ // Removing of the CSS here should happen only
32656
+ // in emergency cases.
32657
+ for (i = len - 1; i >= 0; i--) {
32658
+ if (doc.styleSheets[i].title === title) {
32659
+ found_css = true;
32660
+
32661
+ if (doc.styleSheets[i].title === title &&
32662
+ doc.styleSheets[i].cssRules.length > 0 &&
32663
+ regex.test(doc.styleSheets[i].cssRules[0].cssText) &&
32664
+ doc.styleSheets[i].deleteRule
32665
+ ) {
32666
+ doc.styleSheets[i].deleteRule(0);
32667
+ break;
32668
+ }
32669
+ }
32670
+ }
32671
+ if (!found_css) {
32672
+ // In case there is not yet a CSS style sheet for fullscreen
32673
+ // defined, do it now.
32461
32674
  style = document.createElement("style");
32675
+ style.setAttribute('title', title);
32462
32676
  // WebKit hack :(
32463
32677
  style.appendChild(document.createTextNode(""));
32464
- // Add the <style> element to the page
32465
- doc.appendChild(style);
32466
- len = doc.styleSheets.length;
32467
- }
32468
-
32469
- // Remove a previously installed CSS rule.
32470
- if (
32471
- doc.styleSheets[len - 1].cssRules.length > 0 &&
32472
- regex.test(doc.styleSheets[len - 1].cssRules[0].cssText) &&
32473
- doc.styleSheets[len - 1].deleteRule
32474
- ) {
32475
- doc.styleSheets[len - 1].deleteRule(0);
32678
+ // Add the <style> element to the page head.
32679
+ // It must be document, not the shadowDOM root.
32680
+ // It seems that the head tag does always exist.
32681
+ document.head.appendChild(style);
32476
32682
  }
32683
+ len = doc.styleSheets.length;
32477
32684
 
32478
32685
  // Install a CSS rule to center the JSXGraph div at the first position of the list.
32479
32686
  for (i = 0; i < len_pseudo; i++) {
@@ -32483,14 +32690,10 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
32483
32690
  doc.styleSheets[len - 1].insertRule(rule, 0);
32484
32691
 
32485
32692
  break;
32486
- } catch (err) {
32487
- // console.log('JXG.scaleJSXGraphDiv: Could not add CSS rule "' + pseudo_keys[i] + '".');
32488
- // console.log('One possible reason could be that the id of the JSXGraph container does not start with a letter.');
32489
- }
32693
+ } catch (err) {}
32490
32694
  }
32491
32695
  if (i === len_pseudo) {
32492
- console.log("JXG.scaleJSXGraphDiv: Could not add any CSS rule.");
32493
- console.log(
32696
+ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.debug("JXG.scaleJSXGraphDiv: Could not add any CSS rule.\n" +
32494
32697
  "One possible reason could be that the id of the JSXGraph container does not start with a letter."
32495
32698
  );
32496
32699
  }
@@ -35612,6 +35815,8 @@ math/* default */.Z.Extrapolate = {
35612
35815
 
35613
35816
  /* harmony default export */ var extrapolate = (math/* default */.Z.Extrapolate);
35614
35817
 
35818
+ // EXTERNAL MODULE: ./src/math/geometry.js
35819
+ var geometry = __webpack_require__(922);
35615
35820
  ;// CONCATENATED MODULE: ./src/math/qdt.js
35616
35821
  /*
35617
35822
  Copyright 2008-2023
@@ -35650,22 +35855,38 @@ math/* default */.Z.Extrapolate = {
35650
35855
 
35651
35856
 
35652
35857
 
35858
+
35653
35859
  /**
35654
35860
  * Instantiate a new quad tree.
35655
35861
  *
35656
35862
  * @name JXG.Math.Quadtree
35657
35863
  * @exports Mat.Quadtree as JXG.Math.Quadtree
35658
35864
  * @param {Array} bbox Bounding box of the new quad (sub)tree.
35865
+ * @param {Object} config Configuration object. Default value: to {capacity: 10}
35866
+ *
35659
35867
  * @constructor
35660
35868
  */
35661
- math/* default */.Z.Quadtree = function (bbox) {
35869
+ math/* default */.Z.Quadtree = function (bbox, config, parent) {
35870
+ config = config || {
35871
+ capacity: 10,
35872
+ pointType: 'coords'
35873
+ };
35874
+
35662
35875
  /**
35663
35876
  * The maximum number of points stored in a quad tree node
35664
35877
  * before it is subdivided.
35665
35878
  * @type Number
35666
35879
  * @default 10
35667
35880
  */
35668
- this.capacity = 10;
35881
+ this.capacity = config.capacity || 10;
35882
+
35883
+ /**
35884
+ * Type of a point object. Possible values are:
35885
+ * 'coords', 'object'.
35886
+ * @type String
35887
+ * @default 'coords'
35888
+ */
35889
+ this.pointType = config.pointType || 'coords';
35669
35890
 
35670
35891
  /**
35671
35892
  * Point storage.
@@ -35678,6 +35899,15 @@ math/* default */.Z.Quadtree = function (bbox) {
35678
35899
  this.ylb = bbox[3];
35679
35900
  this.yub = bbox[1];
35680
35901
 
35902
+ /**
35903
+ * Parent quad tree or null if there is not parent.
35904
+ *
35905
+ * @name JXG.Math.Quadtree#northWest
35906
+ * @type JXG.Math.Quadtree
35907
+ *
35908
+ */
35909
+ this.parent = parent || null;
35910
+
35681
35911
  /**
35682
35912
  * In a subdivided quad tree this represents the top left subtree.
35683
35913
  * @name JXG.Math.Quadtree#northWest
@@ -35705,6 +35935,7 @@ math/* default */.Z.Quadtree = function (bbox) {
35705
35935
  * @type JXG.Math.Quadtree
35706
35936
  */
35707
35937
  this.southWest = null;
35938
+
35708
35939
  };
35709
35940
 
35710
35941
  utils_type/* default */.Z.extend(
@@ -35721,13 +35952,24 @@ utils_type/* default */.Z.extend(
35721
35952
  },
35722
35953
 
35723
35954
  /**
35724
- * Insert a new point into this quad tree.
35955
+ * Insert a new point into this quad tree. Do this only,
35956
+ * if the point is not yet in the quadtree (test exactly).
35957
+ *
35725
35958
  * @param {JXG.Coords} p
35726
35959
  * @returns {Boolean}
35727
35960
  */
35728
35961
  insert: function (p) {
35729
- if (!this.contains(p.usrCoords[1], p.usrCoords[2])) {
35730
- return false;
35962
+ switch (this.pointType) {
35963
+ case 'coords':
35964
+ if (!this.contains(p.usrCoords[1], p.usrCoords[2])) {
35965
+ return false;
35966
+ }
35967
+ break;
35968
+ case 'object':
35969
+ if (!this.contains(p.x, p.y)) {
35970
+ return false;
35971
+ }
35972
+ break;
35731
35973
  }
35732
35974
 
35733
35975
  if (this.points.length < this.capacity) {
@@ -35759,21 +36001,22 @@ utils_type/* default */.Z.extend(
35759
36001
  */
35760
36002
  subdivide: function () {
35761
36003
  var i,
35762
- l = this.points.length,
36004
+ le = this.points.length,
35763
36005
  mx = this.xlb + (this.xub - this.xlb) / 2,
35764
36006
  my = this.ylb + (this.yub - this.ylb) / 2;
35765
36007
 
35766
- this.northWest = new math/* default */.Z.Quadtree([this.xlb, this.yub, mx, my]);
35767
- this.northEast = new math/* default */.Z.Quadtree([mx, this.yub, this.xub, my]);
35768
- this.southEast = new math/* default */.Z.Quadtree([this.xlb, my, mx, this.ylb]);
35769
- this.southWest = new math/* default */.Z.Quadtree([mx, my, this.xub, this.ylb]);
36008
+ this.northWest = new math/* default */.Z.Quadtree([this.xlb, this.yub, mx, my], this.config, this);
36009
+ this.northEast = new math/* default */.Z.Quadtree([mx, this.yub, this.xub, my], this.config, this);
36010
+ this.southEast = new math/* default */.Z.Quadtree([this.xlb, my, mx, this.ylb], this.config, this);
36011
+ this.southWest = new math/* default */.Z.Quadtree([mx, my, this.xub, this.ylb], this.config, this);
35770
36012
 
35771
- for (i = 0; i < l; i += 1) {
35772
- this.northWest.insert(this.points[i]);
35773
- this.northEast.insert(this.points[i]);
35774
- this.southEast.insert(this.points[i]);
35775
- this.southWest.insert(this.points[i]);
36013
+ for (i = 0; i < le; i += 1) {
36014
+ this.insert(this.points[i]);
35776
36015
  }
36016
+
36017
+ // We empty this node points
36018
+ this.points.length = 0;
36019
+ this.points = [];
35777
36020
  },
35778
36021
 
35779
36022
  /**
@@ -35819,14 +36062,13 @@ utils_type/* default */.Z.extend(
35819
36062
  },
35820
36063
 
35821
36064
  /**
35822
- * Retrieve the smallest quad tree that contains the given point.
36065
+ * Retrieve the smallest quad tree that contains the given coordinate pair.
35823
36066
  * @name JXG.Math.Quadtree#_query
35824
36067
  * @param {JXG.Coords|Number} xp
35825
36068
  * @param {Number} y
35826
36069
  * @returns {Boolean|JXG.Quadtree} The quad tree if the point is found, false
35827
36070
  * if none of the quad trees contains the point (i.e. the point is not inside
35828
36071
  * the root tree's AABB).
35829
- * @private
35830
36072
  */
35831
36073
  query: function (xp, y) {
35832
36074
  var _x, _y;
@@ -35840,7 +36082,94 @@ utils_type/* default */.Z.extend(
35840
36082
  }
35841
36083
 
35842
36084
  return this._query(_x, _y);
36085
+ },
36086
+
36087
+ /**
36088
+ *
36089
+ * @param {*} x
36090
+ * @param {*} y
36091
+ * @param {*} tol
36092
+ * @returns {Boolean}
36093
+ */
36094
+ isIn: function (x, y, tol) {
36095
+ var r, i, le;
36096
+
36097
+ if (this.contains(x, y)) {
36098
+ le = this.points.length;
36099
+
36100
+ switch (this.pointType) {
36101
+ case 'coords':
36102
+ for (i = 0; i < le; i++) {
36103
+ if (geometry/* default */.Z.distance([x, y], this.points[i].usrCoords.slice(1), 2) < tol) {
36104
+ return true;
36105
+ }
36106
+ }
36107
+ break;
36108
+ case 'object':
36109
+ for (i = 0; i < le; i++) {
36110
+ if (geometry/* default */.Z.distance([x, y], [this.points[i].x, this.points[i].y], 2) < tol) {
36111
+ return true;
36112
+ }
36113
+ }
36114
+ break;
36115
+ }
36116
+
36117
+
36118
+ if (this.northWest === null) {
36119
+ return false;
36120
+ }
36121
+
36122
+ r = this.northWest.isIn(x, y, tol);
36123
+ if (r) {
36124
+ return r;
36125
+ }
36126
+
36127
+ r = this.northEast.isIn(x, y, tol);
36128
+ if (r) {
36129
+ return r;
36130
+ }
36131
+
36132
+ r = this.southEast.isIn(x, y, tol);
36133
+ if (r) {
36134
+ return r;
36135
+ }
36136
+
36137
+ r = this.southWest.isIn(x, y, tol);
36138
+ if (r) {
36139
+ return r;
36140
+ }
36141
+ }
36142
+
36143
+ return false;
36144
+ },
36145
+
36146
+ /**
36147
+ *
36148
+ * @returns {Array}
36149
+ */
36150
+ getAllPoints: function() {
36151
+ var pointsList = [];
36152
+ this.getAllPointsRecursive(pointsList);
36153
+ return pointsList;
36154
+ },
36155
+
36156
+ /**
36157
+ *
36158
+ * @param {Array} pointsList
36159
+ * @private
36160
+ */
36161
+ getAllPointsRecursive(pointsList) {
36162
+ if (this.northWest === null) {
36163
+ Array.prototype.push.apply(pointsList, this.points.slice());
36164
+ return;
36165
+ }
36166
+
36167
+ this.northWest.getAllPointsRecursive(pointsList);
36168
+ this.northEast.getAllPointsRecursive(pointsList);
36169
+ this.southEast.getAllPointsRecursive(pointsList);
36170
+ this.southWest.getAllPointsRecursive(pointsList);
35843
36171
  }
36172
+
35844
36173
  }
35845
36174
  );
35846
36175
 
@@ -37249,8 +37578,6 @@ jxg/* default */.Z.Math.Nlp = {
37249
37578
  var base_coords = __webpack_require__(705);
37250
37579
  // EXTERNAL MODULE: ./src/math/statistics.js
37251
37580
  var statistics = __webpack_require__(309);
37252
- // EXTERNAL MODULE: ./src/math/geometry.js
37253
- var geometry = __webpack_require__(922);
37254
37581
  ;// CONCATENATED MODULE: ./src/math/plot.js
37255
37582
  /*
37256
37583
  Copyright 2008-2023
@@ -46736,20 +47063,21 @@ jxg/* default */.Z.extend(
46736
47063
  MathJax.Hub.Queue(["Typeset", MathJax.Hub, el.rendNode]);
46737
47064
  }
46738
47065
 
46739
- // Restore the transformation necessary for fullscreen mode
46740
- // MathJax removes it when handling dynamic content
46741
- id = el.board.container;
46742
- wrap_id = "fullscreenwrap_" + id;
46743
- if (document.getElementById(wrap_id)) {
46744
- scale = el.board.containerObj._cssFullscreenStore.scale;
46745
- vshift = el.board.containerObj._cssFullscreenStore.vshift;
46746
- env/* default */.Z.scaleJSXGraphDiv(
46747
- "#" + wrap_id,
46748
- "#" + id,
46749
- scale,
46750
- vshift
46751
- );
46752
- }
47066
+ // Obsolete:
47067
+ // // Restore the transformation necessary for fullscreen mode
47068
+ // // MathJax removes it when handling dynamic content
47069
+ // id = el.board.container;
47070
+ // wrap_id = "fullscreenwrap_" + id;
47071
+ // if (document.getElementById(wrap_id)) {
47072
+ // scale = el.board.containerObj._cssFullscreenStore.scale;
47073
+ // vshift = el.board.containerObj._cssFullscreenStore.vshift;
47074
+ // Env.scaleJSXGraphDiv(
47075
+ // "#" + wrap_id,
47076
+ // "#" + id,
47077
+ // scale,
47078
+ // vshift
47079
+ // );
47080
+ // }
46753
47081
  } catch (e) {
46754
47082
  jxg/* default */.Z.debug("MathJax (not yet) loaded");
46755
47083
  }
@@ -50778,6 +51106,11 @@ jxg/* default */.Z.extend(
50778
51106
  return false;
50779
51107
  }
50780
51108
 
51109
+ if (utils_type/* default */.Z.evaluate(this.attr.movetarget) === null &&
51110
+ utils_type/* default */.Z.exists(evt.target) && utils_type/* default */.Z.exists(evt.target.releasePointerCapture)) {
51111
+ evt.target.releasePointerCapture(evt.pointerId);
51112
+ }
51113
+
50781
51114
  if (!object && evt.isPrimary) {
50782
51115
  // First finger down. To be on the safe side this._board_touches is cleared.
50783
51116
  // this._pointerClearTouches();
@@ -50980,9 +51313,7 @@ jxg/* default */.Z.extend(
50980
51313
  * @returns {Boolean}
50981
51314
  */
50982
51315
  pointerMoveListener: function (evt) {
50983
- var i,
50984
- j,
50985
- pos,
51316
+ var i, j, pos, eps,
50986
51317
  touchTargets,
50987
51318
  type = 'mouse'; // in case of no browser
50988
51319
 
@@ -51015,10 +51346,21 @@ jxg/* default */.Z.extend(
51015
51346
  this._inputDevice = this._getPointerInputDevice(evt);
51016
51347
  type = this._inputDevice;
51017
51348
  this.options.precision.hasPoint = this.options.precision[type];
51349
+ eps = this.options.precision.hasPoint * 0.3333;
51350
+
51351
+ pos = this.getMousePosition(evt);
51352
+ // Ignore pointer move event if too close at the border
51353
+ // and setPointerCapture is off
51354
+ if (utils_type/* default */.Z.evaluate(this.attr.movetarget) === null &&
51355
+ pos[0] <= eps || pos[1] <= eps ||
51356
+ pos[0] >= this.canvasWidth - eps ||
51357
+ pos[1] >= this.canvasHeight - eps
51358
+ ) {
51359
+ return this.mode === this.BOARD_MODE_NONE;
51360
+ }
51018
51361
 
51019
51362
  // selection
51020
51363
  if (this.selectingMode) {
51021
- pos = this.getMousePosition(evt);
51022
51364
  this._moveSelecting(pos);
51023
51365
  this.triggerEventHandlers(
51024
51366
  ['touchmoveselecting', 'moveselecting', 'pointermoveselecting'],
@@ -51026,7 +51368,6 @@ jxg/* default */.Z.extend(
51026
51368
  );
51027
51369
  } else if (!this.mouseOriginMove(evt)) {
51028
51370
  if (this.mode === this.BOARD_MODE_DRAG) {
51029
- pos = this.getMousePosition(evt);
51030
51371
  // Run through all jsxgraph elements which are touched by at least one finger.
51031
51372
  for (i = 0; i < this.touches.length; i++) {
51032
51373
  touchTargets = this.touches[i].targets;
@@ -51063,7 +51404,6 @@ jxg/* default */.Z.extend(
51063
51404
  }
51064
51405
 
51065
51406
  // Move event without dragging an element
51066
- pos = this.getMousePosition(evt);
51067
51407
  this.highlightElements(pos[0], pos[1], evt, -1);
51068
51408
  }
51069
51409
  }
@@ -52359,7 +52699,7 @@ jxg/* default */.Z.extend(
52359
52699
  }, options);
52360
52700
  this.intersectionObserver.observe(that.containerObj);
52361
52701
  } catch (err) {
52362
- console.log('JSXGraph: IntersectionObserver not available in this browser.');
52702
+ jxg/* default */.Z.debug('JSXGraph: IntersectionObserver not available in this browser.');
52363
52703
  }
52364
52704
  },
52365
52705
 
@@ -54112,10 +54452,10 @@ jxg/* default */.Z.extend(
54112
54452
  * <li> array: ['key', value]
54113
54453
  * </ul>
54114
54454
  * Some board attributes are immutable, like e.g. the renderer type.
54115
- *
54455
+ *
54116
54456
  * @param {Object} attributes An object with attributes.
54117
54457
  * @returns {JXG.Board} Reference to the board
54118
- *
54458
+ *
54119
54459
  * @example
54120
54460
  * const board = JXG.JSXGraph.initBoard('jxgbox', {
54121
54461
  * boundingbox: [-5, 5, 5, -5],
@@ -54125,7 +54465,7 @@ jxg/* default */.Z.extend(
54125
54465
  * showScreenshot: true,
54126
54466
  * showCopyright: false
54127
54467
  * });
54128
- *
54468
+ *
54129
54469
  * board.setAttribute({
54130
54470
  * animationDelay: 10,
54131
54471
  * boundingbox: [-10, 5, 10, -5],
@@ -54141,7 +54481,7 @@ jxg/* default */.Z.extend(
54141
54481
  * locale: 'de-DE'
54142
54482
  * }
54143
54483
  * });
54144
- *
54484
+ *
54145
54485
  * board.setAttribute({
54146
54486
  * selection: {
54147
54487
  * enabled: true,
@@ -54159,7 +54499,7 @@ jxg/* default */.Z.extend(
54159
54499
  * showNavigation: false
54160
54500
  * });
54161
54501
  * board.setAttribute('showCopyright:false');
54162
- *
54502
+ *
54163
54503
  * var p = board.create('point', [1, 1], {size: 10,
54164
54504
  * label: {
54165
54505
  * fontSize: 24,
@@ -54167,8 +54507,8 @@ jxg/* default */.Z.extend(
54167
54507
  * offset: [5, 0]
54168
54508
  * }
54169
54509
  * });
54170
- *
54171
- *
54510
+ *
54511
+ *
54172
54512
  * </pre><div id="JXGea7b8e09-beac-4d95-9a0c-5fc1c761ffbc" class="jxgbox" style="width: 300px; height: 300px;"></div>
54173
54513
  * <script type="text/javascript">
54174
54514
  * (function() {
@@ -54180,7 +54520,7 @@ jxg/* default */.Z.extend(
54180
54520
  * showScreenshot: true,
54181
54521
  * showCopyright: false
54182
54522
  * });
54183
- *
54523
+ *
54184
54524
  * board.setAttribute({
54185
54525
  * animationDelay: 10,
54186
54526
  * boundingbox: [-10, 5, 10, -5],
@@ -54196,7 +54536,7 @@ jxg/* default */.Z.extend(
54196
54536
  * locale: 'de-DE'
54197
54537
  * }
54198
54538
  * });
54199
- *
54539
+ *
54200
54540
  * board.setAttribute({
54201
54541
  * selection: {
54202
54542
  * enabled: true,
@@ -54213,9 +54553,9 @@ jxg/* default */.Z.extend(
54213
54553
  * showZoom: false,
54214
54554
  * showNavigation: false
54215
54555
  * });
54216
- *
54556
+ *
54217
54557
  * board.setAttribute('showCopyright:false');
54218
- *
54558
+ *
54219
54559
  * var p = board.create('point', [1, 1], {size: 10,
54220
54560
  * label: {
54221
54561
  * fontSize: 24,
@@ -54223,13 +54563,13 @@ jxg/* default */.Z.extend(
54223
54563
  * offset: [5, 0]
54224
54564
  * }
54225
54565
  * });
54226
- *
54227
- *
54566
+ *
54567
+ *
54228
54568
  * })();
54229
- *
54569
+ *
54230
54570
  * </script><pre>
54231
- *
54232
- *
54571
+ *
54572
+ *
54233
54573
  */
54234
54574
  setAttribute: function (attr) {
54235
54575
  var i, arg, pair,
@@ -55345,6 +55685,8 @@ jxg/* default */.Z.extend(
55345
55685
  * Expand the JSXGraph construction to fullscreen.
55346
55686
  * In order to preserve the proportions of the JSXGraph element,
55347
55687
  * a wrapper div is created which is set to fullscreen.
55688
+ * This function is called when fullscreen mode is triggered
55689
+ * <b>and</b> when it is closed.
55348
55690
  * <p>
55349
55691
  * The wrapping div has the CSS class 'jxgbox_wrap_private' which is
55350
55692
  * defined in the file 'jsxgraph.css'
@@ -55417,6 +55759,7 @@ jxg/* default */.Z.extend(
55417
55759
  var wrap_id,
55418
55760
  wrap_node,
55419
55761
  inner_node,
55762
+ dim,
55420
55763
  doc = this.document,
55421
55764
  fullscreenElement;
55422
55765
 
@@ -55425,7 +55768,17 @@ jxg/* default */.Z.extend(
55425
55768
  inner_node = doc.getElementById(id);
55426
55769
  wrap_id = 'fullscreenwrap_' + id;
55427
55770
 
55771
+ // Store the original data.
55772
+ // This is used to establish the ratio h / w in
55773
+ // fullscreen mode
55774
+ dim = this.containerObj.getBoundingClientRect();
55775
+ inner_node._cssFullscreenStore = {
55776
+ w: dim.width,
55777
+ h: dim.height
55778
+ }
55779
+
55428
55780
  // Wrap a div around the JSXGraph div.
55781
+ // It is removed when fullscreen mode is closed.
55429
55782
  if (doc.getElementById(wrap_id)) {
55430
55783
  wrap_node = doc.getElementById(wrap_id);
55431
55784
  } else {
@@ -55436,10 +55789,6 @@ jxg/* default */.Z.extend(
55436
55789
  wrap_node.appendChild(inner_node);
55437
55790
  }
55438
55791
 
55439
- // Get the real width and height of the JSXGraph div
55440
- // and determine the scaling and vertical shift amount
55441
- // this._fullscreen_res = Env._getScaleFactors(inner_node);
55442
-
55443
55792
  // Trigger fullscreen mode
55444
55793
  wrap_node.requestFullscreen =
55445
55794
  wrap_node.requestFullscreen ||
@@ -55454,12 +55803,15 @@ jxg/* default */.Z.extend(
55454
55803
  } else {
55455
55804
  fullscreenElement = doc.msFullscreenElement;
55456
55805
  }
55806
+
55457
55807
  if (fullscreenElement === null) {
55458
55808
  // Start fullscreen mode
55459
55809
  if (wrap_node.requestFullscreen) {
55460
55810
  wrap_node.requestFullscreen();
55811
+ this.startFullscreenResizeObserver(wrap_node);
55461
55812
  }
55462
55813
  } else {
55814
+ this.stopFullscreenResizeObserver(wrap_node);
55463
55815
  if (utils_type/* default */.Z.exists(document.exitFullscreen)) {
55464
55816
  document.exitFullscreen();
55465
55817
  } else if (utils_type/* default */.Z.exists(document.webkitExitFullscreen)) {
@@ -55480,7 +55832,8 @@ jxg/* default */.Z.extend(
55480
55832
  fullscreenListener: function (evt) {
55481
55833
  var inner_id,
55482
55834
  inner_node,
55483
- fullscreenElement, // res,
55835
+ fullscreenElement,
55836
+ i,
55484
55837
  doc = this.document;
55485
55838
 
55486
55839
  inner_id = this._fullscreen_inner_id;
@@ -55503,30 +55856,22 @@ jxg/* default */.Z.extend(
55503
55856
  if (fullscreenElement) {
55504
55857
  // Just entered fullscreen mode
55505
55858
 
55506
- // Get the data computed in board.toFullscreen()
55507
- // res = this._fullscreen_res;
55508
-
55509
- // Store the scaling data.
55510
- // It is used in AbstractRenderer.updateText to restore the scaling matrix
55511
- // which is removed by MathJax.
55859
+ // Store the original data.
55512
55860
  // Further, the CSS margin has to be removed when in fullscreen mode,
55513
55861
  // and must be restored later.
55514
- inner_node._cssFullscreenStore = {
55515
- id: fullscreenElement.id,
55516
- isFullscreen: true,
55517
- margin: inner_node.style.margin
55518
- // width: inner_node.style.width
55519
- // scale: res.scale,
55520
- // vshift: res.vshift
55521
- };
55522
-
55862
+ // Obsolete:
55863
+ // It is used in AbstractRenderer.updateText to restore the scaling matrix
55864
+ // which is removed by MathJax.
55865
+ inner_node._cssFullscreenStore.id = fullscreenElement.id;
55866
+ inner_node._cssFullscreenStore.isFullscreen = true;
55867
+ inner_node._cssFullscreenStore.margin = inner_node.style.margin;
55523
55868
  inner_node.style.margin = '';
55524
- // inner_node.style.width = res.width + 'px';
55525
55869
 
55526
55870
  // Do the shifting and scaling via CSS pseudo rules
55527
55871
  // We do this after fullscreen mode has been established to get the correct size
55528
55872
  // of the JSXGraph div.
55529
- env/* default */.Z.scaleJSXGraphDiv(fullscreenElement.id, inner_id, doc, utils_type/* default */.Z.evaluate(this.attr.fullscreen.scale));
55873
+ env/* default */.Z.scaleJSXGraphDiv(fullscreenElement.id, inner_id, doc,
55874
+ utils_type/* default */.Z.evaluate(this.attr.fullscreen.scale));
55530
55875
 
55531
55876
  // Clear this.doc.fullscreenElement, because Safari doesn't to it and
55532
55877
  // when leaving full screen mode it is still set.
@@ -55535,20 +55880,93 @@ jxg/* default */.Z.extend(
55535
55880
  // Just left the fullscreen mode
55536
55881
 
55537
55882
  // Remove the CSS rules added in Env.scaleJSXGraphDiv
55538
- try {
55539
- doc.styleSheets[doc.styleSheets.length - 1].deleteRule(0);
55540
- } catch (err) {
55541
- console.log('JSXGraph: Could not remove CSS rules for full screen mode');
55883
+ for (i = doc.styleSheets.length - 1; i >= 0; i--) {
55884
+ if (doc.styleSheets[i].title === 'jsxgraph_fullscreen_css') {
55885
+ doc.styleSheets[i].deleteRule(0);
55886
+ break;
55887
+ }
55542
55888
  }
55543
55889
 
55544
55890
  inner_node._cssFullscreenStore.isFullscreen = false;
55545
55891
  inner_node.style.margin = inner_node._cssFullscreenStore.margin;
55546
- // inner_node.style.width = inner_node._cssFullscreenStore.width;
55892
+
55893
+ // Remove the wrapper div
55894
+ inner_node.parentElement.replaceWith(inner_node);
55547
55895
  }
55548
55896
 
55549
55897
  this.updateCSSTransforms();
55550
55898
  },
55551
55899
 
55900
+ /**
55901
+ * Start resize observer in to handle
55902
+ * orientation changes in fullscreen mode.
55903
+ *
55904
+ * @param {Object} node DOM object which is in fullscreen mode. It is the wrapper element
55905
+ * around the JSXGraph div.
55906
+ * @returns {JXG.Board} Reference to the board
55907
+ * @private
55908
+ * @see JXG.Board#toFullscreen
55909
+ *
55910
+ */
55911
+ startFullscreenResizeObserver: function(node) {
55912
+ var that = this;
55913
+
55914
+ if (!env/* default */.Z.isBrowser || !this.attr.resize || !this.attr.resize.enabled) {
55915
+ return this;
55916
+ }
55917
+
55918
+ this.resizeObserver = new ResizeObserver(function (entries) {
55919
+ var inner_id,
55920
+ fullscreenElement,
55921
+ doc = that.document;
55922
+
55923
+ if (!that._isResizing) {
55924
+ that._isResizing = true;
55925
+ window.setTimeout(function () {
55926
+ try {
55927
+ inner_id = that._fullscreen_inner_id;
55928
+ if (doc.fullscreenElement !== undefined) {
55929
+ fullscreenElement = doc.fullscreenElement;
55930
+ } else if (doc.webkitFullscreenElement !== undefined) {
55931
+ fullscreenElement = doc.webkitFullscreenElement;
55932
+ } else {
55933
+ fullscreenElement = doc.msFullscreenElement;
55934
+ }
55935
+ if (fullscreenElement !== null) {
55936
+ env/* default */.Z.scaleJSXGraphDiv(fullscreenElement.id, inner_id, doc,
55937
+ utils_type/* default */.Z.evaluate(that.attr.fullscreen.scale));
55938
+ }
55939
+ } catch (err) {
55940
+ that.stopFullscreenResizeObserver(node);
55941
+ } finally {
55942
+ that._isResizing = false;
55943
+ }
55944
+ }, that.attr.resize.throttle);
55945
+ }
55946
+ });
55947
+ this.resizeObserver.observe(node);
55948
+ return this;
55949
+ },
55950
+
55951
+ /**
55952
+ * Remove resize observer to handle orientation changes in fullscreen mode.
55953
+ * @param {Object} node DOM object which is in fullscreen mode. It is the wrapper element
55954
+ * around the JSXGraph div.
55955
+ * @returns {JXG.Board} Reference to the board
55956
+ * @private
55957
+ * @see JXG.Board#toFullscreen
55958
+ */
55959
+ stopFullscreenResizeObserver: function(node) {
55960
+ if (!env/* default */.Z.isBrowser || !this.attr.resize || !this.attr.resize.enabled) {
55961
+ return this;
55962
+ }
55963
+
55964
+ if (utils_type/* default */.Z.exists(this.resizeObserver)) {
55965
+ this.resizeObserver.unobserve(node);
55966
+ }
55967
+ return this;
55968
+ },
55969
+
55552
55970
  /**
55553
55971
  * Add user activity to the array 'board.userLog'.
55554
55972
  *
@@ -57639,13 +58057,8 @@ jxg/* default */.Z.extend(
57639
58057
 
57640
58058
  // documented in AbstractRenderer
57641
58059
  resize: function (w, h) {
57642
- // this.svgRoot.style.width = parseFloat(w) + 'px';
57643
- // this.svgRoot.style.height = parseFloat(h) + 'px';
57644
-
57645
58060
  this.svgRoot.setAttribute("width", parseFloat(w));
57646
58061
  this.svgRoot.setAttribute("height", parseFloat(h));
57647
- // this.svgRoot.setAttribute('width', '100%');
57648
- // this.svgRoot.setAttribute('height', '100%');
57649
58062
  },
57650
58063
 
57651
58064
  // documented in JXG.AbstractRenderer
@@ -61197,7 +61610,7 @@ jxg/* default */.Z.extend(
61197
61610
  }
61198
61611
  this.context = this.canvasRoot.getContext("2d");
61199
61612
  // The width and height of the canvas is set to twice the CSS values,
61200
- // followed by an appropiate scaling.
61613
+ // followed by an appropriate scaling.
61201
61614
  // See https://stackoverflow.com/questions/22416462/canvas-element-with-blurred-lines
61202
61615
  this.context.scale(2, 2);
61203
61616
  },
@@ -72663,6 +73076,11 @@ jxg/* default */.Z.registerElement("metapostspline", jxg/* default */.Z.createMe
72663
73076
  /**
72664
73077
  * @class This element is used to provide a constructor for Riemann sums, which is realized as a special curve.
72665
73078
  * The returned element has the method Value() which returns the sum of the areas of the bars.
73079
+ * <p>
73080
+ * In case of type "simpson" and "trapezoidal", the horizontal line approximating the function value
73081
+ * is replaced by a parabola or a secant. IN case of "simpson",
73082
+ * the parabola is approximated visually by a polygonal chain of fixed step width.
73083
+ *
72666
73084
  * @pseudo
72667
73085
  * @description
72668
73086
  * @name Riemannsum
@@ -72676,7 +73094,7 @@ jxg/* default */.Z.registerElement("metapostspline", jxg/* default */.Z.createMe
72676
73094
  * n determines the number of bars, it is either a fixed number or a function.
72677
73095
  * <p>
72678
73096
  * type is a string or function returning one of the values: 'left', 'right', 'middle', 'lower', 'upper', 'random', 'simpson', or 'trapezoidal'.
72679
- * Default value is 'left'.
73097
+ * Default value is 'left'. "simpson" is Simpson's 1/3 rule.
72680
73098
  * <p>
72681
73099
  * Further parameters are an optional number or function for the left interval border a,
72682
73100
  * and an optional number or function for the right interval border b.
@@ -80099,6 +80517,7 @@ jxg/* default */.Z.createSlider = function (board, parents, attributes) {
80099
80517
  ticks, ti, t,
80100
80518
  startx, starty,
80101
80519
  withText, withTicks,
80520
+ snapValues, snapValueDistance,
80102
80521
  snapWidth, sw, s,
80103
80522
  attr;
80104
80523
 
@@ -80106,6 +80525,8 @@ jxg/* default */.Z.createSlider = function (board, parents, attributes) {
80106
80525
  withTicks = attr.withticks;
80107
80526
  withText = attr.withlabel;
80108
80527
  snapWidth = attr.snapwidth;
80528
+ snapValues = attr.snapvalues;
80529
+ snapValueDistance = attr.snapvaluedistance;
80109
80530
 
80110
80531
  // start point
80111
80532
  attr = utils_type/* default */.Z.copyAttributes(attributes, board.options, "slider", "point1");
@@ -80142,7 +80563,7 @@ jxg/* default */.Z.createSlider = function (board, parents, attributes) {
80142
80563
  attr.withLabel = false;
80143
80564
  // gliders set snapwidth=-1 by default (i.e. deactivate them)
80144
80565
  p3 = board.create("glider", [startx, starty, l1], attr);
80145
- p3.setAttribute({ snapwidth: snapWidth });
80566
+ p3.setAttribute({ snapwidth: snapWidth, snapvalues: snapValues, snapvaluedistance: snapValueDistance });
80146
80567
 
80147
80568
  // Segment from start point to glider point: highline
80148
80569
  attr = utils_type/* default */.Z.copyAttributes(attributes, board.options, "slider", "highline");
@@ -80157,7 +80578,18 @@ jxg/* default */.Z.createSlider = function (board, parents, attributes) {
80157
80578
  */
80158
80579
  p3.Value = function () {
80159
80580
  var sdiff = this._smax - this._smin,
80160
- ev_sw = utils_type/* default */.Z.evaluate(this.visProp.snapwidth);
80581
+ ev_sw = utils_type/* default */.Z.evaluate(this.visProp.snapwidth),
80582
+ snapValues, i, v;
80583
+
80584
+ snapValues = utils_type/* default */.Z.evaluate(this.visProp.snapvalues);
80585
+ if (utils_type/* default */.Z.isArray(snapValues)) {
80586
+ for (i=0; i < snapValues.length; i++) {
80587
+ v = (snapValues[i] - this._smin) / (this._smax - this._smin);
80588
+ if(this.position === v) {
80589
+ return snapValues[i];
80590
+ }
80591
+ }
80592
+ }
80161
80593
 
80162
80594
  return ev_sw === -1
80163
80595
  ? this.position * sdiff + this._smin
@@ -88802,36 +89234,36 @@ var checkbox_priv = {
88802
89234
  * }, checkbox);
88803
89235
  * })();
88804
89236
  * </script><pre>
88805
- *
88806
89237
  * @example
88807
- * var i1 = board.create('input', [-3, 4, 'sin(x)', 'f(x)='], {cssStyle: 'width:4em', maxlength: 2});
88808
- * var c1 = board.create('checkbox', [-3, 2, 'label 1'], {});
88809
- * var b1 = board.create('button', [-3, -1, 'Change texts', function () {
88810
- * i1.setText('g(x)');
89238
+ * var i1 = board.create('input', [1, 5, 'sin(x)', 'f(x)='], {cssStyle: 'width:4em', maxlength: 2});
89239
+ * var c1 = board.create('checkbox', [1, 3, 'label 1'], {});
89240
+ * var b1 = board.create('button', [1, 1, 'Change texts', function () {
89241
+ * i1.setText('g(x)=');
88811
89242
  * i1.set('cos(x)');
88812
89243
  * c1.setText('label 2');
88813
89244
  * b1.setText('Texts are changed');
88814
89245
  * }],
88815
- * {cssStyle: 'width:400px'});
88816
- *
88817
- * </pre><div id="JXG11cac8gg-2354-47e7-9da4-eb298e53de05" class="jxgbox" style="width: 300px; height: 300px;"></div>
89246
+ * {cssStyle: 'width:200px'});
89247
+ *
89248
+ * </pre><div id="JXG31c6d070-354b-4f09-aab9-9aaa796f730c" class="jxgbox" style="width: 300px; height: 300px;"></div>
88818
89249
  * <script type="text/javascript">
88819
89250
  * (function() {
88820
- * var board = JXG.JSXGraph.initBoard('JXG11cac8gg-2354-47e7-9da4-eb298e53de05',
88821
- * {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
88822
- * var i1 = board.create('input', [-3, 4, 'sin(x)', 'f(x)='], {cssStyle: 'width:4em', maxlength: 2});
88823
- * var c1 = board.create('checkbox', [-3, 2, 'label 1'], {});
88824
- * var b1 = board.create('button', [-3, -1, 'Change texts', function () {
88825
- * i1.setText('g(x)');
89251
+ * var board = JXG.JSXGraph.initBoard('JXG31c6d070-354b-4f09-aab9-9aaa796f730c',
89252
+ * {boundingbox: [-1, 7, 7, -1], axis: true, showcopyright: false, shownavigation: false});
89253
+ * var i1 = board.create('input', [1, 5, 'sin(x)', 'f(x)='], {cssStyle: 'width:4em', maxlength: 2});
89254
+ * var c1 = board.create('checkbox', [1, 3, 'label 1'], {});
89255
+ * var b1 = board.create('button', [1, 1, 'Change texts', function () {
89256
+ * i1.setText('g(x)=');
88826
89257
  * i1.set('cos(x)');
88827
89258
  * c1.setText('label 2');
88828
89259
  * b1.setText('Texts are changed');
88829
89260
  * }],
88830
- * {cssStyle: 'width:400px'});
88831
- *
89261
+ * {cssStyle: 'width:200px'});
89262
+ *
88832
89263
  * })();
88833
- *
89264
+ *
88834
89265
  * </script><pre>
89266
+ *
88835
89267
  */
88836
89268
  jxg/* default */.Z.createCheckbox = function (board, parents, attributes) {
88837
89269
  var t,
@@ -92084,7 +92516,6 @@ jxg/* default */.Z.createView3D = function (board, parents, attributes) {
92084
92516
  }
92085
92517
  d = utils_type/* default */.Z.evaluate(p.visProp.infoboxdigits);
92086
92518
  infobox = view.board.infobox;
92087
- console.log(infobox.useLocale())
92088
92519
  if (d === 'auto') {
92089
92520
  if (infobox.useLocale()) {
92090
92521
  arr = [pre, '(', infobox.formatNumberLocale(p.X()), ' | ', infobox.formatNumberLocale(p.Y()), ' | ', infobox.formatNumberLocale(p.Z()), ')']