jsxgraph 1.14.0 → 1.14.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 (99) hide show
  1. package/CHANGELOG.md +33 -3
  2. package/distrib/docs/3d_linspace3d.js.html +16 -10
  3. package/distrib/docs/3d_point3d.js.html +0 -5
  4. package/distrib/docs/3d_sphere3d.js.html +92 -69
  5. package/distrib/docs/3d_view3d.js.html +24 -16
  6. package/distrib/docs/Angle.html +7 -7
  7. package/distrib/docs/CircumcircleSector.html +2 -2
  8. package/distrib/docs/Conic.html +1 -1
  9. package/distrib/docs/Ellipse.html +23 -1
  10. package/distrib/docs/Hyperbola.html +24 -1
  11. package/distrib/docs/JXG.Board.infobox.html +1 -1
  12. package/distrib/docs/JXG.Board_.html +130 -130
  13. package/distrib/docs/JXG.CanvasRenderer.html +10 -10
  14. package/distrib/docs/JXG.Composition.html +3 -3
  15. package/distrib/docs/JXG.GeometryElement.html +26 -26
  16. package/distrib/docs/JXG.Math.Numerics.html +45 -47
  17. package/distrib/docs/JXG.Math.Statistics.html +14 -15
  18. package/distrib/docs/JXG.Math.Tiling.html +3 -7
  19. package/distrib/docs/JXG.Math.html +101 -83
  20. package/distrib/docs/JXG.Point3D.html +2 -2
  21. package/distrib/docs/JXG.SVGRenderer.html +12 -12
  22. package/distrib/docs/JXG.Sphere3D.html +1255 -2
  23. package/distrib/docs/JXG.View3D.html +29 -29
  24. package/distrib/docs/JXG.html +20 -20
  25. package/distrib/docs/MajorSector.html +1 -1
  26. package/distrib/docs/MinorSector.html +1 -1
  27. package/distrib/docs/NonReflexAngle.html +1 -1
  28. package/distrib/docs/Parabola.html +1 -1
  29. package/distrib/docs/Point3D.html +1 -1
  30. package/distrib/docs/ReflexAngle.html +1 -1
  31. package/distrib/docs/Sector.html +12 -12
  32. package/distrib/docs/Sphere3D.html +17 -1
  33. package/distrib/docs/View3D.html +1 -1
  34. package/distrib/docs/base_board.js.html +63 -13
  35. package/distrib/docs/base_composition.js.html +3 -3
  36. package/distrib/docs/base_constants.js.html +1 -1
  37. package/distrib/docs/base_element.js.html +2 -1
  38. package/distrib/docs/base_text.js.html +2 -2
  39. package/distrib/docs/element_conic.js.html +35 -1
  40. package/distrib/docs/element_sector.js.html +6 -3
  41. package/distrib/docs/index.html +1 -1
  42. package/distrib/docs/math_math.js.html +64 -35
  43. package/distrib/docs/math_numerics.js.html +13 -12
  44. package/distrib/docs/math_statistics.js.html +19 -19
  45. package/distrib/docs/math_tiling.js.html +6 -288
  46. package/distrib/docs/parser_jessiecode.js.html +1 -1
  47. package/distrib/docs/renderer_canvas.js.html +7 -6
  48. package/distrib/docs/renderer_svg.js.html +15 -7
  49. package/distrib/docs/scripts/jsxgraphcore.js +2 -2
  50. package/distrib/docs/styles/jsxgraph.css +1 -1
  51. package/distrib/docs/utils_type.js.html +11 -4
  52. package/distrib/geogebra.min.js +1 -1
  53. package/distrib/geonext.min.js +1 -1
  54. package/distrib/index.d.ts +11 -0
  55. package/distrib/intergeo.min.js +1 -1
  56. package/distrib/jsxgraph.css +1 -1
  57. package/distrib/jsxgraphcore.js +2 -2
  58. package/distrib/jsxgraphcore.mjs +2 -2
  59. package/distrib/jsxgraphcore.mjs.map +1 -1
  60. package/distrib/jsxgraphsrc.js +380 -496
  61. package/distrib/jsxgraphsrc.mjs +380 -496
  62. package/distrib/jsxgraphsrc.mjs.map +1 -1
  63. package/package.json +10 -12
  64. package/src/3d/linspace3d.js +16 -10
  65. package/src/3d/point3d.js +0 -5
  66. package/src/3d/sphere3d.js +92 -69
  67. package/src/3d/view3d.js +24 -16
  68. package/src/base/board.js +63 -13
  69. package/src/base/composition.js +3 -3
  70. package/src/base/constants.js +1 -1
  71. package/src/base/element.js +2 -1
  72. package/src/base/text.js +2 -2
  73. package/src/element/conic.js +35 -1
  74. package/src/element/sector.js +6 -3
  75. package/src/index.d.ts +11 -0
  76. package/src/math/math.js +64 -35
  77. package/src/math/numerics.js +13 -12
  78. package/src/math/statistics.js +19 -19
  79. package/src/math/tiling.js +6 -288
  80. package/src/parser/jessiecode.js +1 -1
  81. package/src/renderer/canvas.js +7 -6
  82. package/src/renderer/svg.js +15 -7
  83. package/src/utils/type.js +11 -4
  84. package/src/unused/bst.js +0 -475
  85. package/src/unused/heap.js +0 -135
  86. package/src/unused/locus.js +0 -162
  87. package/src/unused/server/JXG.py +0 -74
  88. package/src/unused/server/JXGServer.py +0 -94
  89. package/src/unused/server/JXGServerModule.py +0 -9
  90. package/src/unused/server/README.md +0 -63
  91. package/src/unused/server/RStats.py +0 -45
  92. package/src/unused/server/YahooFinance.py +0 -81
  93. package/src/unused/server/fft.py +0 -136
  94. package/src/unused/server/geoloci.py +0 -210
  95. package/src/unused/server/jxggroebner.py +0 -219
  96. package/src/unused/server/jxgtestplugin.py +0 -19
  97. package/src/unused/server/server.js +0 -280
  98. package/src/unused/sketch.js +0 -2895
  99. package/src/unused/symbolic.js +0 -416
