jsxgraph 1.4.4 → 1.4.5

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.
package/src/options.js CHANGED
@@ -1411,14 +1411,33 @@ define([
1411
1411
  * <p>
1412
1412
  * In case the element is a polygon or line and it has the attribute "scalable:false",
1413
1413
  * moving the element with two fingers results in a rotation or translation.
1414
+ * <p>
1415
+ * If an element is set to be neither scalable nor rotatable, it can only be translated.
1414
1416
  *
1415
1417
  * @type Boolean
1416
1418
  * @default true
1417
1419
  * @name JXG.GeometryElement#scalable
1418
1420
  * @see JXG.Ticks#fixed
1421
+ * @see JXG.GeometryElement#rotatable
1419
1422
  */
1420
1423
  scalable: true,
1421
1424
 
1425
+ /**
1426
+ * Determines whether two-finger manipulation may rotate this object.
1427
+ * If set to false, the object can only be scaled and translated.
1428
+ * <p>
1429
+ * In case the element is a polygon or line and it has the attribute "rotatable:false",
1430
+ * moving the element with two fingers results in a rotation or translation.
1431
+ * <p>
1432
+ * If an element is set to be neither scalable nor rotatable, it can only be translated.
1433
+ *
1434
+ * @type Boolean
1435
+ * @default true
1436
+ * @name JXG.GeometryElement#rotatable
1437
+ * @see JXG.GeometryElement#scalable
1438
+ */
1439
+ rotatable: true,
1440
+
1422
1441
  /**
1423
1442
  * If the element is dragged it will be moved on mousedown or touchstart to the
1424
1443
  * top of its layer. Works only for SVG renderer and for simple elements
@@ -1490,6 +1509,7 @@ define([
1490
1509
 
1491
1510
  /**
1492
1511
  * Controls if an element can get the focus with the tab key.
1512
+ * tabindex corresponds to the HTML attribute of the same name.
1493
1513
  * See <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex">descriptiona at MDN</a>.
1494
1514
  * The additional value null completely disables focus of an element.
1495
1515
  * The value will be ignored if keyboard control of the board is not enabled or
@@ -1519,6 +1539,8 @@ define([
1519
1539
  /**
1520
1540
  * A function that expects two {@link JXG.Coords}, the first one representing the coordinates of the
1521
1541
  * tick that is to be labeled, the second one the coordinates of the center (the tick with position 0).
1542
+ * The tird parameter is a null, number or a string. In the latter two cases, this value is taken.
1543
+ * Returns a string.
1522
1544
  *
1523
1545
  * @type function
1524
1546
  * @name Ticks#generateLabelText
@@ -1529,7 +1551,7 @@ define([
1529
1551
  * A function that expects two {@link JXG.Coords}, the first one representing the coordinates of the
1530
1552
  * tick that is to be labeled, the second one the coordinates of the center (the tick with position 0).
1531
1553
  *
1532
- * @deprecated Use {@link JGX.Options@generateLabelValue}
1554
+ * @deprecated Use {@link JGX.Options@generateLabelText}
1533
1555
  * @type function
1534
1556
  * @name Ticks#generateLabelValue
1535
1557
  */
@@ -3505,7 +3527,6 @@ define([
3505
3527
  */
3506
3528
  lastArrow: false,
3507
3529
 
3508
-
3509
3530
  /**
3510
3531
  * This number (pixel value) controls where infinite lines end at the canvas border. If zero, the line
3511
3532
  * ends exactly at the border, if negative there is a margin to the inside, if positive the line
@@ -3682,7 +3703,6 @@ define([
3682
3703
  */
3683
3704
  lineCap: 'butt'
3684
3705
 
3685
-
3686
3706
  /**#@-*/
3687
3707
  },
3688
3708
 
@@ -5623,8 +5643,10 @@ define([
5623
5643
  display: 'html',
5624
5644
 
5625
5645
  /**
5626
- * Anchor element {@link Point}, {@link Text} or {@link Image} of the text. If it exists, the coordinates of the text are relative
5627
- * to this anchor element.
5646
+ * Anchor element {@link Point}, {@link Text} or {@link Image} of the text.
5647
+ * If it exists, the coordinates of the text are relative
5648
+ * to this anchor element. In this case, only numbers are possible coordinates,
5649
+ * functions are not supported.
5628
5650
  *
5629
5651
  * @name anchor
5630
5652
  * @memberOf Text.prototype
@@ -1585,7 +1585,7 @@ define([
1585
1585
  case 'node_str':
1586
1586
  //ret = node.value.replace(/\\'/, "'").replace(/\\"/, '"').replace(/\\\\/, '\\');
1587
1587
  /*jslint regexp:true*/
1588
- ret = node.value.replace(/\\(.)/, '$1');
1588
+ ret = node.value.replace(/\\(.)/g, '$1'); // Remove backslash, important in JessieCode tags
1589
1589
  /*jslint regexp:false*/
1590
1590
  break;
1591
1591
  }
package/src/utils/env.js CHANGED
@@ -840,14 +840,15 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
840
840
  * @param {String} inner_id id of the DOM element which is scaled and shifted
841
841
  * @param {Number} scale Scaling factor
842
842
  * @param {Number} vshift Vertical shift (in pixel)
843
+ * @param {Object} doc document object or shadow root
843
844
  *
844
845
  * @private
845
846
  * @see JXG.Board#toFullscreen
846
847
  * @see JXG.Board#fullscreenListener
847
848
  *
848
849
  */
849
- scaleJSXGraphDiv: function (wrap_id, inner_id, scale, vshift) {
850
- var len = document.styleSheets.length, style,
850
+ scaleJSXGraphDiv: function (wrap_id, inner_id, scale, vshift, doc) {
851
+ var len = doc.styleSheets.length, style,
851
852
 
852
853
  pseudo_keys = [':fullscreen', ':-webkit-full-screen', ':-moz-full-screen', ':-ms-fullscreen'],
853
854
  len_pseudo = pseudo_keys.length, i,
@@ -865,22 +866,21 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
865
866
  // WebKit hack :(
866
867
  style.appendChild(document.createTextNode(''));
867
868
  // Add the <style> element to the page
868
- document.body.appendChild(style);
869
- len = document.styleSheets.length;
869
+ doc.appendChild(style);
870
+ len = doc.styleSheets.length;
870
871
  }
871
872
 
872
873
  // Remove a previously installed CSS rule.
873
- if (document.styleSheets[len - 1].cssRules.length > 0 &&
874
- regex.test(document.styleSheets[len - 1].cssRules[0].cssText) &&
875
- document.styleSheets[len - 1].deleteRule) {
876
-
877
- document.styleSheets[len - 1].deleteRule(0);
874
+ if (doc.styleSheets[len - 1].cssRules.length > 0 &&
875
+ regex.test(doc.styleSheets[len - 1].cssRules[0].cssText) &&
876
+ doc.styleSheets[len - 1].deleteRule) {
877
+ doc.styleSheets[len - 1].deleteRule(0);
878
878
  }
879
879
 
880
880
  // Install a CSS rule to center the JSXGraph div at the first position of the list.
881
881
  for (i = 0; i < len_pseudo; i++) {
882
882
  try {
883
- document.styleSheets[len - 1].insertRule('#' + wrap_id + pseudo_keys[i] + ' #' + inner_id + rule_inner, 0);
883
+ doc.styleSheets[len - 1].insertRule('#' + wrap_id + pseudo_keys[i] + ' #' + inner_id + rule_inner, 0);
884
884
  break;
885
885
  } catch (err) {
886
886
  // console.log('JXG.scaleJSXGraphDiv: Could not add CSS rule "' + pseudo_keys[i] + '".');