jsxgraph 1.3.0 → 1.4.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 (90) hide show
  1. package/README.md +2 -2
  2. package/distrib/README.md +2 -2
  3. package/distrib/geogebra.min.js +3 -3
  4. package/distrib/geonext.min.js +3 -3
  5. package/distrib/index.d.ts +651 -448
  6. package/distrib/intergeo.min.js +3 -3
  7. package/distrib/jsxgraph.css +4 -13
  8. package/distrib/jsxgraphcore.js +9 -25
  9. package/distrib/jsxgraphsrc.js +28203 -25234
  10. package/distrib/sketch.min.js +3 -3
  11. package/package.json +11 -22
  12. package/src/base/board.js +674 -469
  13. package/src/base/chart.js +1 -1
  14. package/src/base/circle.js +23 -1
  15. package/src/base/composition.js +1 -1
  16. package/src/base/constants.js +32 -11
  17. package/src/base/coords.js +4 -4
  18. package/src/base/coordselement.js +51 -24
  19. package/src/base/curve.js +308 -117
  20. package/src/base/element.js +79 -50
  21. package/src/base/foreignobject.js +463 -0
  22. package/src/base/group.js +2 -2
  23. package/src/base/image.js +12 -15
  24. package/src/base/line.js +108 -21
  25. package/src/base/point.js +24 -28
  26. package/src/base/polygon.js +75 -18
  27. package/src/base/text.js +116 -63
  28. package/src/base/ticks.js +29 -11
  29. package/src/base/transformation.js +1 -1
  30. package/src/base/turtle.js +1 -1
  31. package/src/element/arc.js +1 -1
  32. package/src/element/button.js +29 -2
  33. package/src/element/checkbox.js +31 -1
  34. package/src/element/comb.js +5 -2
  35. package/src/element/composition.js +127 -19
  36. package/src/element/conic.js +46 -5
  37. package/src/element/input.js +32 -1
  38. package/src/element/locus.js +2 -2
  39. package/src/element/measure.js +9 -4
  40. package/src/element/sector.js +46 -12
  41. package/src/element/slider.js +17 -12
  42. package/src/element/slopetriangle.js +1 -1
  43. package/src/jsxgraph.js +28 -9
  44. package/src/jxg.js +4 -3
  45. package/src/loadjsxgraph.js +3 -2
  46. package/src/math/bst.js +1 -1
  47. package/src/math/clip.js +550 -345
  48. package/src/math/complex.js +1 -1
  49. package/src/math/extrapolate.js +1 -1
  50. package/src/math/geometry.js +155 -126
  51. package/src/math/ia.js +290 -21
  52. package/src/math/math.js +30 -1
  53. package/src/math/metapost.js +1 -1
  54. package/src/math/nlp.js +25 -5
  55. package/src/math/numerics.js +183 -4
  56. package/src/math/plot.js +4 -4
  57. package/src/math/poly.js +1 -1
  58. package/src/math/probfuncs.js +2 -1
  59. package/src/math/qdt.js +68 -62
  60. package/src/math/statistics.js +58 -7
  61. package/src/math/symbolic.js +1 -1
  62. package/src/options.js +377 -114
  63. package/src/parser/ca.js +1297 -1291
  64. package/src/parser/datasource.js +1 -1
  65. package/src/parser/geonext.js +6 -6
  66. package/src/parser/jessiecode.js +275 -79
  67. package/src/parser/jessiescript.js +1 -1
  68. package/src/reader/cinderella.js +1 -1
  69. package/src/reader/file.js +1 -1
  70. package/src/reader/geogebra.js +1 -1
  71. package/src/reader/geonext.js +1 -1
  72. package/src/reader/graph.js +1 -1
  73. package/src/reader/intergeo.js +1 -1
  74. package/src/reader/sketch.js +21 -13
  75. package/src/renderer/abstract.js +21 -6
  76. package/src/renderer/canvas.js +22 -15
  77. package/src/renderer/no.js +11 -4
  78. package/src/renderer/svg.js +76 -53
  79. package/src/renderer/vml.js +36 -32
  80. package/src/server/server.js +1 -1
  81. package/src/utils/base64.js +2 -2
  82. package/src/utils/color.js +148 -3
  83. package/src/utils/dump.js +21 -15
  84. package/src/utils/env.js +63 -104
  85. package/src/utils/event.js +1 -1
  86. package/src/utils/expect.js +1 -1
  87. package/src/utils/type.js +30 -19
  88. package/src/utils/xml.js +1 -1
  89. package/src/utils/zip.js +1 -1
  90. package/CHANGELOG.md +0 -1281
