jsxgraph 1.4.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.
- package/README.md +1 -1
- package/distrib/README.md +1 -1
- package/distrib/geogebra.min.js +3 -3
- package/distrib/geonext.min.js +3 -3
- package/distrib/index.d.ts +650 -447
- package/distrib/intergeo.min.js +3 -3
- package/distrib/jsxgraph.css +4 -13
- package/distrib/jsxgraphcore.js +9 -25
- package/distrib/jsxgraphsrc.js +2544 -2060
- package/distrib/sketch.min.js +3 -3
- package/package.json +3 -2
- package/src/base/board.js +99 -59
- package/src/base/chart.js +1 -1
- package/src/base/circle.js +1 -1
- package/src/base/composition.js +1 -1
- package/src/base/constants.js +14 -14
- package/src/base/coords.js +3 -3
- package/src/base/coordselement.js +4 -4
- package/src/base/curve.js +1 -1
- package/src/base/element.js +13 -14
- package/src/base/foreignobject.js +5 -1
- package/src/base/group.js +1 -1
- package/src/base/image.js +1 -1
- package/src/base/line.js +1 -1
- package/src/base/point.js +7 -18
- package/src/base/polygon.js +1 -1
- package/src/base/text.js +8 -7
- package/src/base/ticks.js +9 -2
- package/src/base/transformation.js +1 -1
- package/src/base/turtle.js +1 -1
- package/src/element/arc.js +1 -1
- package/src/element/button.js +1 -1
- package/src/element/checkbox.js +1 -1
- package/src/element/comb.js +1 -1
- package/src/element/composition.js +1 -1
- package/src/element/conic.js +3 -3
- package/src/element/input.js +1 -1
- package/src/element/locus.js +1 -1
- package/src/element/measure.js +9 -4
- package/src/element/sector.js +5 -5
- package/src/element/slider.js +17 -12
- package/src/element/slopetriangle.js +1 -1
- package/src/jsxgraph.js +9 -3
- package/src/jxg.js +3 -3
- package/src/loadjsxgraph.js +1 -1
- package/src/math/bst.js +1 -1
- package/src/math/clip.js +550 -345
- package/src/math/complex.js +1 -1
- package/src/math/extrapolate.js +1 -1
- package/src/math/geometry.js +5 -5
- package/src/math/ia.js +69 -69
- package/src/math/math.js +1 -1
- package/src/math/metapost.js +1 -1
- package/src/math/nlp.js +4 -4
- package/src/math/numerics.js +2 -1
- package/src/math/plot.js +4 -4
- package/src/math/poly.js +1 -1
- package/src/math/probfuncs.js +2 -1
- package/src/math/qdt.js +11 -11
- package/src/math/statistics.js +10 -10
- package/src/math/symbolic.js +1 -1
- package/src/options.js +72 -31
- package/src/parser/ca.js +1297 -1291
- package/src/parser/datasource.js +1 -1
- package/src/parser/geonext.js +6 -6
- package/src/parser/jessiecode.js +266 -73
- package/src/parser/jessiescript.js +1 -1
- package/src/reader/cinderella.js +1 -1
- package/src/reader/file.js +1 -1
- package/src/reader/geogebra.js +1 -1
- package/src/reader/geonext.js +1 -1
- package/src/reader/graph.js +1 -1
- package/src/reader/intergeo.js +1 -1
- package/src/reader/sketch.js +1 -1
- package/src/renderer/abstract.js +4 -1
- package/src/renderer/canvas.js +9 -5
- package/src/renderer/no.js +2 -1
- package/src/renderer/svg.js +10 -13
- package/src/renderer/vml.js +1 -1
- package/src/server/server.js +1 -1
- package/src/utils/base64.js +2 -2
- package/src/utils/color.js +7 -7
- package/src/utils/dump.js +20 -5
- package/src/utils/env.js +13 -54
- package/src/utils/event.js +1 -1
- package/src/utils/expect.js +1 -1
- package/src/utils/type.js +10 -8
- package/src/utils/xml.js +1 -1
- package/src/utils/zip.js +1 -1
- package/CHANGELOG.md +0 -1366
package/src/base/point.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2008-
|
|
2
|
+
Copyright 2008-2022
|
|
3
3
|
Matthias Ehmann,
|
|
4
4
|
Michael Gerhaeuser,
|
|
5
5
|
Carsten Miller,
|
|
@@ -156,7 +156,7 @@ define([
|
|
|
156
156
|
* @returns {JXG.CoordsElement} Reference to this object.
|
|
157
157
|
*/
|
|
158
158
|
updateTransform: function (fromParent) {
|
|
159
|
-
var c, i
|
|
159
|
+
var c, i;
|
|
160
160
|
|
|
161
161
|
if (this.transformations.length === 0 || this.baseElement === null) {
|
|
162
162
|
return this;
|
|
@@ -167,17 +167,6 @@ define([
|
|
|
167
167
|
c = this.transformations[0].apply(this.baseElement, 'self');
|
|
168
168
|
this.coords.setCoordinates(Const.COORDS_BY_USER, c);
|
|
169
169
|
} else {
|
|
170
|
-
// Case of board.create('point',[baseElement, transform]);
|
|
171
|
-
// if (!fromParent) {
|
|
172
|
-
// // The element has been dragged or it is the initial update,
|
|
173
|
-
// // now we transform the baseElement
|
|
174
|
-
// if (this.draggable() && this.baseElement.draggable()) {
|
|
175
|
-
// this.transformations[0].update();
|
|
176
|
-
// invMat = Mat.inverse(this.transformations[0].matrix);
|
|
177
|
-
// c = Mat.matVecMult(invMat, this.coords.usrCoords);
|
|
178
|
-
// this.baseElement.coords.setCoordinates(Const.COORDS_BY_USER, c);
|
|
179
|
-
// }
|
|
180
|
-
// }
|
|
181
170
|
c = this.transformations[0].apply(this.baseElement);
|
|
182
171
|
}
|
|
183
172
|
this.coords.setCoordinates(Const.COORDS_BY_USER, c);
|
|
@@ -352,12 +341,12 @@ define([
|
|
|
352
341
|
* var pol = board.create('polygon', [[2,2], [4,2], [4,3]], {strokeColor: 'blue'});
|
|
353
342
|
*
|
|
354
343
|
* var point = board.create('point', [-1, 1], {
|
|
355
|
-
*
|
|
344
|
+
* attractors: [line, seg, circ, po, curve, pol],
|
|
356
345
|
* attractorDistance: 0.2
|
|
357
346
|
* });
|
|
358
347
|
*
|
|
359
348
|
* var txt = board.create('text', [-4, 3, function() {
|
|
360
|
-
*
|
|
349
|
+
* return 'point on line: ' + point.isOn(line) + '<br>' +
|
|
361
350
|
* 'point on seg: ' + point.isOn(seg) + '<br>' +
|
|
362
351
|
* 'point on circ = ' + point.isOn(circ) + '<br>' +
|
|
363
352
|
* 'point on point = ' + point.isOn(po) + '<br>' +
|
|
@@ -380,14 +369,14 @@ define([
|
|
|
380
369
|
} else if (el.elementClass === Const.OBJECT_CLASS_LINE) {
|
|
381
370
|
if (el.elType === 'segment' && !Type.evaluate(this.visProp.alwaysintersect)) {
|
|
382
371
|
arr = JXG.Math.Geometry.projectCoordsToSegment(
|
|
383
|
-
|
|
372
|
+
this.coords.usrCoords,
|
|
384
373
|
el.point1.coords.usrCoords,
|
|
385
374
|
el.point2.coords.usrCoords);
|
|
386
375
|
if (arr[1] >= 0 && arr[1] <= 1 &&
|
|
387
376
|
Geometry.distPointLine(this.coords.usrCoords, el.stdform) < tol) {
|
|
388
|
-
|
|
377
|
+
return true;
|
|
389
378
|
} else {
|
|
390
|
-
|
|
379
|
+
return false;
|
|
391
380
|
}
|
|
392
381
|
} else {
|
|
393
382
|
return Geometry.distPointLine(this.coords.usrCoords, el.stdform) < tol;
|
package/src/base/polygon.js
CHANGED
package/src/base/text.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2008-
|
|
2
|
+
Copyright 2008-2022
|
|
3
3
|
Matthias Ehmann,
|
|
4
4
|
Michael Gerhaeuser,
|
|
5
5
|
Carsten Miller,
|
|
@@ -308,7 +308,7 @@ define([
|
|
|
308
308
|
* @return {[type]} [description]
|
|
309
309
|
*/
|
|
310
310
|
updateSize: function () {
|
|
311
|
-
var tmp,
|
|
311
|
+
var tmp, that, node,
|
|
312
312
|
ev_d = Type.evaluate(this.visProp.display);
|
|
313
313
|
|
|
314
314
|
if (!Env.isBrowser || this.board.renderer.type === 'no') {
|
|
@@ -576,7 +576,7 @@ define([
|
|
|
576
576
|
* @returns {string} expanded String
|
|
577
577
|
*/
|
|
578
578
|
expandShortMath: function (expr) {
|
|
579
|
-
var re = /([
|
|
579
|
+
var re = /([)0-9.])\s*([(a-zA-Z_])/g;
|
|
580
580
|
return expr.replace(re, '$1*$2');
|
|
581
581
|
},
|
|
582
582
|
|
|
@@ -746,7 +746,7 @@ define([
|
|
|
746
746
|
content = content.replace(/<\/value>/g, '</value>');
|
|
747
747
|
|
|
748
748
|
do {
|
|
749
|
-
search = /<value>([\w\s
|
|
749
|
+
search = /<value>([\w\s*/^\-+()[\],<>=!]+)<\/value>/;
|
|
750
750
|
res = search.exec(content);
|
|
751
751
|
|
|
752
752
|
if (res !== null) {
|
|
@@ -874,7 +874,8 @@ define([
|
|
|
874
874
|
*/
|
|
875
875
|
setAutoPosition: function () {
|
|
876
876
|
var x, y, cx, cy,
|
|
877
|
-
anchorCoords,
|
|
877
|
+
anchorCoords,
|
|
878
|
+
// anchorX, anchorY,
|
|
878
879
|
w = this.size[0],
|
|
879
880
|
h = this.size[1],
|
|
880
881
|
start_angle, angle,
|
|
@@ -896,8 +897,8 @@ define([
|
|
|
896
897
|
return this;
|
|
897
898
|
}
|
|
898
899
|
|
|
899
|
-
anchorX = Type.evaluate(this.visProp.anchorx);
|
|
900
|
-
anchorY = Type.evaluate(this.visProp.anchory);
|
|
900
|
+
// anchorX = Type.evaluate(this.visProp.anchorx);
|
|
901
|
+
// anchorY = Type.evaluate(this.visProp.anchory);
|
|
901
902
|
offset = Type.evaluate(this.visProp.offset);
|
|
902
903
|
anchorCoords = this.element.getLabelAnchor();
|
|
903
904
|
cx = anchorCoords.scrCoords[1];
|
package/src/base/ticks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2008-
|
|
2
|
+
Copyright 2008-2022
|
|
3
3
|
Matthias Ehmann,
|
|
4
4
|
Michael Gerhaeuser,
|
|
5
5
|
Carsten Miller,
|
|
@@ -1017,13 +1017,20 @@ define([
|
|
|
1017
1017
|
*/
|
|
1018
1018
|
formatLabelText: function(value) {
|
|
1019
1019
|
var labelText = value.toString(),
|
|
1020
|
+
digits,
|
|
1020
1021
|
ev_s = Type.evaluate(this.visProp.scalesymbol);
|
|
1021
1022
|
|
|
1022
1023
|
// if value is Number
|
|
1023
1024
|
if (Type.isNumber(value)) {
|
|
1024
1025
|
if (labelText.length > Type.evaluate(this.visProp.maxlabellength) ||
|
|
1025
1026
|
labelText.indexOf('e') !== -1) {
|
|
1026
|
-
|
|
1027
|
+
|
|
1028
|
+
digits = Type.evaluate(this.visProp.digits);
|
|
1029
|
+
if (Type.evaluate(this.visProp.precision) !== 3 && digits === 3) {
|
|
1030
|
+
// Use the deprecated attribute "precision"
|
|
1031
|
+
digits = Type.evaluate(this.visProp.precision);
|
|
1032
|
+
}
|
|
1033
|
+
labelText = value.toPrecision(digits).toString();
|
|
1027
1034
|
}
|
|
1028
1035
|
|
|
1029
1036
|
if (Type.evaluate(this.visProp.beautifulscientificticklabels)) {
|
package/src/base/turtle.js
CHANGED
package/src/element/arc.js
CHANGED
package/src/element/button.js
CHANGED
package/src/element/checkbox.js
CHANGED
package/src/element/comb.js
CHANGED
package/src/element/conic.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2008-
|
|
2
|
+
Copyright 2008-2022
|
|
3
3
|
Matthias Ehmann,
|
|
4
4
|
Michael Gerhaeuser,
|
|
5
5
|
Carsten Miller,
|
|
@@ -545,7 +545,7 @@ define([
|
|
|
545
545
|
*
|
|
546
546
|
*/
|
|
547
547
|
JXG.createParabola = function (board, parents, attributes) {
|
|
548
|
-
var polarForm, curve, M,
|
|
548
|
+
var polarForm, curve, M,
|
|
549
549
|
// focus
|
|
550
550
|
F1 = parents[0],
|
|
551
551
|
// directrix
|
|
@@ -574,7 +574,7 @@ define([
|
|
|
574
574
|
}
|
|
575
575
|
|
|
576
576
|
// Create line if given as array of two points.
|
|
577
|
-
if (Type.isArray(l) && l.length
|
|
577
|
+
if (Type.isArray(l) && l.length === 2) {
|
|
578
578
|
attr_line = Type.copyAttributes(attributes, board.options, 'conic', 'line');
|
|
579
579
|
l = board.create('line', l, attr_line);
|
|
580
580
|
}
|
package/src/element/input.js
CHANGED
package/src/element/locus.js
CHANGED
package/src/element/measure.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2008-
|
|
2
|
+
Copyright 2008-2022
|
|
3
3
|
Matthias Ehmann,
|
|
4
4
|
Michael Gerhaeuser,
|
|
5
5
|
Carsten Miller,
|
|
@@ -85,7 +85,7 @@ define([
|
|
|
85
85
|
*/
|
|
86
86
|
JXG.createTapemeasure = function (board, parents, attributes) {
|
|
87
87
|
var pos0, pos1,
|
|
88
|
-
attr, withTicks, withText,
|
|
88
|
+
attr, withTicks, withText, digits,
|
|
89
89
|
li, p1, p2, n, ti;
|
|
90
90
|
|
|
91
91
|
pos0 = parents[0];
|
|
@@ -106,7 +106,12 @@ define([
|
|
|
106
106
|
attr = Type.copyAttributes(attributes, board.options, 'tapemeasure');
|
|
107
107
|
withTicks = attr.withticks;
|
|
108
108
|
withText = attr.withlabel;
|
|
109
|
-
|
|
109
|
+
digits = attr.digits;
|
|
110
|
+
|
|
111
|
+
if (digits === 2 && attr.precision !== 2) {
|
|
112
|
+
// Backward compatibility
|
|
113
|
+
digits = attr.precision;
|
|
114
|
+
}
|
|
110
115
|
|
|
111
116
|
// Below, we will replace the label by the measurement function.
|
|
112
117
|
if (withText) {
|
|
@@ -122,7 +127,7 @@ define([
|
|
|
122
127
|
n = '';
|
|
123
128
|
}
|
|
124
129
|
li.label.setText(function () {
|
|
125
|
-
return n + Type.toFixed(p1.Dist(p2),
|
|
130
|
+
return n + Type.toFixed(p1.Dist(p2), digits);
|
|
126
131
|
});
|
|
127
132
|
}
|
|
128
133
|
|
package/src/element/sector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2008-
|
|
2
|
+
Copyright 2008-2022
|
|
3
3
|
Matthias Ehmann,
|
|
4
4
|
Michael Gerhaeuser,
|
|
5
5
|
Carsten Miller,
|
|
@@ -199,7 +199,7 @@ define([
|
|
|
199
199
|
|
|
200
200
|
if (type === '2lines') {
|
|
201
201
|
/**
|
|
202
|
-
* @ignore
|
|
202
|
+
* @ignore
|
|
203
203
|
*/
|
|
204
204
|
el.Radius = function () {
|
|
205
205
|
var r = Type.evaluate(parents[4]);
|
|
@@ -583,7 +583,7 @@ define([
|
|
|
583
583
|
*/
|
|
584
584
|
el.setRadius = function (val) {
|
|
585
585
|
/**
|
|
586
|
-
* @ignore
|
|
586
|
+
* @ignore
|
|
587
587
|
*/
|
|
588
588
|
el.Radius = function () {
|
|
589
589
|
var r = Type.evaluate(val);
|
|
@@ -972,7 +972,7 @@ define([
|
|
|
972
972
|
el.pointsquare = el.point3 = el.anglepoint = points[2];
|
|
973
973
|
|
|
974
974
|
/**
|
|
975
|
-
* @ignore
|
|
975
|
+
* @ignore
|
|
976
976
|
*/
|
|
977
977
|
el.Radius = function () {
|
|
978
978
|
// Set the angle radius, also @see @link Sector#autoRadius
|
|
@@ -1164,7 +1164,7 @@ define([
|
|
|
1164
1164
|
*/
|
|
1165
1165
|
el.free = function () {
|
|
1166
1166
|
var p = this.anglepoint;
|
|
1167
|
-
|
|
1167
|
+
|
|
1168
1168
|
if (p.transformations.length > 0) {
|
|
1169
1169
|
p.transformations.pop();
|
|
1170
1170
|
p.isDraggable = true;
|
package/src/element/slider.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2008-
|
|
2
|
+
Copyright 2008-2022
|
|
3
3
|
Matthias Ehmann,
|
|
4
4
|
Michael Gerhaeuser,
|
|
5
5
|
Carsten Miller,
|
|
@@ -143,7 +143,7 @@ define([
|
|
|
143
143
|
* @example
|
|
144
144
|
* // Set colors
|
|
145
145
|
* var sl = board.create('slider', [[-3, 1], [1, 1], [-10, 1, 10]], {
|
|
146
|
-
*
|
|
146
|
+
*
|
|
147
147
|
* baseline: { strokeColor: 'blue'},
|
|
148
148
|
* highline: { strokeColor: 'red'},
|
|
149
149
|
* fillColor: 'yellow',
|
|
@@ -151,16 +151,16 @@ define([
|
|
|
151
151
|
* name: 'xyz', // Not shown, if suffixLabel is set
|
|
152
152
|
* suffixLabel: 'x = ',
|
|
153
153
|
* postLabel: ' u'
|
|
154
|
-
*
|
|
154
|
+
*
|
|
155
155
|
* });
|
|
156
|
-
*
|
|
156
|
+
*
|
|
157
157
|
* </pre><div id="JXGd96c9e2c-2c25-4131-b6cf-9dbb80819401" class="jxgbox" style="width: 300px; height: 300px;"></div>
|
|
158
158
|
* <script type="text/javascript">
|
|
159
159
|
* (function() {
|
|
160
160
|
* var board = JXG.JSXGraph.initBoard('JXGd96c9e2c-2c25-4131-b6cf-9dbb80819401',
|
|
161
161
|
* {boundingbox: [-8, 8, 8,-8], axis: true, showcopyright: false, shownavigation: false});
|
|
162
162
|
* var sl = board.create('slider', [[-3, 1], [1, 1], [-10, 1, 10]], {
|
|
163
|
-
*
|
|
163
|
+
*
|
|
164
164
|
* baseline: { strokeColor: 'blue'},
|
|
165
165
|
* highline: { strokeColor: 'red'},
|
|
166
166
|
* fillColor: 'yellow',
|
|
@@ -168,24 +168,23 @@ define([
|
|
|
168
168
|
* name: 'xyz', // Not shown, if suffixLabel is set
|
|
169
169
|
* suffixLabel: 'x = ',
|
|
170
170
|
* postLabel: ' u'
|
|
171
|
-
*
|
|
171
|
+
*
|
|
172
172
|
* });
|
|
173
|
-
*
|
|
173
|
+
*
|
|
174
174
|
* })();
|
|
175
|
-
*
|
|
175
|
+
*
|
|
176
176
|
* </script><pre>
|
|
177
|
-
*
|
|
177
|
+
*
|
|
178
178
|
*/
|
|
179
179
|
JXG.createSlider = function (board, parents, attributes) {
|
|
180
180
|
var pos0, pos1, smin, start, smax, sdiff,
|
|
181
181
|
p1, p2, l1, ticks, ti, startx, starty, p3, l2, t,
|
|
182
|
-
withText, withTicks, snapWidth, sw, s, attr,
|
|
182
|
+
withText, withTicks, snapWidth, sw, s, attr, digits;
|
|
183
183
|
|
|
184
184
|
attr = Type.copyAttributes(attributes, board.options, 'slider');
|
|
185
185
|
withTicks = attr.withticks;
|
|
186
186
|
withText = attr.withlabel;
|
|
187
187
|
snapWidth = attr.snapwidth;
|
|
188
|
-
precision = attr.precision;
|
|
189
188
|
|
|
190
189
|
// start point
|
|
191
190
|
attr = Type.copyAttributes(attributes, board.options, 'slider', 'point1');
|
|
@@ -324,10 +323,16 @@ define([
|
|
|
324
323
|
},
|
|
325
324
|
function () {
|
|
326
325
|
var n,
|
|
326
|
+
d = Type.evaluate(p3.visProp.digits),
|
|
327
327
|
sl = Type.evaluate(p3.visProp.suffixlabel),
|
|
328
328
|
ul = Type.evaluate(p3.visProp.unitlabel),
|
|
329
329
|
pl = Type.evaluate(p3.visProp.postlabel);
|
|
330
330
|
|
|
331
|
+
if (d === 2 && Type.evaluate(p3.visProp.precision) !== 2) {
|
|
332
|
+
// Backwards compatibility
|
|
333
|
+
d = Type.evaluate(p3.visProp.precision);
|
|
334
|
+
}
|
|
335
|
+
|
|
331
336
|
if (sl !== null) {
|
|
332
337
|
n = sl;
|
|
333
338
|
} else if (p3.name && p3.name !== '') {
|
|
@@ -336,7 +341,7 @@ define([
|
|
|
336
341
|
n = '';
|
|
337
342
|
}
|
|
338
343
|
|
|
339
|
-
n += Type.toFixed(p3.Value(),
|
|
344
|
+
n += Type.toFixed(p3.Value(), d);
|
|
340
345
|
|
|
341
346
|
if (ul !== null) {
|
|
342
347
|
n += ul;
|
package/src/jsxgraph.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2008-
|
|
2
|
+
Copyright 2008-2022
|
|
3
3
|
Matthias Ehmann,
|
|
4
4
|
Michael Gerhaeuser,
|
|
5
5
|
Carsten Miller,
|
|
@@ -304,6 +304,8 @@ define([
|
|
|
304
304
|
initBoard: function (box, attributes) {
|
|
305
305
|
var originX, originY, unitX, unitY,
|
|
306
306
|
renderer,
|
|
307
|
+
offX = 0,
|
|
308
|
+
offY = 0,
|
|
307
309
|
w, h, dimensions,
|
|
308
310
|
bbox, attr, axattr, axattr_x, axattr_y,
|
|
309
311
|
board;
|
|
@@ -339,15 +341,19 @@ define([
|
|
|
339
341
|
|
|
340
342
|
if (Math.abs(unitX) < Math.abs(unitY)) {
|
|
341
343
|
unitY = Math.abs(unitX) * unitY / Math.abs(unitY);
|
|
344
|
+
// Add the additional units in equal portions above and below
|
|
345
|
+
offY = (h / unitY - (bbox[1] - bbox[3])) * 0.5;
|
|
342
346
|
} else {
|
|
343
347
|
unitX = Math.abs(unitY) * unitX / Math.abs(unitX);
|
|
348
|
+
// Add the additional units in equal portions left and right
|
|
349
|
+
offX = (w / unitX - (bbox[2] - bbox[0])) * 0.5;
|
|
344
350
|
}
|
|
345
351
|
} else {
|
|
346
352
|
unitX = w / (bbox[2] - bbox[0]);
|
|
347
353
|
unitY = h / (bbox[1] - bbox[3]);
|
|
348
354
|
}
|
|
349
|
-
originX = -unitX * bbox[0];
|
|
350
|
-
originY = unitY * bbox[1];
|
|
355
|
+
originX = -unitX * (bbox[0] - offX);
|
|
356
|
+
originY = unitY * (bbox[1] + offY);
|
|
351
357
|
}
|
|
352
358
|
|
|
353
359
|
renderer = this.initRenderer(box, dimensions, attr.document, attr.renderer);
|
package/src/jxg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2008-
|
|
2
|
+
Copyright 2008-2022
|
|
3
3
|
Matthias Ehmann,
|
|
4
4
|
Michael Gerhaeuser,
|
|
5
5
|
Carsten Miller,
|
|
@@ -131,9 +131,9 @@ define([], function () {
|
|
|
131
131
|
onlyOwn = onlyOwn || false;
|
|
132
132
|
toUpper = toUpper || false;
|
|
133
133
|
|
|
134
|
-
//
|
|
134
|
+
// The purpose of this for...in loop is indeed to use hasOwnProperty only if the caller explicitly wishes so.
|
|
135
135
|
for (e in constants) {
|
|
136
|
-
if (!onlyOwn || (onlyOwn &&
|
|
136
|
+
if (!onlyOwn || (onlyOwn && constants.hasOwnProperty(e))) {
|
|
137
137
|
if (toUpper) {
|
|
138
138
|
e2 = e.toUpperCase();
|
|
139
139
|
} else {
|
package/src/loadjsxgraph.js
CHANGED
package/src/math/bst.js
CHANGED