@@ -46,11 +46,11 @@ import Mat from "./math.js";
46
46
  Mat.Tiling = {
47
47
  /**
48
48
  * Triangulate (partition it into triangles) a given two dimensional domain.
49
- * The number of triangles the original rectangle is divided into depends on the parameters stepsU and stepsV.
50
- * Input are the ranges of u and v, as well as stepsU and stepsV which are static.
51
- * If the optional parameter stepsV is not given or is equal to 0, the rectangle is partitioned into
49
+ * The number of triangles the original rectangle is divided into depends on the parameters` `stepsU` and `stepsV`.
50
+ * Input are the ranges of \\(u\\) and \\(v\\), as well as `stepsU` and `stepsV` which are static.
51
+ * If the optional parameter `stepsV` is not given or is equal to 0, the rectangle is partitioned into
52
52
  * nearly equilateral triangles.
53
- * Otherwise, the shape of the triangles depends on the ratio of stepsU / stepsV.
53
+ * Otherwise, the shape of the triangles depends on the ratio of `stepsU / stepsV`.
54
54
  *
55
55
  * @param {JXG.ParametricSurface3D|JXG.Plane3D} el element which is displayed using a polyhedron3d.
56
56
  * From this element its function F is used.
@@ -206,8 +206,8 @@ Mat.Tiling = {
206
206
 
207
207
  /**
208
208
  * Rectangulate (partition it into rectangles) a given two dimensional domain.
209
- * The number of rectangles the original rectangle is divided into depends on the parameters stepsU and stepsV.
210
- * Input are the ranges of u and v, as well as stepsU and stepsV which are static.
209
+ * The number of rectangles the original rectangle is divided into depends on the parameters `stepsU` and `stepsV`.
210
+ * Input are the ranges of \\(u\\) and \\(v\\), as well as `stepsU` and `stepsV` which are static.
211
211
  *
212
212
  * @param {JXG.ParametricSurface3D|JXG.Plane3D} el element which is displayed using a polyhedron3d.
213
213
  * From this element its function F is used.
@@ -331,288 +331,6 @@ Mat.Tiling = {
331
331
  }
332
332
  return [vertices, faces];
333
333
  }
334
-
335
- // triangulation_old: function (p1, p2, p3, p4, stepsU, stepsV) {
336
- // // Vectors used for checking if the given coordinates create a rectangle
337
- // var vec1 = [p2[0] - p1[0], p2[1] - p1[1]],
338
- // vec2 = [p3[0] - p2[0], p3[1] - p2[1]],
339
- // vec3 = [p4[0] - p3[0], p4[1] - p3[1]],
340
- // vec4 = [p1[0] - p4[0], p1[1] - p4[1]],
341
-
342
- // coords = [],
343
- // faces = [],
344
- // width, height,
345
- // wSide, hSide,
346
- // triangleWidth, triangleHeight,
347
- // s1, s2,
348
- // i, j,
349
- // numRows,
350
- // widthX, widthY, heightX, heightY,
351
- // oddPoints,
352
- // evenPoints;
353
-
354
- // // Check if the given coordinates create a rectangle, otherwise an exception is thrown
355
- // if (
356
- // vec1[0] * vec4[0] + vec1[1] * vec4[1] !== 0 ||
357
- // vec2[0] * vec1[0] + vec2[1] * vec1[1] !== 0 ||
358
- // vec3[0] * vec2[0] + vec3[1] * vec2[1] !== 0 ||
359
- // vec4[0] * vec3[0] + vec4[1] * vec3[1] !== 0
360
- // ) {
361
- // throw new Error(" the board created is not rectangle ");
362
- // }
363
-
364
- // // Set initial values for wSide, hSide
365
- // wSide = [0, 0];
366
- // hSide = [0, 0];
367
-
368
- // // Check for longer side of rectangle:
369
- // // longer side is appointed height, shorter side is appointed width
370
- // s1 = Math.sqrt((p2[0] - p1[0]) * (p2[0] - p1[0]) + (p2[1] - p1[1]) * (p2[1] - p1[1]));
371
- // s2 = Math.sqrt((p3[0] - p2[0]) * (p3[0] - p2[0]) + (p3[1] - p2[1]) * (p3[1] - p2[1]));
372
- // if (s1 <= s2) {
373
- // width = s1;
374
- // height = s2;
375
- // // Determine start and end points of the width-side and height-side
376
- // wSide = [p1, p2];
377
- // hSide = [p2, p3];
378
- // } else {
379
- // width = s2;
380
- // height = s1;
381
- // // Determine start and end points of the width-side and height-side
382
- // wSide = [p2, p3];
383
- // hSide = [p1, p2];
384
- // }
385
- // // Calculate height and width of the triangles and number of rows
386
- // triangleWidth = width / stepsU;
387
-
388
- // if (stepsV === undefined || stepsV === 0) {
389
- // // Equilateral triangles, depending on parameter "stepsU"
390
- // triangleHeight = (triangleWidth * Math.sqrt(3)) / 2;
391
- // numRows = Math.round(height / triangleHeight);
392
- // } else {
393
- // // Two parameters stepsU, stepsV
394
- // numRows = stepsV;
395
- // triangleHeight = height / numRows;
396
- // }
397
-
398
- // // Calculate values of "shifting vectors"
399
- // widthX = (wSide[1][0] - wSide[0][0]) / stepsU;
400
- // widthY = (wSide[1][1] - wSide[0][1]) / stepsU;
401
- // heightX = (hSide[1][0] - hSide[0][0]) / numRows;
402
- // heightY = (hSide[1][1] - hSide[0][1]) / numRows;
403
-
404
- // oddPoints = [];
405
- // evenPoints = [];
406
-
407
- // // Push coordinates of the base point (p1)
408
- // coords.push([p1[0], p1[1]]);
409
- // evenPoints.push(coords.length - 1);
410
-
411
- // // Calculate point coordinates of layer 0 and store indices in evenPoints
412
- // for (i = 1; i <= stepsU; i++) {
413
- // coords.push([p1[0] + i * widthX, p1[1] + i * widthY]); // Points first line
414
- // evenPoints.push(coords.length - 1);
415
- // }
416
-
417
- // for (i = 1; i <= numRows; i++) {
418
- // if (i % 2 === 0) {
419
- // // Points and faces of layers with an even index
420
-
421
- // evenPoints = [];
422
- // // Calculate first point coordinates within the layer
423
- // coords.push([
424
- // p1[0] + i * heightX,
425
- // p1[1] + i * heightY
426
- // ]);
427
- // // evenPoints stores index of the first point of the layer
428
- // evenPoints.push(coords.length - 1);
429
- // // Calculate all other point coordinates within the layer
430
- // for (j = 1; j <= stepsU; j++) {
431
- // coords.push([
432
- // coords[evenPoints[0]][0] + j * widthX,
433
- // coords[evenPoints[0]][1] + j * widthY
434
- // ]);
435
- // //evenPoints stores index of the most recently calculated point of the layer
436
- // evenPoints.push(coords.length - 1);
437
- // }
438
- // // Connect the faces of the row by grouping indices of points
439
- // faces.push([evenPoints[0], oddPoints[0], oddPoints[1]]);
440
- // for (j = 1; j <= stepsU; j++) {
441
- // faces.push([evenPoints[j - 1], oddPoints[j], evenPoints[j]]);
442
- // faces.push([evenPoints[j], oddPoints[j], oddPoints[j + 1]]);
443
- // }
444
- // } else {
445
- // // Points and faces of layers with an odd index
446
-
447
- // oddPoints = [];
448
- // // Calculate first point coordinates within the layer
449
- // coords.push([
450
- // p1[0] + i * heightX,
451
- // p1[1] + i * heightY
452
- // ]);
453
- // // oddPoints stores index of the first point of the layer
454
- // oddPoints.push(coords.length - 1);
455
- // // Calculate all other point coordinates within the layer except for the last point
456
- // for (j = 1; j <= stepsU; j++) {
457
- // coords.push([
458
- // coords[oddPoints[0]][0] + j * widthX - widthX / 2,
459
- // coords[oddPoints[0]][1] + j * widthY - widthY / 2
460
- // ]);
461
- // // oddPoints stores index of the most recently calculated point of the layer
462
- // oddPoints.push(coords.length - 1);
463
- // }
464
- // // Calculate last point coordinates within the layer
465
- // coords.push([
466
- // coords[oddPoints[0]][0] + stepsU * widthX,
467
- // coords[oddPoints[0]][1] + stepsU * widthY
468
- // ]);
469
- // // oddPoints stores index of last point within the layer
470
- // oddPoints.push(coords.length - 1);
471
- // // Connect the faces of the row by grouping indices of points
472
- // faces.push([oddPoints[0], evenPoints[0], oddPoints[1]]);
473
- // for (j = 1; j <= stepsU; j++) {
474
- // faces.push([oddPoints[j], evenPoints[j - 1], evenPoints[j]]);
475
- // faces.push([oddPoints[j], evenPoints[j], oddPoints[j + 1]]);
476
- // }
477
- // }
478
- // }
479
-
480
- // return [coords, faces];
481
- // },
482
-
483
- // rectangulation_old: function (p1, p2, p3, p4, stepsU, stepsV) {
484
- // // Vectors used for checking if the given coordinates create a rectangle
485
- // var vec1 = [p2[0] - p1[0], p2[1] - p1[1]],
486
- // vec2 = [p3[0] - p2[0], p3[1] - p2[1]],
487
- // vec3 = [p4[0] - p3[0], p4[1] - p3[1]],
488
- // vec4 = [p1[0] - p4[0], p1[1] - p4[1]],
489
-
490
- // coords = [],
491
- // faces = [],
492
- // wSide, hSide,
493
- // s1, s2,
494
- // i, j,
495
- // widthX, widthY,
496
- // heightX, heightY,
497
- // startPointLayer;
498
-
499
- // // Check if the given coordinates create a rectangle, otherwise an exception is thrown
500
- // if (
501
- // vec1[0] * vec4[0] + vec1[1] * vec4[1] !== 0 ||
502
- // vec2[0] * vec1[0] + vec2[1] * vec1[1] !== 0 ||
503
- // vec3[0] * vec2[0] + vec3[1] * vec2[1] !== 0 ||
504
- // vec4[0] * vec3[0] + vec4[1] * vec3[1] !== 0
505
- // ) {
506
- // throw new Error("rectangulation_old: area is not rectangle ");
507
- // // console.log("rectangulation_old: area is not rectangle ");
508
- // }
509
-
510
- // // Set initial values for wSide, hSide
511
- // wSide = [0, 0];
512
- // hSide = [0, 0];
513
-
514
- // // Check for longer side of rectangle:
515
- // // longer side is appointed height, shorter side is appointed width
516
- // // s1 = Math.sqrt((p2[0] - p1[0]) * (p2[0] - p1[0]) + (p2[1] - p1[1]) * (p2[1] - p1[1]));
517
- // // s2 = Math.sqrt((p3[0] - p2[0]) * (p3[0] - p2[0]) + (p3[1] - p2[1]) * (p3[1] - p2[1]));
518
- // s1 = Mat.hypot(vec1[0], vec1[1]);
519
- // s2 = Mat.hypot(vec2[0], vec2[1]);
520
-
521
- // if (s1 <= s2) {
522
- // // Determine start and end points of the width-side and height-side
523
- // wSide = [p1, p2];
524
- // hSide = [p2, p3];
525
- // } else {
526
- // // Determine start and end points of the width-side and height-side
527
- // wSide = [p2, p3];
528
- // hSide = [p1, p2];
529
- // }
530
-
531
- // // Calculate values of "shifting vectors"
532
- // widthX = (wSide[1][0] - wSide[0][0]) / stepsV;
533
- // widthY = (wSide[1][1] - wSide[0][1]) / stepsV;
534
- // heightX = (hSide[1][0] - hSide[0][0]) / stepsU;
535
- // heightY = (hSide[1][1] - hSide[0][1]) / stepsU;
536
-
537
- // // Initialize startPointLayer that stores coordinates of the first point of the current layer
538
- // startPointLayer = [];
539
-
540
- // // Push coordinates of base point (p1)
541
- // coords.push([p1[0], p1[1]]);
542
- // startPointLayer = coords[0];
543
-
544
- // // Calculate point coordinates of layer 0
545
- // for (j = 1; j <= stepsV; j++) {
546
- // coords.push([startPointLayer[0] + j * widthX, startPointLayer[1] + j * widthY]);
547
- // }
548
-
549
- // for (i = 1; i <= stepsU; i++) {
550
- // startPointLayer = [];
551
-
552
- // // Calculate point coordinates of first point of layer
553
- // coords.push([
554
- // p1[0] + i * heightX,
555
- // p1[1] + i * heightY
556
- // ]);
557
- // startPointLayer = coords[coords.length - 1];
558
-
559
- // // Calculating remaining point coordinates of layer
560
- // for (j = 1; j <= stepsV; j++) {
561
- // coords.push([
562
- // startPointLayer[0] + j * widthX,
563
- // startPointLayer[1] + j * widthY
564
- // ]);
565
- // }
566
-
567
- // // Connect rectangles by grouping indices of points
568
- // for (
569
- // j = coords.length - stepsV - 1;
570
- // j < coords.length - 1;
571
- // j++
572
- // ) {
573
- // faces.push([j, j - stepsV - 1, j - stepsV, j + 1]);
574
- // }
575
- // }
576
-
577
- // return [coords, faces];
578
- // },
579
-
580
- // /**
581
- // * This function creates an array of dynamic 3-dimensional points
582
- // * based on an array of pairs of two coordinates.
583
- // * It uses a mathematical function to assign a third coordinate (the z-coordinate)
584
- // * to each pair of two coordinates.
585
- // * The 3-dimensional points are not stored directly.
586
- // * Instead the array stores JavaScript functions that utilize the mentioned mathematical function
587
- // * to return an array of three coordinates.
588
- // * This allows the recognition and proper visualization of changes to the underlying
589
- // * mathematical function.
590
- // * @name mapMeshTo3D
591
- // * @param {Array} surface
592
- // * @param {Parametricsurface3d} el
593
- // * @returns {Array} dynamicPoints array of [x, y, z] coordinates
594
- // *
595
- // * @private
596
- // * @memberof JXG.Math.Tiling
597
- // */
598
- // mapMeshTo3D: function (surface, el) {
599
- // var dynamicPoints = [], i;
600
-
601
- // for (i = 0; i < surface[0].length; i++) {
602
- // dynamicPoints.push(
603
- // (function (u, v) {
604
- // return function(x, y) { return el.F(u, v); };
605
- // })(surface[0][i][0], surface[0][i][1])
606
- // ); // Capture values explicitly
607
- // // dynamicPoints.push(
608
- // // (function (u, v) {
609
- // // return function(x, y) { return el.F(Type.evaluate(u), Type.evaluate(v)); };
610
- // // })(surface[0][i][0], surface[0][i][1])
611
- // // ); // Capture values explicitly
612
- // }
613
-
614
- // return dynamicPoints;
615
- // }
616
334
  };
