figureone 1.4.0 → 1.5.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/index.js
CHANGED
|
@@ -17227,7 +17227,7 @@ function offsetLocationForGlyphs(glyphs, offset) {
|
|
|
17227
17227
|
var BaseAnnotationFunction = /*#__PURE__*/function () {
|
|
17228
17228
|
// Optional caller-supplied identifier, assigned post-dispatch by
|
|
17229
17229
|
// EquationFunctions.eqnMethod. Has no layout effect; used by
|
|
17230
|
-
// Equation.
|
|
17230
|
+
// Equation.getFunctionElements to look up the contents of a sub-tree.
|
|
17231
17231
|
|
|
17232
17232
|
function BaseAnnotationFunction(content, annotations, glyphs, options) {
|
|
17233
17233
|
var showContent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
@@ -17877,7 +17877,7 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
|
|
|
17877
17877
|
var BaseEquationFunction = /*#__PURE__*/function (_Elements) {
|
|
17878
17878
|
// Optional caller-supplied identifier, assigned post-dispatch by
|
|
17879
17879
|
// EquationFunctions.eqnMethod. Has no layout effect; used by
|
|
17880
|
-
// Equation.
|
|
17880
|
+
// Equation.getFunctionElements to look up the contents of a sub-tree.
|
|
17881
17881
|
|
|
17882
17882
|
function BaseEquationFunction(content, glyph, options) {
|
|
17883
17883
|
var _this;
|
|
@@ -20257,6 +20257,32 @@ var GoToFormAnimationStep = /*#__PURE__*/function (_TriggerAnimationStep2) {
|
|
|
20257
20257
|
* * {@link GoToFormAnimationStep}
|
|
20258
20258
|
* * {@link NextFormAnimationStep}
|
|
20259
20259
|
*
|
|
20260
|
+
* In addition to the notifications published by {@link FigureElement}, an
|
|
20261
|
+
* Equation publishes a `formChanged` notification whenever the displayed form
|
|
20262
|
+
* may have changed. The payload is an object
|
|
20263
|
+
* `{ phase, form, fromForm?, progress? }` where `phase` is one of:
|
|
20264
|
+
* - `'showForm'`: a form was set via `showForm`. Callers can suppress this
|
|
20265
|
+
* event by passing `notify: false` to `showForm`; internal `showForm`
|
|
20266
|
+
* calls made by `goToForm` do this so the `goToForm*` event stream is
|
|
20267
|
+
* not interleaved with stray `showForm` events.
|
|
20268
|
+
* - `'goToFormStart'`: a `goToForm` call has just begun
|
|
20269
|
+
* - `'goToFormStep'`: published on every animation frame during a `goToForm`
|
|
20270
|
+
* animation; `progress` is the percentage (0-1) through the animation. A
|
|
20271
|
+
* final `goToFormStep` with `progress: 1` is always published immediately
|
|
20272
|
+
* before `goToFormEnd`
|
|
20273
|
+
* - `'goToFormEnd'`: a `goToForm` call has finished
|
|
20274
|
+
*
|
|
20275
|
+
* * `fromForm` is only included on the `goToForm*` phases (it carries the
|
|
20276
|
+
* `fromWhere` option from `goToForm`); it is absent on `showForm`. `progress`
|
|
20277
|
+
* is only included on `goToFormStep`. The event order for a `goToForm` call
|
|
20278
|
+
* is always: `goToFormStart` → zero-or-more `goToFormStep` → `goToFormStep`
|
|
20279
|
+
* with `progress: 1` → `goToFormEnd`.
|
|
20280
|
+
*
|
|
20281
|
+
* A user-initiated `showForm` made while a `goToForm` animation is running
|
|
20282
|
+
* will publish its `showForm` event interleaved with the ongoing
|
|
20283
|
+
* `goToFormStep` stream — listeners that drive UI from "the current
|
|
20284
|
+
* transition" should account for this. Pass `notify: false` to suppress.
|
|
20285
|
+
*
|
|
20260
20286
|
* @extends FigureElementCollection
|
|
20261
20287
|
*
|
|
20262
20288
|
* @see To test examples, append them to the
|
|
@@ -21282,34 +21308,37 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21282
21308
|
}
|
|
21283
21309
|
|
|
21284
21310
|
/**
|
|
21285
|
-
* Return all the elements inside the named equation function within a
|
|
21286
|
-
* form.
|
|
21311
|
+
* Return all the elements inside the named equation function within a form.
|
|
21287
21312
|
*
|
|
21288
21313
|
* Any equation function (container, fraction, matrix, etc.) can be tagged
|
|
21289
21314
|
* with a `name` property in its options — this has no layout effect, but
|
|
21290
21315
|
* makes the function's sub-tree addressable here.
|
|
21291
21316
|
*
|
|
21292
|
-
* With `mode: '
|
|
21293
|
-
* matching function
|
|
21294
|
-
*
|
|
21295
|
-
*
|
|
21296
|
-
*
|
|
21317
|
+
* With `mode: 'all'` (default), walks the entire tree, collects every
|
|
21318
|
+
* matching function (including those nested inside other matches), and
|
|
21319
|
+
* returns the de-duplicated union of their elements. With `mode: 'first'`,
|
|
21320
|
+
* returns only the elements inside the first matching function found by a
|
|
21321
|
+
* depth-first traversal.
|
|
21322
|
+
*
|
|
21323
|
+
* If `formName` is `null` (default), the current form is used.
|
|
21297
21324
|
*
|
|
21298
21325
|
* Returns an empty array if the form does not exist, or no matching
|
|
21299
21326
|
* function is found.
|
|
21300
21327
|
*
|
|
21301
|
-
* @param {string} formName
|
|
21302
21328
|
* @param {string} name
|
|
21303
|
-
* @param {
|
|
21329
|
+
* @param {string | null} [formName] (`null` — uses current form)
|
|
21330
|
+
* @param {'first' | 'all'} [mode] (`'all'`)
|
|
21304
21331
|
* @param {boolean} [includeHidden] (`false`)
|
|
21305
21332
|
* @return {Array<FigureElement>}
|
|
21306
21333
|
*/
|
|
21307
21334
|
}, {
|
|
21308
|
-
key: "
|
|
21309
|
-
value: function
|
|
21310
|
-
var
|
|
21335
|
+
key: "getFunctionElements",
|
|
21336
|
+
value: function getFunctionElements(name) {
|
|
21337
|
+
var formName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
21338
|
+
var mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all';
|
|
21311
21339
|
var includeHidden = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
21312
|
-
var
|
|
21340
|
+
var resolvedFormName = formName == null ? this.eqn.currentForm : formName;
|
|
21341
|
+
var form = this.eqn.forms[resolvedFormName];
|
|
21313
21342
|
if (form == null) {
|
|
21314
21343
|
return [];
|
|
21315
21344
|
}
|
|
@@ -21439,6 +21468,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21439
21468
|
this.stopAnimating(how, '_Equation', true);
|
|
21440
21469
|
this.stopAnimating(how, '_EquationColor', true);
|
|
21441
21470
|
this.stopAnimating(how, '_EquationAnimateColor', true);
|
|
21471
|
+
this.stopAnimating(how, '_EquationFormStep', true);
|
|
21442
21472
|
this.stopPulsing(how);
|
|
21443
21473
|
}
|
|
21444
21474
|
}, {
|
|
@@ -21631,13 +21661,26 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21631
21661
|
/**
|
|
21632
21662
|
* Show equation form
|
|
21633
21663
|
*/
|
|
21664
|
+
/**
|
|
21665
|
+
* Show equation form.
|
|
21666
|
+
*
|
|
21667
|
+
* @param formOrName the form, or its name, to show
|
|
21668
|
+
* @param animationStop if `true`, stops any in-progress element animations
|
|
21669
|
+
* before rendering the form (default `true`)
|
|
21670
|
+
* @param notify if `true`, publish a `formChanged` notification with
|
|
21671
|
+
* `phase: 'showForm'` (default `true`). Pass `false` to suppress the
|
|
21672
|
+
* event — useful for bulk updates or when this `showForm` is part of a
|
|
21673
|
+
* larger transition the caller is broadcasting separately. The internal
|
|
21674
|
+
* `showForm` calls made by `goToForm` use `false` so the `goToForm*`
|
|
21675
|
+
* event stream is not interleaved with stray `showForm` events.
|
|
21676
|
+
*/
|
|
21634
21677
|
}, {
|
|
21635
21678
|
key: "showForm",
|
|
21636
21679
|
value: function showForm() {
|
|
21637
21680
|
var formOrName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.eqn.currentForm;
|
|
21638
21681
|
var animationStop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
21682
|
+
var notify = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
21639
21683
|
_superPropGet(Equation, "show", this, 3)([]);
|
|
21640
|
-
// this.custom.settingForm = true;
|
|
21641
21684
|
var form = formOrName;
|
|
21642
21685
|
if (typeof formOrName === 'string') {
|
|
21643
21686
|
form = this.getForm(formOrName);
|
|
@@ -21648,6 +21691,12 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21648
21691
|
this.render(animationStop);
|
|
21649
21692
|
this.fnMap.exec(form.onTransition);
|
|
21650
21693
|
this.fnMap.exec(form.onShow);
|
|
21694
|
+
if (notify) {
|
|
21695
|
+
this.notifications.publish('formChanged', {
|
|
21696
|
+
phase: 'showForm',
|
|
21697
|
+
form: form
|
|
21698
|
+
});
|
|
21699
|
+
}
|
|
21651
21700
|
}
|
|
21652
21701
|
}
|
|
21653
21702
|
}, {
|
|
@@ -21726,7 +21775,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21726
21775
|
// this.stopEquationAnimating('complete');
|
|
21727
21776
|
var currentForm = this.getCurrentForm();
|
|
21728
21777
|
if (currentForm != null) {
|
|
21729
|
-
this.showForm(currentForm);
|
|
21778
|
+
this.showForm(currentForm, true, false);
|
|
21730
21779
|
}
|
|
21731
21780
|
} else {
|
|
21732
21781
|
// this.stopEquationAnimating('cancel');
|
|
@@ -21810,20 +21859,65 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21810
21859
|
}
|
|
21811
21860
|
}
|
|
21812
21861
|
if (duration === 0) {
|
|
21813
|
-
this.
|
|
21862
|
+
this.notifications.publish('formChanged', {
|
|
21863
|
+
phase: 'goToFormStart',
|
|
21864
|
+
form: form,
|
|
21865
|
+
fromForm: options.fromWhere
|
|
21866
|
+
});
|
|
21867
|
+
this.showForm(form, true, false);
|
|
21814
21868
|
this.fnMap.exec(options.callback);
|
|
21869
|
+
this.notifications.publish('formChanged', {
|
|
21870
|
+
phase: 'goToFormStep',
|
|
21871
|
+
form: form,
|
|
21872
|
+
fromForm: options.fromWhere,
|
|
21873
|
+
progress: 1
|
|
21874
|
+
});
|
|
21875
|
+
this.notifications.publish('formChanged', {
|
|
21876
|
+
phase: 'goToFormEnd',
|
|
21877
|
+
form: form,
|
|
21878
|
+
fromForm: options.fromWhere
|
|
21879
|
+
});
|
|
21815
21880
|
} else {
|
|
21816
21881
|
this.eqn.isAnimating = true;
|
|
21817
21882
|
this.fnMap.exec(onTransition);
|
|
21883
|
+
// Set the current form before publishing goToFormStart so listeners
|
|
21884
|
+
// that call getCurrentForm() see the target form, matching the payload.
|
|
21885
|
+
this.setCurrentForm(form);
|
|
21886
|
+
this.notifications.publish('formChanged', {
|
|
21887
|
+
phase: 'goToFormStart',
|
|
21888
|
+
form: form,
|
|
21889
|
+
fromForm: options.fromWhere
|
|
21890
|
+
});
|
|
21891
|
+
var stepStarted = false;
|
|
21818
21892
|
var end = function end() {
|
|
21819
21893
|
_this1.fnMap.exec(form.onShow);
|
|
21820
21894
|
_this1.eqn.isAnimating = false;
|
|
21821
21895
|
_this1.fnMap.exec(options.callback);
|
|
21896
|
+
// Cancelling the step ticker stops any further frame callbacks
|
|
21897
|
+
// after end(). It cannot retract a step(p:1) the ticker may have
|
|
21898
|
+
// already published earlier in this frame, so the ticker callback
|
|
21899
|
+
// also skips p===1 — the manual publish below is the single
|
|
21900
|
+
// canonical terminal step event.
|
|
21901
|
+
if (stepStarted) {
|
|
21902
|
+
_this1.stopAnimating('cancel', '_EquationFormStep', true);
|
|
21903
|
+
}
|
|
21904
|
+
_this1.notifications.publish('formChanged', {
|
|
21905
|
+
phase: 'goToFormStep',
|
|
21906
|
+
form: form,
|
|
21907
|
+
fromForm: options.fromWhere,
|
|
21908
|
+
progress: 1
|
|
21909
|
+
});
|
|
21910
|
+
_this1.notifications.publish('formChanged', {
|
|
21911
|
+
phase: 'goToFormEnd',
|
|
21912
|
+
form: form,
|
|
21913
|
+
fromForm: options.fromWhere
|
|
21914
|
+
});
|
|
21822
21915
|
};
|
|
21916
|
+
var totalTime = 0;
|
|
21823
21917
|
if (options.animate === 'move') {
|
|
21824
|
-
form.animatePositionsTo(options.delay, options.dissolveOutTime, duration, options.dissolveInTime, end, options.fromWhere, false);
|
|
21918
|
+
totalTime = form.animatePositionsTo(options.delay, options.dissolveOutTime, duration, options.dissolveInTime, end, options.fromWhere, false);
|
|
21825
21919
|
} else if (options.animate === 'dissolveInThenMove') {
|
|
21826
|
-
form.animatePositionsTo(options.delay, options.dissolveOutTime, duration, options.dissolveInTime, end, options.fromWhere, true);
|
|
21920
|
+
totalTime = form.animatePositionsTo(options.delay, options.dissolveOutTime, duration, options.dissolveInTime, end, options.fromWhere, true);
|
|
21827
21921
|
} else if (options.animate === 'moveFrom' && this.eqn.formRestart != null && this.eqn.formRestart.moveFrom != null) {
|
|
21828
21922
|
var moveFrom = this.eqn.formRestart.moveFrom;
|
|
21829
21923
|
var target = this.getPosition();
|
|
@@ -21837,7 +21931,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21837
21931
|
start = (0,_tools_g2__WEBPACK_IMPORTED_MODULE_0__.getPoint)(this.eqn.formRestart.moveFrom);
|
|
21838
21932
|
}
|
|
21839
21933
|
var showFormCallback = function showFormCallback() {
|
|
21840
|
-
_this1.showForm(form.name, false);
|
|
21934
|
+
_this1.showForm(form.name, false, false);
|
|
21841
21935
|
};
|
|
21842
21936
|
this.fnMap.add('_equationShowFormCallback', showFormCallback);
|
|
21843
21937
|
this.animations["new"]('_Equation').dissolveOut({
|
|
@@ -21852,6 +21946,14 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21852
21946
|
target: target,
|
|
21853
21947
|
duration: duration
|
|
21854
21948
|
}).whenFinished(end).start();
|
|
21949
|
+
if (duration != null) {
|
|
21950
|
+
totalTime = options.delay + options.dissolveOutTime + 0.01 + duration;
|
|
21951
|
+
} else {
|
|
21952
|
+
// duration is null — the position step computes a velocity-based
|
|
21953
|
+
// move time internally. Read it back from the chain we just
|
|
21954
|
+
// started so the step ticker still covers the full animation.
|
|
21955
|
+
totalTime = this.animations.getRemainingTime('_Equation');
|
|
21956
|
+
}
|
|
21855
21957
|
} else if (options.animate === 'pulse' && this.eqn.formRestart != null && this.eqn.formRestart.pulse != null) {
|
|
21856
21958
|
var pulse = this.eqn.formRestart.pulse;
|
|
21857
21959
|
var newEnd = function newEnd() {
|
|
@@ -21868,11 +21970,30 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21868
21970
|
});
|
|
21869
21971
|
}
|
|
21870
21972
|
};
|
|
21871
|
-
form.allHideShow(options.delay, options.dissolveOutTime, options.blankTime, options.dissolveInTime, newEnd);
|
|
21973
|
+
var hideShowTime = form.allHideShow(options.delay, options.dissolveOutTime, options.blankTime, options.dissolveInTime, newEnd);
|
|
21974
|
+
totalTime = hideShowTime + (pulse.duration != null ? pulse.duration : 0);
|
|
21872
21975
|
} else {
|
|
21873
|
-
form.allHideShow(options.delay, options.dissolveOutTime, options.blankTime, options.dissolveInTime, end);
|
|
21976
|
+
totalTime = form.allHideShow(options.delay, options.dissolveOutTime, options.blankTime, options.dissolveInTime, end);
|
|
21977
|
+
}
|
|
21978
|
+
if (totalTime > 0) {
|
|
21979
|
+
this.animations["new"]('_EquationFormStep').custom({
|
|
21980
|
+
callback: function callback(p) {
|
|
21981
|
+
// Skip the terminal tick — end() publishes the canonical
|
|
21982
|
+
// step(p:1) so the ticker would otherwise duplicate it (and
|
|
21983
|
+
// CustomAnimationStep can land on p=1 twice via
|
|
21984
|
+
// nextFrame + finish()).
|
|
21985
|
+
if (p >= 1) return;
|
|
21986
|
+
_this1.notifications.publish('formChanged', {
|
|
21987
|
+
phase: 'goToFormStep',
|
|
21988
|
+
form: form,
|
|
21989
|
+
fromForm: options.fromWhere,
|
|
21990
|
+
progress: p
|
|
21991
|
+
});
|
|
21992
|
+
},
|
|
21993
|
+
duration: totalTime
|
|
21994
|
+
}).start();
|
|
21995
|
+
stepStarted = true;
|
|
21874
21996
|
}
|
|
21875
|
-
this.setCurrentForm(form);
|
|
21876
21997
|
}
|
|
21877
21998
|
}
|
|
21878
21999
|
}, {
|
|
@@ -21983,7 +22104,7 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
|
|
|
21983
22104
|
this.eqn.isAnimating = false;
|
|
21984
22105
|
var currentForm = this.getCurrentForm();
|
|
21985
22106
|
if (currentForm != null) {
|
|
21986
|
-
this.showForm(currentForm);
|
|
22107
|
+
this.showForm(currentForm, true, false);
|
|
21987
22108
|
}
|
|
21988
22109
|
return;
|
|
21989
22110
|
}
|
|
@@ -22539,8 +22660,8 @@ var EquationForm = /*#__PURE__*/function (_Elements) {
|
|
|
22539
22660
|
if (elementsToShow.length === 0 && elementsShown.length === 0) {
|
|
22540
22661
|
if (callback != null) {
|
|
22541
22662
|
callback(false);
|
|
22542
|
-
return;
|
|
22543
22663
|
}
|
|
22664
|
+
return 0;
|
|
22544
22665
|
}
|
|
22545
22666
|
var dissolveOutCallback = function dissolveOutCallback() {
|
|
22546
22667
|
_this3.setPositions();
|
|
@@ -22584,6 +22705,13 @@ var EquationForm = /*#__PURE__*/function (_Elements) {
|
|
|
22584
22705
|
delay: blankTime
|
|
22585
22706
|
}).start();
|
|
22586
22707
|
});
|
|
22708
|
+
if (elementsToShow.length > 0) {
|
|
22709
|
+
cumTime += blankTime + showTime;
|
|
22710
|
+
}
|
|
22711
|
+
// Upper bound on the total animation time: when elementsToDelayShowing
|
|
22712
|
+
// finish their dissolveIn. elementsToShowAfterDissolve are scheduled with
|
|
22713
|
+
// `delay: blankTime` (not `cumTime + blankTime`) so they may finish earlier.
|
|
22714
|
+
return cumTime;
|
|
22587
22715
|
}
|
|
22588
22716
|
}, {
|
|
22589
22717
|
key: "applyElementMods",
|
|
@@ -22990,7 +23118,7 @@ function getFigureElement(elementsObject, name) {
|
|
|
22990
23118
|
* around the content, but the content will not be shown (`true`)
|
|
22991
23119
|
* @property {string} [name] - optional identifier (available on every equation
|
|
22992
23120
|
* function). Has no effect on layout, but allows the function's contents to be
|
|
22993
|
-
* looked up later with {@link Equation.
|
|
23121
|
+
* looked up later with {@link Equation.getFunctionElements} (`null`)
|
|
22994
23122
|
*
|
|
22995
23123
|
* @see To test examples, append them to the
|
|
22996
23124
|
* <a href="#drawing-boilerplate">boilerplate</a>
|
|
@@ -25630,7 +25758,7 @@ var EquationFunctions = /*#__PURE__*/function () {
|
|
|
25630
25758
|
var result = this.dispatchEqnMethod(name, params);
|
|
25631
25759
|
// Allow any equation function to be tagged with a caller-supplied
|
|
25632
25760
|
// `name` via its options object. The tag has no layout effect; it's
|
|
25633
|
-
// used by Equation.
|
|
25761
|
+
// used by Equation.getFunctionElements to look up the function's sub-tree.
|
|
25634
25762
|
if (result != null && params != null && !Array.isArray(params) && _typeof(params) === 'object' && params.name != null && (result instanceof _Elements_BaseEquationFunction__WEBPACK_IMPORTED_MODULE_10__["default"] || result instanceof _Elements_BaseAnnotationFunction__WEBPACK_IMPORTED_MODULE_9__["default"])) {
|
|
25635
25763
|
result.functionName = params.name;
|
|
25636
25764
|
}
|
|
@@ -80792,8 +80920,8 @@ var tools = {
|
|
|
80792
80920
|
*/
|
|
80793
80921
|
|
|
80794
80922
|
var Fig = {
|
|
80795
|
-
version: "1.
|
|
80796
|
-
gitHash: "
|
|
80923
|
+
version: "1.5.0",
|
|
80924
|
+
gitHash: "2390662f6",
|
|
80797
80925
|
tools: tools,
|
|
80798
80926
|
Figure: _js_figure_Figure__WEBPACK_IMPORTED_MODULE_5__["default"],
|
|
80799
80927
|
Recorder: _js_figure_Recorder_Recorder__WEBPACK_IMPORTED_MODULE_7__.Recorder,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "figureone",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Draw, animate and interact with shapes, text, plots and equations in Javascript. Create interactive slide shows, and interactive videos.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -726,6 +726,32 @@ type EQN_EquationGoToForm = {
|
|
|
726
726
|
* * {@link GoToFormAnimationStep}
|
|
727
727
|
* * {@link NextFormAnimationStep}
|
|
728
728
|
*
|
|
729
|
+
* In addition to the notifications published by {@link FigureElement}, an
|
|
730
|
+
* Equation publishes a `formChanged` notification whenever the displayed form
|
|
731
|
+
* may have changed. The payload is an object
|
|
732
|
+
* `{ phase, form, fromForm?, progress? }` where `phase` is one of:
|
|
733
|
+
* - `'showForm'`: a form was set via `showForm`. Callers can suppress this
|
|
734
|
+
* event by passing `notify: false` to `showForm`; internal `showForm`
|
|
735
|
+
* calls made by `goToForm` do this so the `goToForm*` event stream is
|
|
736
|
+
* not interleaved with stray `showForm` events.
|
|
737
|
+
* - `'goToFormStart'`: a `goToForm` call has just begun
|
|
738
|
+
* - `'goToFormStep'`: published on every animation frame during a `goToForm`
|
|
739
|
+
* animation; `progress` is the percentage (0-1) through the animation. A
|
|
740
|
+
* final `goToFormStep` with `progress: 1` is always published immediately
|
|
741
|
+
* before `goToFormEnd`
|
|
742
|
+
* - `'goToFormEnd'`: a `goToForm` call has finished
|
|
743
|
+
*
|
|
744
|
+
* * `fromForm` is only included on the `goToForm*` phases (it carries the
|
|
745
|
+
* `fromWhere` option from `goToForm`); it is absent on `showForm`. `progress`
|
|
746
|
+
* is only included on `goToFormStep`. The event order for a `goToForm` call
|
|
747
|
+
* is always: `goToFormStart` → zero-or-more `goToFormStep` → `goToFormStep`
|
|
748
|
+
* with `progress: 1` → `goToFormEnd`.
|
|
749
|
+
*
|
|
750
|
+
* A user-initiated `showForm` made while a `goToForm` animation is running
|
|
751
|
+
* will publish its `showForm` event interleaved with the ongoing
|
|
752
|
+
* `goToFormStep` stream — listeners that drive UI from "the current
|
|
753
|
+
* transition" should account for this. Pass `notify: false` to suppress.
|
|
754
|
+
*
|
|
729
755
|
* @extends FigureElementCollection
|
|
730
756
|
*
|
|
731
757
|
* @see To test examples, append them to the
|
|
@@ -907,29 +933,30 @@ export declare class Equation extends FigureElementCollection {
|
|
|
907
933
|
*/
|
|
908
934
|
getFormElements(form: string, includeHidden?: boolean): (FigureElementCollection | FigureElementPrimitive | ElementInterface)[];
|
|
909
935
|
/**
|
|
910
|
-
* Return all the elements inside the named equation function within a
|
|
911
|
-
* form.
|
|
936
|
+
* Return all the elements inside the named equation function within a form.
|
|
912
937
|
*
|
|
913
938
|
* Any equation function (container, fraction, matrix, etc.) can be tagged
|
|
914
939
|
* with a `name` property in its options — this has no layout effect, but
|
|
915
940
|
* makes the function's sub-tree addressable here.
|
|
916
941
|
*
|
|
917
|
-
* With `mode: '
|
|
918
|
-
* matching function
|
|
919
|
-
*
|
|
920
|
-
*
|
|
921
|
-
*
|
|
942
|
+
* With `mode: 'all'` (default), walks the entire tree, collects every
|
|
943
|
+
* matching function (including those nested inside other matches), and
|
|
944
|
+
* returns the de-duplicated union of their elements. With `mode: 'first'`,
|
|
945
|
+
* returns only the elements inside the first matching function found by a
|
|
946
|
+
* depth-first traversal.
|
|
947
|
+
*
|
|
948
|
+
* If `formName` is `null` (default), the current form is used.
|
|
922
949
|
*
|
|
923
950
|
* Returns an empty array if the form does not exist, or no matching
|
|
924
951
|
* function is found.
|
|
925
952
|
*
|
|
926
|
-
* @param {string} formName
|
|
927
953
|
* @param {string} name
|
|
928
|
-
* @param {
|
|
954
|
+
* @param {string | null} [formName] (`null` — uses current form)
|
|
955
|
+
* @param {'first' | 'all'} [mode] (`'all'`)
|
|
929
956
|
* @param {boolean} [includeHidden] (`false`)
|
|
930
957
|
* @return {Array<FigureElement>}
|
|
931
958
|
*/
|
|
932
|
-
|
|
959
|
+
getFunctionElements(name: string, formName?: string | null, mode?: 'first' | 'all', includeHidden?: boolean): any[];
|
|
933
960
|
/**
|
|
934
961
|
* Return all the elements that are used in an equation phrase.
|
|
935
962
|
* @param {TypeEquationPhrase} phrase
|
|
@@ -978,7 +1005,20 @@ export declare class Equation extends FigureElementCollection {
|
|
|
978
1005
|
/**
|
|
979
1006
|
* Show equation form
|
|
980
1007
|
*/
|
|
981
|
-
|
|
1008
|
+
/**
|
|
1009
|
+
* Show equation form.
|
|
1010
|
+
*
|
|
1011
|
+
* @param formOrName the form, or its name, to show
|
|
1012
|
+
* @param animationStop if `true`, stops any in-progress element animations
|
|
1013
|
+
* before rendering the form (default `true`)
|
|
1014
|
+
* @param notify if `true`, publish a `formChanged` notification with
|
|
1015
|
+
* `phase: 'showForm'` (default `true`). Pass `false` to suppress the
|
|
1016
|
+
* event — useful for bulk updates or when this `showForm` is part of a
|
|
1017
|
+
* larger transition the caller is broadcasting separately. The internal
|
|
1018
|
+
* `showForm` calls made by `goToForm` use `false` so the `goToForm*`
|
|
1019
|
+
* event stream is not interleaved with stray `showForm` events.
|
|
1020
|
+
*/
|
|
1021
|
+
showForm(formOrName?: EquationForm | string, animationStop?: boolean, notify?: boolean): void;
|
|
982
1022
|
showAll(): void;
|
|
983
1023
|
cleanup(): void;
|
|
984
1024
|
cleanupForms(): void;
|
|
@@ -133,7 +133,7 @@ export default class EquationForm extends Elements {
|
|
|
133
133
|
render(): void;
|
|
134
134
|
showHide(showTime?: number, hideTime?: number, callback?: ((arg?: any) => void) | null, animationStop?: boolean): void;
|
|
135
135
|
hideShow(showTime?: number, hideTime?: number, callback?: ((arg?: any) => void) | null, animationStop?: boolean): void;
|
|
136
|
-
allHideShow(delay?: number, hideTime?: number, blankTime?: number, showTime?: number, callback?: ((cancelled: boolean) => void) | null):
|
|
136
|
+
allHideShow(delay?: number, hideTime?: number, blankTime?: number, showTime?: number, callback?: ((cancelled: boolean) => void) | null): number;
|
|
137
137
|
applyElementMods(fromWhere?: null | string): void;
|
|
138
138
|
animatePositionsTo(delay: number, dissolveOutTime: number, moveTime: number | null, dissolveInTime: number, callback?: (string | ((arg?: any) => void)) | null, fromWhere?: string | null | undefined, dissolveInBeforeMove?: boolean): number;
|
|
139
139
|
}
|
|
@@ -172,7 +172,7 @@ export type TypeEquationPhrase = string | number | {
|
|
|
172
172
|
* around the content, but the content will not be shown (`true`)
|
|
173
173
|
* @property {string} [name] - optional identifier (available on every equation
|
|
174
174
|
* function). Has no effect on layout, but allows the function's contents to be
|
|
175
|
-
* looked up later with {@link Equation.
|
|
175
|
+
* looked up later with {@link Equation.getFunctionElements} (`null`)
|
|
176
176
|
*
|
|
177
177
|
* @see To test examples, append them to the
|
|
178
178
|
* <a href="#drawing-boilerplate">boilerplate</a>
|