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/README.md +24 -0
- package/distrib/README.md +24 -0
- package/distrib/geogebra.min.js +1 -1
- package/distrib/geonext.min.js +1 -1
- package/distrib/index.d.ts +27 -7
- package/distrib/intergeo.min.js +1 -1
- package/distrib/jsxgraphcore.js +3 -3
- package/distrib/jsxgraphsrc.js +464 -273
- package/distrib/sketch.min.js +1 -1
- package/package.json +1 -1
- package/src/3d/point3d.js +38 -0
- package/src/3d/view3d.js +1 -1
- package/src/base/board.js +134 -65
- package/src/base/constants.js +1 -1
- package/src/base/text.js +42 -13
- package/src/base/ticks.js +1 -1
- package/src/jsxgraph.js +2 -1
- package/src/math/nlp.js +205 -173
- package/src/options.js +27 -5
- package/src/parser/jessiecode.js +1 -1
- package/src/utils/env.js +10 -10
package/distrib/sketch.min.js
CHANGED
package/package.json
CHANGED
package/src/3d/point3d.js
CHANGED
|
@@ -193,6 +193,44 @@ define(['jxg', 'base/constants', 'math/math', 'math/geometry', 'utils/type', '3d
|
|
|
193
193
|
return this;
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
+
el.normalizeCoords3D = function () {
|
|
197
|
+
if (Math.abs(el.D3.coords[0]) > Mat.eps) {
|
|
198
|
+
el.D3.coords[1] /= el.D3.coords[0];
|
|
199
|
+
el.D3.coords[2] /= el.D3.coords[0];
|
|
200
|
+
el.D3.coords[3] /= el.D3.coords[0];
|
|
201
|
+
el.D3.coords[0] = 1.0;
|
|
202
|
+
}
|
|
203
|
+
return this;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
el.setPosition3D = function (coords, noevent) {
|
|
207
|
+
var c = el.D3.coords,
|
|
208
|
+
oc = el.D3.coords.slice(); // Copy of original values
|
|
209
|
+
|
|
210
|
+
if (coords.length === 3) { // Euclidean coordinates
|
|
211
|
+
c[0] = 1.0;
|
|
212
|
+
c[1] = coords[0];
|
|
213
|
+
c[2] = coords[1];
|
|
214
|
+
c[3] = coords[2];
|
|
215
|
+
} else { // Homogeneous coordinates (normalized)
|
|
216
|
+
c[0] = coords[0];
|
|
217
|
+
c[1] = coords[1];
|
|
218
|
+
c[2] = coords[2];
|
|
219
|
+
el.normalizeCoords3D();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// console.log(el.emitter, !noevent, oc[0] !== c[0] || oc[1] !== c[1] || oc[2] !== c[2] || oc[3] !== c[3]);
|
|
223
|
+
// Not yet working
|
|
224
|
+
if (el.emitter && !noevent &&
|
|
225
|
+
(oc[0] !== c[0] || oc[1] !== c[1] || oc[2] !== c[2] || oc[3] !== c[3])) {
|
|
226
|
+
this.triggerEventHandlers(['update3D'], [oc]);
|
|
227
|
+
}
|
|
228
|
+
return this;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
// Not yet working
|
|
232
|
+
el.__evt__update3D = function (oc) { };
|
|
233
|
+
|
|
196
234
|
return el;
|
|
197
235
|
};
|
|
198
236
|
JXG.registerElement('point3d', ThreeD.createPoint);
|
package/src/3d/view3d.js
CHANGED
package/src/base/board.js
CHANGED
|
@@ -1196,7 +1196,8 @@ define([
|
|
|
1196
1196
|
*/
|
|
1197
1197
|
twoFingerTouchObject: function (tar, drag, id) {
|
|
1198
1198
|
var np, op, nd, od,
|
|
1199
|
-
d,
|
|
1199
|
+
d,
|
|
1200
|
+
alpha = 0,
|
|
1200
1201
|
S, t1, t3, t4, t5,
|
|
1201
1202
|
ar, i, len,
|
|
1202
1203
|
fixEl, moveEl, fix;
|
|
@@ -1230,7 +1231,9 @@ define([
|
|
|
1230
1231
|
return;
|
|
1231
1232
|
}
|
|
1232
1233
|
|
|
1233
|
-
|
|
1234
|
+
if (Type.evaluate(drag.visProp.rotatable)) {
|
|
1235
|
+
alpha = Geometry.rad(op.slice(1), fix.slice(1), np.slice(1));
|
|
1236
|
+
}
|
|
1234
1237
|
|
|
1235
1238
|
t1 = this.create('transform', [alpha, [fix[1], fix[2]]], {type: 'rotate'});
|
|
1236
1239
|
t1.update();
|
|
@@ -2401,7 +2404,8 @@ define([
|
|
|
2401
2404
|
* @returns {Boolean}
|
|
2402
2405
|
*/
|
|
2403
2406
|
pointerUpListener: function (evt) {
|
|
2404
|
-
var i, j, found, touchTargets
|
|
2407
|
+
var i, j, found, touchTargets,
|
|
2408
|
+
updateNeeded = false;
|
|
2405
2409
|
|
|
2406
2410
|
this.triggerEventHandlers(['touchend', 'up', 'pointerup', 'MSPointerUp'], [evt]);
|
|
2407
2411
|
this.displayInfobox(false);
|
|
@@ -2439,8 +2443,14 @@ define([
|
|
|
2439
2443
|
}
|
|
2440
2444
|
if (!found) {
|
|
2441
2445
|
this.downObjects[i].triggerEventHandlers(['touchend', 'up', 'pointerup', 'MSPointerUp'], [evt]);
|
|
2442
|
-
|
|
2443
|
-
|
|
2446
|
+
if (!Type.exists(this.downObjects[i].coords)) {
|
|
2447
|
+
// snapTo methods have to be called e.g. for line elements here.
|
|
2448
|
+
// For coordsElements there might be a conflict with
|
|
2449
|
+
// attractors, see commit from 2022.04.08, 11:12:18.
|
|
2450
|
+
this.downObjects[i].snapToGrid();
|
|
2451
|
+
this.downObjects[i].snapToPoints();
|
|
2452
|
+
updateNeeded = true;
|
|
2453
|
+
}
|
|
2444
2454
|
this.downObjects.splice(i, 1);
|
|
2445
2455
|
}
|
|
2446
2456
|
}
|
|
@@ -2461,7 +2471,9 @@ define([
|
|
|
2461
2471
|
// this.mode = this.BOARD_MODE_NONE;
|
|
2462
2472
|
|
|
2463
2473
|
// this.originMoveEnd();
|
|
2464
|
-
|
|
2474
|
+
if (updateNeeded) {
|
|
2475
|
+
this.update();
|
|
2476
|
+
}
|
|
2465
2477
|
|
|
2466
2478
|
// After one finger leaves the screen the gesture is stopped.
|
|
2467
2479
|
this._pointerClearTouches();
|
|
@@ -2796,7 +2808,8 @@ define([
|
|
|
2796
2808
|
eps = this.options.precision.touch,
|
|
2797
2809
|
tmpTouches = [], found, foundNumber,
|
|
2798
2810
|
evtTouches = evt && evt[JXG.touchProperty],
|
|
2799
|
-
touchTargets
|
|
2811
|
+
touchTargets,
|
|
2812
|
+
updateNeeded = false;
|
|
2800
2813
|
|
|
2801
2814
|
this.triggerEventHandlers(['touchend', 'up'], [evt]);
|
|
2802
2815
|
this.displayInfobox(false);
|
|
@@ -2897,8 +2910,14 @@ define([
|
|
|
2897
2910
|
}
|
|
2898
2911
|
if (!found) {
|
|
2899
2912
|
this.downObjects[i].triggerEventHandlers(['touchup', 'up'], [evt]);
|
|
2900
|
-
|
|
2901
|
-
|
|
2913
|
+
if (!Type.exists(this.downObjects[i].coords)) {
|
|
2914
|
+
// snapTo methods have to be called e.g. for line elements here.
|
|
2915
|
+
// For coordsElements there might be a conflict with
|
|
2916
|
+
// attractors, see commit from 2022.04.08, 11:12:18.
|
|
2917
|
+
this.downObjects[i].snapToGrid();
|
|
2918
|
+
this.downObjects[i].snapToPoints();
|
|
2919
|
+
updateNeeded = true;
|
|
2920
|
+
}
|
|
2902
2921
|
this.downObjects.splice(i, 1);
|
|
2903
2922
|
}
|
|
2904
2923
|
}
|
|
@@ -2914,7 +2933,9 @@ define([
|
|
|
2914
2933
|
this.updateQuality = this.BOARD_QUALITY_HIGH;
|
|
2915
2934
|
|
|
2916
2935
|
this.originMoveEnd();
|
|
2917
|
-
|
|
2936
|
+
if (updateNeeded) {
|
|
2937
|
+
this.update();
|
|
2938
|
+
}
|
|
2918
2939
|
}
|
|
2919
2940
|
|
|
2920
2941
|
return true;
|
|
@@ -3061,11 +3082,16 @@ define([
|
|
|
3061
3082
|
// redraw with high precision
|
|
3062
3083
|
this.updateQuality = this.BOARD_QUALITY_HIGH;
|
|
3063
3084
|
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3085
|
+
if (this.mouse && this.mouse.obj) {
|
|
3086
|
+
if (!Type.exists(this.mouse.obj.coords)) {
|
|
3087
|
+
// snapTo methods have to be called e.g. for line elements here.
|
|
3088
|
+
// For coordsElements there might be a conflict with
|
|
3089
|
+
// attractors, see commit from 2022.04.08, 11:12:18.
|
|
3090
|
+
// The parameter is needed for lines with snapToGrid enabled
|
|
3091
|
+
this.mouse.obj.snapToGrid(this.mouse.targets[0]);
|
|
3092
|
+
this.mouse.obj.snapToPoints();
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3069
3095
|
|
|
3070
3096
|
this.originMoveEnd();
|
|
3071
3097
|
this.dehighlightAll();
|
|
@@ -3121,11 +3147,18 @@ define([
|
|
|
3121
3147
|
},
|
|
3122
3148
|
|
|
3123
3149
|
/**
|
|
3124
|
-
* Allow moving of JSXGraph elements with arrow keys
|
|
3125
|
-
*
|
|
3150
|
+
* Allow moving of JSXGraph elements with arrow keys.
|
|
3151
|
+
* The selection of the element is done with the tab key. For this,
|
|
3152
|
+
* the attribute "tabindex" of the element has to be set to some number (default=0).
|
|
3153
|
+
* tabindex corresponds to the HTML attribute of the same name.
|
|
3154
|
+
* <p>
|
|
3126
3155
|
* Panning of the construction is done with arrow keys
|
|
3127
|
-
* if the pan key (shift or ctrl) is pressed.
|
|
3128
|
-
*
|
|
3156
|
+
* if the pan key (shift or ctrl - depending on the board attributes) is pressed.
|
|
3157
|
+
* <p>
|
|
3158
|
+
* Zooming is triggered with the keys +, o, -, if
|
|
3159
|
+
* the pan key (shift or ctrl - depending on the board attributes) is pressed.
|
|
3160
|
+
* <p>
|
|
3161
|
+
* Keyboard control (move, pan, and zoom) is disabled if an HTML element of type input or textarea has received focus.
|
|
3129
3162
|
*
|
|
3130
3163
|
* @param {Event} evt The browser's event object
|
|
3131
3164
|
*
|
|
@@ -3136,7 +3169,7 @@ define([
|
|
|
3136
3169
|
*/
|
|
3137
3170
|
keyDownListener: function (evt) {
|
|
3138
3171
|
var id_node = evt.target.id,
|
|
3139
|
-
id, el, res,
|
|
3172
|
+
id, el, res, doc,
|
|
3140
3173
|
sX = 0,
|
|
3141
3174
|
sY = 0,
|
|
3142
3175
|
// dx, dy are provided in screen units and
|
|
@@ -3151,6 +3184,15 @@ define([
|
|
|
3151
3184
|
return false;
|
|
3152
3185
|
}
|
|
3153
3186
|
|
|
3187
|
+
// An element of type input or textarea has foxus, get out of here.
|
|
3188
|
+
doc = this.containerObj.shadowRoot || document;
|
|
3189
|
+
if (doc.activeElement) {
|
|
3190
|
+
el = doc.activeElement;
|
|
3191
|
+
if (el.tagName === 'INPUT' || el.tagName === 'textarea') {
|
|
3192
|
+
return false;
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3154
3196
|
// Get the JSXGraph id from the id of the SVG node.
|
|
3155
3197
|
id = id_node.replace(this.containerObj.id + '_', '');
|
|
3156
3198
|
el = this.select(id);
|
|
@@ -3159,12 +3201,15 @@ define([
|
|
|
3159
3201
|
actPos = el.coords.usrCoords.slice(1);
|
|
3160
3202
|
}
|
|
3161
3203
|
|
|
3162
|
-
if (Type.evaluate(this.attr.keyboard.panshift) || Type.evaluate(this.attr.keyboard.panctrl)) {
|
|
3163
|
-
doZoom = true;
|
|
3164
|
-
}
|
|
3165
|
-
|
|
3166
3204
|
if ((Type.evaluate(this.attr.keyboard.panshift) && evt.shiftKey) ||
|
|
3167
3205
|
(Type.evaluate(this.attr.keyboard.panctrl) && evt.ctrlKey)) {
|
|
3206
|
+
// Pan key has been pressed
|
|
3207
|
+
|
|
3208
|
+
if (Type.evaluate(this.attr.zoom.enabled) === true) {
|
|
3209
|
+
doZoom = true;
|
|
3210
|
+
}
|
|
3211
|
+
|
|
3212
|
+
// Arrow keys
|
|
3168
3213
|
if (evt.keyCode === 38) { // up
|
|
3169
3214
|
this.clickUpArrow();
|
|
3170
3215
|
} else if (evt.keyCode === 40) { // down
|
|
@@ -3173,10 +3218,20 @@ define([
|
|
|
3173
3218
|
this.clickLeftArrow();
|
|
3174
3219
|
} else if (evt.keyCode === 39) { // right
|
|
3175
3220
|
this.clickRightArrow();
|
|
3221
|
+
|
|
3222
|
+
// Zoom keys
|
|
3223
|
+
} else if (doZoom && evt.keyCode === 171) { // +
|
|
3224
|
+
this.zoomIn();
|
|
3225
|
+
} else if (doZoom && evt.keyCode === 173) { // -
|
|
3226
|
+
this.zoomOut();
|
|
3227
|
+
} else if (doZoom && evt.keyCode === 79) { // o
|
|
3228
|
+
this.zoom100();
|
|
3229
|
+
|
|
3176
3230
|
} else {
|
|
3177
3231
|
done = false;
|
|
3178
3232
|
}
|
|
3179
3233
|
} else {
|
|
3234
|
+
|
|
3180
3235
|
// Adapt dx, dy to snapToGrid and attractToGrid
|
|
3181
3236
|
// snapToGrid has priority.
|
|
3182
3237
|
if (Type.exists(el.visProp)) {
|
|
@@ -3219,14 +3274,6 @@ define([
|
|
|
3219
3274
|
dir = [-dx, 0];
|
|
3220
3275
|
} else if (evt.keyCode === 39) { // right
|
|
3221
3276
|
dir = [dx, 0];
|
|
3222
|
-
// } else if (evt.keyCode === 9) { // tab
|
|
3223
|
-
|
|
3224
|
-
} else if (doZoom && evt.key === '+') { // +
|
|
3225
|
-
this.zoomIn();
|
|
3226
|
-
} else if (doZoom && evt.key === '-') { // -
|
|
3227
|
-
this.zoomOut();
|
|
3228
|
-
} else if (doZoom && evt.key === 'o') { // o
|
|
3229
|
-
this.zoom100();
|
|
3230
3277
|
} else {
|
|
3231
3278
|
done = false;
|
|
3232
3279
|
}
|
|
@@ -3259,12 +3306,13 @@ define([
|
|
|
3259
3306
|
if (done && Type.exists(evt.preventDefault)) {
|
|
3260
3307
|
evt.preventDefault();
|
|
3261
3308
|
}
|
|
3262
|
-
return
|
|
3309
|
+
return done;
|
|
3263
3310
|
},
|
|
3264
3311
|
|
|
3265
3312
|
/**
|
|
3266
3313
|
* Event listener for SVG elements getting focus.
|
|
3267
3314
|
* This is needed for highlighting when using keyboard control.
|
|
3315
|
+
* Only elements having the attribute "tabindex" can receive focus.
|
|
3268
3316
|
*
|
|
3269
3317
|
* @see JXG.Board#keyFocusOutListener
|
|
3270
3318
|
* @see JXG.Board#keyDownListener
|
|
@@ -3294,6 +3342,7 @@ define([
|
|
|
3294
3342
|
/**
|
|
3295
3343
|
* Event listener for SVG elements losing focus.
|
|
3296
3344
|
* This is needed for dehighlighting when using keyboard control.
|
|
3345
|
+
* Only elements having the attribute "tabindex" can receive focus.
|
|
3297
3346
|
*
|
|
3298
3347
|
* @see JXG.Board#keyFocusInListener
|
|
3299
3348
|
* @see JXG.Board#keyDownListener
|
|
@@ -3344,8 +3393,8 @@ define([
|
|
|
3344
3393
|
}
|
|
3345
3394
|
|
|
3346
3395
|
// If div is invisible - do nothing
|
|
3347
|
-
if (w <= 0 || h <= 0 ||
|
|
3348
|
-
|
|
3396
|
+
if (w <= 0 || h <= 0 || isNaN(w) || isNaN(h)) {
|
|
3397
|
+
return;
|
|
3349
3398
|
}
|
|
3350
3399
|
|
|
3351
3400
|
// If bounding box is not yet initialized, do it now.
|
|
@@ -5359,31 +5408,43 @@ define([
|
|
|
5359
5408
|
*/
|
|
5360
5409
|
updateCSSTransforms: function () {
|
|
5361
5410
|
var obj = this.containerObj,
|
|
5362
|
-
o = obj
|
|
5363
|
-
o2 = obj;
|
|
5411
|
+
o = obj;
|
|
5412
|
+
// o2 = obj;
|
|
5364
5413
|
|
|
5365
5414
|
this.cssTransMat = Env.getCSSTransformMatrix(o);
|
|
5366
5415
|
|
|
5416
|
+
// Newer variant of walking up the tree.
|
|
5417
|
+
// We walk up all parent nodes and collect possible CSS transforms.
|
|
5418
|
+
// Works also for ShadowDOM
|
|
5419
|
+
o = o.parentNode === o.getRootNode() ? o.parentNode.host : o.parentNode;
|
|
5420
|
+
while (o) {
|
|
5421
|
+
this.cssTransMat = Mat.matMatMult(Env.getCSSTransformMatrix(o), this.cssTransMat);
|
|
5422
|
+
o = o.parentNode === o.getRootNode() ? o.parentNode.host : o.parentNode;
|
|
5423
|
+
}
|
|
5424
|
+
this.cssTransMat = Mat.inverse(this.cssTransMat);
|
|
5425
|
+
|
|
5367
5426
|
/*
|
|
5368
5427
|
* In Mozilla and Webkit: offsetParent seems to jump at least to the next iframe,
|
|
5369
5428
|
* if not to the body. In IE and if we are in an position:absolute environment
|
|
5370
5429
|
* offsetParent walks up the DOM hierarchy.
|
|
5371
5430
|
* In order to walk up the DOM hierarchy also in Mozilla and Webkit
|
|
5372
5431
|
* we need the parentNode steps.
|
|
5432
|
+
*
|
|
5433
|
+
* Seems to be outdated
|
|
5373
5434
|
*/
|
|
5374
|
-
o = o.offsetParent;
|
|
5375
|
-
while (o) {
|
|
5376
|
-
|
|
5435
|
+
// o = o.offsetParent;
|
|
5436
|
+
// while (o) {
|
|
5437
|
+
// this.cssTransMat = Mat.matMatMult(Env.getCSSTransformMatrix(o), this.cssTransMat);
|
|
5377
5438
|
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5439
|
+
// o2 = o2.parentNode;
|
|
5440
|
+
// while (o2 !== o) {
|
|
5441
|
+
// this.cssTransMat = Mat.matMatMult(Env.getCSSTransformMatrix(o), this.cssTransMat);
|
|
5442
|
+
// o2 = o2.parentNode;
|
|
5443
|
+
// }
|
|
5383
5444
|
|
|
5384
|
-
|
|
5385
|
-
}
|
|
5386
|
-
this.cssTransMat = Mat.inverse(this.cssTransMat);
|
|
5445
|
+
// o = o.offsetParent;
|
|
5446
|
+
// }
|
|
5447
|
+
// this.cssTransMat = Mat.inverse(this.cssTransMat);
|
|
5387
5448
|
|
|
5388
5449
|
return this;
|
|
5389
5450
|
},
|
|
@@ -5944,16 +6005,17 @@ define([
|
|
|
5944
6005
|
*
|
|
5945
6006
|
*/
|
|
5946
6007
|
toFullscreen: function (id) {
|
|
5947
|
-
var wrap_id, wrap_node, inner_node
|
|
6008
|
+
var wrap_id, wrap_node, inner_node,
|
|
6009
|
+
doc = this.document;
|
|
5948
6010
|
|
|
5949
6011
|
id = id || this.container;
|
|
5950
6012
|
this._fullscreen_inner_id = id;
|
|
5951
|
-
inner_node =
|
|
6013
|
+
inner_node = doc.getElementById(id);
|
|
5952
6014
|
wrap_id = 'fullscreenwrap_' + id;
|
|
5953
6015
|
|
|
5954
6016
|
// Wrap a div around the JSXGraph div.
|
|
5955
|
-
if (
|
|
5956
|
-
wrap_node =
|
|
6017
|
+
if (doc.getElementById(wrap_id)) {
|
|
6018
|
+
wrap_node = doc.getElementById(wrap_id);
|
|
5957
6019
|
} else {
|
|
5958
6020
|
wrap_node = document.createElement('div');
|
|
5959
6021
|
wrap_node.classList.add('JXG_wrap_private');
|
|
@@ -5972,8 +6034,14 @@ define([
|
|
|
5972
6034
|
wrap_node.mozRequestFullScreen ||
|
|
5973
6035
|
wrap_node.msRequestFullscreen;
|
|
5974
6036
|
|
|
5975
|
-
if (
|
|
5976
|
-
|
|
6037
|
+
if (doc.fullscreenElement === null) {
|
|
6038
|
+
// Start fullscreen mode
|
|
6039
|
+
if (wrap_node.requestFullscreen) {
|
|
6040
|
+
wrap_node.requestFullscreen();
|
|
6041
|
+
}
|
|
6042
|
+
} else {
|
|
6043
|
+
// Leave fullscreen mode (e.g. when clicking on the icon)
|
|
6044
|
+
document.exitFullscreen();
|
|
5977
6045
|
}
|
|
5978
6046
|
|
|
5979
6047
|
return this;
|
|
@@ -5987,23 +6055,24 @@ define([
|
|
|
5987
6055
|
* @param {Object} evt fullscreen event object (unused)
|
|
5988
6056
|
*/
|
|
5989
6057
|
fullscreenListener: function (evt) {
|
|
5990
|
-
var res, inner_id, inner_node
|
|
6058
|
+
var res, inner_id, inner_node,
|
|
6059
|
+
doc = this.document;
|
|
5991
6060
|
|
|
5992
6061
|
inner_id = this._fullscreen_inner_id;
|
|
5993
6062
|
if (!Type.exists(inner_id)) {
|
|
5994
6063
|
return;
|
|
5995
6064
|
}
|
|
5996
6065
|
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6066
|
+
doc.fullscreenElement = doc.fullscreenElement ||
|
|
6067
|
+
doc.webkitFullscreenElement ||
|
|
6068
|
+
doc.mozFullscreenElement ||
|
|
6069
|
+
doc.msFullscreenElement;
|
|
6001
6070
|
|
|
6002
|
-
inner_node =
|
|
6071
|
+
inner_node = doc.getElementById(inner_id);
|
|
6003
6072
|
// If full screen mode is started we have to remove CSS margin around the JSXGraph div.
|
|
6004
6073
|
// Otherwise, the positioning of the fullscreen div will be false.
|
|
6005
6074
|
// When leaving the fullscreen mode, the margin is put back in.
|
|
6006
|
-
if (
|
|
6075
|
+
if (doc.fullscreenElement) {
|
|
6007
6076
|
// Just entered fullscreen mode
|
|
6008
6077
|
|
|
6009
6078
|
// Get the data computed in board.toFullscreen()
|
|
@@ -6015,7 +6084,7 @@ define([
|
|
|
6015
6084
|
// Further, the CSS margin has to be removed when in fullscreen mode,
|
|
6016
6085
|
// and must be restored later.
|
|
6017
6086
|
inner_node._cssFullscreenStore = {
|
|
6018
|
-
id:
|
|
6087
|
+
id: doc.fullscreenElement.id,
|
|
6019
6088
|
isFullscreen: true,
|
|
6020
6089
|
margin: inner_node.style.margin,
|
|
6021
6090
|
width: inner_node.style.width,
|
|
@@ -6029,18 +6098,18 @@ define([
|
|
|
6029
6098
|
// Do the shifting and scaling via CSS pseudo rules
|
|
6030
6099
|
// We do this after fullscreen mode has been established to get the correct size
|
|
6031
6100
|
// of the JSXGraph div.
|
|
6032
|
-
Env.scaleJSXGraphDiv(
|
|
6101
|
+
Env.scaleJSXGraphDiv(doc.fullscreenElement.id, inner_id, res.scale, res.vshift, doc);
|
|
6033
6102
|
|
|
6034
6103
|
// Clear this.document.fullscreenElement, because Safari doesn't to it and
|
|
6035
6104
|
// when leaving full screen mode it is still set.
|
|
6036
|
-
|
|
6105
|
+
doc.fullscreenElement = null;
|
|
6037
6106
|
|
|
6038
6107
|
} else if (Type.exists(inner_node._cssFullscreenStore)) {
|
|
6039
6108
|
// Just left the fullscreen mode
|
|
6040
6109
|
|
|
6041
6110
|
// Remove the CSS rules added in Env.scaleJSXGraphDiv
|
|
6042
6111
|
try {
|
|
6043
|
-
|
|
6112
|
+
doc.styleSheets[doc.styleSheets.length - 1].deleteRule(0);
|
|
6044
6113
|
} catch (err) {
|
|
6045
6114
|
console.log('JSXGraph: Could not remove CSS rules for full screen mode');
|
|
6046
6115
|
}
|
package/src/base/constants.js
CHANGED
package/src/base/text.js
CHANGED
|
@@ -200,6 +200,7 @@ define([
|
|
|
200
200
|
|
|
201
201
|
this.orgText = text;
|
|
202
202
|
if (Type.isFunction(text)) {
|
|
203
|
+
// <value> tags will not be evaluated.
|
|
203
204
|
this.updateText = function () {
|
|
204
205
|
resolvedText = text().toString();
|
|
205
206
|
if (ev_p && !ev_um && !ev_uk) {
|
|
@@ -220,14 +221,20 @@ define([
|
|
|
220
221
|
// Convert via ASCIIMathML
|
|
221
222
|
this.content = "'`" + text + "`'";
|
|
222
223
|
} else if (ev_um || ev_uk) {
|
|
223
|
-
|
|
224
|
+
if (ev_p) {
|
|
225
|
+
this.content = this.generateTerm(text, true, true, true); // Replace value-tags
|
|
226
|
+
this.content = this.content.replace(/\\/g, "\\\\");
|
|
227
|
+
} else {
|
|
228
|
+
this.content = "'" + text + "'";
|
|
229
|
+
}
|
|
224
230
|
} else {
|
|
225
231
|
// Converts GEONExT syntax into JavaScript string
|
|
226
232
|
// Short math is allowed
|
|
227
233
|
// Avoid geonext2JS calls
|
|
228
|
-
this.content = this.generateTerm(text, true, true);
|
|
234
|
+
this.content = this.generateTerm(text, true, true, false);
|
|
229
235
|
}
|
|
230
236
|
}
|
|
237
|
+
// Convert JessieCode to JS function
|
|
231
238
|
updateText = this.board.jc.snippet(this.content, true, '', false);
|
|
232
239
|
this.updateText = function () {
|
|
233
240
|
this.plaintext = updateText();
|
|
@@ -583,30 +590,43 @@ define([
|
|
|
583
590
|
/**
|
|
584
591
|
* Converts the GEONExT syntax of the <value> terms into JavaScript.
|
|
585
592
|
* Also, all Objects whose name appears in the term are searched and
|
|
586
|
-
* the text is added as child to these objects.
|
|
593
|
+
* the text is added as child to these objects.
|
|
594
|
+
* This method is called if the attribute parse==true is set.
|
|
587
595
|
*
|
|
588
596
|
* @param{String} contentStr String to be parsed
|
|
589
597
|
* @param{Boolean} [expand] Optional flag if shortened math syntax is allowed (e.g. 3x instead of 3*x).
|
|
590
598
|
* @param{Boolean} [avoidGeonext2JS] Optional flag if geonext2JS should be called. For backwards compatibility
|
|
591
599
|
* this has to be set explicitely to true.
|
|
600
|
+
* @param{Boolean} [outputTeX] Optional flag which has to be true if the resulting term will be sent to MathJax or KaTeX.
|
|
601
|
+
* If true, "_" and "^" are NOT replaced by HTML tags sub and sup. Default: false, i.e. the replacement is done.
|
|
602
|
+
* This flag allows the combination of <value> tag containing calculations with TeX output.
|
|
603
|
+
*
|
|
592
604
|
* @private
|
|
593
605
|
* @see JXG.GeonextParser.geonext2JS
|
|
594
606
|
*/
|
|
595
|
-
generateTerm: function (contentStr, expand, avoidGeonext2JS) {
|
|
607
|
+
generateTerm: function (contentStr, expand, avoidGeonext2JS, outputTeX) {
|
|
596
608
|
var res, term, i, j,
|
|
597
609
|
plaintext = '""';
|
|
598
610
|
|
|
599
|
-
|
|
611
|
+
outputTeX = outputTeX || false;
|
|
612
|
+
|
|
613
|
+
// Revert possible jc replacement
|
|
600
614
|
contentStr = contentStr || '';
|
|
601
615
|
contentStr = contentStr.replace(/\r/g, '');
|
|
602
616
|
contentStr = contentStr.replace(/\n/g, '');
|
|
603
617
|
contentStr = contentStr.replace(/"/g, '\'');
|
|
604
618
|
contentStr = contentStr.replace(/'/g, "\\'");
|
|
605
619
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
620
|
+
if (!outputTeX) {
|
|
621
|
+
// Old GEONExT syntax, not (yet) supported as TeX output.
|
|
622
|
+
// Otherwise, the else clause should be used.
|
|
623
|
+
// That means, i.e. the <arc> tag and <sqrt> tag are not
|
|
624
|
+
// converted into TeX syntax.
|
|
625
|
+
contentStr = contentStr.replace(/&arc;/g, '∠');
|
|
626
|
+
contentStr = contentStr.replace(/<arc\s*\/>/g, '∠');
|
|
627
|
+
contentStr = contentStr.replace(/<arc\s*\/>/g, '∠');
|
|
628
|
+
contentStr = contentStr.replace(/<sqrt\s*\/>/g, '√');
|
|
629
|
+
}
|
|
610
630
|
|
|
611
631
|
contentStr = contentStr.replace(/<value>/g, '<value>');
|
|
612
632
|
contentStr = contentStr.replace(/<\/value>/g, '</value>');
|
|
@@ -616,7 +636,12 @@ define([
|
|
|
616
636
|
j = contentStr.indexOf('</value>');
|
|
617
637
|
if (i >= 0) {
|
|
618
638
|
while (i >= 0) {
|
|
619
|
-
|
|
639
|
+
if (!outputTeX) {
|
|
640
|
+
plaintext += ' + "' + this.replaceSub(this.replaceSup(contentStr.slice(0, i))) + '"';
|
|
641
|
+
// plaintext += ' + "' + this.replaceSub(contentStr.slice(0, i)) + '"';
|
|
642
|
+
} else {
|
|
643
|
+
plaintext += ' + "' + contentStr.slice(0, i) + '"';
|
|
644
|
+
}
|
|
620
645
|
term = contentStr.slice(i + 7, j);
|
|
621
646
|
term = term.replace(/\s+/g, ''); // Remove all whitespace
|
|
622
647
|
if (expand === true) {
|
|
@@ -649,10 +674,14 @@ define([
|
|
|
649
674
|
}
|
|
650
675
|
}
|
|
651
676
|
|
|
652
|
-
|
|
653
|
-
|
|
677
|
+
if (!outputTeX) {
|
|
678
|
+
plaintext += ' + "' + this.replaceSub(this.replaceSup(contentStr)) + '"';
|
|
679
|
+
plaintext = this.convertGeonextAndSketchometry2CSS(plaintext);
|
|
680
|
+
} else {
|
|
681
|
+
plaintext += ' + "' + contentStr + '"';
|
|
682
|
+
}
|
|
654
683
|
|
|
655
|
-
// This should replace &pi; by π
|
|
684
|
+
// This should replace e.g. &pi; by π
|
|
656
685
|
plaintext = plaintext.replace(/&/g, '&');
|
|
657
686
|
plaintext = plaintext.replace(/"/g, "'");
|
|
658
687
|
|
package/src/base/ticks.js
CHANGED
|
@@ -1022,7 +1022,7 @@ define([
|
|
|
1022
1022
|
|
|
1023
1023
|
// if value is Number
|
|
1024
1024
|
if (Type.isNumber(value)) {
|
|
1025
|
-
labelText = (Math.round(value * 1.
|
|
1025
|
+
labelText = (Math.round(value * 1.e11) / 1.e11).toString();
|
|
1026
1026
|
if (labelText.length > Type.evaluate(this.visProp.maxlabellength) ||
|
|
1027
1027
|
labelText.indexOf('e') !== -1) {
|
|
1028
1028
|
|
package/src/jsxgraph.js
CHANGED
|
@@ -546,7 +546,8 @@ define([
|
|
|
546
546
|
}
|
|
547
547
|
};
|
|
548
548
|
|
|
549
|
-
// JessieScript/JessieCode startup:
|
|
549
|
+
// JessieScript/JessieCode startup:
|
|
550
|
+
// Search for script tags of type text/jessiescript and interprete them.
|
|
550
551
|
if (Env.isBrowser && typeof window === 'object' && typeof document === 'object') {
|
|
551
552
|
Env.addEvent(window, 'load', function () {
|
|
552
553
|
var type, i, j, div,
|