jsxgraph 1.4.0 → 1.4.3

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 (98) hide show
  1. package/README.md +1 -1
  2. package/distrib/README.md +1 -1
  3. package/distrib/geogebra.min.js +3 -3
  4. package/distrib/geonext.min.js +3 -3
  5. package/distrib/index.d.ts +5205 -4629
  6. package/distrib/intergeo.min.js +3 -3
  7. package/distrib/jsxgraph.css +10 -15
  8. package/distrib/jsxgraphcore.js +9 -25
  9. package/distrib/jsxgraphsrc.js +4497 -2180
  10. package/distrib/sketch.min.js +3 -3
  11. package/package.json +3 -2
  12. package/src/3d/box3d.js +264 -0
  13. package/src/3d/curve3d.js +97 -0
  14. package/src/3d/linspace3d.js +375 -0
  15. package/src/3d/point3d.js +200 -0
  16. package/src/3d/surface3d.js +81 -0
  17. package/src/3d/threed.js +38 -0
  18. package/src/3d/view3d.js +459 -0
  19. package/src/base/board.js +139 -85
  20. package/src/base/chart.js +1 -1
  21. package/src/base/circle.js +1 -1
  22. package/src/base/composition.js +1 -1
  23. package/src/base/constants.js +15 -14
  24. package/src/base/coords.js +3 -3
  25. package/src/base/coordselement.js +5 -8
  26. package/src/base/curve.js +1 -1
  27. package/src/base/element.js +36 -28
  28. package/src/base/foreignobject.js +12 -2
  29. package/src/base/group.js +1 -1
  30. package/src/base/image.js +1 -1
  31. package/src/base/line.js +2 -2
  32. package/src/base/point.js +8 -18
  33. package/src/base/polygon.js +89 -34
  34. package/src/base/text.js +8 -7
  35. package/src/base/ticks.js +17 -3
  36. package/src/base/transformation.js +1 -1
  37. package/src/base/turtle.js +1 -1
  38. package/src/element/arc.js +1 -1
  39. package/src/element/button.js +1 -1
  40. package/src/element/checkbox.js +1 -1
  41. package/src/element/comb.js +1 -1
  42. package/src/element/composition.js +2 -2
  43. package/src/element/conic.js +3 -3
  44. package/src/element/input.js +1 -1
  45. package/src/element/locus.js +1 -1
  46. package/src/element/measure.js +9 -4
  47. package/src/element/sector.js +5 -5
  48. package/src/element/slider.js +29 -12
  49. package/src/element/slopetriangle.js +1 -1
  50. package/src/jsxgraph.js +9 -3
  51. package/src/jxg.js +3 -3
  52. package/src/loadjsxgraph.js +18 -12
  53. package/src/math/bst.js +1 -1
  54. package/src/math/clip.js +550 -345
  55. package/src/math/complex.js +1 -1
  56. package/src/math/extrapolate.js +1 -1
  57. package/src/math/geometry.js +85 -6
  58. package/src/math/ia.js +69 -69
  59. package/src/math/math.js +10 -1
  60. package/src/math/metapost.js +1 -1
  61. package/src/math/nlp.js +4 -4
  62. package/src/math/numerics.js +2 -1
  63. package/src/math/plot.js +4 -4
  64. package/src/math/poly.js +1 -1
  65. package/src/math/probfuncs.js +2 -1
  66. package/src/math/qdt.js +11 -11
  67. package/src/math/statistics.js +10 -10
  68. package/src/math/symbolic.js +1 -1
  69. package/src/options.js +96 -40
  70. package/src/options3d.js +123 -0
  71. package/src/parser/ca.js +1297 -1291
  72. package/src/parser/datasource.js +1 -1
  73. package/src/parser/geonext.js +6 -6
  74. package/src/parser/jessiecode.js +369 -73
  75. package/src/parser/jessiescript.js +1 -1
  76. package/src/reader/cinderella.js +1 -1
  77. package/src/reader/file.js +1 -1
  78. package/src/reader/geogebra.js +1 -1
  79. package/src/reader/geonext.js +1 -1
  80. package/src/reader/graph.js +1 -1
  81. package/src/reader/intergeo.js +1 -1
  82. package/src/reader/sketch.js +7 -7
  83. package/src/renderer/abstract.js +8 -2
  84. package/src/renderer/canvas.js +9 -5
  85. package/src/renderer/no.js +2 -1
  86. package/src/renderer/svg.js +10 -13
  87. package/src/renderer/vml.js +1 -1
  88. package/src/server/server.js +1 -1
  89. package/src/utils/base64.js +2 -2
  90. package/src/utils/color.js +8 -9
  91. package/src/utils/dump.js +20 -5
  92. package/src/utils/env.js +13 -54
  93. package/src/utils/event.js +1 -1
  94. package/src/utils/expect.js +1 -1
  95. package/src/utils/type.js +12 -10
  96. package/src/utils/xml.js +1 -1
  97. package/src/utils/zip.js +1 -1
  98. package/CHANGELOG.md +0 -1366
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -886,7 +886,7 @@ Copyright 2008-2021
886
886
  str1[i] = pn(step.args.p1[i]);
