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
@@ -1,5 +1,5 @@
1
1
  /*
2
- JSXGraph 1.6.0
2
+ JSXGraph 1.6.1b1
3
3
 
4
4
  Copyright 2008-2023
5
5
  Matthias Ehmann,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "jsxgraph",
3
3
  "description": "Interactive geometry, plotting, visualization",
4
4
  "homepage": "https://jsxgraph.org",
5
- "version": "1.6.0",
5
+ "version": "1.6.1",
6
6
  "exports": {
7
7
  "types": "./src/index.d.ts",
8
8
  "default": "./src/index.js"
package/src/3d/view3d.js CHANGED
@@ -832,7 +832,6 @@ JXG.createView3D = function (board, parents, attributes) {
832
832
  }
833
833
  d = Type.evaluate(p.visProp.infoboxdigits);
834
834
  infobox = view.board.infobox;
835
- console.log(infobox.useLocale())
836
835
  if (d === 'auto') {
837
836
  if (infobox.useLocale()) {
838
837
  arr = [pre, '(', infobox.formatNumberLocale(p.X()), ' | ', infobox.formatNumberLocale(p.Y()), ' | ', infobox.formatNumberLocale(p.Z()), ')']
package/src/base/board.js CHANGED
@@ -2296,6 +2296,11 @@ JXG.extend(
2296
2296
  return false;
2297
2297
  }
2298
2298
 
2299
+ if (Type.evaluate(this.attr.movetarget) === null &&
2300
+ Type.exists(evt.target) && Type.exists(evt.target.releasePointerCapture)) {
2301
+ evt.target.releasePointerCapture(evt.pointerId);
2302
+ }
2303
+
2299
2304
  if (!object && evt.isPrimary) {
2300
2305
  // First finger down. To be on the safe side this._board_touches is cleared.
2301
2306
  // this._pointerClearTouches();
@@ -2498,9 +2503,7 @@ JXG.extend(
2498
2503
  * @returns {Boolean}
2499
2504
  */
