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
@@ -46,7 +46,7 @@
46
46
 
47
47
  var major = 1,
48
48
  minor = 6,
49
- patch = 0,
49
+ patch = 1,
50
50
  add = '', //'dev' 'beta'
51
51
  version = major + '.' + minor + '.' + patch + (add ? '-' + add : ''),
52
52
  constants;
@@ -822,6 +822,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
822
822
  newCoords, newPos,
823
823
  doRound = false,
824
824
  ev_sw,
825
+ snappedTo, snapValues,
825
826
  slide = this.slideObject,
826
827
  res, cu,
827
828
  slides = [],
@@ -950,20 +951,28 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
950
951
  }
951
952
  }
952
953
 
953
- // Snap the glider point of the slider into its appropiate position
954
- // First, recalculate the new value of this.position
955
- // Second, call update(fromParent==true) to make the positioning snappier.
956
- ev_sw = _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(this.visProp.snapwidth);
957
- if (
958
- _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(ev_sw) > 0.0 &&
959
- Math.abs(this._smax - this._smin) >= _math_math__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.eps
960
- ) {
961
- newPos = Math.max(Math.min(newPos, 1), 0);
962
-
963
- v = newPos * (this._smax - this._smin) + this._smin;
964
- v = Math.round(v / ev_sw) * ev_sw;
965
- newPos = (v - this._smin) / (this._smax - this._smin);
954
+ // Snap the glider to snap values.
955
+ snappedTo = this.findClosestSnapValue(newPos);
956
+ if(snappedTo !== null) {
957
+ snapValues = _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(this.visProp.snapvalues);
958
+ newPos = (snapValues[snappedTo] - this._smin) / (this._smax - this._smin);
966
959
  this.update(true);
960
+ } else {
961
+ // Snap the glider point of the slider into its appropiate position
962
+ // First, recalculate the new value of this.position
963
+ // Second, call update(fromParent==true) to make the positioning snappier.
964
+ ev_sw = _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(this.visProp.snapwidth);
965
+ if (
966
+ _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(ev_sw) > 0.0 &&
967
+ Math.abs(this._smax - this._smin) >= _math_math__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.eps
968
+ ) {
969
+ newPos = Math.max(Math.min(newPos, 1), 0);
970
+
971
+ v = newPos * (this._smax - this._smin) + this._smin;
972
+ v = Math.round(v / ev_sw) * ev_sw;
973
+ newPos = (v - this._smin) / (this._smax - this._smin);
974
+ this.update(true);
975
+ }
967
976
  }
968
977
 
969
978
  p1c = slide.point1.coords;
@@ -1110,6 +1119,37 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
1110
1119
  this.position = newPos;
1111
1120
  },
1112
1121
 
1122
+ /**
1123
+ * Find the closest entry in snapValues that is within snapValueDistance of pos.
1124
+ *
1125
+ * @param {Number} pos Value for which snapping is calculated.
1126
+ * @returns {Number} Index of the value to snap to, or null.
1127
+ * @private
1128
+ */
1129
+ findClosestSnapValue: function(pos) {
1130
+ var i, d,
1131
+ snapValues, snapValueDistance,
1132
+ snappedTo = null;
1133
+
1134
+ // Snap the glider to snap values.
1135
+ snapValues = _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(this.visProp.snapvalues);
1136
+ snapValueDistance = _utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.evaluate(this.visProp.snapvaluedistance);
1137
+
1138
+ if (_utils_type__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z.isArray(snapValues) &&
1139
+ Math.abs(this._smax - this._smin) >= _math_math__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.eps &&
1140
+ snapValueDistance > 0.0) {
1141
+ for (i = 0; i < snapValues.length; i++) {
1142
+ d = Math.abs(pos * (this._smax - this._smin) + this._smin - snapValues[i]);
1143
+ if (d < snapValueDistance) {
1144
+ snapValueDistance = d;
1145
+ snappedTo = i;
1146
+ }
1147
+ }
1148
+ }
1149
+
1150
+ return snappedTo;
1151
+ },
1152
+
1113
1153
  /**
1114
1154
  * Update of a glider in case a parent element has been updated. That means the
1115
1155
  * relative position of the glider stays the same.
@@ -2495,7 +2535,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
2495
2535
  * @returns {JXG.CoordsElement} Reference to itself.
2496
2536
  */