887
887
  }
888
888
 
889
- set_str = 'point(' + str1.join(', ') + ') <<id: \'' + pid1 + '\', name: \'\', visible: false, ';
889
+ set_str = 'point(' + str1.join(', ') + ') <<id: \'' + pid1 + '\', name: \'\', visible: false, isinfinit: true, ';
890
890
  set_str += 'snaptogrid: false, snaptopoints: false, priv: true>>; ';
891
891
  reset_str = 'remove(' + pid1 + '); ';
892
892
  } else {
@@ -901,7 +901,7 @@ Copyright 2008-2021
901
901
  str1[i] = pn(step.args.p2[i]);
902
902
  }
903
903
 
904
- set_str += 'point(' + str1.join(', ') + ') <<id: \'' + pid2 + '\', name: \'\', visible: false, ';
904
+ set_str += 'point(' + str1.join(', ') + ') <<id: \'' + pid2 + '\', name: \'\', visible: false, isinfinit: true, ';
905
905
  set_str += 'snaptogrid: false, snaptopoints: false, priv: true>>; ';
906
906
  reset_str = 'remove(' + pid2 + '); ' + reset_str;
907
907
  } else {
@@ -1376,10 +1376,10 @@ Copyright 2008-2021
1376
1376
 
1377
1377
  set_str = assign + step.args.plot_type + '(' + step.args.func;
1378
1378
 
1379
- if (isNaN(step.args.a) || step.args.a === null || step.args.a === undefined)
1380
- step.args.a = '-infinity';
1381
- if (isNaN(step.args.b) || step.args.b === null || step.args.b === undefined)
1382
- step.args.b = 'infinity';
1379
+ if (isNaN(step.args.a) || step.args.a === null || step.args.a === undefined|| step.args.a ==='-infinity')
1380
+ step.args.a = '';
1381
+ if (isNaN(step.args.b) || step.args.b === null || step.args.b === undefined|| step.args.b ==='infinity')
1382
+ step.args.b = '';
1383
1383
 
1384
1384
  if (step.args.a != step.args.b)
1385
1385
  set_str += ', ' + step.args.a + ', ' + step.args.b;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -38,6 +38,7 @@
38
38
  newcap: AsciiMathMl exposes non-constructor functions beginning with upper case letters
39
39
  */
40
40
  /*jslint nomen: true, plusplus: true, newcap: true, unparam: true*/
41
+ /*eslint no-unused-vars: "off"*/
41
42
 
42
43
  /* depends:
43
44
  jxg
@@ -1139,9 +1140,11 @@ define([
1139
1140
  }
1140
1141
  } else if (Type.evaluate(el.visProp.usekatex)) {
1141
1142
  try {
1143
+ /* eslint-disable no-undef */
1142
1144
  katex.render(content, el.rendNode, {
1143
1145
  throwOnError: false
1144
1146
  });
1147
+ /* eslint-enable no-undef */
1145
1148
  } catch (e) {
1146
1149
  JXG.debug('KaTeX (not yet) loaded');
1147
1150
  }
