figureone 1.4.1 → 1.7.0
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/figureone.min.js +1 -1
- package/index.js +1205 -155
- package/package.json +1 -1
- package/types/js/figure/Element.d.ts +12 -3
- package/types/js/figure/Equation/Elements/BaseAnnotationFunction.d.ts +4 -1
- package/types/js/figure/Equation/Elements/BaseEquationFunction.d.ts +2 -1
- package/types/js/figure/Equation/Elements/DrawOrder.d.ts +6 -0
- package/types/js/figure/Equation/Elements/Element.d.ts +11 -3
- package/types/js/figure/Equation/Elements/Opacity.d.ts +6 -0
- package/types/js/figure/Equation/Equation.d.ts +58 -1
- package/types/js/figure/Equation/EquationForm.d.ts +5 -1
- package/types/js/figure/Equation/EquationFunctions.d.ts +300 -2
- package/types/js/figure/FigurePrimitives/FigureElementPrimitive2DText.d.ts +1 -1
- package/types/js/figure/FigurePrimitives/FigureElementPrimitiveGLText.d.ts +1 -1
package/index.js
CHANGED
|
@@ -11338,6 +11338,12 @@ var FigureElement = /*#__PURE__*/function () {
|
|
|
11338
11338
|
|
|
11339
11339
|
// TODO
|
|
11340
11340
|
|
|
11341
|
+
// `setColor` commands can be tagged with a `from` source label (e.g. an
|
|
11342
|
+
// equation tags its default-color cascade with 'form'). An element listed
|
|
11343
|
+
// against a source in `ignoreSetColor` will ignore commands from that source
|
|
11344
|
+
// while still honoring untagged (explicit) commands like `dim`/`undim` or a
|
|
11345
|
+
// direct `setColor`. Accepts a single source string or a list of them.
|
|
11346
|
+
|
|
11341
11347
|
// // TODO
|
|
11342
11348
|
// move: {
|
|
11343
11349
|
// line: Line,
|
|
@@ -11380,6 +11386,7 @@ var FigureElement = /*#__PURE__*/function () {
|
|
|
11380
11386
|
this.isFormIgnored = false;
|
|
11381
11387
|
this.simple = false;
|
|
11382
11388
|
this.allowSetColor = 'all';
|
|
11389
|
+
this.ignoreSetColor = [];
|
|
11383
11390
|
this.transform = transform._dup();
|
|
11384
11391
|
this.dependantTransform = false;
|
|
11385
11392
|
this.fnMap = new _tools_FunctionMap__WEBPACK_IMPORTED_MODULE_13__.FunctionMap();
|
|
@@ -12331,15 +12338,39 @@ var FigureElement = /*#__PURE__*/function () {
|
|
|
12331
12338
|
return false;
|
|
12332
12339
|
}
|
|
12333
12340
|
|
|
12341
|
+
/**
|
|
12342
|
+
* Returns `true` if a `setColor` command tagged with source `from` should be
|
|
12343
|
+
* ignored by this element (per `ignoreSetColor`). Untagged commands
|
|
12344
|
+
* (`from == null`) are never ignored.
|
|
12345
|
+
*/
|
|
12346
|
+
}, {
|
|
12347
|
+
key: "isSetColorIgnored",
|
|
12348
|
+
value: function isSetColorIgnored() {
|
|
12349
|
+
var from = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
12350
|
+
if (from == null) {
|
|
12351
|
+
return false;
|
|
12352
|
+
}
|
|
12353
|
+
if (typeof this.ignoreSetColor === 'string') {
|
|
12354
|
+
return this.ignoreSetColor === from;
|
|
12355
|
+
}
|
|
12356
|
+
return this.ignoreSetColor.indexOf(from) > -1;
|
|
12357
|
+
}
|
|
12358
|
+
|
|
12334
12359
|
/**
|
|
12335
12360
|
Set element color.
|
|
12336
12361
|
@param {[number, number, number, number]} color RGBA color from 0 to 1
|
|
12337
12362
|
@param {boolean} [setDefault] also set the default color to this color
|
|
12363
|
+
@param {string | null} [from] source label of this color command; if it
|
|
12364
|
+
matches `ignoreSetColor` the command is ignored
|
|
12338
12365
|
*/
|
|
12339
12366
|
}, {
|
|
12340
12367
|
key: "setColor",
|
|
12341
12368
|
value: function setColor(color) {
|
|
12342
12369
|
var setDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
12370
|
+
var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
12371
|
+
if (this.isSetColorIgnored(from)) {
|
|
12372
|
+
return;
|
|
12373
|
+
}
|
|
12343
12374
|
if (this.allowSetColor === 'all') {
|
|
12344
12375
|
this.color = color != null ? color.slice() : [0, 0, 0, 0];
|
|
12345
12376
|
} else if (this.allowSetColor === 'opacity') {
|
|
@@ -14577,6 +14608,10 @@ var FigureElementPrimitive = /*#__PURE__*/function (_FigureElement) {
|
|
|
14577
14608
|
key: "setColor",
|
|
14578
14609
|
value: function setColor(color) {
|
|
14579
14610
|
var setDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
14611
|
+
var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
14612
|
+
if (this.isSetColorIgnored(from)) {
|
|
14613
|
+
return;
|
|
14614
|
+
}
|
|
14580
14615
|
if (this.allowSetColor === 'all') {
|
|
14581
14616
|
this.color = color != null ? color.slice() : [0, 0, 0, 0];
|
|
14582
14617
|
} else if (this.allowSetColor === 'opacity') {
|
|
@@ -16307,11 +16342,15 @@ var FigureElementCollection = /*#__PURE__*/function (_FigureElement2) {
|
|
|
16307
16342
|
value: function setColor() {
|
|
16308
16343
|
var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [0, 0, 0, 1];
|
|
16309
16344
|
var setDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
16345
|
+
var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
16346
|
+
if (this.isSetColorIgnored(from)) {
|
|
16347
|
+
return;
|
|
16348
|
+
}
|
|
16310
16349
|
var nonNullColor = color != null ? color : [0, 0, 0, 0];
|
|
16311
16350
|
for (var i = 0; i < this.drawOrder.length; i += 1) {
|
|
16312
16351
|
var element = this.elements[this.drawOrder[i]];
|
|
16313
16352
|
if (!this.preserveChildColor) {
|
|
16314
|
-
element.setColor(nonNullColor, setDefault);
|
|
16353
|
+
element.setColor(nonNullColor, setDefault, from);
|
|
16315
16354
|
}
|
|
16316
16355
|
}
|
|
16317
16356
|
if (this.allowSetColor === 'all') {
|
|
@@ -17185,8 +17224,14 @@ function offsetLocationForAnnotations(annotations, offset) {
|
|
|
17185
17224
|
});
|
|
17186
17225
|
}
|
|
17187
17226
|
function setColorForAnnotations(annotations, color) {
|
|
17227
|
+
var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
17188
17228
|
annotations.forEach(function (annotation) {
|
|
17189
|
-
annotation.content.setColor(color);
|
|
17229
|
+
annotation.content.setColor(color, from);
|
|
17230
|
+
});
|
|
17231
|
+
}
|
|
17232
|
+
function setOpacityForAnnotations(annotations, opacity) {
|
|
17233
|
+
annotations.forEach(function (annotation) {
|
|
17234
|
+
annotation.content.setOpacity(opacity);
|
|
17190
17235
|
});
|
|
17191
17236
|
}
|
|
17192
17237
|
function setPositionsForGlyphs(glyphs) {
|
|
@@ -17203,15 +17248,28 @@ function setPositionsForGlyphs(glyphs) {
|
|
|
17203
17248
|
});
|
|
17204
17249
|
}
|
|
17205
17250
|
function setColorForGlyphs(glyphs, color) {
|
|
17251
|
+
var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
17206
17252
|
Object.keys(glyphs).forEach(function (key) {
|
|
17207
17253
|
if (glyphs[key] == null) {
|
|
17208
17254
|
return;
|
|
17209
17255
|
}
|
|
17210
17256
|
var glyph = glyphs[key];
|
|
17211
17257
|
if (color != null) {
|
|
17212
|
-
glyph.glyph.setColor(color);
|
|
17258
|
+
glyph.glyph.setColor(color, true, from);
|
|
17213
17259
|
}
|
|
17214
|
-
setColorForAnnotations(glyph.annotations, color);
|
|
17260
|
+
setColorForAnnotations(glyph.annotations, color, from);
|
|
17261
|
+
});
|
|
17262
|
+
}
|
|
17263
|
+
function setOpacityForGlyphs(glyphs, opacity) {
|
|
17264
|
+
Object.keys(glyphs).forEach(function (key) {
|
|
17265
|
+
if (glyphs[key] == null) {
|
|
17266
|
+
return;
|
|
17267
|
+
}
|
|
17268
|
+
var glyph = glyphs[key];
|
|
17269
|
+
if (opacity != null) {
|
|
17270
|
+
glyph.glyph.setOpacity(opacity);
|
|
17271
|
+
}
|
|
17272
|
+
setOpacityForAnnotations(glyph.annotations, opacity);
|
|
17215
17273
|
});
|
|
17216
17274
|
}
|
|
17217
17275
|
function offsetLocationForGlyphs(glyphs, offset) {
|
|
@@ -17240,6 +17298,7 @@ var BaseAnnotationFunction = /*#__PURE__*/function () {
|
|
|
17240
17298
|
this.showContent = showContent;
|
|
17241
17299
|
this.scale = 1;
|
|
17242
17300
|
this.color = null;
|
|
17301
|
+
this.opacity = null;
|
|
17243
17302
|
this.functionName = null;
|
|
17244
17303
|
}
|
|
17245
17304
|
return _createClass(BaseAnnotationFunction, [{
|
|
@@ -17277,15 +17336,38 @@ var BaseAnnotationFunction = /*#__PURE__*/function () {
|
|
|
17277
17336
|
key: "setColor",
|
|
17278
17337
|
value: function setColor() {
|
|
17279
17338
|
var colorIn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
17339
|
+
var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
17280
17340
|
var color = null;
|
|
17341
|
+
var nextFrom = from;
|
|
17281
17342
|
if (this.color != null) {
|
|
17282
17343
|
color = this.color;
|
|
17344
|
+
nextFrom = null;
|
|
17283
17345
|
} else if (colorIn != null) {
|
|
17284
17346
|
color = colorIn;
|
|
17285
17347
|
}
|
|
17286
|
-
this.content.setColor(color);
|
|
17287
|
-
setColorForAnnotations(this.annotations, color);
|
|
17288
|
-
setColorForGlyphs(this.glyphs, color);
|
|
17348
|
+
this.content.setColor(color, nextFrom);
|
|
17349
|
+
setColorForAnnotations(this.annotations, color, nextFrom);
|
|
17350
|
+
setColorForGlyphs(this.glyphs, color, nextFrom);
|
|
17351
|
+
}
|
|
17352
|
+
}, {
|
|
17353
|
+
key: "setOpacity",
|
|
17354
|
+
value: function setOpacity() {
|
|
17355
|
+
var opacityIn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
17356
|
+
var opacity = opacityIn;
|
|
17357
|
+
if (this.opacity != null) {
|
|
17358
|
+
opacity = (opacity == null ? 1 : opacity) * this.opacity;
|
|
17359
|
+
}
|
|
17360
|
+
this.content.setOpacity(opacity);
|
|
17361
|
+
setOpacityForAnnotations(this.annotations, opacity);
|
|
17362
|
+
setOpacityForGlyphs(this.glyphs, opacity);
|
|
17363
|
+
}
|
|
17364
|
+
}, {
|
|
17365
|
+
key: "collectDrawOrder",
|
|
17366
|
+
value: function collectDrawOrder(ops) {
|
|
17367
|
+
this.content.collectDrawOrder(ops);
|
|
17368
|
+
this.annotations.forEach(function (annotation) {
|
|
17369
|
+
annotation.content.collectDrawOrder(ops);
|
|
17370
|
+
});
|
|
17289
17371
|
}
|
|
17290
17372
|
}, {
|
|
17291
17373
|
key: "offsetLocation",
|
|
@@ -17985,20 +18067,45 @@ var BaseEquationFunction = /*#__PURE__*/function (_Elements) {
|
|
|
17985
18067
|
key: "setColor",
|
|
17986
18068
|
value: function setColor() {
|
|
17987
18069
|
var colorIn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
18070
|
+
var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
17988
18071
|
var color = null;
|
|
18072
|
+
// An explicit `color` function supplies its own `this.color`; re-stamp the
|
|
18073
|
+
// provenance to null so this color is treated as an explicit command and is
|
|
18074
|
+
// not ignored by a child that ignores the 'form' default cascade.
|
|
18075
|
+
var nextFrom = from;
|
|
17989
18076
|
if (this.color != null) {
|
|
17990
18077
|
color = this.color;
|
|
18078
|
+
nextFrom = null;
|
|
17991
18079
|
} else if (colorIn != null) {
|
|
17992
18080
|
color = colorIn;
|
|
17993
18081
|
}
|
|
17994
18082
|
this.glyphs.forEach(function (glyph) {
|
|
17995
18083
|
if (glyph != null && color != null) {
|
|
17996
|
-
glyph.setColor(color);
|
|
18084
|
+
glyph.setColor(color, true, nextFrom);
|
|
18085
|
+
}
|
|
18086
|
+
});
|
|
18087
|
+
this.contents.forEach(function (content) {
|
|
18088
|
+
if (content != null) {
|
|
18089
|
+
content.setColor(color, nextFrom);
|
|
18090
|
+
}
|
|
18091
|
+
});
|
|
18092
|
+
}
|
|
18093
|
+
}, {
|
|
18094
|
+
key: "setOpacity",
|
|
18095
|
+
value: function setOpacity() {
|
|
18096
|
+
var opacityIn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
18097
|
+
var opacity = opacityIn;
|
|
18098
|
+
if (this.opacity != null) {
|
|
18099
|
+
opacity = (opacity == null ? 1 : opacity) * this.opacity;
|
|
18100
|
+
}
|
|
18101
|
+
this.glyphs.forEach(function (glyph) {
|
|
18102
|
+
if (glyph != null && opacity != null) {
|
|
18103
|
+
glyph.setOpacity(opacity);
|
|
17997
18104
|
}
|
|
17998
18105
|
});
|
|
17999
18106
|
this.contents.forEach(function (content) {
|
|
18000
18107
|
if (content != null) {
|
|
18001
|
-
content.
|
|
18108
|
+
content.setOpacity(opacity);
|
|
18002
18109
|
}
|
|
18003
18110
|
});
|
|
18004
18111
|
}
|
|
@@ -18375,6 +18482,118 @@ var Container = /*#__PURE__*/function (_BaseEquationFunction) {
|
|
|
18375
18482
|
}(_BaseEquationFunction__WEBPACK_IMPORTED_MODULE_1__["default"]);
|
|
18376
18483
|
|
|
18377
18484
|
|
|
18485
|
+
/***/ },
|
|
18486
|
+
|
|
18487
|
+
/***/ "./src/js/figure/Equation/Elements/DrawOrder.ts"
|
|
18488
|
+
/*!******************************************************!*\
|
|
18489
|
+
!*** ./src/js/figure/Equation/Elements/DrawOrder.ts ***!
|
|
18490
|
+
\******************************************************/
|
|
18491
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
18492
|
+
|
|
18493
|
+
__webpack_require__.r(__webpack_exports__);
|
|
18494
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
18495
|
+
/* harmony export */ "default": () => (/* binding */ DrawOrder)
|
|
18496
|
+
/* harmony export */ });
|
|
18497
|
+
/* harmony import */ var _Element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Element */ "./src/js/figure/Element.ts");
|
|
18498
|
+
/* harmony import */ var _Bounds__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Bounds */ "./src/js/figure/Equation/Elements/Bounds.ts");
|
|
18499
|
+
/* harmony import */ var _BaseEquationFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BaseEquationFunction */ "./src/js/figure/Equation/Elements/BaseEquationFunction.ts");
|
|
18500
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
18501
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
18502
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18503
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
18504
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
18505
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
18506
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
18507
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
18508
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
18509
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
18510
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18511
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18512
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
18513
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
18514
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
18515
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18516
|
+
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
18517
|
+
function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
|
|
18518
|
+
function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
|
|
18519
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
18520
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
18521
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
18522
|
+
|
|
18523
|
+
|
|
18524
|
+
|
|
18525
|
+
|
|
18526
|
+
// Layout-neutral wrapper that records a draw-order operation (`front` or
|
|
18527
|
+
// `back`) for the elements it wraps. The actual reordering of the equation
|
|
18528
|
+
// collection's draw stack is performed by `EquationForm.setPositions` after the
|
|
18529
|
+
// ops are gathered with `collectDrawOrder` (paralleling the `color`/`opacity`
|
|
18530
|
+
// cascade). `front` true moves wrapped elements forward in the draw stack,
|
|
18531
|
+
// `front` false moves them back. `num` is the number of places to move; when
|
|
18532
|
+
// `null` the elements are moved completely to the front/back.
|
|
18533
|
+
var DrawOrder = /*#__PURE__*/function (_BaseEquationFunction) {
|
|
18534
|
+
function DrawOrder() {
|
|
18535
|
+
_classCallCheck(this, DrawOrder);
|
|
18536
|
+
return _callSuper(this, DrawOrder, arguments);
|
|
18537
|
+
}
|
|
18538
|
+
_inherits(DrawOrder, _BaseEquationFunction);
|
|
18539
|
+
return _createClass(DrawOrder, [{
|
|
18540
|
+
key: "calcSize",
|
|
18541
|
+
value: function calcSize(location, scale) {
|
|
18542
|
+
this.location = location._dup();
|
|
18543
|
+
var loc = location._dup();
|
|
18544
|
+
var fullContentBounds = this.options.fullContentBounds;
|
|
18545
|
+
var _this$contents = _slicedToArray(this.contents, 1),
|
|
18546
|
+
mainContent = _this$contents[0];
|
|
18547
|
+
var contentBounds = new _Bounds__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
18548
|
+
var fullBounds = new _Bounds__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
18549
|
+
if (mainContent != null) {
|
|
18550
|
+
mainContent.calcSize(loc._dup(), scale);
|
|
18551
|
+
contentBounds.copyFrom(mainContent.getBounds(fullContentBounds));
|
|
18552
|
+
fullBounds.copyFrom(mainContent.getBounds(true));
|
|
18553
|
+
}
|
|
18554
|
+
this.width = contentBounds.width;
|
|
18555
|
+
this.height = contentBounds.height;
|
|
18556
|
+
this.descent = contentBounds.descent;
|
|
18557
|
+
this.ascent = contentBounds.ascent;
|
|
18558
|
+
this.fullSize = {
|
|
18559
|
+
leftOffset: this.location.x - fullBounds.left,
|
|
18560
|
+
width: fullBounds.width,
|
|
18561
|
+
ascent: fullBounds.ascent,
|
|
18562
|
+
descent: fullBounds.descent,
|
|
18563
|
+
height: fullBounds.height
|
|
18564
|
+
};
|
|
18565
|
+
}
|
|
18566
|
+
}, {
|
|
18567
|
+
key: "collectDrawOrder",
|
|
18568
|
+
value: function collectDrawOrder(ops) {
|
|
18569
|
+
// Collect nested front/back ops first so they are applied before this one.
|
|
18570
|
+
// Each op moves its element group while preserving the group's *current*
|
|
18571
|
+
// relative draw order, so a nested front/back reorders the elements and the
|
|
18572
|
+
// outer (this) op then moves the reordered group as a unit. This composes
|
|
18573
|
+
// consistently: the innermost op runs first, the outermost last.
|
|
18574
|
+
_superPropGet(DrawOrder, "collectDrawOrder", this, 3)([ops]);
|
|
18575
|
+
var _this$options = this.options,
|
|
18576
|
+
front = _this$options.front,
|
|
18577
|
+
num = _this$options.num,
|
|
18578
|
+
before = _this$options.before,
|
|
18579
|
+
after = _this$options.after;
|
|
18580
|
+
var elements = this.getAllElements(true).filter(function (e) {
|
|
18581
|
+
return e instanceof _Element__WEBPACK_IMPORTED_MODULE_0__.FigureElementPrimitive || e instanceof _Element__WEBPACK_IMPORTED_MODULE_0__.FigureElementCollection;
|
|
18582
|
+
});
|
|
18583
|
+
if (elements.length > 0) {
|
|
18584
|
+
ops.push({
|
|
18585
|
+
front: front,
|
|
18586
|
+
num: num,
|
|
18587
|
+
before: before,
|
|
18588
|
+
after: after,
|
|
18589
|
+
elements: elements
|
|
18590
|
+
});
|
|
18591
|
+
}
|
|
18592
|
+
}
|
|
18593
|
+
}]);
|
|
18594
|
+
}(_BaseEquationFunction__WEBPACK_IMPORTED_MODULE_2__["default"]);
|
|
18595
|
+
|
|
18596
|
+
|
|
18378
18597
|
/***/ },
|
|
18379
18598
|
|
|
18380
18599
|
/***/ "./src/js/figure/Equation/Elements/Element.ts"
|
|
@@ -18452,6 +18671,7 @@ var Element = /*#__PURE__*/function () {
|
|
|
18452
18671
|
};
|
|
18453
18672
|
this.color = null;
|
|
18454
18673
|
this.defaultColor = content.color.slice();
|
|
18674
|
+
this.opacity = null;
|
|
18455
18675
|
this.fnMap = new _tools_FunctionMap__WEBPACK_IMPORTED_MODULE_4__.FunctionMap();
|
|
18456
18676
|
this.showContent = true;
|
|
18457
18677
|
}
|
|
@@ -18567,20 +18787,52 @@ var Element = /*#__PURE__*/function () {
|
|
|
18567
18787
|
key: "setColor",
|
|
18568
18788
|
value: function setColor() {
|
|
18569
18789
|
var colorIn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
18790
|
+
var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
18570
18791
|
var color = this.defaultColor;
|
|
18792
|
+
// `from` carries the provenance of the cascade down to the FigureElement.
|
|
18793
|
+
// If this wrapper supplies its own explicit color, re-stamp `from` to null
|
|
18794
|
+
// (an explicit command) so a child cannot ignore it as a 'form' default.
|
|
18795
|
+
var nextFrom = from;
|
|
18571
18796
|
if (colorIn != null) {
|
|
18572
18797
|
color = colorIn;
|
|
18573
18798
|
} else if (this.color != null) {
|
|
18574
18799
|
color = this.color;
|
|
18800
|
+
nextFrom = null;
|
|
18801
|
+
}
|
|
18802
|
+
var content = this.content;
|
|
18803
|
+
if (content instanceof _Element__WEBPACK_IMPORTED_MODULE_3__.FigureElementCollection || content instanceof _Element__WEBPACK_IMPORTED_MODULE_3__.FigureElementPrimitive) {
|
|
18804
|
+
if (content.isFormIgnored) {
|
|
18805
|
+
return;
|
|
18806
|
+
}
|
|
18807
|
+
content.setColor(color, true, nextFrom);
|
|
18808
|
+
}
|
|
18809
|
+
}
|
|
18810
|
+
}, {
|
|
18811
|
+
key: "setOpacity",
|
|
18812
|
+
value: function setOpacity() {
|
|
18813
|
+
var opacityIn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
18814
|
+
var opacity = opacityIn;
|
|
18815
|
+
if (this.opacity != null) {
|
|
18816
|
+
opacity = (opacity == null ? 1 : opacity) * this.opacity;
|
|
18817
|
+
}
|
|
18818
|
+
if (opacity == null) {
|
|
18819
|
+
return;
|
|
18575
18820
|
}
|
|
18576
18821
|
var content = this.content;
|
|
18577
18822
|
if (content instanceof _Element__WEBPACK_IMPORTED_MODULE_3__.FigureElementCollection || content instanceof _Element__WEBPACK_IMPORTED_MODULE_3__.FigureElementPrimitive) {
|
|
18578
18823
|
if (content.isFormIgnored) {
|
|
18579
18824
|
return;
|
|
18580
18825
|
}
|
|
18581
|
-
content.
|
|
18826
|
+
content.setOpacity(opacity);
|
|
18582
18827
|
}
|
|
18583
18828
|
}
|
|
18829
|
+
|
|
18830
|
+
// eslint-disable-next-line class-methods-use-this, no-unused-vars
|
|
18831
|
+
}, {
|
|
18832
|
+
key: "collectDrawOrder",
|
|
18833
|
+
value: function collectDrawOrder(ops) {
|
|
18834
|
+
// A leaf element holds no draw-order operation.
|
|
18835
|
+
}
|
|
18584
18836
|
}, {
|
|
18585
18837
|
key: "offsetLocation",
|
|
18586
18838
|
value: function offsetLocation() {
|
|
@@ -18634,6 +18886,7 @@ var Elements = /*#__PURE__*/function () {
|
|
|
18634
18886
|
this.fnMap = new _tools_FunctionMap__WEBPACK_IMPORTED_MODULE_4__.FunctionMap();
|
|
18635
18887
|
this.showContent = true;
|
|
18636
18888
|
this.color = null;
|
|
18889
|
+
this.opacity = null;
|
|
18637
18890
|
}
|
|
18638
18891
|
return _createClass(Elements, [{
|
|
18639
18892
|
key: "cleanup",
|
|
@@ -18719,14 +18972,36 @@ var Elements = /*#__PURE__*/function () {
|
|
|
18719
18972
|
key: "setColor",
|
|
18720
18973
|
value: function setColor() {
|
|
18721
18974
|
var colorIn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
18975
|
+
var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
18722
18976
|
var color = null;
|
|
18977
|
+
var nextFrom = from;
|
|
18723
18978
|
if (this.color != null) {
|
|
18724
18979
|
color = this.color;
|
|
18980
|
+
nextFrom = null;
|
|
18725
18981
|
} else if (colorIn != null) {
|
|
18726
18982
|
color = colorIn;
|
|
18727
18983
|
}
|
|
18728
18984
|
this.content.forEach(function (e) {
|
|
18729
|
-
e.setColor(color);
|
|
18985
|
+
e.setColor(color, nextFrom);
|
|
18986
|
+
});
|
|
18987
|
+
}
|
|
18988
|
+
}, {
|
|
18989
|
+
key: "setOpacity",
|
|
18990
|
+
value: function setOpacity() {
|
|
18991
|
+
var opacityIn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
18992
|
+
var opacity = opacityIn;
|
|
18993
|
+
if (this.opacity != null) {
|
|
18994
|
+
opacity = (opacity == null ? 1 : opacity) * this.opacity;
|
|
18995
|
+
}
|
|
18996
|
+
this.content.forEach(function (e) {
|
|
18997
|
+
e.setOpacity(opacity);
|
|
18998
|
+
});
|
|
18999
|
+
}
|
|
19000
|
+
}, {
|
|
19001
|
+
key: "collectDrawOrder",
|
|
19002
|
+
value: function collectDrawOrder(ops) {
|
|
19003
|
+
this.content.forEach(function (e) {
|
|
19004
|
+
e.collectDrawOrder(ops);
|
|
18730
19005
|
});
|
|
18731
19006
|
}
|
|
18732
19007
|
}, {
|
|
@@ -19359,6 +19634,81 @@ var Offset = /*#__PURE__*/function (_BaseEquationFunction) {
|
|
|
19359
19634
|
}(_BaseEquationFunction__WEBPACK_IMPORTED_MODULE_1__["default"]);
|
|
19360
19635
|
|
|
19361
19636
|
|
|
19637
|
+
/***/ },
|
|
19638
|
+
|
|
19639
|
+
/***/ "./src/js/figure/Equation/Elements/Opacity.ts"
|
|
19640
|
+
/*!****************************************************!*\
|
|
19641
|
+
!*** ./src/js/figure/Equation/Elements/Opacity.ts ***!
|
|
19642
|
+
\****************************************************/
|
|
19643
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
19644
|
+
|
|
19645
|
+
__webpack_require__.r(__webpack_exports__);
|
|
19646
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
19647
|
+
/* harmony export */ "default": () => (/* binding */ Opacity)
|
|
19648
|
+
/* harmony export */ });
|
|
19649
|
+
/* harmony import */ var _Bounds__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Bounds */ "./src/js/figure/Equation/Elements/Bounds.ts");
|
|
19650
|
+
/* harmony import */ var _BaseEquationFunction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BaseEquationFunction */ "./src/js/figure/Equation/Elements/BaseEquationFunction.ts");
|
|
19651
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
19652
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
19653
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19654
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
19655
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
19656
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
19657
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
19658
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
19659
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
19660
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
19661
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19662
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19663
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
19664
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
19665
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
19666
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
19667
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
19668
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
19669
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
19670
|
+
|
|
19671
|
+
|
|
19672
|
+
var Opacity = /*#__PURE__*/function (_BaseEquationFunction) {
|
|
19673
|
+
function Opacity() {
|
|
19674
|
+
_classCallCheck(this, Opacity);
|
|
19675
|
+
return _callSuper(this, Opacity, arguments);
|
|
19676
|
+
}
|
|
19677
|
+
_inherits(Opacity, _BaseEquationFunction);
|
|
19678
|
+
return _createClass(Opacity, [{
|
|
19679
|
+
key: "calcSize",
|
|
19680
|
+
value: function calcSize(location, scale) {
|
|
19681
|
+
this.location = location._dup();
|
|
19682
|
+
var loc = location._dup();
|
|
19683
|
+
var _this$options = this.options,
|
|
19684
|
+
opacity = _this$options.opacity,
|
|
19685
|
+
fullContentBounds = _this$options.fullContentBounds;
|
|
19686
|
+
var _this$contents = _slicedToArray(this.contents, 1),
|
|
19687
|
+
mainContent = _this$contents[0];
|
|
19688
|
+
var contentBounds = new _Bounds__WEBPACK_IMPORTED_MODULE_0__["default"]();
|
|
19689
|
+
var fullBounds = new _Bounds__WEBPACK_IMPORTED_MODULE_0__["default"]();
|
|
19690
|
+
if (mainContent != null) {
|
|
19691
|
+
mainContent.calcSize(loc._dup(), scale);
|
|
19692
|
+
contentBounds.copyFrom(mainContent.getBounds(fullContentBounds));
|
|
19693
|
+
fullBounds.copyFrom(mainContent.getBounds(true));
|
|
19694
|
+
}
|
|
19695
|
+
this.opacity = opacity;
|
|
19696
|
+
this.width = contentBounds.width;
|
|
19697
|
+
this.height = contentBounds.height;
|
|
19698
|
+
this.descent = contentBounds.descent;
|
|
19699
|
+
this.ascent = contentBounds.ascent;
|
|
19700
|
+
this.fullSize = {
|
|
19701
|
+
leftOffset: this.location.x - fullBounds.left,
|
|
19702
|
+
width: fullBounds.width,
|
|
19703
|
+
ascent: fullBounds.ascent,
|
|
19704
|
+
descent: fullBounds.descent,
|
|
19705
|
+
height: fullBounds.height
|
|
19706
|
+
};
|
|
19707
|
+
}
|
|
19708
|
+
}]);
|
|
19709
|
+
}(_BaseEquationFunction__WEBPACK_IMPORTED_MODULE_1__["default"]);
|
|
19710
|
+
|
|
19711
|
+
|
|
19362
19712
|
/***/ },
|
|
19363
19713
|
|
|
19364
19714
|
/***/ "./src/js/figure/Equation/Elements/Scale.ts"
|
|
@@ -19518,6 +19868,16 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
|
|
|
19518
19868
|
* Object where keys are property names of a {@link FigureElement} and values
|
|
19519
19869
|
* are the values to set the properties to.
|
|
19520
19870
|
*
|
|
19871
|
+
* Two keys are treated specially as draw-order operations rather than element
|
|
19872
|
+
* properties: `back` and `front`. Each takes an options object (`{}` for the
|
|
19873
|
+
* full extreme, `{ num }` to move a set number of places, or `{ before }` /
|
|
19874
|
+
* `{ after }` to position relative to an anchor element) and reorders the
|
|
19875
|
+
* element in the equation's draw stack - paralleling the {@link EQN_Back} and
|
|
19876
|
+
* {@link EQN_Front} equation functions. When several elements declare `back` or
|
|
19877
|
+
* `front` mods, they are applied in definition order, so
|
|
19878
|
+
* `{ a: { back: {} }, b: { back: {} } }` sends `a` to the back and then `b` to
|
|
19879
|
+
* the back.
|
|
19880
|
+
*
|
|
19521
19881
|
* @property {any} [_propertyName]
|
|
19522
19882
|
* @interface
|
|
19523
19883
|
* @group Misc Figure Element
|
|
@@ -19882,6 +20242,11 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
|
|
|
19882
20242
|
* automatically in the equation based on EQN_Color equation functions. In such
|
|
19883
20243
|
* cases, colors that are set external to the equation will be overridden. Use
|
|
19884
20244
|
* `true` to allow setting of colors externally only. (`false`)
|
|
20245
|
+
* @property {boolean} [ignoreOpacity] when `false`, opacity will be set
|
|
20246
|
+
* automatically in the equation based on EQN_Opacity equation functions
|
|
20247
|
+
* (multiplicative cascade). Element opacities set externally will be
|
|
20248
|
+
* overridden. Use `true` to allow setting of opacities externally only.
|
|
20249
|
+
* (`false`)
|
|
19885
20250
|
*
|
|
19886
20251
|
* @example
|
|
19887
20252
|
* // Simple form definition of two different forms of the same equation and one
|
|
@@ -20257,6 +20622,32 @@ var GoToFormAnimationStep = /*#__PURE__*/function (_TriggerAnimationStep2) {
|
|
|
20257
20622
|
* * {@link GoToFormAnimationStep}
|
|
20258
20623
|
* * {@link NextFormAnimationStep}
|
|
20259
20624
|
*
|
|
20625
|
+
* In addition to the notifications published by {@link FigureElement}, an
|
|
20626
|
+
* Equation publishes a `formChanged` notification whenever the displayed form
|
|
20627
|
+
* may have changed. The payload is an object
|
|
20628
|
+
* `{ phase, form, fromForm?, progress? }` where `phase` is one of:
|
|
20629
|
+
* - `'showForm'`: a form was set via `showForm`. Callers can suppress this
|
|
20630
|
+
* event by passing `notify: false` to `showForm`; internal `showForm`
|
|
20631
|
+
* calls made by `goToForm` do this so the `goToForm*` event stream is
|
|
20632
|
+
* not interleaved with stray `showForm` events.
|
|
20633
|
+
* - `'goToFormStart'`: a `goToForm` call has just begun
|
|
20634
|
+
* - `'goToFormStep'`: published on every animation frame during a `goToForm`
|
|
20635
|
+
* animation; `progress` is the percentage (0-1) through the animation. A
|
|
20636
|
+
* final `goToFormStep` with `progress: 1` is always published immediately
|
|
20637
|
+
* before `goToFormEnd`
|
|
20638
|
+
* - `'goToFormEnd'`: a `goToForm` call has finished
|
|
20639
|
+
*
|
|
20640
|
+
* * `fromForm` is only included on the `goToForm*` phases (it carries the
|
|
20641
|
+
* `fromWhere` option from `goToForm`); it is absent on `showForm`. `progress`
|
|
20642
|
+
* is only included on `goToFormStep`. The event order for a `goToForm` call
|
|
20643
|
+
* is always: `goToFormStart` → zero-or-more `goToFormStep` → `goToFormStep`
|
|
20644
|
+
* with `progress: 1` → `goToFormEnd`.
|
|
20645
|
+
*
|
|
20646
|
+
* A user-initiated `showForm` made while a `goToForm` animation is running
|
|
20647
|
+
* will publish its `showForm` event interleaved with the ongoing
|
|
20648
|
+
* `goToFormStep` stream — listeners that drive UI from "the current
|
|
20649
|
+
* transition" should account for this. Pass `notify: false` to suppress.
|
|
20650
|
+
*
|
|
20260
20651
|
* @extends FigureElementCollection
|
|
20261
20652
|
*
|
|
20262
20653
|
* @see To test examples, append them to the
|
|
@@ -20351,7 +20742,8 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
20351
20742
|
},
|
|
20352
20743
|
elementMods: {},
|
|
20353
20744
|
layout: 'always',
|
|
20354
|
-
ignoreColor: false
|
|
20745
|
+
ignoreColor: false,
|
|
20746
|
+
ignoreOpacity: false
|
|
20355
20747
|
// lazyLayout: true,
|
|
20356
20748
|
// layoutonce: false,
|
|
20357
20749
|
},
|
|
@@ -20411,7 +20803,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
20411
20803
|
// this.setTransform(getTransform(optionsToUse.transform));
|
|
20412
20804
|
// }
|
|
20413
20805
|
_this.shapes = shapes;
|
|
20414
|
-
_this.setColor(optionsToUse.color);
|
|
20806
|
+
_this.setColor(optionsToUse.color, true, 'form');
|
|
20415
20807
|
_this.dimColor = optionsToUse.dimColor;
|
|
20416
20808
|
// this.defaultTextType = optionsToUse.type;
|
|
20417
20809
|
_this.textureAtlases = {};
|
|
@@ -20440,7 +20832,8 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
20440
20832
|
duration: optionsToUse.formDefaults.duration,
|
|
20441
20833
|
translation: optionsToUse.formDefaults.translation,
|
|
20442
20834
|
layout: optionsToUse.formDefaults.layout,
|
|
20443
|
-
ignoreColor: optionsToUse.formDefaults.ignoreColor
|
|
20835
|
+
ignoreColor: optionsToUse.formDefaults.ignoreColor,
|
|
20836
|
+
ignoreOpacity: optionsToUse.formDefaults.ignoreOpacity
|
|
20444
20837
|
},
|
|
20445
20838
|
functions: new _EquationFunctions__WEBPACK_IMPORTED_MODULE_10__.EquationFunctions(_this.elements, _this.addElementFromKey.bind(_this), _this.getExistingOrAddSymbol.bind(_this), _this.makeInlineElement.bind(_this)),
|
|
20446
20839
|
symbols: new _EquationSymbols__WEBPACK_IMPORTED_MODULE_9__["default"](_this.shapes, _this.color),
|
|
@@ -20904,7 +21297,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
20904
21297
|
var symbol = this.eqn.symbols.get(cleanKey, options);
|
|
20905
21298
|
if (symbol != null) {
|
|
20906
21299
|
if (symbol.color[3] > 0.01 && options.color == null) {
|
|
20907
|
-
symbol.setColor(this.color);
|
|
21300
|
+
symbol.setColor(this.color, true, 'form');
|
|
20908
21301
|
}
|
|
20909
21302
|
if (options.mods != null) {
|
|
20910
21303
|
symbol.setProperties(options.mods);
|
|
@@ -20931,7 +21324,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
20931
21324
|
}
|
|
20932
21325
|
if (symbol != null) {
|
|
20933
21326
|
if (symbol.color[3] > 0.01 && options.color == null) {
|
|
20934
|
-
symbol.setColor(this.color);
|
|
21327
|
+
symbol.setColor(this.color, true, 'form');
|
|
20935
21328
|
}
|
|
20936
21329
|
if (options.mods != null) {
|
|
20937
21330
|
symbol.setProperties(options.mods);
|
|
@@ -21013,7 +21406,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21013
21406
|
});
|
|
21014
21407
|
}
|
|
21015
21408
|
if (options.color == null && symbol.color[3] > 0.01) {
|
|
21016
|
-
symbol.setColor(this.color);
|
|
21409
|
+
symbol.setColor(this.color, true, 'form');
|
|
21017
21410
|
}
|
|
21018
21411
|
symbol.dimColor = this.dimColor.slice();
|
|
21019
21412
|
if (options.mods != null) {
|
|
@@ -21196,7 +21589,9 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21196
21589
|
translation = _ref.translation,
|
|
21197
21590
|
fromForm = _ref.fromForm,
|
|
21198
21591
|
onShow = _ref.onShow,
|
|
21199
|
-
onTransition = _ref.onTransition
|
|
21592
|
+
onTransition = _ref.onTransition,
|
|
21593
|
+
ignoreColor = _ref.ignoreColor,
|
|
21594
|
+
ignoreOpacity = _ref.ignoreOpacity;
|
|
21200
21595
|
var options = {
|
|
21201
21596
|
elementMods: elementMods,
|
|
21202
21597
|
alignment: alignment,
|
|
@@ -21207,7 +21602,9 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21207
21602
|
duration: duration,
|
|
21208
21603
|
translation: translation,
|
|
21209
21604
|
onShow: onShow,
|
|
21210
|
-
onTransition: onTransition
|
|
21605
|
+
onTransition: onTransition,
|
|
21606
|
+
ignoreColor: ignoreColor,
|
|
21607
|
+
ignoreOpacity: ignoreOpacity
|
|
21211
21608
|
};
|
|
21212
21609
|
try {
|
|
21213
21610
|
_this7.addForm(name, formContent, options);
|
|
@@ -21442,6 +21839,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21442
21839
|
this.stopAnimating(how, '_Equation', true);
|
|
21443
21840
|
this.stopAnimating(how, '_EquationColor', true);
|
|
21444
21841
|
this.stopAnimating(how, '_EquationAnimateColor', true);
|
|
21842
|
+
this.stopAnimating(how, '_EquationFormStep', true);
|
|
21445
21843
|
this.stopPulsing(how);
|
|
21446
21844
|
}
|
|
21447
21845
|
}, {
|
|
@@ -21480,7 +21878,8 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21480
21878
|
onTransition = _optionsToUse.onTransition,
|
|
21481
21879
|
duration = _optionsToUse.duration,
|
|
21482
21880
|
translation = _optionsToUse.translation,
|
|
21483
|
-
ignoreColor = _optionsToUse.ignoreColor
|
|
21881
|
+
ignoreColor = _optionsToUse.ignoreColor,
|
|
21882
|
+
ignoreOpacity = _optionsToUse.ignoreOpacity;
|
|
21484
21883
|
var form = this.createForm();
|
|
21485
21884
|
this.eqn.forms[name] = form;
|
|
21486
21885
|
form.description = description;
|
|
@@ -21492,6 +21891,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21492
21891
|
form.onShow = onShow;
|
|
21493
21892
|
form.onTransition = onTransition;
|
|
21494
21893
|
form.ignoreColor = ignoreColor;
|
|
21894
|
+
form.ignoreOpacity = ignoreOpacity;
|
|
21495
21895
|
|
|
21496
21896
|
// Populate element mods
|
|
21497
21897
|
form.elementMods = {};
|
|
@@ -21634,13 +22034,26 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21634
22034
|
/**
|
|
21635
22035
|
* Show equation form
|
|
21636
22036
|
*/
|
|
22037
|
+
/**
|
|
22038
|
+
* Show equation form.
|
|
22039
|
+
*
|
|
22040
|
+
* @param formOrName the form, or its name, to show
|
|
22041
|
+
* @param animationStop if `true`, stops any in-progress element animations
|
|
22042
|
+
* before rendering the form (default `true`)
|
|
22043
|
+
* @param notify if `true`, publish a `formChanged` notification with
|
|
22044
|
+
* `phase: 'showForm'` (default `true`). Pass `false` to suppress the
|
|
22045
|
+
* event — useful for bulk updates or when this `showForm` is part of a
|
|
22046
|
+
* larger transition the caller is broadcasting separately. The internal
|
|
22047
|
+
* `showForm` calls made by `goToForm` use `false` so the `goToForm*`
|
|
22048
|
+
* event stream is not interleaved with stray `showForm` events.
|
|
22049
|
+
*/
|
|
21637
22050
|
}, {
|
|
21638
22051
|
key: "showForm",
|
|
21639
22052
|
value: function showForm() {
|
|
21640
22053
|
var formOrName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.eqn.currentForm;
|
|
21641
22054
|
var animationStop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
22055
|
+
var notify = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
21642
22056
|
_superPropGet(Equation, "show", this, 3)([]);
|
|
21643
|
-
// this.custom.settingForm = true;
|
|
21644
22057
|
var form = formOrName;
|
|
21645
22058
|
if (typeof formOrName === 'string') {
|
|
21646
22059
|
form = this.getForm(formOrName);
|
|
@@ -21651,6 +22064,12 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21651
22064
|
this.render(animationStop);
|
|
21652
22065
|
this.fnMap.exec(form.onTransition);
|
|
21653
22066
|
this.fnMap.exec(form.onShow);
|
|
22067
|
+
if (notify) {
|
|
22068
|
+
this.notifications.publish('formChanged', {
|
|
22069
|
+
phase: 'showForm',
|
|
22070
|
+
form: form
|
|
22071
|
+
});
|
|
22072
|
+
}
|
|
21654
22073
|
}
|
|
21655
22074
|
}
|
|
21656
22075
|
}, {
|
|
@@ -21729,7 +22148,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21729
22148
|
// this.stopEquationAnimating('complete');
|
|
21730
22149
|
var currentForm = this.getCurrentForm();
|
|
21731
22150
|
if (currentForm != null) {
|
|
21732
|
-
this.showForm(currentForm);
|
|
22151
|
+
this.showForm(currentForm, true, false);
|
|
21733
22152
|
}
|
|
21734
22153
|
} else {
|
|
21735
22154
|
// this.stopEquationAnimating('cancel');
|
|
@@ -21813,20 +22232,65 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21813
22232
|
}
|
|
21814
22233
|
}
|
|
21815
22234
|
if (duration === 0) {
|
|
21816
|
-
this.
|
|
22235
|
+
this.notifications.publish('formChanged', {
|
|
22236
|
+
phase: 'goToFormStart',
|
|
22237
|
+
form: form,
|
|
22238
|
+
fromForm: options.fromWhere
|
|
22239
|
+
});
|
|
22240
|
+
this.showForm(form, true, false);
|
|
21817
22241
|
this.fnMap.exec(options.callback);
|
|
22242
|
+
this.notifications.publish('formChanged', {
|
|
22243
|
+
phase: 'goToFormStep',
|
|
22244
|
+
form: form,
|
|
22245
|
+
fromForm: options.fromWhere,
|
|
22246
|
+
progress: 1
|
|
22247
|
+
});
|
|
22248
|
+
this.notifications.publish('formChanged', {
|
|
22249
|
+
phase: 'goToFormEnd',
|
|
22250
|
+
form: form,
|
|
22251
|
+
fromForm: options.fromWhere
|
|
22252
|
+
});
|
|
21818
22253
|
} else {
|
|
21819
22254
|
this.eqn.isAnimating = true;
|
|
21820
22255
|
this.fnMap.exec(onTransition);
|
|
22256
|
+
// Set the current form before publishing goToFormStart so listeners
|
|
22257
|
+
// that call getCurrentForm() see the target form, matching the payload.
|
|
22258
|
+
this.setCurrentForm(form);
|
|
22259
|
+
this.notifications.publish('formChanged', {
|
|
22260
|
+
phase: 'goToFormStart',
|
|
22261
|
+
form: form,
|
|
22262
|
+
fromForm: options.fromWhere
|
|
22263
|
+
});
|
|
22264
|
+
var stepStarted = false;
|
|
21821
22265
|
var end = function end() {
|
|
21822
22266
|
_this1.fnMap.exec(form.onShow);
|
|
21823
22267
|
_this1.eqn.isAnimating = false;
|
|
21824
22268
|
_this1.fnMap.exec(options.callback);
|
|
22269
|
+
// Cancelling the step ticker stops any further frame callbacks
|
|
22270
|
+
// after end(). It cannot retract a step(p:1) the ticker may have
|
|
22271
|
+
// already published earlier in this frame, so the ticker callback
|
|
22272
|
+
// also skips p===1 — the manual publish below is the single
|
|
22273
|
+
// canonical terminal step event.
|
|
22274
|
+
if (stepStarted) {
|
|
22275
|
+
_this1.stopAnimating('cancel', '_EquationFormStep', true);
|
|
22276
|
+
}
|
|
22277
|
+
_this1.notifications.publish('formChanged', {
|
|
22278
|
+
phase: 'goToFormStep',
|
|
22279
|
+
form: form,
|
|
22280
|
+
fromForm: options.fromWhere,
|
|
22281
|
+
progress: 1
|
|
22282
|
+
});
|
|
22283
|
+
_this1.notifications.publish('formChanged', {
|
|
22284
|
+
phase: 'goToFormEnd',
|
|
22285
|
+
form: form,
|
|
22286
|
+
fromForm: options.fromWhere
|
|
22287
|
+
});
|
|
21825
22288
|
};
|
|
22289
|
+
var totalTime = 0;
|
|
21826
22290
|
if (options.animate === 'move') {
|
|
21827
|
-
form.animatePositionsTo(options.delay, options.dissolveOutTime, duration, options.dissolveInTime, end, options.fromWhere, false);
|
|
22291
|
+
totalTime = form.animatePositionsTo(options.delay, options.dissolveOutTime, duration, options.dissolveInTime, end, options.fromWhere, false);
|
|
21828
22292
|
} else if (options.animate === 'dissolveInThenMove') {
|
|
21829
|
-
form.animatePositionsTo(options.delay, options.dissolveOutTime, duration, options.dissolveInTime, end, options.fromWhere, true);
|
|
22293
|
+
totalTime = form.animatePositionsTo(options.delay, options.dissolveOutTime, duration, options.dissolveInTime, end, options.fromWhere, true);
|
|
21830
22294
|
} else if (options.animate === 'moveFrom' && this.eqn.formRestart != null && this.eqn.formRestart.moveFrom != null) {
|
|
21831
22295
|
var moveFrom = this.eqn.formRestart.moveFrom;
|
|
21832
22296
|
var target = this.getPosition();
|
|
@@ -21840,7 +22304,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21840
22304
|
start = (0,_tools_g2__WEBPACK_IMPORTED_MODULE_0__.getPoint)(this.eqn.formRestart.moveFrom);
|
|
21841
22305
|
}
|
|
21842
22306
|
var showFormCallback = function showFormCallback() {
|
|
21843
|
-
_this1.showForm(form.name, false);
|
|
22307
|
+
_this1.showForm(form.name, false, false);
|
|
21844
22308
|
};
|
|
21845
22309
|
this.fnMap.add('_equationShowFormCallback', showFormCallback);
|
|
21846
22310
|
this.animations["new"]('_Equation').dissolveOut({
|
|
@@ -21855,6 +22319,14 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21855
22319
|
target: target,
|
|
21856
22320
|
duration: duration
|
|
21857
22321
|
}).whenFinished(end).start();
|
|
22322
|
+
if (duration != null) {
|
|
22323
|
+
totalTime = options.delay + options.dissolveOutTime + 0.01 + duration;
|
|
22324
|
+
} else {
|
|
22325
|
+
// duration is null — the position step computes a velocity-based
|
|
22326
|
+
// move time internally. Read it back from the chain we just
|
|
22327
|
+
// started so the step ticker still covers the full animation.
|
|
22328
|
+
totalTime = this.animations.getRemainingTime('_Equation');
|
|
22329
|
+
}
|
|
21858
22330
|
} else if (options.animate === 'pulse' && this.eqn.formRestart != null && this.eqn.formRestart.pulse != null) {
|
|
21859
22331
|
var pulse = this.eqn.formRestart.pulse;
|
|
21860
22332
|
var newEnd = function newEnd() {
|
|
@@ -21871,11 +22343,30 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21871
22343
|
});
|
|
21872
22344
|
}
|
|
21873
22345
|
};
|
|
21874
|
-
form.allHideShow(options.delay, options.dissolveOutTime, options.blankTime, options.dissolveInTime, newEnd);
|
|
22346
|
+
var hideShowTime = form.allHideShow(options.delay, options.dissolveOutTime, options.blankTime, options.dissolveInTime, newEnd);
|
|
22347
|
+
totalTime = hideShowTime + (pulse.duration != null ? pulse.duration : 0);
|
|
21875
22348
|
} else {
|
|
21876
|
-
form.allHideShow(options.delay, options.dissolveOutTime, options.blankTime, options.dissolveInTime, end);
|
|
22349
|
+
totalTime = form.allHideShow(options.delay, options.dissolveOutTime, options.blankTime, options.dissolveInTime, end);
|
|
22350
|
+
}
|
|
22351
|
+
if (totalTime > 0) {
|
|
22352
|
+
this.animations["new"]('_EquationFormStep').custom({
|
|
22353
|
+
callback: function callback(p) {
|
|
22354
|
+
// Skip the terminal tick — end() publishes the canonical
|
|
22355
|
+
// step(p:1) so the ticker would otherwise duplicate it (and
|
|
22356
|
+
// CustomAnimationStep can land on p=1 twice via
|
|
22357
|
+
// nextFrame + finish()).
|
|
22358
|
+
if (p >= 1) return;
|
|
22359
|
+
_this1.notifications.publish('formChanged', {
|
|
22360
|
+
phase: 'goToFormStep',
|
|
22361
|
+
form: form,
|
|
22362
|
+
fromForm: options.fromWhere,
|
|
22363
|
+
progress: p
|
|
22364
|
+
});
|
|
22365
|
+
},
|
|
22366
|
+
duration: totalTime
|
|
22367
|
+
}).start();
|
|
22368
|
+
stepStarted = true;
|
|
21877
22369
|
}
|
|
21878
|
-
this.setCurrentForm(form);
|
|
21879
22370
|
}
|
|
21880
22371
|
}
|
|
21881
22372
|
}, {
|
|
@@ -21986,7 +22477,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21986
22477
|
this.eqn.isAnimating = false;
|
|
21987
22478
|
var currentForm = this.getCurrentForm();
|
|
21988
22479
|
if (currentForm != null) {
|
|
21989
|
-
this.showForm(currentForm);
|
|
22480
|
+
this.showForm(currentForm, true, false);
|
|
21990
22481
|
}
|
|
21991
22482
|
return;
|
|
21992
22483
|
}
|
|
@@ -22095,6 +22586,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22095
22586
|
/* harmony import */ var _Element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Element */ "./src/js/figure/Element.ts");
|
|
22096
22587
|
/* harmony import */ var _Elements_Element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Elements/Element */ "./src/js/figure/Equation/Elements/Element.ts");
|
|
22097
22588
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
22589
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
22590
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22591
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
22592
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
22593
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
22594
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
22098
22595
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
22099
22596
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
22100
22597
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
@@ -22166,6 +22663,7 @@ var EquationForm = /*#__PURE__*/function (_Elements) {
|
|
|
22166
22663
|
_this.positionsSet = false;
|
|
22167
22664
|
_this.layout = 'always';
|
|
22168
22665
|
_this.ignoreColor = false;
|
|
22666
|
+
_this.ignoreOpacity = false;
|
|
22169
22667
|
// this.subForm = '';
|
|
22170
22668
|
return _this;
|
|
22171
22669
|
}
|
|
@@ -22199,8 +22697,187 @@ var EquationForm = /*#__PURE__*/function (_Elements) {
|
|
|
22199
22697
|
}
|
|
22200
22698
|
_superPropGet(EquationForm, "setPositions", this, 3)([]);
|
|
22201
22699
|
if (!this.ignoreColor) {
|
|
22202
|
-
_superPropGet(EquationForm, "setColor", this, 3)([]);
|
|
22700
|
+
_superPropGet(EquationForm, "setColor", this, 3)([null, 'form']);
|
|
22701
|
+
}
|
|
22702
|
+
if (!this.ignoreOpacity) {
|
|
22703
|
+
_superPropGet(EquationForm, "setOpacity", this, 3)([]);
|
|
22704
|
+
}
|
|
22705
|
+
this.setDrawOrder();
|
|
22706
|
+
}
|
|
22707
|
+
|
|
22708
|
+
// Collect the `front`/`back` draw-order operations declared on this form's
|
|
22709
|
+
// `elementMods` (e.g. `elementMods: { a: { back: {} } }`). These are applied
|
|
22710
|
+
// alongside the inline `front`/`back` equation functions, in element-mod key
|
|
22711
|
+
// order, so `{ a: { back: {} }, b: { back: {} } }` sends `a` to the back and
|
|
22712
|
+
// then `b` to the back.
|
|
22713
|
+
}, {
|
|
22714
|
+
key: "collectElementModDrawOrder",
|
|
22715
|
+
value: function collectElementModDrawOrder(ops) {
|
|
22716
|
+
var _this2 = this;
|
|
22717
|
+
Object.keys(this.elementMods).forEach(function (name) {
|
|
22718
|
+
var entry = _this2.elementMods[name];
|
|
22719
|
+
if (entry == null || entry.element == null || entry.mods == null) {
|
|
22720
|
+
return;
|
|
22721
|
+
}
|
|
22722
|
+
var element = entry.element,
|
|
22723
|
+
mods = entry.mods;
|
|
22724
|
+
if (element.isFormIgnored) {
|
|
22725
|
+
return;
|
|
22726
|
+
}
|
|
22727
|
+
var add = function add(modOption, front) {
|
|
22728
|
+
if (modOption === undefined) {
|
|
22729
|
+
return;
|
|
22730
|
+
}
|
|
22731
|
+
var o = modOption == null ? {} : modOption;
|
|
22732
|
+
ops.push({
|
|
22733
|
+
front: front,
|
|
22734
|
+
num: o.num,
|
|
22735
|
+
before: o.before,
|
|
22736
|
+
after: o.after,
|
|
22737
|
+
elements: [element]
|
|
22738
|
+
});
|
|
22739
|
+
};
|
|
22740
|
+
add(mods.back, false);
|
|
22741
|
+
add(mods.front, true);
|
|
22742
|
+
});
|
|
22743
|
+
}
|
|
22744
|
+
|
|
22745
|
+
// Apply any `front`/`back` draw-order operations - both the inline equation
|
|
22746
|
+
// functions (gathered from the form tree) and those declared on `elementMods`.
|
|
22747
|
+
// Operations are applied relative to a baseline (the natural draw order,
|
|
22748
|
+
// captured before the first reorder) so the result is deterministic no matter
|
|
22749
|
+
// how many times `setPositions` runs. The reorder is performed on the shared
|
|
22750
|
+
// equation collection (the common parent of all wrapped elements).
|
|
22751
|
+
}, {
|
|
22752
|
+
key: "setDrawOrder",
|
|
22753
|
+
value: function setDrawOrder() {
|
|
22754
|
+
var _this3 = this;
|
|
22755
|
+
var ops = [];
|
|
22756
|
+
_superPropGet(EquationForm, "collectDrawOrder", this, 3)([ops]);
|
|
22757
|
+
this.collectElementModDrawOrder(ops);
|
|
22758
|
+
// Find the equation collection (the common parent of all child elements).
|
|
22759
|
+
var children = this.collectionMethods.getAllElements();
|
|
22760
|
+
var collection = children != null && children.length > 0 ? children[0].parent : null;
|
|
22761
|
+
if (collection == null) {
|
|
22762
|
+
return;
|
|
22763
|
+
}
|
|
22764
|
+
// Draw order is color-like: once the equation has used front/back at least
|
|
22765
|
+
// once (so a baseline has been captured), every form resets to the natural
|
|
22766
|
+
// baseline before applying its ops - so a form with no front/back restores
|
|
22767
|
+
// the natural draw order. Equations that never use front/back are left
|
|
22768
|
+
// untouched (no baseline, no reset).
|
|
22769
|
+
if (ops.length === 0 && collection.equationDrawOrderBaseline == null) {
|
|
22770
|
+
return;
|
|
22771
|
+
}
|
|
22772
|
+
// Lazily capture / extend the baseline draw order on the shared collection
|
|
22773
|
+
// (so every form resets to the same natural order). New element names (added
|
|
22774
|
+
// after the baseline was captured) are appended in their current order.
|
|
22775
|
+
if (collection.equationDrawOrderBaseline == null) {
|
|
22776
|
+
collection.equationDrawOrderBaseline = [];
|
|
22777
|
+
}
|
|
22778
|
+
var baseline = collection.equationDrawOrderBaseline;
|
|
22779
|
+
var baselineSet = new Set(baseline);
|
|
22780
|
+
collection.drawOrder.forEach(function (name) {
|
|
22781
|
+
if (!baselineSet.has(name)) {
|
|
22782
|
+
baseline.push(name);
|
|
22783
|
+
baselineSet.add(name);
|
|
22784
|
+
}
|
|
22785
|
+
});
|
|
22786
|
+
// Reset to baseline (dropping any names no longer present) before applying.
|
|
22787
|
+
var currentSet = new Set(collection.drawOrder);
|
|
22788
|
+
collection.drawOrder = baseline.filter(function (name) {
|
|
22789
|
+
return currentSet.has(name);
|
|
22790
|
+
});
|
|
22791
|
+
ops.forEach(function (op) {
|
|
22792
|
+
_this3.applyDrawOrderOp(collection, op);
|
|
22793
|
+
});
|
|
22794
|
+
}
|
|
22795
|
+
|
|
22796
|
+
// Move a single op's element group within the equation collection's draw
|
|
22797
|
+
// stack. The group is always kept contiguous and in its current relative
|
|
22798
|
+
// order (front/back does not reorder within the group). The target position
|
|
22799
|
+
// is determined by `before`/`after` (anchor relative) or `num` (relative for
|
|
22800
|
+
// positive, absolute-from-the-extreme for negative), else the full extreme.
|
|
22801
|
+
// eslint-disable-next-line class-methods-use-this
|
|
22802
|
+
}, {
|
|
22803
|
+
key: "applyDrawOrderOp",
|
|
22804
|
+
value: function applyDrawOrderOp(collection, op) {
|
|
22805
|
+
var order = collection.drawOrder;
|
|
22806
|
+
var inGroup = {};
|
|
22807
|
+
op.elements.forEach(function (e) {
|
|
22808
|
+
inGroup[e.name] = true;
|
|
22809
|
+
});
|
|
22810
|
+
// Group names in their current relative draw order, so the move preserves it
|
|
22811
|
+
var group = order.filter(function (name) {
|
|
22812
|
+
return inGroup[name];
|
|
22813
|
+
});
|
|
22814
|
+
if (group.length === 0) {
|
|
22815
|
+
return;
|
|
22816
|
+
}
|
|
22817
|
+
var groupSize = group.length;
|
|
22818
|
+
var minIdx = order.indexOf(group[0]);
|
|
22819
|
+
var maxIdx = order.indexOf(group[groupSize - 1]);
|
|
22820
|
+
var rest = order.filter(function (name) {
|
|
22821
|
+
return !inGroup[name];
|
|
22822
|
+
});
|
|
22823
|
+
var restLength = rest.length;
|
|
22824
|
+
var anchorNames = function anchorNames(anchor) {
|
|
22825
|
+
if (anchor == null) {
|
|
22826
|
+
return [];
|
|
22827
|
+
}
|
|
22828
|
+
var arr = Array.isArray(anchor) ? anchor : [anchor];
|
|
22829
|
+
return arr.map(function (a) {
|
|
22830
|
+
return a != null && a.name != null ? a.name : a;
|
|
22831
|
+
}).filter(function (n) {
|
|
22832
|
+
return typeof n === 'string';
|
|
22833
|
+
});
|
|
22834
|
+
};
|
|
22835
|
+
var target;
|
|
22836
|
+
if (op.before != null) {
|
|
22837
|
+
// Position the group just before the most-back anchor (`num` shifts it
|
|
22838
|
+
// further back; defaults to 0 when an anchor is given). If none of the
|
|
22839
|
+
// named anchors resolve (typo, or the anchor is itself inside the moved
|
|
22840
|
+
// group), leave the group where the baseline placed it rather than
|
|
22841
|
+
// silently sending it to an extreme.
|
|
22842
|
+
var idxs = anchorNames(op.before).map(function (n) {
|
|
22843
|
+
return rest.indexOf(n);
|
|
22844
|
+
}).filter(function (i) {
|
|
22845
|
+
return i > -1;
|
|
22846
|
+
});
|
|
22847
|
+
if (idxs.length === 0) {
|
|
22848
|
+
return;
|
|
22849
|
+
}
|
|
22850
|
+
var num = op.num == null ? 0 : op.num;
|
|
22851
|
+
target = Math.min.apply(Math, _toConsumableArray(idxs)) - num;
|
|
22852
|
+
} else if (op.after != null) {
|
|
22853
|
+
// Position the group just after the most-front anchor (`num` shifts it
|
|
22854
|
+
// further forward; defaults to 0 when an anchor is given). As with
|
|
22855
|
+
// `before`, an unresolved anchor is a no-op.
|
|
22856
|
+
var _idxs = anchorNames(op.after).map(function (n) {
|
|
22857
|
+
return rest.indexOf(n);
|
|
22858
|
+
}).filter(function (i) {
|
|
22859
|
+
return i > -1;
|
|
22860
|
+
});
|
|
22861
|
+
if (_idxs.length === 0) {
|
|
22862
|
+
return;
|
|
22863
|
+
}
|
|
22864
|
+
var _num = op.num == null ? 0 : op.num;
|
|
22865
|
+
target = Math.max.apply(Math, _toConsumableArray(_idxs)) + 1 + _num;
|
|
22866
|
+
} else if (op.num == null) {
|
|
22867
|
+
target = op.front ? restLength : 0;
|
|
22868
|
+
} else {
|
|
22869
|
+
// Positive `num` moves the group that many places relative to its current
|
|
22870
|
+
// edge; negative `num` positions it absolutely, `|num|` places before the
|
|
22871
|
+
// full extreme.
|
|
22872
|
+
var n = op.num;
|
|
22873
|
+
if (op.front) {
|
|
22874
|
+
target = n >= 0 ? maxIdx + n - groupSize + 1 : restLength + n;
|
|
22875
|
+
} else {
|
|
22876
|
+
target = n >= 0 ? minIdx - n : -n;
|
|
22877
|
+
}
|
|
22203
22878
|
}
|
|
22879
|
+
target = Math.max(0, Math.min(restLength, target));
|
|
22880
|
+
collection.drawOrder = [].concat(_toConsumableArray(rest.slice(0, target)), _toConsumableArray(group), _toConsumableArray(rest.slice(target)));
|
|
22204
22881
|
}
|
|
22205
22882
|
}, {
|
|
22206
22883
|
key: "_dup",
|
|
@@ -22394,7 +23071,7 @@ var EquationForm = /*#__PURE__*/function (_Elements) {
|
|
|
22394
23071
|
}, {
|
|
22395
23072
|
key: "dissolveElements",
|
|
22396
23073
|
value: function dissolveElements(elements) {
|
|
22397
|
-
var
|
|
23074
|
+
var _this4 = this;
|
|
22398
23075
|
var dissolve = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'in';
|
|
22399
23076
|
var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.01;
|
|
22400
23077
|
var time = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
@@ -22413,7 +23090,7 @@ var EquationForm = /*#__PURE__*/function (_Elements) {
|
|
|
22413
23090
|
if (completed === count) {
|
|
22414
23091
|
if (callback) {
|
|
22415
23092
|
// callback(cancelled);
|
|
22416
|
-
|
|
23093
|
+
_this4.fnMap.exec(callback, cancelled);
|
|
22417
23094
|
}
|
|
22418
23095
|
}
|
|
22419
23096
|
};
|
|
@@ -22518,7 +23195,7 @@ var EquationForm = /*#__PURE__*/function (_Elements) {
|
|
|
22518
23195
|
}, {
|
|
22519
23196
|
key: "allHideShow",
|
|
22520
23197
|
value: function allHideShow() {
|
|
22521
|
-
var
|
|
23198
|
+
var _this5 = this;
|
|
22522
23199
|
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
22523
23200
|
var hideTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.5;
|
|
22524
23201
|
var blankTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.5;
|
|
@@ -22542,15 +23219,15 @@ var EquationForm = /*#__PURE__*/function (_Elements) {
|
|
|
22542
23219
|
if (elementsToShow.length === 0 && elementsShown.length === 0) {
|
|
22543
23220
|
if (callback != null) {
|
|
22544
23221
|
callback(false);
|
|
22545
|
-
return;
|
|
22546
23222
|
}
|
|
23223
|
+
return 0;
|
|
22547
23224
|
}
|
|
22548
23225
|
var dissolveOutCallback = function dissolveOutCallback() {
|
|
22549
|
-
|
|
23226
|
+
_this5.setPositions();
|
|
22550
23227
|
};
|
|
22551
23228
|
if (elementsToShow.length === 0) {
|
|
22552
23229
|
dissolveOutCallback = function dissolveOutCallback(cancelled) {
|
|
22553
|
-
|
|
23230
|
+
_this5.setPositions();
|
|
22554
23231
|
if (callback != null) {
|
|
22555
23232
|
callback(cancelled);
|
|
22556
23233
|
}
|
|
@@ -22587,6 +23264,13 @@ var EquationForm = /*#__PURE__*/function (_Elements) {
|
|
|
22587
23264
|
delay: blankTime
|
|
22588
23265
|
}).start();
|
|
22589
23266
|
});
|
|
23267
|
+
if (elementsToShow.length > 0) {
|
|
23268
|
+
cumTime += blankTime + showTime;
|
|
23269
|
+
}
|
|
23270
|
+
// Upper bound on the total animation time: when elementsToDelayShowing
|
|
23271
|
+
// finish their dissolveIn. elementsToShowAfterDissolve are scheduled with
|
|
23272
|
+
// `delay: blankTime` (not `cumTime + blankTime`) so they may finish earlier.
|
|
23273
|
+
return cumTime;
|
|
22590
23274
|
}
|
|
22591
23275
|
}, {
|
|
22592
23276
|
key: "applyElementMods",
|
|
@@ -22601,7 +23285,9 @@ var EquationForm = /*#__PURE__*/function (_Elements) {
|
|
|
22601
23285
|
return;
|
|
22602
23286
|
}
|
|
22603
23287
|
if (element != null && mods != null) {
|
|
22604
|
-
|
|
23288
|
+
// `back`/`front` are draw-order operations handled by setDrawOrder, not
|
|
23289
|
+
// element properties, so don't copy them onto the element.
|
|
23290
|
+
element.setProperties(mods, ['back', 'front']);
|
|
22605
23291
|
if (mods.color != null) {
|
|
22606
23292
|
element.setColor(mods.color);
|
|
22607
23293
|
}
|
|
@@ -22841,6 +23527,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22841
23527
|
/* harmony import */ var _Symbols_Line__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Symbols/Line */ "./src/js/figure/Equation/Symbols/Line.ts");
|
|
22842
23528
|
/* harmony import */ var _Elements_Offset__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Elements/Offset */ "./src/js/figure/Equation/Elements/Offset.ts");
|
|
22843
23529
|
/* harmony import */ var _Elements_Color__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Elements/Color */ "./src/js/figure/Equation/Elements/Color.ts");
|
|
23530
|
+
/* harmony import */ var _Elements_Opacity__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Elements/Opacity */ "./src/js/figure/Equation/Elements/Opacity.ts");
|
|
23531
|
+
/* harmony import */ var _Elements_DrawOrder__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Elements/DrawOrder */ "./src/js/figure/Equation/Elements/DrawOrder.ts");
|
|
22844
23532
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
22845
23533
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
22846
23534
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -22871,6 +23559,8 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
22871
23559
|
|
|
22872
23560
|
|
|
22873
23561
|
|
|
23562
|
+
|
|
23563
|
+
|
|
22874
23564
|
// import type {
|
|
22875
23565
|
// EQN_Annotation, EQN_EncompassGlyph, EQN_LeftRightGlyph, EQN_TopBottomGlyph,
|
|
22876
23566
|
// } from './Elements/BaseAnnotationFunction';
|
|
@@ -22923,6 +23613,10 @@ function getFigureElement(elementsObject, name) {
|
|
|
22923
23613
|
* - `{ prodOf: `{@link EQN_ProdOf} `}`
|
|
22924
23614
|
* - `{ topStrike: `{@link EQN_StrikeComment} `}`
|
|
22925
23615
|
* - `{ bottomStrike: `{@link EQN_StrikeComment} `}`
|
|
23616
|
+
* - `{ color: `{@link EQN_Color} `}`
|
|
23617
|
+
* - `{ opacity: `{@link EQN_Opacity} `}`
|
|
23618
|
+
* - `{ back: `{@link EQN_Back} `}`
|
|
23619
|
+
* - `{ front: `{@link EQN_Front} `}`
|
|
22926
23620
|
* - `{ make: string, name?: string, ... }` (inline element — creates any
|
|
22927
23621
|
* element type directly in a form using the same `make` values as
|
|
22928
23622
|
* {@link Figure.add}. If `name` is omitted, one is auto-generated.)
|
|
@@ -23317,6 +24011,243 @@ function getFigureElement(elementsObject, name) {
|
|
|
23317
24011
|
* },
|
|
23318
24012
|
* touch: { onClick: e => e.nextForm() },
|
|
23319
24013
|
* });
|
|
24014
|
+
* @example
|
|
24015
|
+
* // The `color` function recolours a phrase explicitly. Separately, an element
|
|
24016
|
+
* // can opt out of the equation's default ('form') colour cascade with
|
|
24017
|
+
* // `ignoreSetColor`, while still accepting explicit colour commands. Here both
|
|
24018
|
+
* // squares start blue; recolouring the whole equation to grey greys the left
|
|
24019
|
+
* // (free) square, but the right (locked) square keeps its colour.
|
|
24020
|
+
* const blue = [0, 0, 1, 1];
|
|
24021
|
+
* const locked = figure.primitives.rectangle({ width: 0.5, height: 0.5, color: blue });
|
|
24022
|
+
* locked.ignoreSetColor = 'form'; // ignore the default cascade, keep blue
|
|
24023
|
+
* const eqn = figure.add({
|
|
24024
|
+
* make: 'equation',
|
|
24025
|
+
* color: [1, 0, 0, 1],
|
|
24026
|
+
* elements: {
|
|
24027
|
+
* free: figure.primitives.rectangle({ width: 0.5, height: 0.5, color: blue }),
|
|
24028
|
+
* locked,
|
|
24029
|
+
* },
|
|
24030
|
+
* forms: { 0: ['free', ' ', 'locked'] },
|
|
24031
|
+
* });
|
|
24032
|
+
* eqn.setColor([0.5, 0.5, 0.5, 1], true, 'form'); // free -> grey, locked stays blue
|
|
24033
|
+
* @interface
|
|
24034
|
+
* @group Equation Layout
|
|
24035
|
+
*/
|
|
24036
|
+
|
|
24037
|
+
/**
|
|
24038
|
+
* Equation opacity function
|
|
24039
|
+
*
|
|
24040
|
+
* Set an opacity multiplier on an equation phrase. The opacity cascades
|
|
24041
|
+
* multiplicatively, so nested `opacity` functions multiply together (e.g. an
|
|
24042
|
+
* outer `0.5` around an inner `0.5` yields `0.25` on the inner content).
|
|
24043
|
+
*
|
|
24044
|
+
* Opacity values are expected to be in the range `[0, 1]`. Whenever the form
|
|
24045
|
+
* is shown, the cascaded opacity is assigned to each wrapped element, overriding
|
|
24046
|
+
* any externally-set element `opacity`. Set `ignoreOpacity: true` on the form
|
|
24047
|
+
* to suppress this and preserve externally-set opacities.
|
|
24048
|
+
*
|
|
24049
|
+
* Options can be an object, or an array in the property order below
|
|
24050
|
+
*
|
|
24051
|
+
* @property {TypeEquationPhrase} content
|
|
24052
|
+
* @property {number} opacity opacity multiplier in the range `[0, 1]`
|
|
24053
|
+
* @property {boolean} [fullContentBounds] Use full bounds with content (`false`)
|
|
24054
|
+
*
|
|
24055
|
+
* @see To test examples, append them to the
|
|
24056
|
+
* <a href="#drawing-boilerplate">boilerplate</a>
|
|
24057
|
+
*
|
|
24058
|
+
* @example
|
|
24059
|
+
* // Simple Array Definition
|
|
24060
|
+
* figure.add({
|
|
24061
|
+
* make: 'equation',
|
|
24062
|
+
* forms: {
|
|
24063
|
+
* 0: ['a', { opacity: ['b', 0.3] }, 'c'],
|
|
24064
|
+
* },
|
|
24065
|
+
* });
|
|
24066
|
+
*
|
|
24067
|
+
* @example
|
|
24068
|
+
* // Simple Object Definition
|
|
24069
|
+
* figure.add({
|
|
24070
|
+
* make: 'equation',
|
|
24071
|
+
* forms: {
|
|
24072
|
+
* 0: [
|
|
24073
|
+
* 'a',
|
|
24074
|
+
* {
|
|
24075
|
+
* opacity: {
|
|
24076
|
+
* content: 'b',
|
|
24077
|
+
* opacity: 0.3,
|
|
24078
|
+
* },
|
|
24079
|
+
* },
|
|
24080
|
+
* 'c',
|
|
24081
|
+
* ],
|
|
24082
|
+
* },
|
|
24083
|
+
* });
|
|
24084
|
+
*
|
|
24085
|
+
* @interface
|
|
24086
|
+
* @group Equation Layout
|
|
24087
|
+
*/
|
|
24088
|
+
|
|
24089
|
+
/**
|
|
24090
|
+
* Equation back function
|
|
24091
|
+
*
|
|
24092
|
+
* Send an equation phrase's elements back in the equation's draw stack. All
|
|
24093
|
+
* elements within `content` are moved together as a group, keeping their
|
|
24094
|
+
* current relative draw order. Nested `front`/`back` functions are applied
|
|
24095
|
+
* inner-most first, so an inner `front`/`back` reorders the elements and this
|
|
24096
|
+
* (outer) function then moves the reordered group as a unit.
|
|
24097
|
+
*
|
|
24098
|
+
* The group's position is determined by, in order of precedence:
|
|
24099
|
+
* - `before` - position the group just before (behind) the most-back of the
|
|
24100
|
+
* named anchor element(s). `num` shifts it further back (default `0`).
|
|
24101
|
+
* - `after` - position the group just after (in front of) the most-front of
|
|
24102
|
+
* the named anchor element(s). `num` shifts it further forward (default `0`).
|
|
24103
|
+
* - `num` - a positive value moves the group that many places back; a negative
|
|
24104
|
+
* value positions it `|num|` places ahead of the very back.
|
|
24105
|
+
* - otherwise the group is sent completely to the back.
|
|
24106
|
+
*
|
|
24107
|
+
* The reorder is applied whenever the form is shown, relative to the equation's
|
|
24108
|
+
* natural (definition) draw order, so each form deterministically defines its
|
|
24109
|
+
* own stacking.
|
|
24110
|
+
*
|
|
24111
|
+
* Options can be an object, or an array in the property order below
|
|
24112
|
+
*
|
|
24113
|
+
* @property {TypeEquationPhrase} content
|
|
24114
|
+
* @property {number} [num] places to send the group back (positive), or an
|
|
24115
|
+
* absolute position `|num|` places ahead of the full back (negative). When
|
|
24116
|
+
* `before`/`after` is set, `num` is the offset from the anchor (default `0`).
|
|
24117
|
+
* If undefined (and no anchor), the group is sent completely to the back
|
|
24118
|
+
* @property {string | Array<string>} [before] anchor element name(s) - position
|
|
24119
|
+
* the group just before the most-back anchor
|
|
24120
|
+
* @property {string | Array<string>} [after] anchor element name(s) - position
|
|
24121
|
+
* the group just after the most-front anchor
|
|
24122
|
+
* @property {boolean} [fullContentBounds] Use full bounds with content (`false`)
|
|
24123
|
+
*
|
|
24124
|
+
* @see To test examples, append them to the
|
|
24125
|
+
* <a href="#drawing-boilerplate">boilerplate</a>
|
|
24126
|
+
*
|
|
24127
|
+
* @example
|
|
24128
|
+
* // Three overlapping squares, offset so the stacking order is visible. Blue
|
|
24129
|
+
* // is defined last so it sits on top by default; `back` sends it behind the
|
|
24130
|
+
* // red and green squares (so green ends up on top).
|
|
24131
|
+
* const sq = color => figure.primitives.rectangle({ width: 0.6, height: 0.6, color });
|
|
24132
|
+
* figure.add({
|
|
24133
|
+
* make: 'equation',
|
|
24134
|
+
* elements: {
|
|
24135
|
+
* r: sq([1, 0, 0, 1]),
|
|
24136
|
+
* g: sq([0, 0.8, 0, 1]),
|
|
24137
|
+
* b: sq([0, 0, 1, 1]),
|
|
24138
|
+
* },
|
|
24139
|
+
* forms: {
|
|
24140
|
+
* 0: [
|
|
24141
|
+
* { offset: ['r', [0, 0]] },
|
|
24142
|
+
* { offset: ['g', [0.3, -0.25]] },
|
|
24143
|
+
* { offset: [{ back: ['b'] }, [0.6, -0.5]] },
|
|
24144
|
+
* ],
|
|
24145
|
+
* },
|
|
24146
|
+
* });
|
|
24147
|
+
*
|
|
24148
|
+
* @example
|
|
24149
|
+
* // Object Definition with an anchor - position the blue square just before
|
|
24150
|
+
* // (behind) the red square, so red and green sit on top of it.
|
|
24151
|
+
* const sq = color => figure.primitives.rectangle({ width: 0.6, height: 0.6, color });
|
|
24152
|
+
* figure.add({
|
|
24153
|
+
* make: 'equation',
|
|
24154
|
+
* elements: {
|
|
24155
|
+
* r: sq([1, 0, 0, 1]),
|
|
24156
|
+
* g: sq([0, 0.8, 0, 1]),
|
|
24157
|
+
* b: sq([0, 0, 1, 1]),
|
|
24158
|
+
* },
|
|
24159
|
+
* forms: {
|
|
24160
|
+
* 0: [
|
|
24161
|
+
* { offset: ['r', [0, 0]] },
|
|
24162
|
+
* { offset: ['g', [0.3, -0.25]] },
|
|
24163
|
+
* { offset: [{ back: { content: 'b', before: 'r' } }, [0.6, -0.5]] },
|
|
24164
|
+
* ],
|
|
24165
|
+
* },
|
|
24166
|
+
* });
|
|
24167
|
+
*
|
|
24168
|
+
* @interface
|
|
24169
|
+
* @group Equation Layout
|
|
24170
|
+
*/
|
|
24171
|
+
|
|
24172
|
+
/**
|
|
24173
|
+
* Equation front function
|
|
24174
|
+
*
|
|
24175
|
+
* Bring an equation phrase's elements forward in the equation's draw stack. All
|
|
24176
|
+
* elements within `content` are moved together as a group, keeping their
|
|
24177
|
+
* current relative draw order. Nested `front`/`back` functions are applied
|
|
24178
|
+
* inner-most first, so an inner `front`/`back` reorders the elements and this
|
|
24179
|
+
* (outer) function then moves the reordered group as a unit.
|
|
24180
|
+
*
|
|
24181
|
+
* The group's position is determined by, in order of precedence:
|
|
24182
|
+
* - `before` - position the group just before (behind) the most-back of the
|
|
24183
|
+
* named anchor element(s). `num` shifts it further back (default `0`).
|
|
24184
|
+
* - `after` - position the group just after (in front of) the most-front of
|
|
24185
|
+
* the named anchor element(s). `num` shifts it further forward (default `0`).
|
|
24186
|
+
* - `num` - a positive value moves the group that many places forward; a
|
|
24187
|
+
* negative value positions it `|num|` places behind the very front.
|
|
24188
|
+
* - otherwise the group is brought completely to the front.
|
|
24189
|
+
*
|
|
24190
|
+
* The reorder is applied whenever the form is shown, relative to the equation's
|
|
24191
|
+
* natural (definition) draw order, so each form deterministically defines its
|
|
24192
|
+
* own stacking.
|
|
24193
|
+
*
|
|
24194
|
+
* Options can be an object, or an array in the property order below
|
|
24195
|
+
*
|
|
24196
|
+
* @property {TypeEquationPhrase} content
|
|
24197
|
+
* @property {number} [num] places to bring the group forward (positive), or an
|
|
24198
|
+
* absolute position `|num|` places behind the full front (negative). When
|
|
24199
|
+
* `before`/`after` is set, `num` is the offset from the anchor (default `0`).
|
|
24200
|
+
* If undefined (and no anchor), the group is brought completely to the front
|
|
24201
|
+
* @property {string | Array<string>} [before] anchor element name(s) - position
|
|
24202
|
+
* the group just before the most-back anchor
|
|
24203
|
+
* @property {string | Array<string>} [after] anchor element name(s) - position
|
|
24204
|
+
* the group just after the most-front anchor
|
|
24205
|
+
* @property {boolean} [fullContentBounds] Use full bounds with content (`false`)
|
|
24206
|
+
*
|
|
24207
|
+
* @see To test examples, append them to the
|
|
24208
|
+
* <a href="#drawing-boilerplate">boilerplate</a>
|
|
24209
|
+
*
|
|
24210
|
+
* @example
|
|
24211
|
+
* // Three overlapping squares, offset so the stacking order is visible. Red is
|
|
24212
|
+
* // defined first so it sits at the back by default; `front` brings it on top
|
|
24213
|
+
* // of the green and blue squares.
|
|
24214
|
+
* const sq = color => figure.primitives.rectangle({ width: 0.6, height: 0.6, color });
|
|
24215
|
+
* figure.add({
|
|
24216
|
+
* make: 'equation',
|
|
24217
|
+
* elements: {
|
|
24218
|
+
* r: sq([1, 0, 0, 1]),
|
|
24219
|
+
* g: sq([0, 0.8, 0, 1]),
|
|
24220
|
+
* b: sq([0, 0, 1, 1]),
|
|
24221
|
+
* },
|
|
24222
|
+
* forms: {
|
|
24223
|
+
* 0: [
|
|
24224
|
+
* { offset: [{ front: ['r'] }, [0, 0]] },
|
|
24225
|
+
* { offset: ['g', [0.3, -0.25]] },
|
|
24226
|
+
* { offset: ['b', [0.6, -0.5]] },
|
|
24227
|
+
* ],
|
|
24228
|
+
* },
|
|
24229
|
+
* });
|
|
24230
|
+
*
|
|
24231
|
+
* @example
|
|
24232
|
+
* // Object Definition with an anchor - position the red square just after (in
|
|
24233
|
+
* // front of) the green square, so it covers green but stays behind blue.
|
|
24234
|
+
* const sq = color => figure.primitives.rectangle({ width: 0.6, height: 0.6, color });
|
|
24235
|
+
* figure.add({
|
|
24236
|
+
* make: 'equation',
|
|
24237
|
+
* elements: {
|
|
24238
|
+
* r: sq([1, 0, 0, 1]),
|
|
24239
|
+
* g: sq([0, 0.8, 0, 1]),
|
|
24240
|
+
* b: sq([0, 0, 1, 1]),
|
|
24241
|
+
* },
|
|
24242
|
+
* forms: {
|
|
24243
|
+
* 0: [
|
|
24244
|
+
* { offset: [{ front: { content: 'r', after: 'g' } }, [0, 0]] },
|
|
24245
|
+
* { offset: ['g', [0.3, -0.25]] },
|
|
24246
|
+
* { offset: ['b', [0.6, -0.5]] },
|
|
24247
|
+
* ],
|
|
24248
|
+
* },
|
|
24249
|
+
* });
|
|
24250
|
+
*
|
|
23320
24251
|
* @interface
|
|
23321
24252
|
* @group Equation Layout
|
|
23322
24253
|
*/
|
|
@@ -25723,6 +26654,15 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
25723
26654
|
if (name === 'color') {
|
|
25724
26655
|
return this.color(params);
|
|
25725
26656
|
}
|
|
26657
|
+
if (name === 'opacity') {
|
|
26658
|
+
return this.opacity(params);
|
|
26659
|
+
}
|
|
26660
|
+
if (name === 'back') {
|
|
26661
|
+
return this.back(params);
|
|
26662
|
+
}
|
|
26663
|
+
if (name === 'front') {
|
|
26664
|
+
return this.front(params);
|
|
26665
|
+
}
|
|
25726
26666
|
return null;
|
|
25727
26667
|
}
|
|
25728
26668
|
|
|
@@ -26348,6 +27288,108 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
26348
27288
|
}
|
|
26349
27289
|
}
|
|
26350
27290
|
|
|
27291
|
+
/**
|
|
27292
|
+
* Equation opacity function
|
|
27293
|
+
* @see {@link EQN_Opacity} for description and examples
|
|
27294
|
+
*/
|
|
27295
|
+
}, {
|
|
27296
|
+
key: "opacity",
|
|
27297
|
+
value: function opacity(options) {
|
|
27298
|
+
try {
|
|
27299
|
+
var content;
|
|
27300
|
+
var _opacity;
|
|
27301
|
+
var fullContentBounds;
|
|
27302
|
+
var defaultOptions = {
|
|
27303
|
+
opacity: null,
|
|
27304
|
+
fullContentBounds: false
|
|
27305
|
+
};
|
|
27306
|
+
if (Array.isArray(options)) {
|
|
27307
|
+
var _options6 = _slicedToArray(options, 3);
|
|
27308
|
+
content = _options6[0];
|
|
27309
|
+
_opacity = _options6[1];
|
|
27310
|
+
fullContentBounds = _options6[2];
|
|
27311
|
+
} else {
|
|
27312
|
+
content = options.content;
|
|
27313
|
+
_opacity = options.opacity;
|
|
27314
|
+
fullContentBounds = options.fullContentBounds;
|
|
27315
|
+
}
|
|
27316
|
+
var optionsIn = {
|
|
27317
|
+
opacity: _opacity,
|
|
27318
|
+
fullContentBounds: fullContentBounds
|
|
27319
|
+
};
|
|
27320
|
+
var o = (0,_tools_tools__WEBPACK_IMPORTED_MODULE_1__.joinObjects)(defaultOptions, optionsIn);
|
|
27321
|
+
return new _Elements_Opacity__WEBPACK_IMPORTED_MODULE_14__["default"]([this.contentToElement(content)], [], o);
|
|
27322
|
+
} catch (e) {
|
|
27323
|
+
throw new Error("FigureOne Equation Opacity Error: ".concat(e.message));
|
|
27324
|
+
}
|
|
27325
|
+
}
|
|
27326
|
+
|
|
27327
|
+
/**
|
|
27328
|
+
* Equation back function
|
|
27329
|
+
* @see {@link EQN_Back} for description and examples
|
|
27330
|
+
*/
|
|
27331
|
+
}, {
|
|
27332
|
+
key: "back",
|
|
27333
|
+
value: function back(options) {
|
|
27334
|
+
try {
|
|
27335
|
+
return this.drawOrder(options, false);
|
|
27336
|
+
} catch (e) {
|
|
27337
|
+
throw new Error("FigureOne Equation Back Error: ".concat(e.message));
|
|
27338
|
+
}
|
|
27339
|
+
}
|
|
27340
|
+
|
|
27341
|
+
/**
|
|
27342
|
+
* Equation front function
|
|
27343
|
+
* @see {@link EQN_Front} for description and examples
|
|
27344
|
+
*/
|
|
27345
|
+
}, {
|
|
27346
|
+
key: "front",
|
|
27347
|
+
value: function front(options) {
|
|
27348
|
+
try {
|
|
27349
|
+
return this.drawOrder(options, true);
|
|
27350
|
+
} catch (e) {
|
|
27351
|
+
throw new Error("FigureOne Equation Front Error: ".concat(e.message));
|
|
27352
|
+
}
|
|
27353
|
+
}
|
|
27354
|
+
|
|
27355
|
+
// Shared implementation for the `front`/`back` equation functions.
|
|
27356
|
+
}, {
|
|
27357
|
+
key: "drawOrder",
|
|
27358
|
+
value: function drawOrder(options, front) {
|
|
27359
|
+
var content;
|
|
27360
|
+
var num;
|
|
27361
|
+
var fullContentBounds;
|
|
27362
|
+
var before;
|
|
27363
|
+
var after;
|
|
27364
|
+
var defaultOptions = {
|
|
27365
|
+
num: null,
|
|
27366
|
+
fullContentBounds: false,
|
|
27367
|
+
before: null,
|
|
27368
|
+
after: null
|
|
27369
|
+
};
|
|
27370
|
+
if (Array.isArray(options)) {
|
|
27371
|
+
var _options7 = _slicedToArray(options, 3);
|
|
27372
|
+
content = _options7[0];
|
|
27373
|
+
num = _options7[1];
|
|
27374
|
+
fullContentBounds = _options7[2];
|
|
27375
|
+
} else {
|
|
27376
|
+
content = options.content;
|
|
27377
|
+
num = options.num;
|
|
27378
|
+
fullContentBounds = options.fullContentBounds;
|
|
27379
|
+
before = options.before;
|
|
27380
|
+
after = options.after;
|
|
27381
|
+
}
|
|
27382
|
+
var optionsIn = {
|
|
27383
|
+
num: num,
|
|
27384
|
+
fullContentBounds: fullContentBounds,
|
|
27385
|
+
front: front,
|
|
27386
|
+
before: before,
|
|
27387
|
+
after: after
|
|
27388
|
+
};
|
|
27389
|
+
var o = (0,_tools_tools__WEBPACK_IMPORTED_MODULE_1__.joinObjects)(defaultOptions, optionsIn);
|
|
27390
|
+
return new _Elements_DrawOrder__WEBPACK_IMPORTED_MODULE_15__["default"]([this.contentToElement(content)], [], o);
|
|
27391
|
+
}
|
|
27392
|
+
|
|
26351
27393
|
/**
|
|
26352
27394
|
* Equation fraction function
|
|
26353
27395
|
* @see {@link EQN_Fraction} for description and examples
|
|
@@ -26382,17 +27424,17 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
26382
27424
|
baseline: 'vinculum'
|
|
26383
27425
|
};
|
|
26384
27426
|
if (Array.isArray(options)) {
|
|
26385
|
-
var
|
|
26386
|
-
numerator =
|
|
26387
|
-
symbol =
|
|
26388
|
-
denominator =
|
|
26389
|
-
scale =
|
|
26390
|
-
numeratorSpace =
|
|
26391
|
-
denominatorSpace =
|
|
26392
|
-
overhang =
|
|
26393
|
-
offsetY =
|
|
26394
|
-
baseline =
|
|
26395
|
-
fullContentBounds =
|
|
27427
|
+
var _options8 = _slicedToArray(options, 10);
|
|
27428
|
+
numerator = _options8[0];
|
|
27429
|
+
symbol = _options8[1];
|
|
27430
|
+
denominator = _options8[2];
|
|
27431
|
+
scale = _options8[3];
|
|
27432
|
+
numeratorSpace = _options8[4];
|
|
27433
|
+
denominatorSpace = _options8[5];
|
|
27434
|
+
overhang = _options8[6];
|
|
27435
|
+
offsetY = _options8[7];
|
|
27436
|
+
baseline = _options8[8];
|
|
27437
|
+
fullContentBounds = _options8[9];
|
|
26396
27438
|
} else {
|
|
26397
27439
|
numerator = options.numerator;
|
|
26398
27440
|
symbol = options.symbol;
|
|
@@ -26537,14 +27579,14 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
26537
27579
|
var superscriptOffset = null;
|
|
26538
27580
|
var inSize;
|
|
26539
27581
|
if (Array.isArray(options)) {
|
|
26540
|
-
var
|
|
26541
|
-
content =
|
|
26542
|
-
superscript =
|
|
26543
|
-
subscript =
|
|
26544
|
-
scale =
|
|
26545
|
-
superscriptOffset =
|
|
26546
|
-
subscriptOffset =
|
|
26547
|
-
inSize =
|
|
27582
|
+
var _options9 = _slicedToArray(options, 7);
|
|
27583
|
+
content = _options9[0];
|
|
27584
|
+
superscript = _options9[1];
|
|
27585
|
+
subscript = _options9[2];
|
|
27586
|
+
scale = _options9[3];
|
|
27587
|
+
superscriptOffset = _options9[4];
|
|
27588
|
+
subscriptOffset = _options9[5];
|
|
27589
|
+
inSize = _options9[6];
|
|
26548
27590
|
} else {
|
|
26549
27591
|
content = options.content;
|
|
26550
27592
|
superscript = options.superscript;
|
|
@@ -26614,12 +27656,12 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
26614
27656
|
// let superscriptOffset = null;
|
|
26615
27657
|
var inSize;
|
|
26616
27658
|
if (Array.isArray(options)) {
|
|
26617
|
-
var
|
|
26618
|
-
content =
|
|
26619
|
-
superscript =
|
|
26620
|
-
scale =
|
|
26621
|
-
offset =
|
|
26622
|
-
inSize =
|
|
27659
|
+
var _options0 = _slicedToArray(options, 5);
|
|
27660
|
+
content = _options0[0];
|
|
27661
|
+
superscript = _options0[1];
|
|
27662
|
+
scale = _options0[2];
|
|
27663
|
+
offset = _options0[3];
|
|
27664
|
+
inSize = _options0[4];
|
|
26623
27665
|
} else {
|
|
26624
27666
|
content = options.content;
|
|
26625
27667
|
superscript = options.superscript;
|
|
@@ -26653,12 +27695,12 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
26653
27695
|
var offset;
|
|
26654
27696
|
var inSize;
|
|
26655
27697
|
if (Array.isArray(options)) {
|
|
26656
|
-
var
|
|
26657
|
-
content =
|
|
26658
|
-
subscript =
|
|
26659
|
-
scale =
|
|
26660
|
-
offset =
|
|
26661
|
-
inSize =
|
|
27698
|
+
var _options1 = _slicedToArray(options, 5);
|
|
27699
|
+
content = _options1[0];
|
|
27700
|
+
subscript = _options1[1];
|
|
27701
|
+
scale = _options1[2];
|
|
27702
|
+
offset = _options1[3];
|
|
27703
|
+
inSize = _options1[4];
|
|
26662
27704
|
} else {
|
|
26663
27705
|
content = options.content;
|
|
26664
27706
|
subscript = options.subscript;
|
|
@@ -26702,14 +27744,14 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
26702
27744
|
rightSpace: null
|
|
26703
27745
|
};
|
|
26704
27746
|
if (Array.isArray(options)) {
|
|
26705
|
-
var
|
|
26706
|
-
content =
|
|
26707
|
-
symbol =
|
|
26708
|
-
space =
|
|
26709
|
-
topSpace =
|
|
26710
|
-
rightSpace =
|
|
26711
|
-
bottomSpace =
|
|
26712
|
-
leftSpace =
|
|
27747
|
+
var _options10 = _slicedToArray(options, 7);
|
|
27748
|
+
content = _options10[0];
|
|
27749
|
+
symbol = _options10[1];
|
|
27750
|
+
space = _options10[2];
|
|
27751
|
+
topSpace = _options10[3];
|
|
27752
|
+
rightSpace = _options10[4];
|
|
27753
|
+
bottomSpace = _options10[5];
|
|
27754
|
+
leftSpace = _options10[6];
|
|
26713
27755
|
} else {
|
|
26714
27756
|
content = options.content;
|
|
26715
27757
|
symbol = options.symbol;
|
|
@@ -26779,17 +27821,17 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
26779
27821
|
useFullBounds: false
|
|
26780
27822
|
};
|
|
26781
27823
|
if (Array.isArray(options)) {
|
|
26782
|
-
var
|
|
26783
|
-
content =
|
|
26784
|
-
symbol =
|
|
26785
|
-
inSize =
|
|
26786
|
-
space =
|
|
26787
|
-
topSpace =
|
|
26788
|
-
rightSpace =
|
|
26789
|
-
bottomSpace =
|
|
26790
|
-
leftSpace =
|
|
26791
|
-
fullContentBounds =
|
|
26792
|
-
useFullBounds =
|
|
27824
|
+
var _options11 = _slicedToArray(options, 10);
|
|
27825
|
+
content = _options11[0];
|
|
27826
|
+
symbol = _options11[1];
|
|
27827
|
+
inSize = _options11[2];
|
|
27828
|
+
space = _options11[3];
|
|
27829
|
+
topSpace = _options11[4];
|
|
27830
|
+
rightSpace = _options11[5];
|
|
27831
|
+
bottomSpace = _options11[6];
|
|
27832
|
+
leftSpace = _options11[7];
|
|
27833
|
+
fullContentBounds = _options11[8];
|
|
27834
|
+
useFullBounds = _options11[9];
|
|
26793
27835
|
} else {
|
|
26794
27836
|
content = options.content;
|
|
26795
27837
|
symbol = options.symbol;
|
|
@@ -26856,12 +27898,12 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
26856
27898
|
bottom: 0
|
|
26857
27899
|
};
|
|
26858
27900
|
if (Array.isArray(options)) {
|
|
26859
|
-
var
|
|
26860
|
-
content =
|
|
26861
|
-
top =
|
|
26862
|
-
right =
|
|
26863
|
-
bottom =
|
|
26864
|
-
left =
|
|
27901
|
+
var _options12 = _slicedToArray(options, 5);
|
|
27902
|
+
content = _options12[0];
|
|
27903
|
+
top = _options12[1];
|
|
27904
|
+
right = _options12[2];
|
|
27905
|
+
bottom = _options12[3];
|
|
27906
|
+
left = _options12[4];
|
|
26865
27907
|
} else {
|
|
26866
27908
|
content = options.content;
|
|
26867
27909
|
top = options.top;
|
|
@@ -26948,17 +27990,17 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
26948
27990
|
fullContentBounds: false
|
|
26949
27991
|
};
|
|
26950
27992
|
if (Array.isArray(options)) {
|
|
26951
|
-
var
|
|
26952
|
-
order =
|
|
26953
|
-
left =
|
|
26954
|
-
content =
|
|
26955
|
-
right =
|
|
26956
|
-
scale =
|
|
26957
|
-
fit =
|
|
26958
|
-
space =
|
|
26959
|
-
yAlign =
|
|
26960
|
-
brac =
|
|
26961
|
-
fullContentBounds =
|
|
27993
|
+
var _options13 = _slicedToArray(options, 10);
|
|
27994
|
+
order = _options13[0];
|
|
27995
|
+
left = _options13[1];
|
|
27996
|
+
content = _options13[2];
|
|
27997
|
+
right = _options13[3];
|
|
27998
|
+
scale = _options13[4];
|
|
27999
|
+
fit = _options13[5];
|
|
28000
|
+
space = _options13[6];
|
|
28001
|
+
yAlign = _options13[7];
|
|
28002
|
+
brac = _options13[8];
|
|
28003
|
+
fullContentBounds = _options13[9];
|
|
26962
28004
|
} else {
|
|
26963
28005
|
order = options.order;
|
|
26964
28006
|
left = options.left;
|
|
@@ -27031,13 +28073,13 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
27031
28073
|
fullContentBounds: false
|
|
27032
28074
|
};
|
|
27033
28075
|
if (Array.isArray(options)) {
|
|
27034
|
-
var
|
|
27035
|
-
content =
|
|
27036
|
-
justify =
|
|
27037
|
-
baselineSpace =
|
|
27038
|
-
space =
|
|
27039
|
-
yAlign =
|
|
27040
|
-
fullContentBounds =
|
|
28076
|
+
var _options14 = _slicedToArray(options, 6);
|
|
28077
|
+
content = _options14[0];
|
|
28078
|
+
justify = _options14[1];
|
|
28079
|
+
baselineSpace = _options14[2];
|
|
28080
|
+
space = _options14[3];
|
|
28081
|
+
yAlign = _options14[4];
|
|
28082
|
+
fullContentBounds = _options14[5];
|
|
27041
28083
|
} else {
|
|
27042
28084
|
content = options.content;
|
|
27043
28085
|
justify = options.justify;
|
|
@@ -27155,34 +28197,34 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
27155
28197
|
useFullBounds: false
|
|
27156
28198
|
};
|
|
27157
28199
|
if (Array.isArray(options)) {
|
|
27158
|
-
var
|
|
27159
|
-
symbol =
|
|
27160
|
-
content =
|
|
27161
|
-
from =
|
|
27162
|
-
to =
|
|
27163
|
-
inSize =
|
|
27164
|
-
space =
|
|
27165
|
-
topSpace =
|
|
27166
|
-
bottomSpace =
|
|
27167
|
-
height =
|
|
27168
|
-
yOffset =
|
|
27169
|
-
scale =
|
|
27170
|
-
fromScale =
|
|
27171
|
-
toScale =
|
|
27172
|
-
fromOffset =
|
|
27173
|
-
toOffset =
|
|
27174
|
-
limitsPosition =
|
|
27175
|
-
limitsAroundContent =
|
|
27176
|
-
fromXPosition =
|
|
27177
|
-
fromYPosition =
|
|
27178
|
-
fromXAlign =
|
|
27179
|
-
fromYAlign =
|
|
27180
|
-
toXPosition =
|
|
27181
|
-
toYPosition =
|
|
27182
|
-
toXAlign =
|
|
27183
|
-
toYAlign =
|
|
27184
|
-
fullBoundsContent =
|
|
27185
|
-
useFullBounds =
|
|
28200
|
+
var _options15 = _slicedToArray(options, 27);
|
|
28201
|
+
symbol = _options15[0];
|
|
28202
|
+
content = _options15[1];
|
|
28203
|
+
from = _options15[2];
|
|
28204
|
+
to = _options15[3];
|
|
28205
|
+
inSize = _options15[4];
|
|
28206
|
+
space = _options15[5];
|
|
28207
|
+
topSpace = _options15[6];
|
|
28208
|
+
bottomSpace = _options15[7];
|
|
28209
|
+
height = _options15[8];
|
|
28210
|
+
yOffset = _options15[9];
|
|
28211
|
+
scale = _options15[10];
|
|
28212
|
+
fromScale = _options15[11];
|
|
28213
|
+
toScale = _options15[12];
|
|
28214
|
+
fromOffset = _options15[13];
|
|
28215
|
+
toOffset = _options15[14];
|
|
28216
|
+
limitsPosition = _options15[15];
|
|
28217
|
+
limitsAroundContent = _options15[16];
|
|
28218
|
+
fromXPosition = _options15[17];
|
|
28219
|
+
fromYPosition = _options15[18];
|
|
28220
|
+
fromXAlign = _options15[19];
|
|
28221
|
+
fromYAlign = _options15[20];
|
|
28222
|
+
toXPosition = _options15[21];
|
|
28223
|
+
toYPosition = _options15[22];
|
|
28224
|
+
toXAlign = _options15[23];
|
|
28225
|
+
toYAlign = _options15[24];
|
|
28226
|
+
fullBoundsContent = _options15[25];
|
|
28227
|
+
useFullBounds = _options15[26];
|
|
27186
28228
|
} else {
|
|
27187
28229
|
content = options.content;
|
|
27188
28230
|
symbol = options.symbol;
|
|
@@ -27731,17 +28773,17 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
27731
28773
|
useFullBounds: false
|
|
27732
28774
|
};
|
|
27733
28775
|
if (Array.isArray(options)) {
|
|
27734
|
-
var
|
|
27735
|
-
content =
|
|
27736
|
-
symbol =
|
|
27737
|
-
inSize =
|
|
27738
|
-
space =
|
|
27739
|
-
topSpace =
|
|
27740
|
-
rightSpace =
|
|
27741
|
-
bottomSpace =
|
|
27742
|
-
leftSpace =
|
|
27743
|
-
fullContentBounds =
|
|
27744
|
-
useFullBounds =
|
|
28776
|
+
var _options16 = _slicedToArray(options, 10);
|
|
28777
|
+
content = _options16[0];
|
|
28778
|
+
symbol = _options16[1];
|
|
28779
|
+
inSize = _options16[2];
|
|
28780
|
+
space = _options16[3];
|
|
28781
|
+
topSpace = _options16[4];
|
|
28782
|
+
rightSpace = _options16[5];
|
|
28783
|
+
bottomSpace = _options16[6];
|
|
28784
|
+
leftSpace = _options16[7];
|
|
28785
|
+
fullContentBounds = _options16[8];
|
|
28786
|
+
useFullBounds = _options16[9];
|
|
27745
28787
|
} else {
|
|
27746
28788
|
content = options.content;
|
|
27747
28789
|
symbol = options.symbol;
|
|
@@ -51603,7 +52645,11 @@ var FigureElementPrimitive2DText = /*#__PURE__*/function (_FigureElementPrimiti)
|
|
|
51603
52645
|
key: "setColor",
|
|
51604
52646
|
value: function setColor(color) {
|
|
51605
52647
|
var setDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
51606
|
-
|
|
52648
|
+
var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
52649
|
+
if (this.isSetColorIgnored(from)) {
|
|
52650
|
+
return;
|
|
52651
|
+
}
|
|
52652
|
+
_superPropGet(FigureElementPrimitive2DText, "setColor", this, 3)([color, setDefault, from]);
|
|
51607
52653
|
this.drawingObject.font.color = color.slice();
|
|
51608
52654
|
}
|
|
51609
52655
|
}, {
|
|
@@ -52072,7 +53118,11 @@ var FigureElementPrimitiveGLText = /*#__PURE__*/function (_FigureElementPrimiti)
|
|
|
52072
53118
|
key: "setColor",
|
|
52073
53119
|
value: function setColor(color) {
|
|
52074
53120
|
var setDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
52075
|
-
|
|
53121
|
+
var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
53122
|
+
if (this.isSetColorIgnored(from)) {
|
|
53123
|
+
return;
|
|
53124
|
+
}
|
|
53125
|
+
_superPropGet(FigureElementPrimitiveGLText, "setColor", this, 3)([color, setDefault, from]);
|
|
52076
53126
|
this.font.color = color.slice();
|
|
52077
53127
|
}
|
|
52078
53128
|
}, {
|
|
@@ -80795,8 +81845,8 @@ var tools = {
|
|
|
80795
81845
|
*/
|
|
80796
81846
|
|
|
80797
81847
|
var Fig = {
|
|
80798
|
-
version: "1.
|
|
80799
|
-
gitHash: "
|
|
81848
|
+
version: "1.7.0",
|
|
81849
|
+
gitHash: "8c04ba173",
|
|
80800
81850
|
tools: tools,
|
|
80801
81851
|
Figure: _js_figure_Figure__WEBPACK_IMPORTED_MODULE_5__["default"],
|
|
80802
81852
|
Recorder: _js_figure_Recorder_Recorder__WEBPACK_IMPORTED_MODULE_7__.Recorder,
|