2497
2537
  _anim: function (direction, stepCount) {
2498
- var dX, dY, alpha, startPoint, newX, radius, sp1c, sp2c, res, d;
2538
+ var dX, dY, alpha, startPoint, newX, radius, sp1c, sp2c, res;
2499
2539
 
2500
2540
  this.intervalCount += 1;
2501
2541
  if (this.intervalCount > stepCount) {
@@ -5894,7 +5934,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
5894
5934
  },
5895
5935
 
5896
5936
  /**
5897
- * The update function of the renderert
5937
+ * The update function of the renderer
5898
5938
  * is called.
5899
5939
  * @private
5900
5940
  */
@@ -6364,11 +6404,9 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
6364
6404
  * @param {Number} h width of the box in pixel
6365
6405
  * @return {Number} Number of overlapping elements
6366
6406
  */
6367
- getNumberofConflicts: function (x, y, w, h) {
6407
+ getNumberOfConflicts: function (x, y, w, h) {
6368
6408
  var count = 0,
6369
- i,
6370
- obj,
6371
- le,
6409
+ i, obj, le,
6372
6410
  savePointPrecision;
6373
6411
 
6374
6412
  // Set the precision of hasPoint to half the max if label isn't too long
@@ -6403,33 +6441,22 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
6403
6441
  * @returns {JXG.Text} Reference to the text object.
6404
6442
  */
6405
6443
  setAutoPosition: function () {
6406
- var x,
6407
- y,
6408
- cx,
6409
- cy,
6444
+ var x, y, cx, cy,
6410
6445
  anchorCoords,
6411
6446
  // anchorX, anchorY,
6412
6447
  w = this.size[0],
6413
6448
  h = this.size[1],
6414
- start_angle,
6415
- angle,
6449
+ start_angle, angle,
6416
6450
  optimum = {
6417
6451
  conflicts: Infinity,
6418
6452
  angle: 0,
6419
6453
  r: 0
6420
6454
  },
6421
- max_r,
6422
- delta_r,
6423
- conflicts,
6424
- offset,
6425
- r,
6455
+ max_r, delta_r,
6456
+ conflicts, offset, r,
6426
6457
  num_positions = 12,
6427
6458
  step = (2 * Math.PI) / num_positions,
6428
- j,
6429
- dx,
6430
- dy,
6431
- co,
6432
- si;
6459
+ j, dx, dy, co, si;
6433
6460
 
6434
6461
  if (
6435
6462
  this === this.board.infobox ||
@@ -6452,15 +6479,15 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
6452
6479
  dx = offset[0];
6453
6480
  dy = offset[1];
6454
6481
 
6455
- conflicts = this.getNumberofConflicts(cx + dx, cy - dy, w, h);
6482
+ conflicts = this.getNumberOfConflicts(cx + dx, cy - dy, w, h);
6456
6483
  if (conflicts === 0) {
6457
6484
  return this;
6458
6485
  }
6459
6486
  // console.log(this.id, conflicts, w, h);
6460
6487
  // r = Geometry.distance([0, 0], offset, 2);
6461
6488
 
6462
- r = 12;
6463
- max_r = 28;
6489
+ r = _utils_type__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.evaluate(this.visProp.autopositionmindistance);
6490
+ max_r = _utils_type__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.evaluate(this.visProp.autopositionmaxdistance);
6464
6491
  delta_r = 0.2 * r;
6465
6492
 
6466
6493
  start_angle = Math.atan2(dy, dx);
@@ -6469,7 +6496,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
6469
6496
  optimum.angle = start_angle;
6470
6497
  optimum.r = r;
6471
6498
 
6472
- while (optimum.conflicts > 0 && r < max_r) {
6499
+ while (optimum.conflicts > 0 && r <= max_r) {
6473
6500
  for (
6474
6501
  j = 1, angle = start_angle + step;
6475
6502
  j < num_positions && optimum.conflicts > 0;
@@ -6481,7 +6508,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
6481
6508
  x = cx + r * co;
6482
6509
  y = cy - r * si;
6483
6510
 
6484
- conflicts = this.getNumberofConflicts(x, y, w, h);
6511
+ conflicts = this.getNumberOfConflicts(x, y, w, h);
6485
6512
  if (conflicts < optimum.conflicts) {
6486
6513
  optimum.conflicts = conflicts;
6487
6514
  optimum.angle = angle;
@@ -16371,12 +16398,18 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16371
16398
  /**
16372
16399
  * Helper function to create curve which displays Riemann sums.
16373
16400
  * Compute coordinates for the rectangles showing the Riemann sum.
16401
+ * <p>
16402
+ * In case of type "simpson" and "trapezoidal", the horizontal line approximating the function value
16403
+ * is replaced by a parabola or a secant. IN case of "simpson",
16404
+ * the parabola is approximated visually by a polygonal chain of fixed step width.
16405
+ *
16374
16406
  * @param {Function,Array} f Function or array of two functions.
16375
16407
  * If f is a function the integral of this function is approximated by the Riemann sum.
16376
16408
  * If f is an array consisting of two functions the area between the two functions is filled
16377
16409
  * by the Riemann sum bars.
16378
16410
  * @param {Number} n number of rectangles.
16379
16411
  * @param {String} type Type of approximation. Possible values are: 'left', 'right', 'middle', 'lower', 'upper', 'random', 'simpson', or 'trapezoidal'.
16412
+ * "simpson" is Simpson's 1/3 rule.
16380
16413
  * @param {Number} start Left border of the approximation interval
16381
16414
  * @param {Number} end Right border of the approximation interval
16382
16415
  * @returns {Array} An array of two arrays containing the x and y coordinates for the rectangles showing the Riemann sum. This
@@ -16385,18 +16418,14 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16385
16418
  * @memberof JXG.Math.Numerics
16386
16419
  */
16387
16420
  riemann: function (gf, n, type, start, end) {
16388
- var i,
16389
- delta,
16421
+ var i, delta,
16422
+ k, a, b, c, f0, f1, f2, xx, h,
16423
+ steps = 30, // Fixed step width for Simpson's rule
16390
16424
  xarr = [],
16391
16425
  yarr = [],
16392
- j = 0,
16393
16426
  x = start,
16394
- y,
16395
16427
  sum = 0,
16396
- f,
16397
- g,
16398
- ylow,
16399
- yup;
16428
+ y, f, g;
16400
16429
 
16401
16430
  if (_utils_type__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.isArray(gf)) {
16402
16431
  g = gf[0];
@@ -16413,61 +16442,94 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16413
16442
 
16414
16443
  delta = (end - start) / n;
16415
16444
 
16416
- // Upper bar ends
16445
+ // "Upper" horizontal line defined by function
16417
16446
  for (i = 0; i < n; i++) {
16418
- y = this._riemannValue(x, f, type, delta);
16419
- xarr[j] = x;
16420
- yarr[j] = y;
16447
+ if (type === "simpson") {
16448
+ sum += this._riemannValue(x, f, type, delta) * delta;
16449
+
16450
+ h = delta * 0.5;
16451
+ f0 = f(x);
16452
+ f1 = f(x + h);
16453
+ f2 = f(x + 2 * h);
16454
+
16455
+ a = (f2 + f0 - 2 * f1) / (h * h) * 0.5;
16456
+ b = (f2 - f0) / (2 * h);
16457
+ c = f1;
16458
+ for (k = 0; k < steps; k++) {
16459
+ xx = k * delta / steps - h;
16460
+ xarr.push(x + xx + h);
16461
+ yarr.push(a * xx * xx + b * xx + c);
16462
+ }
16463
+ x += delta;
16464
+ y = f2;
16465
+ } else {
16466
+ y = this._riemannValue(x, f, type, delta);
16467
+ xarr.push(x);
16468
+ yarr.push(y);
16469
+
16470
+ x += delta;
16471
+ if (type === "trapezoidal") {
16472
+ f2 = f(x);
16473
+ sum += (y + f2) * 0.5 * delta;
16474
+ y = f2;
16475
+ } else {
16476
+ sum += y * delta;
16477
+ }
16421
16478
 
16422
- j += 1;
16423
- x += delta;
16424
- if (type === "trapezoidal") {
16425
- y = f(x);
16479
+ xarr.push(x);
16480
+ yarr.push(y);
16426
16481
  }
16427
- xarr[j] = x;
16428
- yarr[j] = y;
16429
-
16430
- j += 1;
16482
+ xarr.push(x);
16483
+ yarr.push(y);
16431
16484
  }
16432
16485
 
16433
- // Lower bar ends
16486
+ // "Lower" horizontal line
16487
+ // Go backwards
16434
16488
  for (i = 0; i < n; i++) {
16435
- if (g) {
16436
- y = this._riemannValue(x, g, type, -delta);
16437
- } else {
16438
- y = 0.0;
16439
- }
16440
- xarr[j] = x;
16441
- yarr[j] = y;
16442
-
16443
- j += 1;
16444
- x -= delta;
16445
- if (type === "trapezoidal" && g) {
16446
- y = g(x);
16447
- }
16448
- xarr[j] = x;
16449
- yarr[j] = y;
16450
-
16451
- // Add the area of the bar to 'sum'
16452
- if (type !== "trapezoidal") {
16453
- ylow = y;
16454
- yup = yarr[2 * (n - 1) - 2 * i];
16489
+ if (type === "simpson" && g) {
16490
+ sum -= this._riemannValue(x, g, type, -delta) * delta;
16491
+
16492
+ h = delta * 0.5;
16493
+ f0 = g(x);
16494
+ f1 = g(x - h);
16495
+ f2 = g(x - 2 * h);
16496
+
16497
+ a = (f2 + f0 - 2 * f1) / (h * h) * 0.5;
16498
+ b = (f2 - f0) / (2 * h);
16499
+ c = f1;
16500
+ for (k = 0; k < steps; k++) {
16501
+ xx = k * delta / steps - h;
16502
+ xarr.push(x - xx - h);
16503
+ yarr.push(a * xx * xx + b * xx + c);
16504
+ }
16505
+ x -= delta;
16506
+ y = f2;
16455
16507
  } else {
16456
- yup = 0.5 * (f(x + delta) + f(x));
16457
16508
  if (g) {
16458
- ylow = 0.5 * (g(x + delta) + g(x));
16509
+ y = this._riemannValue(x, g, type, -delta);
16459
16510
  } else {
16460
- ylow = 0.0;
16511
+ y = 0.0;
16512
+ }
16513
+ xarr.push(x);
16514
+ yarr.push(y);
16515
+
16516
+ x -= delta;
16517
+ if (g) {
16518
+ if (type === "trapezoidal") {
16519
+ f2 = g(x);
16520
+ sum -= (y + f2) * 0.5 * delta;
16521
+ y = f2;
16522
+ } else {
16523
+ sum -= y * delta;
16524
+ }
16461
16525
  }
16462
16526
  }
16463
- sum += (yup - ylow) * delta;
16527
+ xarr.push(x);
16528
+ yarr.push(y);
16464
16529
 
16465
16530
  // Draw the vertical lines
16466
- j += 1;
16467
- xarr[j] = x;
16468
- yarr[j] = yarr[2 * (n - 1) - 2 * i];
16469
-
16470
- j += 1;
16531
+ xarr.push(x);
16532
+ yarr.push(f(x));
16471
16533
  }
16472
16534
 
16473
16535
  return [xarr, yarr, sum];
@@ -16493,12 +16555,12 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16493
16555
  * @memberof JXG.Math.Numerics
16494
16556
  */
16495
16557
  riemannsum: function (f, n, type, start, end) {
16496
- _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.deprecated("Numerics.riemannsum()", "Numerics.riemann()");
16558
+ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.deprecated("Numerics.riemannsum()", "Numerics.riemann()[2]");
16497
16559
  return this.riemann(f, n, type, start, end)[2];
16498
16560
  },
16499
16561
 
16500
16562
  /**
16501
- * Solve initial value problems numerically using Runge-Kutta-methods.
16563
+ * Solve initial value problems numerically using <i>explicit</i> Runge-Kutta methods.
16502
16564
  * See {@link https://en.wikipedia.org/wiki/Runge-Kutta_methods} for more information on the algorithm.
16503
16565
  * @param {object,String} butcher Butcher tableau describing the Runge-Kutta method to use. This can be either a string describing
16504
16566
  * a Runge-Kutta method with a Butcher tableau predefined in JSXGraph like 'euler', 'heun', 'rk4' or an object providing the structure
@@ -16510,18 +16572,20 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16510
16572
  * c: &lt;Array&gt;
16511
16573
  * }
16512
16574
  * </pre>
16513
- * 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
16514
- * @param {Array} x0 Initial value vector. If the problem is of one-dimensional, the initial value also has to be given in an array.
16575
+ * which corresponds to the Butcher tableau structure
16576
+ * shown here: https://en.wikipedia.org/w/index.php?title=List_of_Runge%E2%80%93Kutta_methods&oldid=357796696 .
16577
+ * <i>Default</i> is 'euler'.
16578
+ * @param {Array} x0 Initial value vector. Even if the problem is one-dimensional, the initial value has to be given in an array.
16515
16579
  * @param {Array} I Interval on which to integrate.
16516
- * @param {Number} N Number of evaluation points.
16580
+ * @param {Number} N Number of integration intervals, i.e. there are <i>N+1</i> evaluation points.
16517
16581
  * @param {function} f Function describing the right hand side of the first order ordinary differential equation, i.e. if the ode
16518
- * 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
16519
- * vector <tt>x</tt>, and has to return a vector of the same dimension as <tt>x</tt> has.
16582
+ * 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
16583
+ * vector <tt>x</tt>, and has to return a vector of the same length as <tt>x</tt> has.
16520
16584
  * @returns {Array} An array of vectors describing the solution of the ode on the given interval I.
16521
16585
  * @example
16522
16586
  * // A very simple autonomous system dx(t)/dt = x(t);
16523
- * function f(t, x) {
16524
- * return x;
16587
+ * var f = function(t, x) {
16588
+ * return [x[0]];
16525
16589
  * }
16526
16590
  *
16527
16591
  * // Solve it with initial value x(0) = 1 on the interval [0, 2]
@@ -16532,7 +16596,8 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16532
16596
  * var dataX = [];
16533
16597
  * var dataY = [];
16534
16598
  * var h = 0.1; // (I[1] - I[0])/N = (2-0)/20
16535
- * for(var i=0; i&lt;data.length; i++) {
16599
+ * var i;
16600
+ * for(i=0; i&lt;data.length; i++) {
16536
16601
  * dataX[i] = i*h;
16537
16602
  * dataY[i] = data[i][0];
16538
16603
  * }
@@ -16540,7 +16605,7 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16540
16605
  * </pre><div class="jxgbox" id="JXGd2432d04-4ef7-4159-a90b-a2eb8d38c4f6" style="width: 300px; height: 300px;"></div>
16541
16606
  * <script type="text/javascript">
16542
16607
  * var board = JXG.JSXGraph.initBoard('JXGd2432d04-4ef7-4159-a90b-a2eb8d38c4f6', {boundingbox: [-1, 5, 5, -1], axis: true, showcopyright: false, shownavigation: false});
16543
- * function f(t, x) {
16608
+ * var f = function(t, x) {
16544
16609
  * // we have to copy the value.
16545
16610
  * // return x; would just return the reference.
16546
16611
  * return [x[0]];
@@ -16559,11 +16624,7 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16559
16624
  */
16560
16625
  rungeKutta: function (butcher, x0, I, N, f) {
16561
16626
  var e,
16562
- i,
16563
- j,
16564
- k,
16565
- l,
16566
- s,
16627
+ i, j, k, l, s,
16567
16628
  x = [],
16568
16629
  y = [],
16569
16630
  h = (I[1] - I[0]) / N,
@@ -16578,17 +16639,19 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16578
16639
  s = butcher.s;
16579
16640
 
16580
16641
  // don't change x0, so copy it
16581
- for (e = 0; e < dim; e++) {
16582
- x[e] = x0[e];
16583
- }
16642
+ // for (e = 0; e < dim; e++) {
16643
+ // x[e] = x0[e];
16644
+ // }
16645
+ x = x0.slice();
16584
16646
 
16585
- for (i = 0; i < N; i++) {
16647
+ for (i = 0; i <= N; i++) {
16586
16648
  // Optimization doesn't work for ODEs plotted using time
16587
16649
  // if((i % quotient == 0) || (i == N-1)) {
16588
- result[r] = [];
16589
- for (e = 0; e < dim; e++) {
16590
- result[r][e] = x[e];
16591
- }
16650
+ // result[r] = [];
16651
+ // for (e = 0; e < dim; e++) {
16652
+ // result[r][e] = x[e];
16653
+ // }
16654
+ result[r] = x.slice();
16592
16655
 
16593
16656
  r += 1;
16594
16657
  k = [];
@@ -16661,7 +16724,7 @@ _math__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.Numerics = {
16661
16724
  * @param {Function} f Function, whose root is to be found
16662
16725
  * @param {Number} x0 Start value
16663
16726
  * @param {Object} object Parent object in case f is method of it
16664
- * @returns {Array} [x_0, f(x_0), x_1, f(x_1)] in case that x_0 <= x_1
16727
+ * @returns {Array} [x_0, f(x_0), x_1, f(x_1)] in case that x_0 <= x_1
16665
16728
  * or [x_1, f(x_1), x_0, f(x_0)] in case that x_1 < x_0.
16666
16729
  *
16667
16730
  * @see JXG.Math.Numerics.fzero
@@ -19030,7 +19093,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19030
19093
  * Especially, on mobile devices this enhances the user experience.
19031
19094
  * However, it is recommended to allow dragging outside of the JSXGraph board only
19032
19095
  * in certain constructions where users may not "loose" points outside of the board.
19033
- * Then points may become unreachable.
19096
+ * In such a case, points may become unreachable.
19034
19097
  * <p>
19035
19098
  * A situation where dragging outside of the board is uncritical is for example if
19036
19099
  * only sliders are used to interact with the construction.
@@ -19042,9 +19105,18 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19042
19105
  * <li> document
19043
19106
  * </ul>
19044
19107
  * <p>
19108
+ * Since the introduction of this attribute "moveTarget", the value "document" has become sort of
19109
+ * default on touch devices like smartphones. However, it is no longer the case that the document listens to
19110
+ * move events, but there is the new feature "setPointerCapture", which is also implicitly enabled on certain devices.
19111
+ * In future versions, JSXGraph may adopt this new standard and distinguish only two cases:
19112
+ * <ul>
19113
+ * <li>null: no pointerCapture
19114
+ * <li>document: use pointerCapture
19115
+ * </ul>
19116
+ * <p>
19045
19117
  * This attribute is immutable.
19046
19118
  * It can be changed as follows:
19047
- *
19119
+ *
19048
19120
  * @example
19049
19121
  * board.setAttribute({moveTarget: null});
19050
19122
  * board.removeEventHandlers();
@@ -19127,9 +19199,9 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19127
19199
  * Allow user interaction by registering mouse, pointer, keyboard or touch events.
19128
19200
  * Decide if JSXGraph listens to these events. Keyboard events can then turned off
19129
19201
  * separately with the keyboard attribute.
19130
- *
19202
+ *
19131
19203
  * <p>This attribute is immutable. Please use
19132
- * {@link JXG.Board#addEventHandlers()} and
19204
+ * {@link JXG.Board#addEventHandlers()} and
19133
19205
  * {@link JXG.Board#removeEventHandlers()} directly.
19134
19206
  *
19135
19207
  * @name JXG.Board#registerEvents
@@ -19145,7 +19217,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19145
19217
  * Listen to fullscreen event.
19146
19218
  *
19147
19219
  * <p>This attribute is immutable. Please use
19148
- * {@link JXG.Board#addFullscreenEventHandlers()} and
19220
+ * {@link JXG.Board#addFullscreenEventHandlers()} and
19149
19221
  * {@link JXG.Board#removeEventHandlers()} directly.
19150
19222
  *
19151
19223
  * @name JXG.Board#registerFullscreenEvent
@@ -19159,14 +19231,14 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19159
19231
  /**
19160
19232
  * Listen to resize events, i.e. start "resizeObserver" or handle the resize event with
19161
19233
  * "resizeListener". This is independent from the mouse, touch, pointer events.
19162
- *
19234
+ *
19163
19235
  * <p>This attribute is immutable. Please use
19164
- * {@link JXG.Board#addResizeEventHandlers()} and
19236
+ * {@link JXG.Board#addResizeEventHandlers()} and
19165
19237
  * {@link JXG.Board#removeEventHandlers()} directly.
19166
19238
  * <p>
19167
19239
  * This attribute just starts a resizeObserver. If the resizeObserver reacts
19168
19240
  * to size changed is controled wuth {@link JXG.Board#resize}.
19169
- *
19241
+ *
19170
19242
  * @name JXG.Board#registerResizeEvent
19171
19243
  * @see JXG.Board#resize
19172
19244
  * @see JXG.Board#registerEvents
@@ -19183,7 +19255,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
19183
19255
  * <p>
19184
19256
  * In case of 'canvas' it is advisable to call 'board.update()' after all elements have been
19185
19257
  * constructed. This ensures that all elements are drawn with their intended visual appearance.
19186
- *
19258
+ *
19187
19259
  * <p>
19188
19260
  * This attribute is immutable.
19189
19261
  *
@@ -22214,11 +22286,11 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
22214
22286
  width: 0.4,
22215
22287
 
22216
22288
  /**
22217
- * Angle under which comb elements are positioned.
22289
+ * Angle - given in radians - under which comb elements are positioned.
22218
22290
  *
22219
22291
  * @type Number
22220
22292
  * @name Comb#angle
22221
- * @default 60 degrees
22293
+ * @default Math.PI / 3 (i.e. &pi; /3 or 60^° degrees)
22222
22294
  */
22223
22295
  angle: Math.PI / 3,
22224
22296
 
@@ -23054,7 +23126,37 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
23054
23126
  *
23055
23127
  *
23056
23128
  */
23057
- autoPosition: false
23129
+ autoPosition: false,
23130
+
23131
+ /**
23132
+ * The auto position algorithm tries to put a label to a conflict-free
23133
+ * position around it's anchor element. For this, the algorithm tests 12 positions
23134
+ * around the anchor element starting at a distance from the anchor
23135
+ * defined here (in pixel).
23136
+ *
23137
+ * @name Label#autoPositionMinDistance
23138
+ * @see Label#autoPosition
23139
+ * @see Label#autoPositionMaxDistance
23140
+ * @type Number
23141
+ * @default 12
23142
+ *
23143
+ */
23144
+ autoPositionMinDistance: 12,
23145
+
23146
+ /**
23147
+ * The auto position algorithm tries to put a label to a conflict-free
23148
+ * position around it's anchor element. For this, the algorithm tests 12 positions
23149
+ * around the anchor element up to a distance from the anchor
23150
+ * defined here (in pixel).
23151
+ *
23152
+ * @name Label#autoPositionMaxDistance
23153
+ * @see Label#autoPosition
23154
+ * @see Label#autoPositionMinDistance
23155
+ * @type Number
23156
+ * @default 28
23157
+ *
23158
+ */
23159
+ autoPositionMaxDistance: 28
23058
23160
 
23059
23161
  /**#@-*/
23060
23162
  },
@@ -24356,6 +24458,70 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.Options = {
24356
24458
  */
24357
24459
  snapWidth: -1, // -1 = deactivated
24358
24460
 
24461
+ /**
24462
+ * List of values to snap to. If the glider is within snapValueDistance
24463
+ * (in user coordinate units) of one of these points,
24464
+ * then the glider snaps to that point.
24465
+ *
24466
+ * @memberOf Slider.prototype
24467
+ * @name snapValues
24468
+ * @type Array
24469
+ * @see Slider#snapValueDistance
24470
+ * @default empty
24471
+ *
24472
+ * @example
24473
+ * var n = board.create('slider', [[-2, 3], [4, 3], [1, 5, 100]], {
24474
+ * name: 'n',
24475
+ * snapWidth: 1,
24476
+ * snapValues: [1, 22, 77, 100],
24477
+ * snapValueDistance: 5
24478
+ * });
24479
+ *
24480
+ * var k = board.create('slider', [[-2, -1], [4, -1], [-4, 0, 4]], {
24481
+ * name: 'k',
24482
+ * snapWidth: 0.1,
24483
+ * snapValues: [-3, -1, 1, 3],
24484
+ * snapValueDistance: 0.4
24485
+ * });
24486
+ *
24487
+ * </pre><div id="JXG9be68014-4e14-479a-82b4-e92d9b8f6eef" class="jxgbox" style="width: 300px; height: 300px;"></div>
24488
+ * <script type="text/javascript">
24489
+ * (function() {
24490
+ * var board = JXG.JSXGraph.initBoard('JXG9be68014-4e14-479a-82b4-e92d9b8f6eef',
24491
+ * {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
24492
+ * var n = board.create('slider', [[-2, 3], [4, 3], [1, 5, 100]], {
24493
+ * name: 'n',
24494
+ * snapWidth: 1,
24495
+ * snapValues: [1, 22, 77, 100],
24496
+ * snapValueDistance: 5
24497
+ * });
24498
+ *
24499
+ * var k = board.create('slider', [[-2, -1], [4, -1], [-4, 0, 4]], {
24500
+ * name: 'k',
24501
+ * snapWidth: 0.1,
24502
+ * snapValues: [-3, -1, 1, 3],
24503
+ * snapValueDistance: 0.4
24504
+ * });
24505
+ *
24506
+ * })();
24507
+ *
24508
+ * </script><pre>
24509
+ *
24510
+ */
24511
+ snapValues: [],
24512
+
24513
+ /**
24514
+ * If the difference between the slider value and one of the elements of snapValues is less
24515
+ * than this number (in user coordinate units), the slider will snap to that value.
24516
+ *
24517
+ * @memberOf Slider.prototype
24518
+ * @name snapValueDistance
24519
+ * @type Number
24520
+ * @see Slider#snapValues
24521
+ * @default 0.0
24522
+ */
24523
+ snapValueDistance: 0.0,
24524
+
24359
24525
  /**
24360
24526
  * The precision of the slider value displayed in the optional text.
24361
24527
  * Replaced by the attribute "digits".
@@ -32076,7 +32242,7 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
32076
32242
  /**
32077
32243
  * Cross browser mouse / pointer / touch coordinates retrieval relative to the documents's top left corner.
32078
32244
  * This method might be a bit outdated today, since pointer events and clientX/Y are omnipresent.
32079
- *
32245
+ *
32080
32246
  * @param {Object} [e] The browsers event object. If omitted, <tt>window.event</tt> will be used.
32081
32247
  * @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.
32082
32248
  * @param {Object} [doc] The document object.
@@ -32441,10 +32607,16 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
32441
32607
  *
32442
32608
  */
32443
32609
  scaleJSXGraphDiv: function (wrap_id, inner_id, doc, scale) {
32444
- var len = doc.styleSheets.length, style, rule, w, h, b, wi, hi, bi,
32445
- scale_l, vshift_l, // scale_p, vshift_p,
32610
+ var len = doc.styleSheets.length, style, rule,
32611
+ w, h, b,
32612
+ wi, hi,
32613
+ wo, ho, inner,
32614
+ scale_l, vshift_l,
32446
32615
  f = scale,
32447
- rule_inner_l, // rule_inner_p,
32616
+ ratio,
32617
+ rule_inner_l,
32618
+ title = 'jsxgraph_fullscreen_css',
32619
+ found_css,
32448
32620
  pseudo_keys = [
32449
32621
  ":fullscreen",
32450
32622
  ":-webkit-full-screen",
@@ -32467,45 +32639,80 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
32467
32639
  h = b.height;
32468
32640
  w = b.width;
32469
32641
 
32470
- bi = doc.getElementById(inner_id).getBoundingClientRect();
32471
- hi = bi.height;
32472
- wi = bi.width;
32642
+ inner = doc.getElementById(inner_id);
32643
+ wo = inner._cssFullscreenStore.w;
32644
+ ho = inner._cssFullscreenStore.h;
32645
+ ratio = ho / wo;
32473
32646
 
32474
- if (wi / hi >= w / h) {
32475
- scale_l = (f * w) / wi;
32647
+ // Scale the div such that fits into the fullscreen.
32648
+ if (wo > w * f) {
32649
+ wo = w * f;
32650
+ ho = wo * ratio;
32651
+ }
32652
+ if (ho > h * f) {
32653
+ ho = h * f;
32654
+ wo = ho / ratio;
32655
+ }
32656
+
32657
+ wi = wo;
32658
+ hi = ho;
32659
+ // Compare this.setBoundingBox()
32660
+ if (ratio > 1) {
32661
+ // h > w
32662
+ if (ratio < h / w) {
32663
+ scale_l = w * f / wo;
32664
+ } else {
32665
+ scale_l = h * f / ho;
32666
+ }
32476
32667
  } else {
32477
- scale_l = (f * h) / hi;
32668
+ // h <= w
32669
+ if (ratio < h / w) {
32670
+ scale_l = w * f / wo;
32671
+ } else {
32672
+ scale_l = h * f / ho;
32673
+ }
32478
32674
  }
32479
32675
  vshift_l = (h - hi) * 0.5;
32480
32676
 
32481
32677
  // CSS rules to center the inner div horizontally and vertically.
32482
32678
  rule_inner_l =
32483
- "{margin:0 auto;transform:matrix(" +
32484
- scale_l +
32485
- ",0,0," +
32486
- scale_l +
32487
- ",0," +
32488
- vshift_l +
32489
- ");}";
32490
-
32491
- if (len === 0) {
32492
- // In case there is not a single CSS rule defined at all.
32679
+ "{" +
32680
+ "width:" + wi + "px !important;" +
32681
+ "height:" + hi + "px !important;" +
32682
+ "margin:0 auto;" +
32683
+ "transform:matrix(" + scale_l + ",0,0," + scale_l + ",0," + vshift_l + ");" +
32684
+ "}";
32685
+
32686
+ found_css = false;
32687
+ // Removing of the CSS here should happen only
32688
+ // in emergency cases.
32689
+ for (i = len - 1; i >= 0; i--) {
32690
+ if (doc.styleSheets[i].title === title) {
32691
+ found_css = true;
32692
+
32693
+ if (doc.styleSheets[i].title === title &&
32694
+ doc.styleSheets[i].cssRules.length > 0 &&
32695
+ regex.test(doc.styleSheets[i].cssRules[0].cssText) &&
32696
+ doc.styleSheets[i].deleteRule
32697
+ ) {
32698
+ doc.styleSheets[i].deleteRule(0);
32699
+ break;
32700
+ }
32701
+ }
32702
+ }
32703
+ if (!found_css) {
32704
+ // In case there is not yet a CSS style sheet for fullscreen
32705
+ // defined, do it now.
32493
32706
  style = document.createElement("style");
32707
+ style.setAttribute('title', title);
32494
32708
  // WebKit hack :(
32495
32709
  style.appendChild(document.createTextNode(""));
32496
- // Add the <style> element to the page
32497
- doc.appendChild(style);
32498
- len = doc.styleSheets.length;
32499
- }
32500
-
32501
- // Remove a previously installed CSS rule.
32502
- if (
32503
- doc.styleSheets[len - 1].cssRules.length > 0 &&
32504
- regex.test(doc.styleSheets[len - 1].cssRules[0].cssText) &&
32505
- doc.styleSheets[len - 1].deleteRule
32506
- ) {
32507
- doc.styleSheets[len - 1].deleteRule(0);
32710
+ // Add the <style> element to the page head.
32711
+ // It must be document, not the shadowDOM root.
32712
+ // It seems that the head tag does always exist.
32713
+ document.head.appendChild(style);
32508
32714
  }
32715
+ len = doc.styleSheets.length;
32509
32716
 
32510
32717
  // Install a CSS rule to center the JSXGraph div at the first position of the list.
32511
32718
  for (i = 0; i < len_pseudo; i++) {
@@ -32515,14 +32722,10 @@ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.extend(
32515
32722
  doc.styleSheets[len - 1].insertRule(rule, 0);
32516
32723
 
32517
32724
  break;
32518
- } catch (err) {
32519
- // console.log('JXG.scaleJSXGraphDiv: Could not add CSS rule "' + pseudo_keys[i] + '".');
32520
- // console.log('One possible reason could be that the id of the JSXGraph container does not start with a letter.');
32521
- }
32725
+ } catch (err) {}
32522
32726
  }
32523
32727
  if (i === len_pseudo) {
32524
- console.log("JXG.scaleJSXGraphDiv: Could not add any CSS rule.");
32525
- console.log(
32728
+ _jxg__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.debug("JXG.scaleJSXGraphDiv: Could not add any CSS rule.\n" +
32526
32729
  "One possible reason could be that the id of the JSXGraph container does not start with a letter."
32527
32730
  );
32528
32731
  }
@@ -35774,6 +35977,8 @@ math/* default */.Z.Extrapolate = {
35774
35977
 
35775
35978
  /* harmony default export */ const extrapolate = (math/* default */.Z.Extrapolate);
35776
35979
 
35980
+ // EXTERNAL MODULE: ./src/math/geometry.js
35981
+ var geometry = __webpack_require__(922);
35777
35982
  ;// CONCATENATED MODULE: ./src/math/qdt.js
35778
35983
  /*
35779
35984
  Copyright 2008-2023
@@ -35812,22 +36017,38 @@ math/* default */.Z.Extrapolate = {
35812
36017
 
35813
36018
 
35814
36019
 
36020
+
35815
36021
  /**
35816
36022
  * Instantiate a new quad tree.
35817
36023
  *
35818
36024
  * @name JXG.Math.Quadtree
35819
36025
  * @exports Mat.Quadtree as JXG.Math.Quadtree
35820
36026
  * @param {Array} bbox Bounding box of the new quad (sub)tree.
36027
+ * @param {Object} config Configuration object. Default value: to {capacity: 10}
36028
+ *
35821
36029
  * @constructor
35822
36030
  */
35823
- math/* default */.Z.Quadtree = function (bbox) {
36031
+ math/* default */.Z.Quadtree = function (bbox, config, parent) {
36032
+ config = config || {
36033
+ capacity: 10,
36034
+ pointType: 'coords'
36035
+ };
36036
+
35824
36037
  /**
35825
36038
  * The maximum number of points stored in a quad tree node
35826
36039
  * before it is subdivided.
35827
36040
  * @type Number
35828
36041
  * @default 10
35829
36042
  */
35830
- this.capacity = 10;
36043
+ this.capacity = config.capacity || 10;
36044
+
36045
+ /**
36046
+ * Type of a point object. Possible values are:
36047
+ * 'coords', 'object'.
36048
+ * @type String
36049
+ * @default 'coords'
36050
+ */
36051
+ this.pointType = config.pointType || 'coords';
35831
36052
 
35832
36053
  /**
35833
36054
  * Point storage.
@@ -35840,6 +36061,15 @@ math/* default */.Z.Quadtree = function (bbox) {
35840
36061
  this.ylb = bbox[3];
35841
36062
  this.yub = bbox[1];
35842
36063
 
36064
+ /**
36065
+ * Parent quad tree or null if there is not parent.
36066
+ *
36067
+ * @name JXG.Math.Quadtree#northWest
36068
+ * @type JXG.Math.Quadtree
36069
+ *
36070
+ */
36071
+ this.parent = parent || null;
36072
+
35843
36073
  /**
35844
36074
  * In a subdivided quad tree this represents the top left subtree.
35845
36075
  * @name JXG.Math.Quadtree#northWest
@@ -35867,6 +36097,7 @@ math/* default */.Z.Quadtree = function (bbox) {
35867
36097
  * @type JXG.Math.Quadtree
35868
36098
  */
35869
36099
  this.southWest = null;
36100
+
35870
36101
  };
35871
36102
 
35872
36103
  utils_type/* default */.Z.extend(
@@ -35883,13 +36114,24 @@ utils_type/* default */.Z.extend(
35883
36114
  },
35884
36115
 
35885
36116
  /**
35886
- * Insert a new point into this quad tree.
36117
+ * Insert a new point into this quad tree. Do this only,
36118
+ * if the point is not yet in the quadtree (test exactly).
36119
+ *
35887
36120
  * @param {JXG.Coords} p
35888
36121
  * @returns {Boolean}
35889
36122
  */
35890
36123
  insert: function (p) {
35891
- if (!this.contains(p.usrCoords[1], p.usrCoords[2])) {
35892
- return false;
36124
+ switch (this.pointType) {
36125
+ case 'coords':
36126
+ if (!this.contains(p.usrCoords[1], p.usrCoords[2])) {
36127
+ return false;
36128
+ }
36129
+ break;
36130
+ case 'object':
36131
+ if (!this.contains(p.x, p.y)) {
36132
+ return false;
36133
+ }
36134
+ break;
35893
36135
  }
35894
36136
 
35895
36137
  if (this.points.length < this.capacity) {
@@ -35921,21 +36163,22 @@ utils_type/* default */.Z.extend(
35921
36163
  */
35922
36164
  subdivide: function () {
35923
36165
  var i,
35924
- l = this.points.length,
36166
+ le = this.points.length,
35925
36167
  mx = this.xlb + (this.xub - this.xlb) / 2,
35926
36168
  my = this.ylb + (this.yub - this.ylb) / 2;
35927
36169
 
35928
- this.northWest = new math/* default */.Z.Quadtree([this.xlb, this.yub, mx, my]);
35929
- this.northEast = new math/* default */.Z.Quadtree([mx, this.yub, this.xub, my]);
35930
- this.southEast = new math/* default */.Z.Quadtree([this.xlb, my, mx, this.ylb]);
35931
- this.southWest = new math/* default */.Z.Quadtree([mx, my, this.xub, this.ylb]);
36170
+ this.northWest = new math/* default */.Z.Quadtree([this.xlb, this.yub, mx, my], this.config, this);
36171
+ this.northEast = new math/* default */.Z.Quadtree([mx, this.yub, this.xub, my], this.config, this);
36172
+ this.southEast = new math/* default */.Z.Quadtree([this.xlb, my, mx, this.ylb], this.config, this);
36173
+ this.southWest = new math/* default */.Z.Quadtree([mx, my, this.xub, this.ylb], this.config, this);
35932
36174
 
35933
- for (i = 0; i < l; i += 1) {
35934
- this.northWest.insert(this.points[i]);
35935
- this.northEast.insert(this.points[i]);
35936
- this.southEast.insert(this.points[i]);
35937
- this.southWest.insert(this.points[i]);
36175
+ for (i = 0; i < le; i += 1) {
36176
+ this.insert(this.points[i]);
35938
36177
  }
36178
+
36179
+ // We empty this node points
36180
+ this.points.length = 0;
36181
+ this.points = [];
35939
36182
  },
35940
36183
 
35941
36184
  /**
@@ -35981,14 +36224,13 @@ utils_type/* default */.Z.extend(
35981
36224
  },
35982
36225
 
35983
36226
  /**
35984
- * Retrieve the smallest quad tree that contains the given point.
36227
+ * Retrieve the smallest quad tree that contains the given coordinate pair.
35985
36228
  * @name JXG.Math.Quadtree#_query
35986
36229
  * @param {JXG.Coords|Number} xp
35987
36230
  * @param {Number} y
35988
36231
  * @returns {Boolean|JXG.Quadtree} The quad tree if the point is found, false
35989
36232
  * if none of the quad trees contains the point (i.e. the point is not inside
35990
36233
  * the root tree's AABB).
35991
- * @private
35992
36234
  */
35993
36235
  query: function (xp, y) {
35994
36236
  var _x, _y;
@@ -36002,7 +36244,94 @@ utils_type/* default */.Z.extend(
36002
36244
  }
36003
36245
 
36004
36246
  return this._query(_x, _y);
36247
+ },
36248
+
36249
+ /**
36250
+ *
36251
+ * @param {*} x
36252
+ * @param {*} y
36253
+ * @param {*} tol
36254
+ * @returns {Boolean}
36255
+ */
36256
+ isIn: function (x, y, tol) {
36257
+ var r, i, le;
36258
+
36259
+ if (this.contains(x, y)) {
36260
+ le = this.points.length;
36261
+
36262
+ switch (this.pointType) {
36263
+ case 'coords':
36264
+ for (i = 0; i < le; i++) {
36265
+ if (geometry/* default */.Z.distance([x, y], this.points[i].usrCoords.slice(1), 2) < tol) {
36266
+ return true;
36267
+ }
36268
+ }
36269
+ break;
36270
+ case 'object':
36271
+ for (i = 0; i < le; i++) {
36272
+ if (geometry/* default */.Z.distance([x, y], [this.points[i].x, this.points[i].y], 2) < tol) {
36273
+ return true;
36274
+ }
36275
+ }
36276
+ break;
36277
+ }
36278
+
36279
+
36280
+ if (this.northWest === null) {
36281
+ return false;
36282
+ }
36283
+
36284
+ r = this.northWest.isIn(x, y, tol);
36285
+ if (r) {
36286
+ return r;
36287
+ }
36288
+
36289
+ r = this.northEast.isIn(x, y, tol);
36290
+ if (r) {
36291
+ return r;
36292
+ }
36293
+
36294
+ r = this.southEast.isIn(x, y, tol);
36295
+ if (r) {
36296
+ return r;
36297
+ }
36298
+
36299
+ r = this.southWest.isIn(x, y, tol);
36300
+ if (r) {
36301
+ return r;
36302
+ }
36303
+ }
36304
+
36305
+ return false;
36306
+ },
36307
+
36308
+ /**
36309
+ *
36310
+ * @returns {Array}
36311
+ */
36312
+ getAllPoints: function() {
36313
+ var pointsList = [];
36314
+ this.getAllPointsRecursive(pointsList);
36315
+ return pointsList;
36316
+ },
36317
+
36318
+ /**
36319
+ *
36320
+ * @param {Array} pointsList
36321
+ * @private
36322
+ */
36323
+ getAllPointsRecursive(pointsList) {
36324
+ if (this.northWest === null) {
36325
+ Array.prototype.push.apply(pointsList, this.points.slice());
36326
+ return;
36327
+ }
36328
+
36329
+ this.northWest.getAllPointsRecursive(pointsList);
36330
+ this.northEast.getAllPointsRecursive(pointsList);
36331
+ this.southEast.getAllPointsRecursive(pointsList);
36332
+ this.southWest.getAllPointsRecursive(pointsList);
36005
36333
  }
36334
+
36006
36335
  }
36007
36336
  );
36008
36337
 
@@ -37411,8 +37740,6 @@ jxg/* default */.Z.Math.Nlp = {
37411
37740
  var base_coords = __webpack_require__(705);
37412
37741
  // EXTERNAL MODULE: ./src/math/statistics.js
37413
37742
  var statistics = __webpack_require__(309);
37414
- // EXTERNAL MODULE: ./src/math/geometry.js
37415
- var geometry = __webpack_require__(922);
37416
37743
  ;// CONCATENATED MODULE: ./src/math/plot.js
37417
37744
  /*
37418
37745
  Copyright 2008-2023
@@ -46898,20 +47225,21 @@ jxg/* default */.Z.extend(
46898
47225
  MathJax.Hub.Queue(["Typeset", MathJax.Hub, el.rendNode]);
46899
47226
  }
46900
47227
 
46901
- // Restore the transformation necessary for fullscreen mode
46902
- // MathJax removes it when handling dynamic content
46903
- id = el.board.container;
46904
- wrap_id = "fullscreenwrap_" + id;
46905
- if (document.getElementById(wrap_id)) {
46906
- scale = el.board.containerObj._cssFullscreenStore.scale;
46907
- vshift = el.board.containerObj._cssFullscreenStore.vshift;
46908
- env/* default */.Z.scaleJSXGraphDiv(
46909
- "#" + wrap_id,
46910
- "#" + id,
46911
- scale,
46912
- vshift
46913
- );
46914
- }
47228
+ // Obsolete:
47229
+ // // Restore the transformation necessary for fullscreen mode
47230
+ // // MathJax removes it when handling dynamic content
47231
+ // id = el.board.container;
47232
+ // wrap_id = "fullscreenwrap_" + id;
47233
+ // if (document.getElementById(wrap_id)) {
47234
+ // scale = el.board.containerObj._cssFullscreenStore.scale;
47235
+ // vshift = el.board.containerObj._cssFullscreenStore.vshift;
47236
+ // Env.scaleJSXGraphDiv(
47237
+ // "#" + wrap_id,
47238
+ // "#" + id,
47239
+ // scale,
47240
+ // vshift
47241
+ // );
47242
+ // }
46915
47243
  } catch (e) {
46916
47244
  jxg/* default */.Z.debug("MathJax (not yet) loaded");
46917
47245
  }
@@ -50940,6 +51268,11 @@ jxg/* default */.Z.extend(
50940
51268
  return false;
50941
51269
  }
50942
51270
 
51271
+ if (utils_type/* default */.Z.evaluate(this.attr.movetarget) === null &&
51272
+ utils_type/* default */.Z.exists(evt.target) && utils_type/* default */.Z.exists(evt.target.releasePointerCapture)) {
51273
+ evt.target.releasePointerCapture(evt.pointerId);
51274
+ }
51275
+
50943
51276
  if (!object && evt.isPrimary) {
50944
51277
  // First finger down. To be on the safe side this._board_touches is cleared.
50945
51278
  // this._pointerClearTouches();
@@ -51142,9 +51475,7 @@ jxg/* default */.Z.extend(
51142
51475
  * @returns {Boolean}
51143
51476
  */
51144
51477
  pointerMoveListener: function (evt) {
51145
- var i,
51146
- j,
51147
- pos,
51478
+ var i, j, pos, eps,
51148
51479
  touchTargets,
51149
51480
  type = 'mouse'; // in case of no browser
51150
51481
 
@@ -51177,10 +51508,21 @@ jxg/* default */.Z.extend(
51177
51508
  this._inputDevice = this._getPointerInputDevice(evt);
51178
51509
  type = this._inputDevice;
51179
51510
  this.options.precision.hasPoint = this.options.precision[type];
51511
+ eps = this.options.precision.hasPoint * 0.3333;
51512
+
51513
+ pos = this.getMousePosition(evt);
51514
+ // Ignore pointer move event if too close at the border
51515
+ // and setPointerCapture is off
51516
+ if (utils_type/* default */.Z.evaluate(this.attr.movetarget) === null &&
51517
+ pos[0] <= eps || pos[1] <= eps ||
51518
+ pos[0] >= this.canvasWidth - eps ||
51519
+ pos[1] >= this.canvasHeight - eps
51520
+ ) {
51521
+ return this.mode === this.BOARD_MODE_NONE;
51522
+ }
51180
51523
 
51181
51524
  // selection
51182
51525
  if (this.selectingMode) {
51183
- pos = this.getMousePosition(evt);
51184
51526
  this._moveSelecting(pos);
51185
51527
  this.triggerEventHandlers(
51186
51528
  ['touchmoveselecting', 'moveselecting', 'pointermoveselecting'],
@@ -51188,7 +51530,6 @@ jxg/* default */.Z.extend(
51188
51530
  );
51189
51531
  } else if (!this.mouseOriginMove(evt)) {
51190
51532
  if (this.mode === this.BOARD_MODE_DRAG) {
51191
- pos = this.getMousePosition(evt);
51192
51533
  // Run through all jsxgraph elements which are touched by at least one finger.
51193
51534
  for (i = 0; i < this.touches.length; i++) {
51194
51535
  touchTargets = this.touches[i].targets;
@@ -51225,7 +51566,6 @@ jxg/* default */.Z.extend(
51225
51566
  }
51226
51567
 
51227
51568
  // Move event without dragging an element
51228
- pos = this.getMousePosition(evt);
51229
51569
  this.highlightElements(pos[0], pos[1], evt, -1);
51230
51570
  }
51231
51571
  }
@@ -52521,7 +52861,7 @@ jxg/* default */.Z.extend(
52521
52861
  }, options);
52522
52862
  this.intersectionObserver.observe(that.containerObj);
52523
52863
  } catch (err) {
52524
- console.log('JSXGraph: IntersectionObserver not available in this browser.');
52864
+ jxg/* default */.Z.debug('JSXGraph: IntersectionObserver not available in this browser.');
52525
52865
  }
52526
52866
  },
52527
52867
 
@@ -54274,10 +54614,10 @@ jxg/* default */.Z.extend(
54274
54614
  * <li> array: ['key', value]
54275
54615
  * </ul>
54276
54616
  * Some board attributes are immutable, like e.g. the renderer type.
54277
- *
54617
+ *
54278
54618
  * @param {Object} attributes An object with attributes.
54279
54619
  * @returns {JXG.Board} Reference to the board
54280
- *
54620
+ *
54281
54621
  * @example
54282
54622
  * const board = JXG.JSXGraph.initBoard('jxgbox', {
54283
54623
  * boundingbox: [-5, 5, 5, -5],
@@ -54287,7 +54627,7 @@ jxg/* default */.Z.extend(
54287
54627
  * showScreenshot: true,
54288
54628
  * showCopyright: false
54289
54629
  * });
54290
- *
54630
+ *
54291
54631
  * board.setAttribute({
54292
54632
  * animationDelay: 10,
54293
54633
  * boundingbox: [-10, 5, 10, -5],
@@ -54303,7 +54643,7 @@ jxg/* default */.Z.extend(
54303
54643
  * locale: 'de-DE'
54304
54644
  * }
54305
54645
  * });
54306
- *
54646
+ *
54307
54647
  * board.setAttribute({
54308
54648
  * selection: {
54309
54649
  * enabled: true,
@@ -54321,7 +54661,7 @@ jxg/* default */.Z.extend(
54321
54661
  * showNavigation: false
54322
54662
  * });
54323
54663
  * board.setAttribute('showCopyright:false');
54324
- *
54664
+ *
54325
54665
  * var p = board.create('point', [1, 1], {size: 10,
54326
54666
  * label: {
54327
54667
  * fontSize: 24,
@@ -54329,8 +54669,8 @@ jxg/* default */.Z.extend(
54329
54669
  * offset: [5, 0]
54330
54670
  * }
54331
54671
  * });
54332
- *
54333
- *
54672
+ *
54673
+ *
54334
54674
  * </pre><div id="JXGea7b8e09-beac-4d95-9a0c-5fc1c761ffbc" class="jxgbox" style="width: 300px; height: 300px;"></div>
54335
54675
  * <script type="text/javascript">
54336
54676
  * (function() {
@@ -54342,7 +54682,7 @@ jxg/* default */.Z.extend(
54342
54682
  * showScreenshot: true,
54343
54683
  * showCopyright: false
54344
54684
  * });
54345
- *
54685
+ *
54346
54686
  * board.setAttribute({
54347
54687
  * animationDelay: 10,
54348
54688
  * boundingbox: [-10, 5, 10, -5],
@@ -54358,7 +54698,7 @@ jxg/* default */.Z.extend(
54358
54698
  * locale: 'de-DE'
54359
54699
  * }
54360
54700
  * });
54361
- *
54701
+ *
54362
54702
  * board.setAttribute({
54363
54703
  * selection: {
54364
54704
  * enabled: true,
@@ -54375,9 +54715,9 @@ jxg/* default */.Z.extend(
54375
54715
  * showZoom: false,
54376
54716
  * showNavigation: false
54377
54717
  * });
54378
- *
54718
+ *
54379
54719
  * board.setAttribute('showCopyright:false');
54380
- *
54720
+ *
54381
54721
  * var p = board.create('point', [1, 1], {size: 10,
54382
54722
  * label: {
54383
54723
  * fontSize: 24,
@@ -54385,13 +54725,13 @@ jxg/* default */.Z.extend(
54385
54725
  * offset: [5, 0]
54386
54726
  * }
54387
54727
  * });
54388
- *
54389
- *
54728
+ *
54729
+ *
54390
54730
  * })();
54391
- *
54731
+ *
54392
54732
  * </script><pre>
54393
- *
54394
- *
54733
+ *
54734
+ *
54395
54735
  */
54396
54736
  setAttribute: function (attr) {
54397
54737
  var i, arg, pair,
@@ -55507,6 +55847,8 @@ jxg/* default */.Z.extend(
55507
55847
  * Expand the JSXGraph construction to fullscreen.
55508
55848
  * In order to preserve the proportions of the JSXGraph element,
55509
55849
  * a wrapper div is created which is set to fullscreen.
55850
+ * This function is called when fullscreen mode is triggered
55851
+ * <b>and</b> when it is closed.
55510
55852
  * <p>
55511
55853
  * The wrapping div has the CSS class 'jxgbox_wrap_private' which is
55512
55854
  * defined in the file 'jsxgraph.css'
@@ -55579,6 +55921,7 @@ jxg/* default */.Z.extend(
55579
55921
  var wrap_id,
55580
55922
  wrap_node,
55581
55923
  inner_node,
55924
+ dim,
55582
55925
  doc = this.document,
55583
55926
  fullscreenElement;
55584
55927
 
@@ -55587,7 +55930,17 @@ jxg/* default */.Z.extend(
55587
55930
  inner_node = doc.getElementById(id);
55588
55931
  wrap_id = 'fullscreenwrap_' + id;
55589
55932
 
55933
+ // Store the original data.
55934
+ // This is used to establish the ratio h / w in
55935
+ // fullscreen mode
55936
+ dim = this.containerObj.getBoundingClientRect();
55937
+ inner_node._cssFullscreenStore = {
55938
+ w: dim.width,
55939
+ h: dim.height
55940
+ }
55941
+
55590
55942
  // Wrap a div around the JSXGraph div.
55943
+ // It is removed when fullscreen mode is closed.
55591
55944
  if (doc.getElementById(wrap_id)) {
55592
55945
  wrap_node = doc.getElementById(wrap_id);
55593
55946
  } else {
@@ -55598,10 +55951,6 @@ jxg/* default */.Z.extend(
55598
55951
  wrap_node.appendChild(inner_node);
55599
55952
  }
55600
55953
 
55601
- // Get the real width and height of the JSXGraph div
55602
- // and determine the scaling and vertical shift amount
55603
- // this._fullscreen_res = Env._getScaleFactors(inner_node);
55604
-
55605
55954
  // Trigger fullscreen mode
55606
55955
  wrap_node.requestFullscreen =
55607
55956
  wrap_node.requestFullscreen ||
@@ -55616,12 +55965,15 @@ jxg/* default */.Z.extend(
55616
55965
  } else {
55617
55966
  fullscreenElement = doc.msFullscreenElement;
55618
55967
  }
55968
+
55619
55969
  if (fullscreenElement === null) {
55620
55970
  // Start fullscreen mode
55621
55971
  if (wrap_node.requestFullscreen) {
55622
55972
  wrap_node.requestFullscreen();
55973
+ this.startFullscreenResizeObserver(wrap_node);
55623
55974
  }
55624
55975
  } else {
55976
+ this.stopFullscreenResizeObserver(wrap_node);
55625
55977
  if (utils_type/* default */.Z.exists(document.exitFullscreen)) {
55626
55978
  document.exitFullscreen();
55627
55979
  } else if (utils_type/* default */.Z.exists(document.webkitExitFullscreen)) {
@@ -55642,7 +55994,8 @@ jxg/* default */.Z.extend(
55642
55994
  fullscreenListener: function (evt) {
55643
55995
  var inner_id,
55644
55996
  inner_node,
55645
- fullscreenElement, // res,
55997
+ fullscreenElement,
55998
+ i,
55646
55999
  doc = this.document;
55647
56000
 
55648
56001
  inner_id = this._fullscreen_inner_id;
@@ -55665,30 +56018,22 @@ jxg/* default */.Z.extend(
55665
56018
  if (fullscreenElement) {
55666
56019
  // Just entered fullscreen mode
55667
56020
 
55668
- // Get the data computed in board.toFullscreen()
55669
- // res = this._fullscreen_res;
55670
-
55671
- // Store the scaling data.
55672
- // It is used in AbstractRenderer.updateText to restore the scaling matrix
55673
- // which is removed by MathJax.
56021
+ // Store the original data.
55674
56022
  // Further, the CSS margin has to be removed when in fullscreen mode,
55675
56023
  // and must be restored later.
55676
- inner_node._cssFullscreenStore = {
55677
- id: fullscreenElement.id,
55678
- isFullscreen: true,
55679
- margin: inner_node.style.margin
55680
- // width: inner_node.style.width
55681
- // scale: res.scale,
55682
- // vshift: res.vshift
55683
- };
55684
-
56024
+ // Obsolete:
56025
+ // It is used in AbstractRenderer.updateText to restore the scaling matrix
56026
+ // which is removed by MathJax.
56027
+ inner_node._cssFullscreenStore.id = fullscreenElement.id;
56028
+ inner_node._cssFullscreenStore.isFullscreen = true;
56029
+ inner_node._cssFullscreenStore.margin = inner_node.style.margin;
55685
56030
  inner_node.style.margin = '';
55686
- // inner_node.style.width = res.width + 'px';
55687
56031
 
55688
56032
  // Do the shifting and scaling via CSS pseudo rules
55689
56033
  // We do this after fullscreen mode has been established to get the correct size
55690
56034
  // of the JSXGraph div.
55691
- env/* default */.Z.scaleJSXGraphDiv(fullscreenElement.id, inner_id, doc, utils_type/* default */.Z.evaluate(this.attr.fullscreen.scale));
56035
+ env/* default */.Z.scaleJSXGraphDiv(fullscreenElement.id, inner_id, doc,
56036
+ utils_type/* default */.Z.evaluate(this.attr.fullscreen.scale));
55692
56037
 
55693
56038
  // Clear this.doc.fullscreenElement, because Safari doesn't to it and
55694
56039
  // when leaving full screen mode it is still set.
@@ -55697,20 +56042,93 @@ jxg/* default */.Z.extend(
55697
56042
  // Just left the fullscreen mode
55698
56043
 
55699
56044
  // Remove the CSS rules added in Env.scaleJSXGraphDiv
55700
- try {
55701
- doc.styleSheets[doc.styleSheets.length - 1].deleteRule(0);
55702
- } catch (err) {
55703
- console.log('JSXGraph: Could not remove CSS rules for full screen mode');
56045
+ for (i = doc.styleSheets.length - 1; i >= 0; i--) {
56046
+ if (doc.styleSheets[i].title === 'jsxgraph_fullscreen_css') {
56047
+ doc.styleSheets[i].deleteRule(0);
56048
+ break;
56049
+ }
55704
56050
  }
55705
56051
 
55706
56052
  inner_node._cssFullscreenStore.isFullscreen = false;
55707
56053
  inner_node.style.margin = inner_node._cssFullscreenStore.margin;
55708
- // inner_node.style.width = inner_node._cssFullscreenStore.width;
56054
+
56055
+ // Remove the wrapper div
56056
+ inner_node.parentElement.replaceWith(inner_node);
55709
56057
  }
55710
56058
 
55711
56059
  this.updateCSSTransforms();
55712
56060
  },
55713
56061
 
56062
+ /**
56063
+ * Start resize observer in to handle
56064
+ * orientation changes in fullscreen mode.
56065
+ *
56066
+ * @param {Object} node DOM object which is in fullscreen mode. It is the wrapper element
56067
+ * around the JSXGraph div.
56068
+ * @returns {JXG.Board} Reference to the board
56069
+ * @private
56070
+ * @see JXG.Board#toFullscreen
56071
+ *
56072
+ */
56073
+ startFullscreenResizeObserver: function(node) {
56074
+ var that = this;
56075
+
56076
+ if (!env/* default */.Z.isBrowser || !this.attr.resize || !this.attr.resize.enabled) {
56077
+ return this;
56078
+ }
56079
+
56080
+ this.resizeObserver = new ResizeObserver(function (entries) {
56081
+ var inner_id,
56082
+ fullscreenElement,
56083
+ doc = that.document;
56084
+
56085
+ if (!that._isResizing) {
56086
+ that._isResizing = true;
56087
+ window.setTimeout(function () {
56088
+ try {
56089
+ inner_id = that._fullscreen_inner_id;
56090
+ if (doc.fullscreenElement !== undefined) {
56091
+ fullscreenElement = doc.fullscreenElement;
56092
+ } else if (doc.webkitFullscreenElement !== undefined) {
56093
+ fullscreenElement = doc.webkitFullscreenElement;
56094
+ } else {
56095
+ fullscreenElement = doc.msFullscreenElement;
56096
+ }
56097
+ if (fullscreenElement !== null) {
56098
+ env/* default */.Z.scaleJSXGraphDiv(fullscreenElement.id, inner_id, doc,
56099
+ utils_type/* default */.Z.evaluate(that.attr.fullscreen.scale));
56100
+ }
56101
+ } catch (err) {
56102
+ that.stopFullscreenResizeObserver(node);
56103
+ } finally {
56104
+ that._isResizing = false;
56105
+ }
56106
+ }, that.attr.resize.throttle);
56107
+ }
56108
+ });
56109
+ this.resizeObserver.observe(node);
56110
+ return this;
56111
+ },
56112
+
56113
+ /**
56114
+ * Remove resize observer to handle orientation changes in fullscreen mode.
56115
+ * @param {Object} node DOM object which is in fullscreen mode. It is the wrapper element
56116
+ * around the JSXGraph div.
56117
+ * @returns {JXG.Board} Reference to the board
56118
+ * @private
56119
+ * @see JXG.Board#toFullscreen
56120
+ */
56121
+ stopFullscreenResizeObserver: function(node) {
56122
+ if (!env/* default */.Z.isBrowser || !this.attr.resize || !this.attr.resize.enabled) {
56123
+ return this;
56124
+ }
56125
+
56126
+ if (utils_type/* default */.Z.exists(this.resizeObserver)) {
56127
+ this.resizeObserver.unobserve(node);
56128
+ }
56129
+ return this;
56130
+ },
56131
+
55714
56132
  /**
55715
56133
  * Add user activity to the array 'board.userLog'.
55716
56134
  *
@@ -57801,13 +58219,8 @@ jxg/* default */.Z.extend(
57801
58219
 
57802
58220
  // documented in AbstractRenderer
57803
58221
  resize: function (w, h) {
57804
- // this.svgRoot.style.width = parseFloat(w) + 'px';
57805
- // this.svgRoot.style.height = parseFloat(h) + 'px';
57806
-
57807
58222
  this.svgRoot.setAttribute("width", parseFloat(w));
57808
58223
  this.svgRoot.setAttribute("height", parseFloat(h));
57809
- // this.svgRoot.setAttribute('width', '100%');
57810
- // this.svgRoot.setAttribute('height', '100%');
57811
58224
  },
57812
58225
 
57813
58226
  // documented in JXG.AbstractRenderer
@@ -61359,7 +61772,7 @@ jxg/* default */.Z.extend(
61359
61772
  }
61360
61773
  this.context = this.canvasRoot.getContext("2d");
61361
61774
  // The width and height of the canvas is set to twice the CSS values,
61362
- // followed by an appropiate scaling.
61775
+ // followed by an appropriate scaling.
61363
61776
  // See https://stackoverflow.com/questions/22416462/canvas-element-with-blurred-lines
61364
61777
  this.context.scale(2, 2);
61365
61778
  },
@@ -72825,6 +73238,11 @@ jxg/* default */.Z.registerElement("metapostspline", jxg/* default */.Z.createMe
72825
73238
  /**
72826
73239
  * @class This element is used to provide a constructor for Riemann sums, which is realized as a special curve.
72827
73240
  * The returned element has the method Value() which returns the sum of the areas of the bars.
73241
+ * <p>
73242
+ * In case of type "simpson" and "trapezoidal", the horizontal line approximating the function value
73243
+ * is replaced by a parabola or a secant. IN case of "simpson",
73244
+ * the parabola is approximated visually by a polygonal chain of fixed step width.
73245
+ *
72828
73246
  * @pseudo
72829
73247
  * @description
72830
73248
  * @name Riemannsum
@@ -72838,7 +73256,7 @@ jxg/* default */.Z.registerElement("metapostspline", jxg/* default */.Z.createMe
72838
73256
  * n determines the number of bars, it is either a fixed number or a function.
72839
73257
  * <p>
72840
73258
  * type is a string or function returning one of the values: 'left', 'right', 'middle', 'lower', 'upper', 'random', 'simpson', or 'trapezoidal'.
72841
- * Default value is 'left'.
73259
+ * Default value is 'left'. "simpson" is Simpson's 1/3 rule.
72842
73260
  * <p>
72843
73261
  * Further parameters are an optional number or function for the left interval border a,
72844
73262
  * and an optional number or function for the right interval border b.
@@ -80261,6 +80679,7 @@ jxg/* default */.Z.createSlider = function (board, parents, attributes) {
80261
80679
  ticks, ti, t,
80262
80680
  startx, starty,
80263
80681
  withText, withTicks,
80682
+ snapValues, snapValueDistance,
80264
80683
  snapWidth, sw, s,
80265
80684
  attr;
80266
80685
 
@@ -80268,6 +80687,8 @@ jxg/* default */.Z.createSlider = function (board, parents, attributes) {
80268
80687
  withTicks = attr.withticks;
80269
80688
  withText = attr.withlabel;
80270
80689
  snapWidth = attr.snapwidth;
80690
+ snapValues = attr.snapvalues;
80691
+ snapValueDistance = attr.snapvaluedistance;
80271
80692
 
80272
80693
  // start point
80273
80694
  attr = utils_type/* default */.Z.copyAttributes(attributes, board.options, "slider", "point1");
@@ -80304,7 +80725,7 @@ jxg/* default */.Z.createSlider = function (board, parents, attributes) {
80304
80725
  attr.withLabel = false;
80305
80726
  // gliders set snapwidth=-1 by default (i.e. deactivate them)
80306
80727
  p3 = board.create("glider", [startx, starty, l1], attr);
80307
- p3.setAttribute({ snapwidth: snapWidth });
80728
+ p3.setAttribute({ snapwidth: snapWidth, snapvalues: snapValues, snapvaluedistance: snapValueDistance });
80308
80729
 
80309
80730
  // Segment from start point to glider point: highline
80310
80731
  attr = utils_type/* default */.Z.copyAttributes(attributes, board.options, "slider", "highline");
@@ -80319,7 +80740,18 @@ jxg/* default */.Z.createSlider = function (board, parents, attributes) {
80319
80740
  */
80320
80741
  p3.Value = function () {
80321
80742
  var sdiff = this._smax - this._smin,
80322
- ev_sw = utils_type/* default */.Z.evaluate(this.visProp.snapwidth);
80743
+ ev_sw = utils_type/* default */.Z.evaluate(this.visProp.snapwidth),
80744
+ snapValues, i, v;
80745
+
80746
+ snapValues = utils_type/* default */.Z.evaluate(this.visProp.snapvalues);
80747
+ if (utils_type/* default */.Z.isArray(snapValues)) {
80748
+ for (i=0; i < snapValues.length; i++) {
80749
+ v = (snapValues[i] - this._smin) / (this._smax - this._smin);
80750
+ if(this.position === v) {
80751
+ return snapValues[i];
80752
+ }
80753
+ }
80754
+ }
80323
80755
 
80324
80756
  return ev_sw === -1
80325
80757
  ? this.position * sdiff + this._smin
@@ -88964,36 +89396,36 @@ var checkbox_priv = {
88964
89396
  * }, checkbox);
88965
89397
  * })();
88966
89398
  * </script><pre>
88967
- *
88968
89399
  * @example
88969
- * var i1 = board.create('input', [-3, 4, 'sin(x)', 'f(x)='], {cssStyle: 'width:4em', maxlength: 2});
88970
- * var c1 = board.create('checkbox', [-3, 2, 'label 1'], {});
88971
- * var b1 = board.create('button', [-3, -1, 'Change texts', function () {
88972
- * i1.setText('g(x)');
89400
+ * var i1 = board.create('input', [1, 5, 'sin(x)', 'f(x)='], {cssStyle: 'width:4em', maxlength: 2});
89401
+ * var c1 = board.create('checkbox', [1, 3, 'label 1'], {});
89402
+ * var b1 = board.create('button', [1, 1, 'Change texts', function () {
89403
+ * i1.setText('g(x)=');
88973
89404
  * i1.set('cos(x)');
88974
89405
  * c1.setText('label 2');
88975
89406
  * b1.setText('Texts are changed');
88976
89407
  * }],
88977
- * {cssStyle: 'width:400px'});
88978
- *
88979
- * </pre><div id="JXG11cac8gg-2354-47e7-9da4-eb298e53de05" class="jxgbox" style="width: 300px; height: 300px;"></div>
89408
+ * {cssStyle: 'width:200px'});
89409
+ *
89410
+ * </pre><div id="JXG31c6d070-354b-4f09-aab9-9aaa796f730c" class="jxgbox" style="width: 300px; height: 300px;"></div>
88980
89411
  * <script type="text/javascript">
88981
89412
  * (function() {
88982
- * var board = JXG.JSXGraph.initBoard('JXG11cac8gg-2354-47e7-9da4-eb298e53de05',
88983
- * {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
88984
- * var i1 = board.create('input', [-3, 4, 'sin(x)', 'f(x)='], {cssStyle: 'width:4em', maxlength: 2});
88985
- * var c1 = board.create('checkbox', [-3, 2, 'label 1'], {});
88986
- * var b1 = board.create('button', [-3, -1, 'Change texts', function () {
88987
- * i1.setText('g(x)');
89413
+ * var board = JXG.JSXGraph.initBoard('JXG31c6d070-354b-4f09-aab9-9aaa796f730c',
89414
+ * {boundingbox: [-1, 7, 7, -1], axis: true, showcopyright: false, shownavigation: false});
89415
+ * var i1 = board.create('input', [1, 5, 'sin(x)', 'f(x)='], {cssStyle: 'width:4em', maxlength: 2});
89416
+ * var c1 = board.create('checkbox', [1, 3, 'label 1'], {});
89417
+ * var b1 = board.create('button', [1, 1, 'Change texts', function () {
89418
+ * i1.setText('g(x)=');
88988
89419
  * i1.set('cos(x)');
88989
89420
  * c1.setText('label 2');
88990
89421
  * b1.setText('Texts are changed');
88991
89422
  * }],
88992
- * {cssStyle: 'width:400px'});
88993
- *
89423
+ * {cssStyle: 'width:200px'});
89424
+ *
88994
89425
  * })();
88995
- *
89426
+ *
88996
89427
  * </script><pre>
89428
+ *
88997
89429
  */
88998
89430
  jxg/* default */.Z.createCheckbox = function (board, parents, attributes) {
88999
89431
  var t,
@@ -92246,7 +92678,6 @@ jxg/* default */.Z.createView3D = function (board, parents, attributes) {
92246
92678
  }
92247
92679
  d = utils_type/* default */.Z.evaluate(p.visProp.infoboxdigits);
92248
92680
  infobox = view.board.infobox;
92249
- console.log(infobox.useLocale())
92250
92681
  if (d === 'auto') {
92251
92682
  if (infobox.useLocale()) {
92252
92683
  arr = [pre, '(', infobox.formatNumberLocale(p.X()), ' | ', infobox.formatNumberLocale(p.Y()), ' | ', infobox.formatNumberLocale(p.Z()), ')']