617
335
 
618
336
  export default Mat.Tiling;
@@ -3473,7 +3473,7 @@ upcomingInput:function () {
3473
3473
  showPosition:function () {
3474
3474
  var pre = this.pastInput();
3475
3475
  var c = new Array(pre.length + 1).join("-");
3476
- return pre + this.upcomingInput() + "\n" + c+"^";
3476
+ return JXG.escapeHTML(pre + this.upcomingInput() + "\n" + c+"^");
3477
3477
  },
3478
3478
  next:function () {
3479
3479
  if (this.done) {
@@ -206,7 +206,7 @@ JXG.extend(
206
206
  * Set the gradient angle for linear color gradients.
207
207
  *
208
208
  * @private
209
- * @param {JXG.GeometryElement} node An arbitrary JSXGraph element, preferably one with an area.
209
+ * @param {JXG.GeometryElement} el An arbitrary JSXGraph element, preferably one with an area.
210
210
  * @param {Number} radians angle value in radians. 0 is horizontal from left to right, Pi/4 is vertical from top to bottom.
211
211
  */
212
212
  updateGradientAngle: function (el, radians) {
@@ -262,7 +262,7 @@ JXG.extend(
262
262
  * Set circles for radial color gradients.
263
263
  *
264
264
  * @private
265
- * @param {SVGnode} node SVG gradient node
265
+ * @param {JXG.GeometryElement} el An arbitrary JSXGraph element, preferably one with an area.
266
266
  * @param {Number} cx Canvas value x1 (but value between 0 and 1)
267
267
  * @param {Number} cy Canvas value y1 (but value between 0 and 1)
268
268
  * @param {Number} r Canvas value r1 (but value between 0 and 1)
@@ -275,19 +275,20 @@ JXG.extend(
275
275
  c1, c2,
276
276
  cxs, cys, rs,
277
277
  fxs, fys, frs,
278
- dx, dy;
278
+ dx, dy, d;
279
279
 
280
280
  c1 = new Coords(Const.COORDS_BY_USER, [bb[0], bb[1]], el.board);
281
281
  c2 = new Coords(Const.COORDS_BY_USER, [bb[2], bb[3]], el.board);
282
282
  dx = c2.scrCoords[1] - c1.scrCoords[1];
283
283
  dy = c1.scrCoords[2] - c2.scrCoords[2];
284
-
285
284
  cxs = c1.scrCoords[1] + dx * cx;
286
285
  cys = c2.scrCoords[2] + dy * cy;
287
286
  fxs = c1.scrCoords[1] + dx * fx;
288
287
  fys = c2.scrCoords[2] + dy * fy;
289
- rs = r * (dx + dy) * 0.5;
290
- frs = fr * (dx + dy) * 0.5;
288
+
289
+ d = Math.abs(dx) + Math.abs(dy);
290
+ rs = Math.max(r * d * 0.5, 0);
291
+ frs = Math.max(fr * d * 0.5, 0);
291
292
 
292
293
  return this.context.createRadialGradient(fxs, fys, frs, cxs, cys, rs);
293
294
  },
@@ -253,7 +253,7 @@ JXG.SVGRenderer = function (container, dim) {
253
253
  var id = this.uniqName('ClipFull'),
254
254
  node1 = this.container.ownerDocument.createElementNS(this.svgNamespace, 'clipPath'),
255
255
  node2 = this.container.ownerDocument.createElementNS(this.svgNamespace, 'rect'),
256
- style, rx, ry;
256
+ style, r;
257
257
  node1.setAttributeNS(null, 'id', id);
258
258
 
259
259
  node2.setAttributeNS(null, 'x', 0);
@@ -263,10 +263,9 @@ JXG.SVGRenderer = function (container, dim) {
263
263
 
264
264
  // Inherit border-radius
265
265
  style = getComputedStyle(this.container);
266
- rx = Type.exists(style['border-radius']) ? parseFloat(style['border-radius']) : 0;
267
- ry = rx;
268
- node2.setAttributeNS(null, 'rx', rx);
269
- node2.setAttributeNS(null, 'ry', ry);
266
+ r = (Type.exists(style['border-radius']) && style['border-radius'] !== '') ? parseFloat(style['border-radius']) : 0;
267
+ node2.setAttributeNS(null, 'rx', r);
268
+ node2.setAttributeNS(null, 'ry', r);
270
269
 
271
270
  node1.appendChild(node2);
272
271
  return node1;
@@ -954,7 +953,7 @@ JXG.extend(
954
953
 
955
954
  // Already documented in JXG.AbstractRenderer
956
955
  setLayer: function (el, level) {
957
- var node;
956
+ var node, elNode;
958
957
  if (!Type.exists(level)) {
959
958
  level = 0;
960
959
  } else if (level >= Options.layer.numlayers) {
@@ -962,8 +961,16 @@ JXG.extend(
962
961
  }
963
962
 
964
963
  node = this.layer[level];
964
+ // if ('moveBefore' in Element.prototype) {
965
965
  if (Type.exists(node.moveBefore)) {
966
- node.moveBefore(el.rendNode, null);
966
+ // node.moveBefore(el.rendNode, null);
967
+ elNode = el.rendNode;
968
+ if (elNode.isConnected && node.isConnected &&
969
+ (elNode.ownerDocument === node.ownerDocument)) {
970
+ node.moveBefore(elNode, null);
971
+ } else {
972
+ node.insertBefore(elNode, null);
973
+ }
967
974
  } else {
968
975
  node.appendChild(el.rendNode);
969
976
  }
@@ -1250,6 +1257,7 @@ JXG.extend(
1250
1257
  i = 0;
1251
1258
  while (i < len) {
1252
1259
  if (el.points[i] === undefined) {
1260
+ i++;
1253
1261
  continue;
1254
1262
  }
1255
1263
  scr = el.points[i].scrCoords;
package/src/utils/type.js CHANGED
@@ -1404,8 +1404,10 @@ JXG.extend(
1404
1404
  mergeAttr: function (attr, special, toLower, ignoreUndefinedSpecials) {
1405
1405
  var e, e2, o;
1406
1406
 
1407
- toLower = toLower || true;
1408
- ignoreUndefinedSpecials = ignoreUndefinedSpecials || false;
1407
+ // toLower = toLower || true;
1408
+ // ignoreUndefinedSpecials || false;
1409
+ toLower = this.def(toLower, true);
1410
+ ignoreUndefinedSpecials = this.def(ignoreUndefinedSpecials, false);
1409
1411
 
1410
1412
  for (e in special) {
1411
1413
  if (special.hasOwnProperty(e)) {
@@ -1878,8 +1880,13 @@ JXG.extend(
1878
1880
  * @returns {String}
1879
1881
  */
1880
1882
  trimNumber: function (str) {
1881
- str = str.replace(/^0+/, "");
1882
- str = str.replace(/0+$/, "");
1883
+ if (str !== '0') {
1884
+ str = str.replace(/^0+/, "");
1885
+ }
1886
+
1887
+ if (str.indexOf('.') >= 0 || str.indexOf(',') >= 0) {
1888
+ str = str.replace(/0+$/, "");
1889
+ }
1883
1890
 
1884
1891
  if (str[str.length - 1] === "." || str[str.length - 1] === ",") {
1885
1892
  str = str.slice(0, -1);