jsxgraph 1.4.1 → 1.4.2

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.
@@ -42,7 +42,7 @@ define(['jxg'], function (JXG) {
42
42
 
43
43
  var major = 1,
44
44
  minor = 4,
45
- patch = 1,
45
+ patch = 2,
46
46
  add = '', //'dev'
47
47
  version = major + '.' + minor + '.' + patch + (add ? '-' + add : ''),
48
48
  constants;
@@ -111,6 +111,7 @@ define(['jxg'], function (JXG) {
111
111
  OBJECT_TYPE_BUTTON: 29,
112
112
  OBJECT_TYPE_TRANSFORMATION: 30,
113
113
  OBJECT_TYPE_FOREIGNOBJECT: 31,
114
+ OBJECT_TYPE_VIEW3D: 32,
114
115
 
115
116
  // IMPORTANT:
116
117
  // ----------
@@ -224,7 +224,7 @@ define([
224
224
 
225
225
  /**
226
226
  * Inherits contains the subelements, which may have an attribute
227
- * (in partuclar the attribute "visible") having value 'inherit'.
227
+ * (in particular the attribute "visible") having value 'inherit'.
228
228
  * @type Object
229
229
  */
230
230
  this.inherits = [];
package/src/base/point.js CHANGED
@@ -87,6 +87,7 @@ define([
87
87
  this.board.renderer.drawPoint(this);
88
88
  this.board.finalizeAdding(this);
89
89
 
90
+ this.createGradient();
90
91
  this.createLabel();
91
92
 
92
93
  };
package/src/base/ticks.js CHANGED
@@ -1016,12 +1016,13 @@ define([
1016
1016
  * @private
1017
1017
  */
1018
1018
  formatLabelText: function(value) {
1019
- var labelText = value.toString(),
1019
+ var labelText,
1020
1020
  digits,
1021
1021
  ev_s = Type.evaluate(this.visProp.scalesymbol);
1022
1022
 
1023
1023
  // if value is Number
1024
1024
  if (Type.isNumber(value)) {
1025
+ labelText = (Math.round(value * 1.e13) / 1.e13).toString();
1025
1026
  if (labelText.length > Type.evaluate(this.visProp.maxlabellength) ||
1026
1027
  labelText.indexOf('e') !== -1) {
1027
1028
 
@@ -1030,7 +1031,9 @@ define([
1030
1031
  // Use the deprecated attribute "precision"
1031
1032
  digits = Type.evaluate(this.visProp.precision);
1032
1033
  }
1033
- labelText = value.toPrecision(digits).toString();
1034
+
1035
+ //labelText = value.toPrecision(digits).toString();
1036
+ labelText = value.toExponential(digits).toString();
1034
1037
  }
1035
1038
 
1036
1039
  if (Type.evaluate(this.visProp.beautifulscientificticklabels)) {
@@ -1043,6 +1046,8 @@ define([
1043
1046
  // trim trailing .
1044
1047
  labelText = labelText.replace(/\.$/, '');
1045
1048
  }
1049
+ } else {
1050
+ labelText = value.toString();
1046
1051
  }
1047
1052
 
1048
1053
  if (ev_s.length > 0) {
package/src/options.js CHANGED
@@ -1488,7 +1488,20 @@ define([
1488
1488
  */
1489
1489
  isLabel: false,
1490
1490
 
1491
-
1491
+ /**
1492
+ * Controls if an element can get the focus with the tab key.
1493
+ * See <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex">descriptiona at MDN</a>.
1494
+ * The additional value null completely disables focus of an element.
1495
+ * The value will be ignored if keyboard control of the board is not enabled or
1496
+ * the element is fixed or not visible.
1497
+ *
1498
+ * @name JXG.GeometryElement#tabindex
1499
+ * @type Number
1500
+ * @default 0
1501
+ * @see JXG.Board#keyboard
1502
+ * @see JXG.GeometryElement#fixed
1503
+ * @see JXG.GeometryElement#visible
1504
+ */
1492
1505
  tabindex: 0
1493
1506
 
1494
1507
  // close the meta tag
@@ -4688,6 +4701,7 @@ define([
4688
4701
  visible: 'inherit',
4689
4702
  fixed: true,
4690
4703
  scalable: false,
4704
+ tabindex: null,
4691
4705
  name: '',
4692
4706
  strokeWidth: 1,
4693
4707
  strokeColor: '#000000',
@@ -4737,6 +4751,7 @@ define([
4737
4751
  strokeWidth: 3,
4738
4752
  visible: 'inherit',
4739
4753
  fixed: true,
4754
+ tabindex: null,
4740
4755
  name: '',
4741
4756
  strokeColor: '#000000',
4742
4757
  highlightStrokeColor: '#888888'
@@ -172,6 +172,12 @@ define([
172
172
  */
173
173
  this.builtIn = this.defineBuiltIn();
174
174
 
175
+ /**
176
+ * List of all possible operands in JessieCode (except of JSXGraph objects).
177
+ * @type Object
178
+ */
179
+ this.operands = this.getPossibleOperands();
180
+
175
181
  /**
176
182
  * The board which currently is used to create and look up elements.
177
183
  * @type JXG.Board
@@ -2464,6 +2470,103 @@ define([
2464
2470
  return builtIn;
2465
2471
  },
2466
2472
 
2473
+ /**
2474
+ * Returns information about the possible functions and constants.
2475
+ * @returns {Object}
2476
+ */
2477
+ getPossibleOperands: function () {
2478
+ var FORBIDDEN = ['E'],
2479
+ jessiecode = this.defineBuiltIn(),
2480
+ math = Math,
2481
+ jc, ma, merge,
2482
+ i, j, p, len, e,
2483
+ funcs, funcsJC, consts, operands,
2484
+ sort, pack;
2485
+
2486
+ sort = function (a, b) {
2487
+ return a.toLowerCase().localeCompare(b.toLowerCase());
2488
+ };
2489
+
2490
+ pack = function (name, origin) {
2491
+ var that = null;
2492
+
2493
+ if (origin === 'jc') that = jessiecode[name];
2494
+ else if (origin === 'Math') that = math[name];
2495
+ else return;
2496
+
2497
+ if (FORBIDDEN.includes(name)) {
2498
+ return;
2499
+ } else if (JXG.isFunction(that)) {
2500
+ return {
2501
+ name: name,
2502
+ type: 'function',
2503
+ numParams: that.length,
2504
+ origin: origin,
2505
+ };
2506
+ } else if (JXG.isNumber(that)) {
2507
+ return {
2508
+ name: name,
2509
+ type: 'constant',
2510
+ value: that,
2511
+ origin: origin,
2512
+ };
2513
+ } else if (that !== undefined) {
2514
+ console.error('undefined type', that);
2515
+ }
2516
+ };
2517
+
2518
+ jc = Object.getOwnPropertyNames(jessiecode).sort(sort);
2519
+ ma = Object.getOwnPropertyNames(math).sort(sort);
2520
+ merge = [];
2521
+ i = 0;
2522
+ j = 0;
2523
+
2524
+ while (i < jc.length || j < ma.length) {
2525
+ if (jc[i] === ma[j]) {
2526
+ p = pack(ma[j], 'Math');
2527
+ if (JXG.exists(p)) merge.push(p);
2528
+ i++;
2529
+ j++;
2530
+ } else if (!JXG.exists(ma[j]) || jc[i].toLowerCase().localeCompare(ma[j].toLowerCase()) < 0) {
2531
+ p = pack(jc[i], 'jc');
2532
+ if (JXG.exists(p)) merge.push(p);
2533
+ i++;
2534
+ } else {
2535
+ p = pack(ma[j], 'Math');
2536
+ if (JXG.exists(p)) merge.push(p);
2537
+ j++;
2538
+ }
2539
+ }
2540
+
2541
+ funcs = [];
2542
+ funcsJC = [];
2543
+ consts = [];
2544
+ operands = {};
2545
+ len = merge.length;
2546
+ for (i = 0; i < len; i++) {
2547
+ e = merge[i];
2548
+ switch (e.type) {
2549
+ case 'function':
2550
+ funcs.push(e.name);
2551
+ if (e.origin === 'jc')
2552
+ funcsJC.push(e.name);
2553
+ break;
2554
+ case 'constant':
2555
+ consts.push(e.name);
2556
+ break;
2557
+ }
2558
+ operands[e.name] = e;
2559
+ }
2560
+
2561
+ return {
2562
+ all: operands,
2563
+ list: merge,
2564
+ functions: funcs,
2565
+ functions_jessiecode: funcsJC,
2566
+ constants: consts,
2567
+ };
2568
+ },
2569
+
2467
2570
  /**
2468
2571
  * Output a debugging message. Uses debug console, if available. Otherwise an HTML element with the
2469
2572
  * id "debug" and an innerHTML property is used.
@@ -1376,10 +1376,10 @@ Copyright 2008-2022
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;
@@ -1584,8 +1584,11 @@ define([
1584
1584
 
1585
1585
  setTabindex: function(element) {
1586
1586
  var val;
1587
- if (Type.exists(element.rendNode)) {
1587
+ if (element.board.attr.keyboard.enabled && Type.exists(element.rendNode)) {
1588
1588
  val = Type.evaluate(element.visProp.tabindex);
1589
+ if (!element.visPropCalc.visible || Type.evaluate(element.visProp.fixed)) {
1590
+ val = null;
1591
+ }
1589
1592
  if (val !== element.visPropOld.tabindex) {
1590
1593
  element.rendNode.setAttribute('tabindex', val);
1591
1594
  element.visPropOld.tabindex = val;
@@ -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
  /**