@@ -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,8 @@
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'], function (JXG, Type, Mat) {
48
+ define(['jxg', 'utils/type', 'math/math'],
49
+ function (JXG, Type, Mat) {
49
50
 
50
51
  "use strict";
51
52
 
@@ -198,9 +199,10 @@ define(['jxg', 'utils/type', 'math/math'], function (JXG, Type, Mat) {
198
199
  yellow: 'ffff00',
199
200
  yellowgreen: '9acd32'
200
201
  },
202
+
201
203
  // array of color definition objects
202
204
  colorDefs = [{
203
- 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*$/,
204
206
  example: ['rgba(123, 234, 45, 0.5)', 'rgba(255,234,245,1.0)'],
205
207
  process: function (bits) {
206
208
  return [
@@ -872,5 +874,148 @@ define(['jxg', 'utils/type', 'math/math'], function (JXG, Type, Mat) {
872
874
  return lightColor;
873
875
  };
874
876
 
877
+ /**
878
+ * Use the color scheme of JSXGraph up to version 1.3.2.
879
+ * This method has to be called before JXG.JSXGraph.initBoard();
880
+ *
881
+ * @see JXG.palette
882
+ * @see JXG.paletteWong
883
+ *
884
+ * @example
885
+ *
886
+ * JXG.setClassicColors();
887
+ * var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-5, 5, 5,-5]});
888
+ *
889
+ */
890
+ JXG.setClassicColors = function() {
891
+ JXG.Options.elements.strokeColor = 'blue';
892
+ JXG.Options.elements.fillColor = 'red';
893
+ JXG.Options.hatch.strokeColor = 'blue';
894
+ JXG.Options.angle.fillColor = '#ff7f00';
895
+ JXG.Options.angle.highlightFillColor = '#ff7f00';
896
+ JXG.Options.angle.strokeColor = '#ff7f00';
897
+ JXG.Options.angle.label.strokeColor = 'blue';
898
+ JXG.Options.arc.strokeColor = 'blue';
899
+ JXG.Options.circle.center.fillColor = 'red';
900
+ JXG.Options.circle.center.strokeColor = 'blue';
901
+ JXG.Options.circumcircle.strokeColor = 'blue';
902
+ JXG.Options.circumcircle.center.fillColor = 'red';
903
+ JXG.Options.circumcircle.center.strokeColor = 'blue';
904
+ JXG.Options.circumcirclearc.strokeColor = 'blue';
905
+ JXG.Options.circumcirclesector.strokeColor = 'blue';
906
+ JXG.Options.circumcirclesector.fillColor = 'green';
907
+ JXG.Options.circumcirclesector.highlightFillColor = 'green';
908
+ JXG.Options.conic.strokeColor = 'blue';
909
+ JXG.Options.curve.strokeColor = 'blue';
910
+ JXG.Options.incircle.strokeColor = 'blue';
911
+ JXG.Options.incircle.center.fillColor = 'red';
912
+ JXG.Options.incircle.center.strokeColor = 'blue';
913
+ JXG.Options.inequality.fillColor = 'red';
914
+ JXG.Options.integral.fillColor = 'red';
915
+ JXG.Options.integral.curveLeft.color = 'red';
916
+ JXG.Options.integral.curveRight.color = 'red';
917
+ JXG.Options.line.strokeColor = 'blue';
918
+ JXG.Options.point.fillColor = 'red';
919
+ JXG.Options.point.strokeColor = 'red';
920
+ JXG.Options.polygon.fillColor = 'green';
921
+ JXG.Options.polygon.highlightFillColor = 'green';
922
+ JXG.Options.polygon.vertices.strokeColor = 'red';
923
+ JXG.Options.polygon.vertices.fillColor = 'red';
924
+ JXG.Options.regularpolygon.fillColor = 'green';
925
+ JXG.Options.regularpolygon.highlightFillColor = 'green';
926
+ JXG.Options.regularpolygon.vertices.strokeColor = 'red';
927
+ JXG.Options.regularpolygon.vertices.fillColor = 'red';
928
+ JXG.Options.riemannsum.fillColor = 'yellow';
929
+ JXG.Options.sector.fillColor = 'green';
930
+ JXG.Options.sector.highlightFillColor = 'green';
931
+ JXG.Options.semicircle.center.fillColor = 'red';
932
+ JXG.Options.semicircle.center.strokeColor = 'blue';
933
+ JXG.Options.slopetriangle.fillColor = 'red';
934
+ JXG.Options.slopetriangle.highlightFillColor = 'red';
935
+ JXG.Options.turtle.arrow.strokeColor = 'blue';
936
+ };
937
+
938
+ JXG.extend(JXG, /** @lends JXG */ {
939
+ /**
940
+ * Bang Wong color palette,
941
+ * optimized for various type
942
+ * of color blindness.
943
+ * It contains values for
944
+ * <ul>
945
+ * <li> 'black'
946
+ * <li> 'orange'
947
+ * <li> 'skyblue'
948
+ * <li> 'bluishgreen'
949
+ * <li> 'yellow'
950
+ * <li> 'darkblue'
951
+ * <li> 'vermillion'
952
+ * <li> 'reddishpurple'
953
+ * </ul>
954
+ *
955
+ * As substitutes for standard colors, it contains the following aliases:
956
+ *
957
+ * <ul>
958
+ * <li> black (= #000000)
959
+ * <li> blue (= darkblue)
960
+ * <li> green (= bluishgreen)
961
+ * <li> purple (= reddishpurple)
962
+ * <li> red (= vermillion)
963
+ * <li> white (= #ffffff)
964
+ * </ul>
965
+ *
966
+ * See <a href="https://www.nature.com/articles/nmeth.1618">Bang Wong: "Points of view: Color blindness"</a>
967
+ * and
968
+ * <a href="https://davidmathlogic.com/colorblind/">https://davidmathlogic.com/colorblind/</a>.
969
+ *
970
+ * @name JXG.paletteWong
971
+ * @type Object
972
+ * @see JXG.palette
973
+ * @example
974
+ * var p = board.create('line', [[-1, 1], [2, -3]], {strokeColor: JXG.paletteWong.yellow});
975
+ */
976
+ paletteWong: {
977
+ black: '#000000',
978
+ orange: '#E69F00',
979
+ skyblue: '#56B4E9',
980
+ bluishgreen: '#009E73',
981
+ yellow: '#F0E442',
982
+ darkblue: '#0072B2',
983
+ vermillion: '#D55E00',
984
+ reddishpurple: '#CC79A7',
985
+
986
+ blue: '#0072B2',
987
+ red: '#D55E00', // vermillion
988
+ green: '#009E73', // bluishgreen
989
+ purple: '#CC79A7', // reddishpurple
990
+ white: '#ffffff'
991
+ },
992
+
993
+ });
994
+
995
+ /**
996
+ * Default color palette.
997
+ * Contains at least color values for
998
+ * <ul>
999
+ * <li> black
1000
+ * <li> blue
1001
+ * <li> green
1002
+ * <li> purple
1003
+ * <li> red
1004
+ * <li> white
1005
+ * <li> yellow
1006
+ * </ul>
1007
+ *
1008
+ * @name JXG.palette
1009
+ * @type Object
1010
+ * @default JXG.paletteWong
1011
+ * @see JXG.paletteWong
1012
+ *
1013
+ * @example
1014
+ *
1015
+ * var p = board.create('line', [[-1, 1], [2, -3]], {strokeColor: JXG.palette.yellow});
1016
+ *
1017
+ */
1018
+ JXG.palette = JXG.paletteWong;
1019
+
875
1020
  return JXG;
876
1021
  });
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,
@@ -188,7 +188,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
188
188
  methods.push({
189
189
  obj: boardVarName,
190
190
  method: 'setBoundingBox',
191
- params: [board.getBoundingBox(), true]
191
+ params: [board.getBoundingBox(), board.keepaspectratio]
192
192
  });
193
193
 
194
194
  return methods;
@@ -209,15 +209,6 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
209
209
 
210
210
  this.addMarkers(board, 'dumped', false);
211
211
 
212
- // This has been moved to toJavaScript and toJessie
213
- /*
214
- methods.push({
215
- obj: '$board',
216
- method: 'setBoundingBox',
217
- params: [board.getBoundingBox(), true]
218
- });
219
- */
220
-
221
212
  for (e = 0; e < len; e++) {
222
213
  obj = board.objectsList[e];
223
214
  element = {};
@@ -313,7 +304,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
313
304
  }
314
305
  return 'null';
315
306
  case 'string':
316
- return '\'' + obj.replace(/(["'])/g, '\\$1') + '\'';
307
+ return '\'' + obj.replace(/\\/g,'\\\\').replace(/(["'])/g, '\\$1') + '\'';
317
308
  case 'number':
318
309
  case 'boolean':
319
310
  return obj.toString();
@@ -328,7 +319,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
328
319
  * @returns {String} JessieCode
329
320
  */
330
321
  toJessie: function (board) {
331
- var i, elements,
322
+ var i, elements, id,
332
323
  dump = this.dump(board),
333
324
  script = [];
334
325
 
@@ -340,8 +331,15 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
340
331
  if (elements[i].attributes.name.length > 0) {
341
332
  script.push('// ' + elements[i].attributes.name);
342
333
  }
343
-
344
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
+ }
345
343
  script.push('');
346
344
  }
347
345
 
@@ -364,7 +362,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
364
362
  * @returns {String} JavaScript
365
363
  */
366
364
  toJavaScript: function (board) {
367
- var i, elements,
365
+ var i, elements, id,
368
366
  dump = this.dump(board),
369
367
  script = [];
370
368
 
@@ -374,6 +372,14 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
374
372
 
375
373
  for (i = 0; i < elements.length; i++) {
376
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
+ }
377
383
  }
378
384
 
379
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,
@@ -51,8 +51,9 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
51
51
  JXG.extendConstants(JXG, /** @lends JXG */{
52
52
  /**
53
53
  * Determines the property that stores the relevant information in the event object.
54
- * @type {String}
54
+ * @type String
55
55
  * @default 'touches'
56
+ * @private
56
57
  */
57
58
  touchProperty: 'touches',
58
59
  });
@@ -73,7 +74,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
73
74
  * @returns {Boolean}
74
75
  */
75
76
  isPointerEvent: function (evt) {
76
- return JXG.exists(evt['pointerId']);
77
+ return JXG.exists(evt.pointerId);
77
78
  },
78
79
 
79
80
  /**
@@ -131,12 +132,16 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
131
132
  * @default false
132
133
  */
133
134
  supportsES6: function () {
135
+ var testMap;
136
+ /* jshint ignore:start */
134
137
  try {
138
+ // This would kill the old uglifyjs: testMap = (a = 0) => a;
135
139
  new Function('(a = 0) => a');
136
140
  return true;
137
141
  } catch (err) {
138
142
  return false;
139
143
  }
144
+ /* jshint ignore:end */
140
145
  },
141
146
 
142
147
  /**
@@ -248,7 +253,7 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
248
253
  * @returns {Boolean}
249
254
  */
250
255
  isWebkitApple: function () {
251
- 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);
252
257
  },
253
258
 
254
259
  /**
@@ -788,33 +793,74 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
788
793
  window.setTimeout(timerFun, 1);
789
794
  },
790
795
 
796
+ /**
797
+ * Calculate the scale factor and vertical shift for the JSXGraph div
798
+ * in full screen mode.
799
+ *
800
+ * @param {Object} obj Reference to a DOM node.
801
+ * @returns Object {scale: number, vshift: number}
802
+ * @see JXG.Board#fullscreenListener
803
+ * @private
804
+ */
805
+ _getScaleFactors: function (node) {
806
+ var width = node.getBoundingClientRect().width,
807
+ height = node.getBoundingClientRect().height,
808
+
809
+ // Determine the maximum scale factor.
810
+ r_w = window.screen.width / width,
811
+ r_h = window.screen.height / height,
812
+
813
+ // Determine the vertical shift to place the div in the center of the screen
814
+ vshift = (window.screen.height - height) * 0.5,
815
+
816
+ // Scaling factor: if not supplied, it's taken as large as possible
817
+ scale = Math.min(r_w, r_h);
818
+
819
+ // Adapt vshift and scale for landscape on tablets
820
+ if (window.matchMedia && window.matchMedia('(orientation:landscape)').matches &&
821
+ window.screen.width < window.screen.height) {
822
+ // Landscape on iOS: it returns 'landscape', but still width < height.
823
+ r_w = window.screen.height / width;
824
+ r_h = window.screen.width / height;
825
+ scale = Math.min(r_w, r_h);
826
+ vshift = (window.screen.width - height) * 0.5;
827
+ }
828
+ scale *= 0.85;
829
+
830
+ return { scale: scale, vshift: vshift, width: width };
831
+ },
832
+
791
833
  /**
792
834
  * Scale and vertically shift a DOM element (usually a JSXGraph div)
793
835
  * inside of a parent DOM
794
836
  * element which is set to fullscreen.
795
837
  * This is realized with a CSS transformation.
796
- *
838
+ * *
797
839
  * @param {String} wrap_id id of the parent DOM element which is in fullscreen mode
798
- * @param {String} inner_id id of the DOM element which is scaled and shifted-
840
+ * @param {String} inner_id id of the DOM element which is scaled and shifted
799
841
  * @param {Number} scale Scaling factor
800
842
  * @param {Number} vshift Vertical shift (in pixel)
801
843
  *
802
844
  * @private
803
- * @see JXG#toFullscreen
845
+ * @see JXG.Board#toFullscreen
846
+ * @see JXG.Board#fullscreenListener
847
+ *
804
848
  */
805
849
  scaleJSXGraphDiv: function (wrap_id, inner_id, scale, vshift) {
806
850
  var len = document.styleSheets.length, style,
807
851
 
808
- pseudo_keys = [':fullscreen', ':-webkit-full-screen', ':-moz-full-screen',':-ms-fullscreen'],
852
+ pseudo_keys = [':fullscreen', ':-webkit-full-screen', ':-moz-full-screen', ':-ms-fullscreen'],
809
853
  len_pseudo = pseudo_keys.length, i,
854
+
810
855
  // CSS rules to center the inner div horizontally and vertically.
811
856
  rule_inner = '{margin:0 auto;transform:matrix(' + scale + ',0,0,' + scale + ',0,' + vshift + ');}',
857
+
812
858
  // A previously installed CSS rule to center the JSXGraph div has to
813
859
  // be searched and removed again.
814
- regex = new RegExp('.*' + wrap_id + ':.*full.*screen.*' + inner_id + '.*auto;.*transform:.*matrix');
860
+ regex = new RegExp('.*#' + wrap_id + ':.*full.*screen.*#' + inner_id + '.*auto;.*transform:.*matrix');
815
861
 
816
862
  if (len === 0) {
817
- // In case there is not a single CSS rule defined.
863
+ // In case there is not a single CSS rule defined at all.
818
864
  style = document.createElement('style');
819
865
  // WebKit hack :(
820
866
  style.appendChild(document.createTextNode(''));
@@ -831,106 +877,19 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
831
877
  document.styleSheets[len - 1].deleteRule(0);
832
878
  }
833
879
 
834
- // Install a CSS rule to center the JSXGraph div at the first position
835
- // of the list.
880
+ // Install a CSS rule to center the JSXGraph div at the first position of the list.
836
881
  for (i = 0; i < len_pseudo; i++) {
837
882
  try {
838
- document.styleSheets[len - 1].insertRule(wrap_id + pseudo_keys[i] + ' ' + inner_id + rule_inner, 0);
883
+ document.styleSheets[len - 1].insertRule('#' + wrap_id + pseudo_keys[i] + ' #' + inner_id + rule_inner, 0);
839
884
  break;
840
885
  } catch (err) {
841
- console.log('JXG.scaleJSXGraphDiv: Could not add CSS rule "' + pseudo_keys[i] + '".');
842
- 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.');
843
888
  }
844
889
  }
845
- },
846
-
847
- /**
848
- * Set the DOM element with id='wrap_id' containing the the JSXGraph div
849
- * element into fullscreen mode.
850
- * By default, the JSXGraph element is scaled as large as possible while
851
- * retaining its proportions.
852
- *
853
- * @param {String} wrap_id id of DOM element containing the JSXGraph
854
- * div element.
855
- *
856
- * @param {String} jsxgraph_id ID of the JSXGraph div element.
857
- * @parame {Number} scale scale factor for the JSXGraph div. If null,
858
- * the scaling factor is chosen as large as possible.
859
- *
860
- * @example
861
- *
862
- * &lt;div id="outer" class="JXG_wrap_private"&gt;
863
- * &lt;div id='jxgbox' class='jxgbox' style='width:300px; height:300px;'&gt;&lt;/div&gt;
864
- * &lt;/div&gt;
865
- * &lt;button onClick="JXG.toFullscreen('outer', 'jxgbox')"&gt;Fullscreen&lt;/button&gt;
866
- * &lt;script&gt;
867
- * var board = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-8, 8, 8,-8]});
868
- * var p = board.create('point', [0, 1]);
869
- * &lt;/script&gt;
870
- *
871
- * </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>
872
- * <button onClick="JXG.toFullscreen('JXGf9b973ea4_outer', 'JXGd9b973ea4-fd43-11e8-ab14-901b0e1b8723')">Fullscreen</button>
873
- * <script type="text/javascript">
874
- * (function() {
875
- * var board = JXG.JSXGraph.initBoard('JXGd9b973ea4-fd43-11e8-ab14-901b0e1b8723',
876
- * {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
877
- * var p = board.create('point', [0, 1]);
878
- * })();
879
- * </script><pre>
880
- *
881
- */
882
- toFullscreen: function (wrap_id, jsxgraph_id, scale) {
883
- var elem = document.getElementById(wrap_id),
884
- elem_inner = document.getElementById(jsxgraph_id),
885
-
886
- // height seems to be independent from zoom level on all browsers
887
- height = parseInt(elem_inner.style.height, 10),
888
- width = parseInt(elem_inner.style.width, 10),
889
-
890
- // Determine the maximum scale factor.
891
- r_w = window.screen.width / width,
892
- r_h = window.screen.height / height,
893
-
894
- // Determine the vertical shift to place the div in the center of the screen
895
- vshift = (window.screen.height - height) * 0.5;
896
-
897
- // Scaling factor: if not supplied, it's taken as large as possible
898
- scale = scale || Math.min(r_w, r_h);
899
-
900
- // Adapt vshift and scale for landscape on tablets
901
- if (window.matchMedia && window.matchMedia('(orientation:landscape)').matches &&
902
- window.screen.width < window.screen.height) {
903
- // Landscape on iOS: it returns 'landscape', but still width < height.
904
- r_w = window.screen.height / width;
905
- r_h = window.screen.width / height;
906
- scale = Math.min(r_w, r_h);
907
- vshift = (window.screen.width - height) * 0.5;
908
- }
909
- scale *= 0.85;
910
-
911
- // Do the shifting and scaling via CSS pseudo rules
912
- this.scaleJSXGraphDiv('#' + wrap_id, '#' + jsxgraph_id, scale, vshift);
913
-
914
- // Store the scaling data.
915
- // It is used in AbstractRenderer.updateText to restore the scaling matrix
916
- // which is removed by MathJax.
917
- // Further, the CSS margin has to be removed when in fullscreen mode,
918
- // and must be restored later.
919
- elem_inner._cssFullscreenStore = {
920
- isFullscreen: false,
921
- margin: elem_inner.style.margin,
922
- scale: scale,
923
- vshift: vshift
924
- };
925
-
926
- // Trigger the fullscreen mode
927
- elem.requestFullscreen = elem.requestFullscreen ||
928
- elem.webkitRequestFullscreen ||
929
- elem.mozRequestFullScreen ||
930
- elem.msRequestFullscreen;
931
-
932
- if (elem.requestFullscreen) {
933
- elem.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,
@@ -196,18 +196,29 @@ define([
196
196
  * @param {Boolean} [checkEmptyString=false] If set to true, it is also checked whether v is not equal to ''.
197
197
  * @returns {Boolean} True, if v is neither undefined nor null.
198
198
  */
199
- exists: (function (undef) {
200
- return function (v, checkEmptyString) {
201
- var result = !(v === undef || v === null);
202
-
203
- checkEmptyString = checkEmptyString || false;
204
-
205
- if (checkEmptyString) {
206
- return result && v !== '';
207
- }
208
- return result;
209
- };
210
- }()),
199
+ exists: function (v, checkEmptyString) {
200
+ /* eslint-disable eqeqeq */
201
+ var result = !(v == undefined || v === null);
202
+ /* eslint-enable eqeqeq */
203
+ checkEmptyString = checkEmptyString || false;
204
+
205
+ if (checkEmptyString) {
206
+ return result && v !== '';
207
+ }
208
+ return result;
209
+ },
210
+ // exists: (function (undef) {
211
+ // return function (v, checkEmptyString) {
212
+ // var result = !(v === undef || v === null);
213
+
214
+ // checkEmptyString = checkEmptyString || false;
215
+
216
+ // if (checkEmptyString) {
217
+ // return result && v !== '';
218
+ // }
219
+ // return result;
220
+ // };
221
+ // }()),
211
222
 
212
223
  /**
213
224
  * Checks if v is an empty object or empty.
@@ -703,12 +714,12 @@ define([
703
714
  * is returned by JavaScript's toFixed()
704
715
  *
705
716
  * @memberOf JXG
706
- * @param {Number} num Number tp be rounded
707
- * @param {Number} precision Decimal digits
708
- * @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
709
720
  */
710
- toFixed: function (num, precision) {
711
- return this._round10(num, -precision).toFixed(precision);
721
+ toFixed: function (num, digits) {
722
+ return this._round10(num, -digits).toFixed(digits);
712
723
  },
713
724
 
714
725
  /**
@@ -1155,7 +1166,7 @@ define([
1155
1166
  * @returns {String}
1156
1167
  */
1157
1168
  unescapeHTML: function (str) {
1158
- // this regex is NOT insecure. We are replacing everything found with ''
1169
+ // This regex is NOT insecure. We are replacing everything found with ''
1159
1170
  /*jslint regexp:true*/
1160
1171
  return str.replace(/<\/?[^>]+>/gi, '').replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>');
1161
1172
  },
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,