@@ -1581,8 +1584,11 @@ define([
1581
1584
 
1582
1585
  setTabindex: function(element) {
1583
1586
  var val;
1584
- if (Type.exists(element.rendNode)) {
1587
+ if (element.board.attr.keyboard.enabled && Type.exists(element.rendNode)) {
1585
1588
  val = Type.evaluate(element.visProp.tabindex);
1589
+ if (!element.visPropCalc.visible || Type.evaluate(element.visProp.fixed)) {
1590
+ val = null;
1591
+ }
1586
1592
  if (val !== element.visPropOld.tabindex) {
1587
1593
  element.rendNode.setAttribute('tabindex', val);
1588
1594
  element.visPropOld.tabindex = val;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -89,13 +89,17 @@ define([
89
89
  'px" height="', dim.height,
90
90
  'px"><', '/canvas>'].join('');
91
91
  this.canvasRoot = this.container.ownerDocument.getElementById(this.canvasId);
92
- this.context = this.canvasRoot.getContext('2d');
93
92
  this.canvasRoot.style.display = 'block';
93
+ this.context = this.canvasRoot.getContext('2d');
94
94
 
95
95
  } else if (Env.isNode()) {
96
- this.canvasId = (typeof module === 'object' ? module.require('canvas') : require('canvas'));
97
- this.canvasRoot = new this.canvasId(500, 500);
98
- this.context = this.canvasRoot.getContext('2d');
96
+ try {
97
+ this.canvasId = (typeof module === 'object' ? module.require('canvas') : require('canvas'));
98
+ this.canvasRoot = new this.canvasId(500, 500);
99
+ this.context = this.canvasRoot.getContext('2d');
100
+ } catch (err) {
101
+ console.log("Warning: 'canvas' not found. You might need to call 'npm install canvas'");
102
+ }
99
103
  }
100
104
 
101
105
  this.dashArray = [[2, 2], [5, 5], [10, 10], [20, 20], [20, 10, 10, 10], [20, 5, 10, 5]];
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -32,6 +32,7 @@
32
32
 
33
33
  /*global JXG: true, define: true, AMprocessNode: true, MathJax: true, document: true */
34
34
  /*jslint nomen: true, plusplus: true, newcap:true, unparam: true*/
35
+ /*eslint no-unused-vars: "off"*/
35
36
 
36
37
  /* depends:
37
38
  jxg
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1579,7 +1579,6 @@ define([
1579
1579
  canvas.height = images[i].getAttribute("height");
1580
1580
  try {
1581
1581
  ctx.drawImage(images[i], 0, 0, canvas.width, canvas.height);
1582
- //ctx.drawImage(document.getElementById('testimg2'), 0, 0, canvas.width, canvas.height);
1583
1582
 
1584
1583
  // If the image is not png, the format must be specified here
1585
1584
  ur = canvas.toDataURL();
@@ -1587,7 +1586,6 @@ define([
1587
1586
  } catch (err) {
1588
1587
  console.log("CORS problem! Image can not be used", err);
1589
1588
  }
1590
- //};
1591
1589
  }
1592
1590
  //canvas.remove();
1593
1591
  }
@@ -1650,8 +1648,8 @@ define([
1650
1648
  // }
1651
1649
 
1652
1650
  // In IE we have to remove the namespace again.
1653
- if ((svg.match(/xmlns=\"http:\/\/www.w3.org\/2000\/svg\"/g) || []).length > 1) {
1654
- svg = svg.replace(/xmlns=\"http:\/\/www.w3.org\/2000\/svg\"/g, '');
1651
+ if ((svg.match(/xmlns="http:\/\/www.w3.org\/2000\/svg"/g) || []).length > 1) {
1652
+ svg = svg.replace(/xmlns="http:\/\/www.w3.org\/2000\/svg"/g, '');
1655
1653
  }
1656
1654
 
1657
1655
  // Safari fails if the svg string contains a "&nbsp;"
@@ -1696,17 +1694,16 @@ define([
1696
1694
  * setTimeout(function() { console.log('done'); }, 400);
1697
1695
  */
1698
1696
  dumpToCanvas: function (canvasId, w, h, ignoreTexts) {
1699
- var //svgRoot = this.svgRoot,
1700
- svg, tmpImg, cv, ctx;
1701
- // wOrg, hOrg;
1702
-
1703
- // wOrg = svgRoot.getAttribute('width');
1704
- // hOrg = svgRoot.getAttribute('height');
1697
+ var svg, tmpImg, cv, ctx;
1705
1698
 
1706
1699
  // Prepare the canvas element
1707
1700
  cv = document.getElementById(canvasId);
1701
+
1708
1702
  // Clear the canvas
1703
+ /* eslint-disable no-self-assign */
1709
1704
  cv.width = cv.width;
1705
+ /* eslint-enable no-self-assign */
1706
+
1710
1707
  ctx = cv.getContext("2d");
1711
1708
  if (w !== undefined && h !== undefined) {
1712
1709
  cv.style.width = parseFloat(w) + 'px';
@@ -1793,8 +1790,8 @@ define([
1793
1790
  return this;
1794
1791
  }
1795
1792
 
1796
- w = bas.scale * parseFloat(this.container.style.width);
1797
- h = bas.scale * parseFloat(this.container.style.height);
1793
+ w = bas.scale * this.container.getBoundingClientRect().width;
1794
+ h = bas.scale * this.container.getBoundingClientRect().height;
1798
1795
 
1799
1796
  if (imgId === undefined || imgId === '') {
1800
1797
  newImg = true;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -134,7 +134,7 @@ define(['jxg', 'utils/encoding'], function (JXG, Encoding) {
134
134
 
135
135
  // deactivate regexp linting. Our regex is secure, because we replace everything with ''
136
136
  /*jslint regexp:true*/
137
- encInput = input.replace(/[^A-Za-z0-9\+\/=]/g, '');
137
+ encInput = input.replace(/[^A-Za-z0-9+/=]/g, '');
138
138
  /*jslint regexp:false*/
139
139
 
140
140
  len = encInput.length;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -45,7 +45,7 @@
45
45
  * Stoyan Stefanov <sstoo@gmail.com> (see http://www.phpied.com/rgb-color-parser-in-javascript/)
46
46
  */
47
47
 
48
- define(['jxg', 'utils/type', 'math/math'],
48
+ define(['jxg', 'utils/type', 'math/math'],
49
49
  function (JXG, Type, Mat) {
50
50
 
51
51
  "use strict";
@@ -202,7 +202,7 @@ define(['jxg', 'utils/type', 'math/math'],
202
202
 
203
203
  // array of color definition objects
204
204
  colorDefs = [{
205
- re: /^\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d\.]{1,3})\s*\)\s*$/,
205
+ re: /^\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d.]{1,3})\s*\)\s*$/,
206
206
  example: ['rgba(123, 234, 45, 0.5)', 'rgba(255,234,245,1.0)'],
207
207
  process: function (bits) {
208
208
  return [
@@ -988,8 +988,7 @@ define(['jxg', 'utils/type', 'math/math'],
988
988
  green: '#009E73', // bluishgreen
989
989
  purple: '#CC79A7', // reddishpurple
990
990
  white: '#ffffff'
991
- },
992
-
991
+ }
993
992
  });
994
993
 
995
994
  /**
@@ -1004,16 +1003,16 @@ define(['jxg', 'utils/type', 'math/math'],
1004
1003
  * <li> white
1005
1004
  * <li> yellow
1006
1005
  * </ul>
1007
- *
1006
+ *
1008
1007
  * @name JXG.palette
1009
1008
  * @type Object
1010
1009
  * @default JXG.paletteWong
1011
1010
  * @see JXG.paletteWong
1012
- *
1011
+ *
1013
1012
  * @example
1014
- *
1013
+ *
1015
1014
  * var p = board.create('line', [[-1, 1], [2, -3]], {strokeColor: JXG.palette.yellow});
1016
- *
1015
+ *
1017
1016
  */
1018
1017
  JXG.palette = JXG.paletteWong;
1019
1018
 
package/src/utils/dump.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -304,7 +304,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
304
304
  }
305
305
  return 'null';
306
306
  case 'string':
307
- return '\'' + obj.replace(/(["'])/g, '\\$1') + '\'';
307
+ return '\'' + obj.replace(/\\/g,'\\\\').replace(/(["'])/g, '\\$1') + '\'';
308
308
  case 'number':
309
309
  case 'boolean':
310
310
  return obj.toString();
@@ -319,7 +319,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
319
319
  * @returns {String} JessieCode
320
320
  */
321
321
  toJessie: function (board) {
322
- var i, elements,
322
+ var i, elements, id,
323
323
  dump = this.dump(board),
324
324
  script = [];
325
325
 
@@ -331,8 +331,15 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
331
331
  if (elements[i].attributes.name.length > 0) {
332
332
  script.push('// ' + elements[i].attributes.name);
333
333
  }
334
-
335
334
  script.push('s' + i + ' = ' + elements[i].type + '(' + elements[i].parents.join(', ') + ') ' + this.toJCAN(elements[i].attributes).replace(/\n/, '\\n') + ';');
335
+
336
+ if (elements[i].type === 'axis') {
337
+ // Handle the case that remove[All]Ticks had been called.
338
+ id = elements[i].attributes.id;
339
+ if (board.objects[id].defaultTicks === null) {
340
+ script.push('s' + i + '.removeAllTicks();');
341
+ }
342
+ }
336
343
  script.push('');
337
344
  }
338
345
 
@@ -355,7 +362,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
355
362
  * @returns {String} JavaScript
356
363
  */
357
364
  toJavaScript: function (board) {
358
- var i, elements,
365
+ var i, elements, id,
359
366
  dump = this.dump(board),
360
367
  script = [];
361
368
 
@@ -365,6 +372,14 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
365
372
 
366
373
  for (i = 0; i < elements.length; i++) {
367
374
  script.push('board.create("' + elements[i].type + '", [' + elements[i].parents.join(', ') + '], ' + Type.toJSON(elements[i].attributes) + ');');
375
+
376
+ if (elements[i].type === 'axis') {
377
+ // Handle the case that remove[All]Ticks had been called.
378
+ id = elements[i].attributes.id;
379
+ if (board.objects[id].defaultTicks === null) {
380
+ script.push('board.objects["' + id + '"].removeTicks(board.objects["' + id + '"].defaultTicks);');
381
+ }
382
+ }
368
383
  }
369
384
 
370
385
  for (i = 0; i < dump.methods.length; i++) {
package/src/utils/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -253,7 +253,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
253
253
  * @returns {Boolean}
254
254
  */
255
255
  isWebkitApple: function () {
256
- return this.isApple() && (navigator.userAgent.search(/Mobile\/[0-9A-Za-z\.]*Safari/) > -1);
256
+ return this.isApple() && (navigator.userAgent.search(/Mobile\/[0-9A-Za-z.]*Safari/) > -1);
257
257
  },
258
258
 
259
259
  /**
@@ -802,8 +802,8 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
802
802
  * @see JXG.Board#fullscreenListener
803
803
  * @private
804
804
  */
805
- _getScaleFactors: function(node) {
806
- var width = node.getBoundingClientRect().width,
805
+ _getScaleFactors: function (node) {
806
+ var width = node.getBoundingClientRect().width,
807
807
  height = node.getBoundingClientRect().height,
808
808
 
809
809
  // Determine the maximum scale factor.
@@ -827,7 +827,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
827
827
  }
828
828
  scale *= 0.85;
829
829
 
830
- return {scale: scale, vshift: vshift};
830
+ return { scale: scale, vshift: vshift, width: width };
831
831
  },
832
832
 
833
833
  /**
@@ -842,14 +842,14 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
842
842
  * @param {Number} vshift Vertical shift (in pixel)
843
843
  *
844
844
  * @private
845
- * @see JXG#toFullscreen
845
+ * @see JXG.Board#toFullscreen
846
846
  * @see JXG.Board#fullscreenListener
847
847
  *
848
848
  */
849
849
  scaleJSXGraphDiv: function (wrap_id, inner_id, scale, vshift) {
850
850
  var len = document.styleSheets.length, style,
851
851
 
852
- pseudo_keys = [':fullscreen', ':-webkit-full-screen', ':-moz-full-screen',':-ms-fullscreen'],
852
+ pseudo_keys = [':fullscreen', ':-webkit-full-screen', ':-moz-full-screen', ':-ms-fullscreen'],
853
853
  len_pseudo = pseudo_keys.length, i,
854
854
 
855
855
  // CSS rules to center the inner div horizontally and vertically.
@@ -860,7 +860,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
860
860
  regex = new RegExp('.*#' + wrap_id + ':.*full.*screen.*#' + inner_id + '.*auto;.*transform:.*matrix');
861
861
 
862
862
  if (len === 0) {
863
- // In case there is not a single CSS rule defined.
863
+ // In case there is not a single CSS rule defined at all.
864
864
  style = document.createElement('style');
865
865
  // WebKit hack :(
866
866
  style.appendChild(document.createTextNode(''));
@@ -883,54 +883,13 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
883
883
  document.styleSheets[len - 1].insertRule('#' + wrap_id + pseudo_keys[i] + ' #' + inner_id + rule_inner, 0);
884
884
  break;
885
885
  } catch (err) {
886
- console.log('JXG.scaleJSXGraphDiv: Could not add CSS rule "' + pseudo_keys[i] + '".');
887
- console.log('One possible reason could be that the id of the JSXGraph container does not start with a letter.');
886
+ // console.log('JXG.scaleJSXGraphDiv: Could not add CSS rule "' + pseudo_keys[i] + '".');
887
+ // console.log('One possible reason could be that the id of the JSXGraph container does not start with a letter.');
888
888
  }
889
889
  }
890
- },
891
-
892
- /**
893
- * Set the DOM element with id='wrap_id' containing the JSXGraph div
894
- * element in fullscreen mode.
895
- * The JSXGraph element is scaled as large as possible while
896
- * retaining its proportions.
897
- *
898
- * @param {String} wrap_id id of DOM element containing the JSXGraph
899
- * div element.
900
- *
901
- * @example
902
- *
903
- * &lt;div id="outer" class="JXG_wrap_private"&gt;
904
- * &lt;div id='jxgbox' class='jxgbox' style='width:300px; height:300px;'&gt;&lt;/div&gt;
905
- * &lt;/div&gt;
906
- * &lt;button onClick="JXG.toFullscreen('outer')"&gt;Fullscreen&lt;/button&gt;
907
- * &lt;script&gt;
908
- * var board = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-8, 8, 8,-8]});
909
- * var p = board.create('point', [0, 1]);
910
- * &lt;/script&gt;
911
- *
912
- * </pre><div id="JXGf9b973ea4_outer" class="JXG_wrap_private"><div id="JXGd9b973ea4-fd43-11e8-ab14-901b0e1b8723" class="jxgbox" style="width: 300px; height: 300px;"></div></div>
913
- * <button onClick="JXG.toFullscreen('JXGf9b973ea4_outer')">Fullscreen</button>
914
- * <script type="text/javascript">
915
- * (function() {
916
- * var board = JXG.JSXGraph.initBoard('JXGd9b973ea4-fd43-11e8-ab14-901b0e1b8723',
917
- * {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
918
- * var p = board.create('point', [0, 1]);
919
- * })();
920
- * </script><pre>
921
- *
922
- */
923
- toFullscreen: function (wrap_id) {
924
- var node = document.getElementById(wrap_id);
925
-
926
- // Trigger the fullscreen mode
927
- node.requestFullscreen = node.requestFullscreen ||
928
- node.webkitRequestFullscreen ||
929
- node.mozRequestFullScreen ||
930
- node.msRequestFullscreen;
931
-
932
- if (node.requestFullscreen) {
933
- node.requestFullscreen();
890
+ if (i === len_pseudo) {
891
+ console.log('JXG.scaleJSXGraphDiv: Could not add any CSS rule.');
892
+ console.log('One possible reason could be that the id of the JSXGraph container does not start with a letter.');
934
893
  }
935
894
  }
936
895
  });
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
package/src/utils/type.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
@@ -197,9 +197,11 @@ define([
197
197
  * @returns {Boolean} True, if v is neither undefined nor null.
198
198
  */
199
199
  exists: function (v, checkEmptyString) {
200
+ /* eslint-disable eqeqeq */
200
201
  var result = !(v == undefined || v === null);
202
+ /* eslint-enable eqeqeq */
201
203
  checkEmptyString = checkEmptyString || false;
202
-
204
+
203
205
  if (checkEmptyString) {
204
206
  return result && v !== '';
205
207
  }
@@ -210,7 +212,7 @@ define([
210
212
  // var result = !(v === undef || v === null);
211
213
 
212
214
  // checkEmptyString = checkEmptyString || false;
213
-
215
+
214
216
  // if (checkEmptyString) {
215
217
  // return result && v !== '';
216
218
  // }
@@ -712,12 +714,12 @@ define([
712
714
  * is returned by JavaScript's toFixed()
713
715
  *
714
716
  * @memberOf JXG
715
- * @param {Number} num Number tp be rounded
716
- * @param {Number} precision Decimal digits
717
- * @return {String} Rounded number is returned as string
717
+ * @param {Number} num Number tp be rounded
718
+ * @param {Number} digits Decimal digits
719
+ * @return {String} Rounded number is returned as string
718
720
  */
719
- toFixed: function (num, precision) {
720
- return this._round10(num, -precision).toFixed(precision);
721
+ toFixed: function (num, digits) {
722
+ return this._round10(num, -digits).toFixed(digits);
721
723
  },
722
724
 
723
725
  /**
@@ -975,7 +977,7 @@ define([
975
977
  }
976
978
 
977
979
  // options from attributes
978
- o = attributes;
980
+ o = (typeof attributes === 'object') ? attributes : {};
979
981
  isAvail = true;
980
982
  for (i = 3; i < len; i++) {
981
983
  if (this.exists(o[arguments[i]])) {
@@ -1281,7 +1283,7 @@ define([
1281
1283
  return html_sanitize(str, function () { return undefined; }, function (id) { return id; });
1282
1284
  }
1283
1285
 
1284
- if (str) {
1286
+ if (str && typeof str === 'string') {
1285
1287
  str = str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
1286
1288
  }
1287
1289
 
package/src/utils/xml.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,
package/src/utils/zip.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2008-2021
2
+ Copyright 2008-2022
3
3
  Matthias Ehmann,
4
4
  Michael Gerhaeuser,
5
5
  Carsten Miller,