2500
2505
  pointerMoveListener: function (evt) {
2501
- var i,
2502
- j,
2503
- pos,
2506
+ var i, j, pos, eps,
2504
2507
  touchTargets,
2505
2508
  type = 'mouse'; // in case of no browser
2506
2509
 
@@ -2533,10 +2536,21 @@ JXG.extend(
2533
2536
  this._inputDevice = this._getPointerInputDevice(evt);
2534
2537
  type = this._inputDevice;
2535
2538
  this.options.precision.hasPoint = this.options.precision[type];
2539
+ eps = this.options.precision.hasPoint * 0.3333;
2540
+
2541
+ pos = this.getMousePosition(evt);
2542
+ // Ignore pointer move event if too close at the border
2543
+ // and setPointerCapture is off
2544
+ if (Type.evaluate(this.attr.movetarget) === null &&
2545
+ pos[0] <= eps || pos[1] <= eps ||
2546
+ pos[0] >= this.canvasWidth - eps ||
2547
+ pos[1] >= this.canvasHeight - eps
2548
+ ) {
2549
+ return this.mode === this.BOARD_MODE_NONE;
2550
+ }
2536
2551
 
2537
2552
  // selection
2538
2553
  if (this.selectingMode) {
2539
- pos = this.getMousePosition(evt);
2540
2554
  this._moveSelecting(pos);
2541
2555
  this.triggerEventHandlers(
2542
2556
  ['touchmoveselecting', 'moveselecting', 'pointermoveselecting'],
@@ -2544,7 +2558,6 @@ JXG.extend(
2544
2558
  );
2545
2559
  } else if (!this.mouseOriginMove(evt)) {
2546
2560
  if (this.mode === this.BOARD_MODE_DRAG) {
2547
- pos = this.getMousePosition(evt);
2548
2561
  // Run through all jsxgraph elements which are touched by at least one finger.
2549
2562
  for (i = 0; i < this.touches.length; i++) {
2550
2563
  touchTargets = this.touches[i].targets;
@@ -2581,7 +2594,6 @@ JXG.extend(
2581
2594
  }
2582
2595
 
2583
2596
  // Move event without dragging an element
2584
- pos = this.getMousePosition(evt);
2585
2597
  this.highlightElements(pos[0], pos[1], evt, -1);
2586
2598
  }
2587
2599
  }
@@ -3877,7 +3889,7 @@ JXG.extend(
3877
3889
  }, options);
3878
3890
  this.intersectionObserver.observe(that.containerObj);
3879
3891
  } catch (err) {
3880
- console.log('JSXGraph: IntersectionObserver not available in this browser.');
3892
+ JXG.debug('JSXGraph: IntersectionObserver not available in this browser.');
3881
3893
  }
3882
3894
  },
3883
3895
 
@@ -5630,10 +5642,10 @@ JXG.extend(
5630
5642
  * <li> array: ['key', value]
5631
5643
  * </ul>
5632
5644
  * Some board attributes are immutable, like e.g. the renderer type.
5633
- *
5645
+ *
5634
5646
  * @param {Object} attributes An object with attributes.
5635
5647
  * @returns {JXG.Board} Reference to the board
5636
- *
5648
+ *
5637
5649
  * @example
5638
5650
  * const board = JXG.JSXGraph.initBoard('jxgbox', {
5639
5651
  * boundingbox: [-5, 5, 5, -5],
@@ -5643,7 +5655,7 @@ JXG.extend(
5643
5655
  * showScreenshot: true,
5644
5656
  * showCopyright: false
5645
5657
  * });
5646
- *
5658
+ *
5647
5659
  * board.setAttribute({
5648
5660
  * animationDelay: 10,
5649
5661
  * boundingbox: [-10, 5, 10, -5],
@@ -5659,7 +5671,7 @@ JXG.extend(
5659
5671
  * locale: 'de-DE'
5660
5672
  * }
5661
5673
  * });
5662
- *
5674
+ *
5663
5675
  * board.setAttribute({
5664
5676
  * selection: {
5665
5677
  * enabled: true,
@@ -5677,7 +5689,7 @@ JXG.extend(
5677
5689
  * showNavigation: false
5678
5690
  * });
5679
5691
  * board.setAttribute('showCopyright:false');
5680
- *
5692
+ *
5681
5693
  * var p = board.create('point', [1, 1], {size: 10,
5682
5694
  * label: {
5683
5695
  * fontSize: 24,
@@ -5685,8 +5697,8 @@ JXG.extend(
5685
5697
  * offset: [5, 0]
5686
5698
  * }
5687
5699
  * });
5688
- *
5689
- *
5700
+ *
5701
+ *
5690
5702
  * </pre><div id="JXGea7b8e09-beac-4d95-9a0c-5fc1c761ffbc" class="jxgbox" style="width: 300px; height: 300px;"></div>
5691
5703
  * <script type="text/javascript">
5692
5704
  * (function() {
@@ -5698,7 +5710,7 @@ JXG.extend(
5698
5710
  * showScreenshot: true,
5699
5711
  * showCopyright: false
5700
5712
  * });
5701
- *
5713
+ *
5702
5714
  * board.setAttribute({
5703
5715
  * animationDelay: 10,
5704
5716
  * boundingbox: [-10, 5, 10, -5],
@@ -5714,7 +5726,7 @@ JXG.extend(
5714
5726
  * locale: 'de-DE'
5715
5727
  * }
5716
5728
  * });
5717
- *
5729
+ *
5718
5730
  * board.setAttribute({
5719
5731
  * selection: {
5720
5732
  * enabled: true,
@@ -5731,9 +5743,9 @@ JXG.extend(
5731
5743
  * showZoom: false,
5732
5744
  * showNavigation: false
5733
5745
  * });
5734
- *
5746
+ *
5735
5747
  * board.setAttribute('showCopyright:false');
5736
- *
5748
+ *
5737
5749
  * var p = board.create('point', [1, 1], {size: 10,
5738
5750
  * label: {
5739
5751
  * fontSize: 24,
@@ -5741,13 +5753,13 @@ JXG.extend(
5741
5753
  * offset: [5, 0]
5742
5754
  * }
5743
5755
  * });
5744
- *
5745
- *
5756
+ *
5757
+ *
5746
5758
  * })();
5747
- *
5759
+ *
5748
5760
  * </script><pre>
5749
- *
5750
- *
5761
+ *
5762
+ *
5751
5763
  */
5752
5764
  setAttribute: function (attr) {
5753
5765
  var i, arg, pair,
@@ -6863,6 +6875,8 @@ JXG.extend(
6863
6875
  * Expand the JSXGraph construction to fullscreen.
6864
6876
  * In order to preserve the proportions of the JSXGraph element,
6865
6877
  * a wrapper div is created which is set to fullscreen.
6878
+ * This function is called when fullscreen mode is triggered
6879
+ * <b>and</b> when it is closed.
6866
6880
  * <p>
6867
6881
  * The wrapping div has the CSS class 'jxgbox_wrap_private' which is
6868
6882
  * defined in the file 'jsxgraph.css'
@@ -6935,6 +6949,7 @@ JXG.extend(
6935
6949
  var wrap_id,
6936
6950
  wrap_node,
6937
6951
  inner_node,
6952
+ dim,
6938
6953
  doc = this.document,
6939
6954
  fullscreenElement;
6940
6955
 
@@ -6943,7 +6958,17 @@ JXG.extend(
6943
6958
  inner_node = doc.getElementById(id);
6944
6959
  wrap_id = 'fullscreenwrap_' + id;
6945
6960
 
6961
+ // Store the original data.
6962
+ // This is used to establish the ratio h / w in
6963
+ // fullscreen mode
6964
+ dim = this.containerObj.getBoundingClientRect();
6965
+ inner_node._cssFullscreenStore = {
6966
+ w: dim.width,
6967
+ h: dim.height
6968
+ }
6969
+
6946
6970
  // Wrap a div around the JSXGraph div.
6971
+ // It is removed when fullscreen mode is closed.
6947
6972
  if (doc.getElementById(wrap_id)) {
6948
6973
  wrap_node = doc.getElementById(wrap_id);
6949
6974
  } else {
@@ -6954,10 +6979,6 @@ JXG.extend(
6954
6979
  wrap_node.appendChild(inner_node);
6955
6980
  }
6956
6981
 
6957
- // Get the real width and height of the JSXGraph div
6958
- // and determine the scaling and vertical shift amount
6959
- // this._fullscreen_res = Env._getScaleFactors(inner_node);
6960
-
6961
6982
  // Trigger fullscreen mode
6962
6983
  wrap_node.requestFullscreen =
6963
6984
  wrap_node.requestFullscreen ||
@@ -6972,12 +6993,15 @@ JXG.extend(
6972
6993
  } else {
6973
6994
  fullscreenElement = doc.msFullscreenElement;
6974
6995
  }
6996
+
6975
6997
  if (fullscreenElement === null) {
6976
6998
  // Start fullscreen mode
6977
6999
  if (wrap_node.requestFullscreen) {
6978
7000
  wrap_node.requestFullscreen();
7001
+ this.startFullscreenResizeObserver(wrap_node);
6979
7002
  }
6980
7003
  } else {
7004
+ this.stopFullscreenResizeObserver(wrap_node);
6981
7005
  if (Type.exists(document.exitFullscreen)) {
6982
7006
  document.exitFullscreen();
6983
7007
  } else if (Type.exists(document.webkitExitFullscreen)) {
@@ -6998,7 +7022,8 @@ JXG.extend(
6998
7022
  fullscreenListener: function (evt) {
6999
7023
  var inner_id,
7000
7024
  inner_node,
7001
- fullscreenElement, // res,
7025
+ fullscreenElement,
7026
+ i,
7002
7027
  doc = this.document;
7003
7028
 
7004
7029
  inner_id = this._fullscreen_inner_id;
@@ -7021,30 +7046,22 @@ JXG.extend(
7021
7046
  if (fullscreenElement) {
7022
7047
  // Just entered fullscreen mode
7023
7048
 
7024
- // Get the data computed in board.toFullscreen()
7025
- // res = this._fullscreen_res;
7026
-
7027
- // Store the scaling data.
7028
- // It is used in AbstractRenderer.updateText to restore the scaling matrix
7029
- // which is removed by MathJax.
7049
+ // Store the original data.
7030
7050
  // Further, the CSS margin has to be removed when in fullscreen mode,
7031
7051
  // and must be restored later.
7032
- inner_node._cssFullscreenStore = {
7033
- id: fullscreenElement.id,
7034
- isFullscreen: true,
7035
- margin: inner_node.style.margin
7036
- // width: inner_node.style.width
7037
- // scale: res.scale,
7038
- // vshift: res.vshift
7039
- };
7040
-
7052
+ // Obsolete:
7053
+ // It is used in AbstractRenderer.updateText to restore the scaling matrix
7054
+ // which is removed by MathJax.
7055
+ inner_node._cssFullscreenStore.id = fullscreenElement.id;
7056
+ inner_node._cssFullscreenStore.isFullscreen = true;
7057
+ inner_node._cssFullscreenStore.margin = inner_node.style.margin;
7041
7058
  inner_node.style.margin = '';
7042
- // inner_node.style.width = res.width + 'px';
7043
7059
 
7044
7060
  // Do the shifting and scaling via CSS pseudo rules
7045
7061
  // We do this after fullscreen mode has been established to get the correct size
7046
7062
  // of the JSXGraph div.
7047
- Env.scaleJSXGraphDiv(fullscreenElement.id, inner_id, doc, Type.evaluate(this.attr.fullscreen.scale));
7063
+ Env.scaleJSXGraphDiv(fullscreenElement.id, inner_id, doc,
7064
+ Type.evaluate(this.attr.fullscreen.scale));
7048
7065
 
7049
7066
  // Clear this.doc.fullscreenElement, because Safari doesn't to it and
7050
7067
  // when leaving full screen mode it is still set.
@@ -7053,20 +7070,93 @@ JXG.extend(
7053
7070
  // Just left the fullscreen mode
7054
7071
 
7055
7072
  // Remove the CSS rules added in Env.scaleJSXGraphDiv
7056
- try {
7057
- doc.styleSheets[doc.styleSheets.length - 1].deleteRule(0);
7058
- } catch (err) {
7059
- console.log('JSXGraph: Could not remove CSS rules for full screen mode');
7073
+ for (i = doc.styleSheets.length - 1; i >= 0; i--) {
7074
+ if (doc.styleSheets[i].title === 'jsxgraph_fullscreen_css') {
7075
+ doc.styleSheets[i].deleteRule(0);
7076
+ break;
7077
+ }
7060
7078
  }
7061
7079
 
7062
7080
  inner_node._cssFullscreenStore.isFullscreen = false;
7063
7081
  inner_node.style.margin = inner_node._cssFullscreenStore.margin;
7064
- // inner_node.style.width = inner_node._cssFullscreenStore.width;
7082
+
7083
+ // Remove the wrapper div
7084
+ inner_node.parentElement.replaceWith(inner_node);
7065
7085
  }
7066
7086
 
7067
7087
  this.updateCSSTransforms();
7068
7088
  },
7069
7089
 
7090
+ /**
7091
+ * Start resize observer in to handle
7092
+ * orientation changes in fullscreen mode.
7093
+ *
7094
+ * @param {Object} node DOM object which is in fullscreen mode. It is the wrapper element
7095
+ * around the JSXGraph div.
7096
+ * @returns {JXG.Board} Reference to the board
7097
+ * @private
7098
+ * @see JXG.Board#toFullscreen
7099
+ *
7100
+ */
7101
+ startFullscreenResizeObserver: function(node) {
7102
+ var that = this;
7103
+
7104
+ if (!Env.isBrowser || !this.attr.resize || !this.attr.resize.enabled) {
7105
+ return this;
7106
+ }
7107
+
7108
+ this.resizeObserver = new ResizeObserver(function (entries) {
7109
+ var inner_id,
7110
+ fullscreenElement,
7111
+ doc = that.document;
7112
+
7113
+ if (!that._isResizing) {
7114
+ that._isResizing = true;
7115
+ window.setTimeout(function () {
7116
+ try {
7117
+ inner_id = that._fullscreen_inner_id;
7118
+ if (doc.fullscreenElement !== undefined) {
7119
+ fullscreenElement = doc.fullscreenElement;
7120
+ } else if (doc.webkitFullscreenElement !== undefined) {
7121
+ fullscreenElement = doc.webkitFullscreenElement;
7122
+ } else {
7123
+ fullscreenElement = doc.msFullscreenElement;
7124
+ }
7125
+ if (fullscreenElement !== null) {
7126
+ Env.scaleJSXGraphDiv(fullscreenElement.id, inner_id, doc,
7127
+ Type.evaluate(that.attr.fullscreen.scale));
7128
+ }
7129
+ } catch (err) {
7130
+ that.stopFullscreenResizeObserver(node);
7131
+ } finally {
7132
+ that._isResizing = false;
7133
+ }
7134
+ }, that.attr.resize.throttle);
7135
+ }
7136
+ });
7137
+ this.resizeObserver.observe(node);
7138
+ return this;
7139
+ },
7140
+
7141
+ /**
7142
+ * Remove resize observer to handle orientation changes in fullscreen mode.
7143
+ * @param {Object} node DOM object which is in fullscreen mode. It is the wrapper element
7144
+ * around the JSXGraph div.
7145
+ * @returns {JXG.Board} Reference to the board
7146
+ * @private
7147
+ * @see JXG.Board#toFullscreen
7148
+ */
7149
+ stopFullscreenResizeObserver: function(node) {
7150
+ if (!Env.isBrowser || !this.attr.resize || !this.attr.resize.enabled) {
7151
+ return this;
7152
+ }
7153
+
7154
+ if (Type.exists(this.resizeObserver)) {
7155
+ this.resizeObserver.unobserve(node);
7156
+ }
7157
+ return this;
7158
+ },
7159
+
7070
7160
  /**
7071
7161
  * Add user activity to the array 'board.userLog'.
7072
7162
  *
@@ -37,7 +37,7 @@ import JXG from "../jxg";
37
37
 
38
38
  var major = 1,
39
39
  minor = 6,
40
- patch = 0,
40
+ patch = 1,
41
41
  add = '', //'dev' 'beta'
42
42
  version = major + '.' + minor + '.' + patch + (add ? '-' + add : ''),
43
43
  constants;
@@ -245,6 +245,7 @@ JXG.extend(
245
245
  newCoords, newPos,
246
246
  doRound = false,
247
247
  ev_sw,
248
+ snappedTo, snapValues,
248
249
  slide = this.slideObject,
249
250
  res, cu,
250
251
  slides = [],
@@ -373,20 +374,28 @@ JXG.extend(
373
374
  }
374
375
  }
375
376
 
376
- // Snap the glider point of the slider into its appropiate position
377
- // First, recalculate the new value of this.position
378
- // Second, call update(fromParent==true) to make the positioning snappier.
379
- ev_sw = Type.evaluate(this.visProp.snapwidth);
380
- if (
381
- Type.evaluate(ev_sw) > 0.0 &&
382
- Math.abs(this._smax - this._smin) >= Mat.eps
383
- ) {
384
- newPos = Math.max(Math.min(newPos, 1), 0);
385
-
386
- v = newPos * (this._smax - this._smin) + this._smin;
387
- v = Math.round(v / ev_sw) * ev_sw;
388
- newPos = (v - this._smin) / (this._smax - this._smin);
377
+ // Snap the glider to snap values.
378
+ snappedTo = this.findClosestSnapValue(newPos);
379
+ if(snappedTo !== null) {
380
+ snapValues = Type.evaluate(this.visProp.snapvalues);
381
+ newPos = (snapValues[snappedTo] - this._smin) / (this._smax - this._smin);
389
382
  this.update(true);
383
+ } else {
384
+ // Snap the glider point of the slider into its appropiate position
385
+ // First, recalculate the new value of this.position
386
+ // Second, call update(fromParent==true) to make the positioning snappier.
387
+ ev_sw = Type.evaluate(this.visProp.snapwidth);
388
+ if (
389
+ Type.evaluate(ev_sw) > 0.0 &&
390
+ Math.abs(this._smax - this._smin) >= Mat.eps
391
+ ) {
392
+ newPos = Math.max(Math.min(newPos, 1), 0);
393
+
394
+ v = newPos * (this._smax - this._smin) + this._smin;
395
+ v = Math.round(v / ev_sw) * ev_sw;
396
+ newPos = (v - this._smin) / (this._smax - this._smin);
397
+ this.update(true);
398
+ }
390
399
  }
391
400
 
392
401
  p1c = slide.point1.coords;
@@ -533,6 +542,37 @@ JXG.extend(
533
542
  this.position = newPos;
534
543
  },
535
544
 
545
+ /**
546
+ * Find the closest entry in snapValues that is within snapValueDistance of pos.
547
+ *
548
+ * @param {Number} pos Value for which snapping is calculated.
549
+ * @returns {Number} Index of the value to snap to, or null.
550
+ * @private
551
+ */
552
+ findClosestSnapValue: function(pos) {
553
+ var i, d,
554
+ snapValues, snapValueDistance,
555
+ snappedTo = null;
556
+
557
+ // Snap the glider to snap values.
558
+ snapValues = Type.evaluate(this.visProp.snapvalues);
559
+ snapValueDistance = Type.evaluate(this.visProp.snapvaluedistance);
560
+
561
+ if (Type.isArray(snapValues) &&
562
+ Math.abs(this._smax - this._smin) >= Mat.eps &&
563
+ snapValueDistance > 0.0) {
564
+ for (i = 0; i < snapValues.length; i++) {
565
+ d = Math.abs(pos * (this._smax - this._smin) + this._smin - snapValues[i]);
566
+ if (d < snapValueDistance) {
567
+ snapValueDistance = d;
568
+ snappedTo = i;
569
+ }
570
+ }
571
+ }
572
+
573
+ return snappedTo;
574
+ },
575
+
536
576
  /**
537
577
  * Update of a glider in case a parent element has been updated. That means the
538
578
  * relative position of the glider stays the same.
@@ -1918,7 +1958,7 @@ JXG.extend(
1918
1958
  * @returns {JXG.CoordsElement} Reference to itself.
1919
1959
  */
1920
1960
  _anim: function (direction, stepCount) {
1921
- var dX, dY, alpha, startPoint, newX, radius, sp1c, sp2c, res, d;
1961
+ var dX, dY, alpha, startPoint, newX, radius, sp1c, sp2c, res;
1922
1962
 
1923
1963
  this.intervalCount += 1;
1924
1964
  if (this.intervalCount > stepCount) {
package/src/base/curve.js CHANGED
@@ -2231,6 +2231,11 @@ JXG.registerElement("metapostspline", JXG.createMetapostSpline);
2231
2231
  /**
2232
2232
  * @class This element is used to provide a constructor for Riemann sums, which is realized as a special curve.
2233
2233
  * The returned element has the method Value() which returns the sum of the areas of the bars.
2234
+ * <p>
2235
+ * In case of type "simpson" and "trapezoidal", the horizontal line approximating the function value
2236
+ * is replaced by a parabola or a secant. IN case of "simpson",
2237
+ * the parabola is approximated visually by a polygonal chain of fixed step width.
2238
+ *
2234
2239
  * @pseudo
2235
2240
  * @description
2236
2241
  * @name Riemannsum
@@ -2244,7 +2249,7 @@ JXG.registerElement("metapostspline", JXG.createMetapostSpline);
2244
2249
  * n determines the number of bars, it is either a fixed number or a function.
2245
2250
  * <p>
2246
2251
  * type is a string or function returning one of the values: 'left', 'right', 'middle', 'lower', 'upper', 'random', 'simpson', or 'trapezoidal'.
2247
- * Default value is 'left'.
2252
+ * Default value is 'left'. "simpson" is Simpson's 1/3 rule.
2248
2253
  * <p>
2249
2254
  * Further parameters are an optional number or function for the left interval border a,
2250
2255
  * and an optional number or function for the right interval border b.
package/src/base/text.js CHANGED
@@ -654,7 +654,7 @@ JXG.extend(
654
654
  },
655
655
 
656
656
  /**
657
- * The update function of the renderert
657
+ * The update function of the renderer
658
658
  * is called.
659
659
  * @private
660
660
  */
@@ -1124,11 +1124,9 @@ JXG.extend(
1124
1124
  * @param {Number} h width of the box in pixel
1125
1125
  * @return {Number} Number of overlapping elements
1126
1126
  */
1127
- getNumberofConflicts: function (x, y, w, h) {
1127
+ getNumberOfConflicts: function (x, y, w, h) {
1128
1128
  var count = 0,
1129
- i,
1130
- obj,
1131
- le,
1129
+ i, obj, le,
1132
1130
  savePointPrecision;
1133
1131
 
1134
1132
  // Set the precision of hasPoint to half the max if label isn't too long
@@ -1163,33 +1161,22 @@ JXG.extend(
1163
1161
  * @returns {JXG.Text} Reference to the text object.
1164
1162
  */
1165
1163
  setAutoPosition: function () {
1166
- var x,
1167
- y,
1168
- cx,
1169
- cy,
1164
+ var x, y, cx, cy,
1170
1165
  anchorCoords,
1171
1166
  // anchorX, anchorY,
1172
1167
  w = this.size[0],
1173
1168
  h = this.size[1],
1174
- start_angle,
1175
- angle,
1169
+ start_angle, angle,
1176
1170
  optimum = {
1177
1171
  conflicts: Infinity,
1178
1172
  angle: 0,
1179
1173
  r: 0
1180
1174
  },
1181
- max_r,
1182
- delta_r,
1183
- conflicts,
1184
- offset,
1185
- r,
1175
+ max_r, delta_r,
1176
+ conflicts, offset, r,
1186
1177
  num_positions = 12,
1187
1178
  step = (2 * Math.PI) / num_positions,
1188
- j,
1189
- dx,
1190
- dy,
1191
- co,
1192
- si;
1179
+ j, dx, dy, co, si;
1193
1180
 
1194
1181
  if (
1195
1182
  this === this.board.infobox ||
@@ -1212,15 +1199,15 @@ JXG.extend(
1212
1199
  dx = offset[0];
1213
1200
  dy = offset[1];
1214
1201
 
1215
- conflicts = this.getNumberofConflicts(cx + dx, cy - dy, w, h);
1202
+ conflicts = this.getNumberOfConflicts(cx + dx, cy - dy, w, h);
1216
1203
  if (conflicts === 0) {
1217
1204
  return this;
1218
1205
  }
1219
1206
  // console.log(this.id, conflicts, w, h);
1220
1207
  // r = Geometry.distance([0, 0], offset, 2);
1221
1208
 
1222
- r = 12;
1223
- max_r = 28;
1209
+ r = Type.evaluate(this.visProp.autopositionmindistance);
1210
+ max_r = Type.evaluate(this.visProp.autopositionmaxdistance);
1224
1211
  delta_r = 0.2 * r;
1225
1212
 
1226
1213
  start_angle = Math.atan2(dy, dx);
@@ -1229,7 +1216,7 @@ JXG.extend(
1229
1216
  optimum.angle = start_angle;
1230
1217
  optimum.r = r;
1231
1218
 
1232
- while (optimum.conflicts > 0 && r < max_r) {
1219
+ while (optimum.conflicts > 0 && r <= max_r) {
1233
1220
  for (
1234
1221
  j = 1, angle = start_angle + step;
1235
1222
  j < num_positions && optimum.conflicts > 0;
@@ -1241,7 +1228,7 @@ JXG.extend(
1241
1228
  x = cx + r * co;
1242
1229
  y = cy - r * si;
1243
1230
 
1244
- conflicts = this.getNumberofConflicts(x, y, w, h);
1231
+ conflicts = this.getNumberOfConflicts(x, y, w, h);
1245
1232
  if (conflicts < optimum.conflicts) {
1246
1233
  optimum.conflicts = conflicts;
1247
1234
  optimum.angle = angle;