figureone 1.5.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/figureone.min.js +1 -1
- package/index.js +1069 -144
- package/llms-full.txt +65 -0
- package/llms.txt +17 -0
- 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 +18 -0
- package/types/js/figure/Equation/EquationForm.d.ts +4 -0
- 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/llms-full.txt
CHANGED
|
@@ -20,6 +20,10 @@ Colors are `[r, g, b, a]` with values 0-1. Default scene is `[-1, -1, 2, 2]` (x,
|
|
|
20
20
|
| lineWidth | number | | Default line width |
|
|
21
21
|
| length | number | | Default primary dimension |
|
|
22
22
|
| backgroundColor | TypeColor | | Background color |
|
|
23
|
+
| textStyle | `'italic'` \| `'normal'` | `'italic'` | Default equation text style (also settable on FigurePrimitives and Equation) |
|
|
24
|
+
| antialias | boolean | `true` | Enable WebGL anti-aliasing |
|
|
25
|
+
| atlasScale | number | `2` | GL text atlas texture resolution relative to 1:1 pixel mapping |
|
|
26
|
+
| onWebGLUnavailable | () => void | | Callback fired once during construction if no WebGL context is available (figure is still created but renders nothing) |
|
|
23
27
|
|
|
24
28
|
### Key Figure Methods
|
|
25
29
|
|
|
@@ -45,6 +49,11 @@ figure.resize(); // Resize after container change
|
|
|
45
49
|
figure.animateNextFrame(); // Request next animation frame
|
|
46
50
|
figure.isAnimating(); // Check if any animation running
|
|
47
51
|
|
|
52
|
+
// WebGL context state
|
|
53
|
+
figure.webglAvailable; // false if no live WebGL context (e.g. context lost)
|
|
54
|
+
figure.notifications.add('contextLost', () => { /* context removed by browser */ });
|
|
55
|
+
figure.notifications.add('contextRestored', () => { /* context returned */ });
|
|
56
|
+
|
|
48
57
|
// Coordinate transforms
|
|
49
58
|
figure.transformPoint(point, fromSpace, toSpace);
|
|
50
59
|
figure.spaceTransformMatrix(fromSpace, toSpace);
|
|
@@ -92,6 +101,7 @@ Path to figure element(s) within a collection. Supports multiple formats:
|
|
|
92
101
|
| underline | boolean \| object | `false` | Underline options |
|
|
93
102
|
| outline | boolean \| object | `false` | Outline options |
|
|
94
103
|
| render | `'gl'` \| `'2d'` \| `'html'` | `'gl'` | Render target |
|
|
104
|
+
| atlasId | string | | Share a single GL atlas texture across text elements with different sizes (elements with the same `atlasId` reuse one atlas) |
|
|
95
105
|
|
|
96
106
|
### OBJ_Texture
|
|
97
107
|
|
|
@@ -119,6 +129,11 @@ Path to figure element(s) within a collection. Supports multiple formats:
|
|
|
119
129
|
| defaultColor | TypeColor | | Color when undimmed |
|
|
120
130
|
| scenarios | OBJ_Scenarios | | Named presets |
|
|
121
131
|
| scene | Scene \| OBJ_Scene | | Custom scene |
|
|
132
|
+
| isFormIgnored | boolean | `false` | Exclude from equation form changes — skipped by form layout, show/hide, transform/color sets, and `elementMods`, so its user-applied transform, color, and visibility persist across `showForm` / `goToForm` (contributes zero size to layout) |
|
|
133
|
+
| allowSetColor | `'all'` \| `'opacity'` \| `'none'` | `'all'` | Freeze color: `'opacity'` allows only the alpha channel to change; `'none'` blocks all `setColor` |
|
|
134
|
+
| ignoreSetColor | string \| string[] | `[]` | Source label(s) whose tagged `setColor` commands are ignored (e.g. the equation's default `'form'` color cascade), while explicit/untagged commands (`dim`/`undim`, direct `setColor`) are still honored |
|
|
135
|
+
|
|
136
|
+
These element properties are also settable at runtime; `setColor(color, setDefault?, from?)` takes an optional `from` source label that is matched against `ignoreSetColor`.
|
|
122
137
|
|
|
123
138
|
### OBJ_Collection
|
|
124
139
|
|
|
@@ -1252,6 +1267,26 @@ Array: `{ color: [content, [r, g, b, a]] }`
|
|
|
1252
1267
|
| color | TypeColor | | Color to apply |
|
|
1253
1268
|
| fullContentBounds | boolean | `false` | Use full bounds |
|
|
1254
1269
|
|
|
1270
|
+
#### EQN_Opacity (`opacity`)
|
|
1271
|
+
Array: `{ opacity: [content, opacity_value] }`. Wraps a phrase in an opacity multiplier that cascades multiplicatively through nested `opacity` wrappers (outer `0.5` × inner `0.5` = `0.25` on inner content). The cascaded opacity is assigned to each wrapped element whenever the form is shown, overriding externally-set element opacity — set `ignoreOpacity: true` on the form to suppress this and preserve external opacities.
|
|
1272
|
+
|
|
1273
|
+
| Property | Type | Default | Description |
|
|
1274
|
+
|---|---|---|---|
|
|
1275
|
+
| content | TypeEquationPhrase | | Content |
|
|
1276
|
+
| opacity | number | | Opacity multiplier in range `[0, 1]` |
|
|
1277
|
+
| fullContentBounds | boolean | `false` | Use full bounds |
|
|
1278
|
+
|
|
1279
|
+
#### EQN_Front (`front`) / EQN_Back (`back`)
|
|
1280
|
+
Array: `{ front: [content, num] }` / `{ back: [content, num] }`. Reorder a phrase's elements within the equation's draw stack, per-form. All elements in `content` move together as a group, keeping their relative draw order. Applied whenever the form is shown, relative to the equation's natural definition order, so each form deterministically defines its own stacking. The same operations are available as `front` / `back` element mods (e.g. `elementMods: { a: { back: {} } }`).
|
|
1281
|
+
|
|
1282
|
+
| Property | Type | Default | Description |
|
|
1283
|
+
|---|---|---|---|
|
|
1284
|
+
| content | TypeEquationPhrase | | Content |
|
|
1285
|
+
| num | number | | `front`: places to move forward (positive) or `\|num\|` places behind the front (negative). `back`: places to move back (positive) or `\|num\|` places ahead of the back (negative). With `before`/`after`, it's the offset from the anchor (default `0`). If omitted with no anchor, moves fully to front/back |
|
|
1286
|
+
| before | string \| string[] | | Anchor element name(s) — position the group just before (behind) the most-back anchor |
|
|
1287
|
+
| after | string \| string[] | | Anchor element name(s) — position the group just after (in front of) the most-front anchor |
|
|
1288
|
+
| fullContentBounds | boolean | `false` | Use full bounds |
|
|
1289
|
+
|
|
1255
1290
|
#### EQN_Container (`container`)
|
|
1256
1291
|
Array: `{ container: [content, width] }`
|
|
1257
1292
|
|
|
@@ -1452,10 +1487,17 @@ forms: {
|
|
|
1452
1487
|
scale: { elementName: 1.5 }, // Per-element target scales during animation
|
|
1453
1488
|
fromPrev: { elementName: 'otherElement' }, // Animate from another element's position
|
|
1454
1489
|
fromNext: { elementName: 'otherElement' }, // Animate from another element's position (reverse)
|
|
1490
|
+
ignoreColor: false, // true preserves externally-set element colors (suppresses color cascade)
|
|
1491
|
+
ignoreOpacity: false, // true preserves externally-set element opacities (suppresses opacity cascade)
|
|
1492
|
+
elementMods: { // Per-element property mods applied when form shows
|
|
1493
|
+
elementName: { back: {} }, // e.g. front/back reorder mods (see EQN_Front/EQN_Back)
|
|
1494
|
+
},
|
|
1455
1495
|
},
|
|
1456
1496
|
}
|
|
1457
1497
|
```
|
|
1458
1498
|
|
|
1499
|
+
Every equation layout function (container, frac, matrix, brac, annotate, color, opacity, front, back, etc.) also accepts an optional `name` property — purely a label with no layout effect, used to address the function's sub-tree via `eqn.getFunctionElements(name)`.
|
|
1500
|
+
|
|
1459
1501
|
### Forms and Animation
|
|
1460
1502
|
|
|
1461
1503
|
```js
|
|
@@ -1474,9 +1516,24 @@ const eqn = figure.add({
|
|
|
1474
1516
|
});
|
|
1475
1517
|
|
|
1476
1518
|
eqn.showForm('1');
|
|
1519
|
+
eqn.showForm('1', false); // notify=false suppresses the formChanged event for this call
|
|
1477
1520
|
eqn.goToForm({ form: '2', delay: 1, duration: 1.5, animate: 'move' });
|
|
1478
1521
|
eqn.nextForm(); // Navigate formSeries
|
|
1479
1522
|
eqn.prevForm();
|
|
1523
|
+
|
|
1524
|
+
// Element lookup within forms
|
|
1525
|
+
eqn.getFormElements(formName, includeHidden?); // All elements in a form
|
|
1526
|
+
eqn.getPhraseElements(phrase); // All elements in a phrase
|
|
1527
|
+
// Elements inside a named layout function (any function tagged with `name`).
|
|
1528
|
+
// (name, formName? = current, mode? = 'all', includeHidden? = false).
|
|
1529
|
+
// mode 'first' = first match; 'all' = de-duplicated union across all matches.
|
|
1530
|
+
eqn.getFunctionElements('myFrac');
|
|
1531
|
+
```
|
|
1532
|
+
|
|
1533
|
+
`Equation` publishes a `formChanged` notification whenever the displayed form may have changed, with payload `{ phase, form, fromForm?, progress? }`. `phase` is one of: `'showForm'` (form set via `showForm`; suppress with `notify: false`), `'goToFormStart'`, `'goToFormStep'` (per animation frame, with `progress` 0–1; a final step with `progress: 1` precedes the end), `'goToFormEnd'`. `fromForm` is present only on the `goToForm*` phases.
|
|
1534
|
+
|
|
1535
|
+
```js
|
|
1536
|
+
eqn.notifications.add('formChanged', ({ phase, form, progress }) => { /* drive UI */ });
|
|
1480
1537
|
```
|
|
1481
1538
|
|
|
1482
1539
|
### Phrases (reusable sub-expressions)
|
|
@@ -1488,6 +1545,14 @@ eqn.prevForm();
|
|
|
1488
1545
|
}
|
|
1489
1546
|
```
|
|
1490
1547
|
|
|
1548
|
+
### LaTeX Parsing
|
|
1549
|
+
`Fig.latexToFigureOne(latex)` converts a LaTeX math expression into `{ elements, form }` for use in an equation definition (basic support).
|
|
1550
|
+
|
|
1551
|
+
```js
|
|
1552
|
+
const { elements, form } = Fig.latexToFigureOne('\\frac{a}{b} = c');
|
|
1553
|
+
figure.add({ make: 'equation', elements, forms: { base: form } });
|
|
1554
|
+
```
|
|
1555
|
+
|
|
1491
1556
|
---
|
|
1492
1557
|
|
|
1493
1558
|
## 7. Animation System
|
package/llms.txt
CHANGED
|
@@ -24,6 +24,8 @@ figure.add({ make: 'triangle', width: 0.5, height: 0.5, color: [1, 0, 0, 1] });
|
|
|
24
24
|
|
|
25
25
|
Colors are `[r, g, b, a]` with values 0-1. Coordinates default to a scene of `[-1, -1, 2, 2]` (x, y, width, height). Override with `new Fig.Figure({ scene: [-2, -2, 4, 4] })`.
|
|
26
26
|
|
|
27
|
+
Other `Fig.Figure` options: `textStyle` (`'italic'` default | `'normal'` — default equation text style), `antialias` (default `true`), `atlasScale` (GL text atlas resolution, default `2`), `onWebGLUnavailable` (callback if no WebGL context). Check `figure.webglAvailable` and subscribe to `contextLost` / `contextRestored` notifications for runtime WebGL context transitions.
|
|
28
|
+
|
|
27
29
|
## Core Concepts
|
|
28
30
|
|
|
29
31
|
- **Figure** — top-level container that manages all elements and rendering
|
|
@@ -105,6 +107,9 @@ All elements accept these common options alongside shape-specific ones:
|
|
|
105
107
|
- `color` — `[r, g, b, a]`
|
|
106
108
|
- `position` — `[x, y]` shorthand for translation
|
|
107
109
|
- `rotation` — rotation in radians
|
|
110
|
+
- `isFormIgnored` — exclude from equation form changes (its transform/color/visibility persist across `showForm`/`goToForm`)
|
|
111
|
+
- `allowSetColor` — `'all'` (default), `'opacity'` (alpha only), or `'none'` to freeze color
|
|
112
|
+
- `ignoreSetColor` — source label(s) whose tagged `setColor` is ignored (e.g. the equation's `'form'` color cascade), while explicit commands still apply
|
|
108
113
|
|
|
109
114
|
When `options` is used, shape-specific properties go inside it:
|
|
110
115
|
|
|
@@ -256,9 +261,14 @@ Any element type can be created inline in forms using `make`:
|
|
|
256
261
|
| `prodOf` | `{ prodOf: { symbol, content, from, to } }` | Product |
|
|
257
262
|
| `scale` | `{ scale: [content, scale_factor] }` | Scale content |
|
|
258
263
|
| `color` | `{ color: [content, [r,g,b,a]] }` | Color content |
|
|
264
|
+
| `opacity` | `{ opacity: [content, 0.3] }` | Opacity multiplier (cascades multiplicatively through nesting) |
|
|
265
|
+
| `front` | `{ front: [content, num] }` | Bring content forward in draw stack (per-form); supports `before`/`after` anchors |
|
|
266
|
+
| `back` | `{ back: [content, num] }` | Send content back in draw stack (per-form); supports `before`/`after` anchors |
|
|
259
267
|
| `container` | `{ container: { content, width, ... } }` | Fixed-size container |
|
|
260
268
|
| `lines` | `{ lines: { content: [...], justify } }` | Multi-line layout |
|
|
261
269
|
|
|
270
|
+
Any layout function also accepts a `name` label to address its elements via `eqn.getFunctionElements(name)`. Form objects accept `ignoreColor` / `ignoreOpacity` to preserve externally-set element color/opacity (suppress the cascade).
|
|
271
|
+
|
|
262
272
|
### Symbols
|
|
263
273
|
|
|
264
274
|
Define symbols in `elements` with `{ symbol: 'type' }`:
|
|
@@ -302,9 +312,12 @@ const eqn = figure.add({
|
|
|
302
312
|
});
|
|
303
313
|
|
|
304
314
|
eqn.showForm('1');
|
|
315
|
+
eqn.showForm('1', false); // notify=false suppresses the formChanged event
|
|
305
316
|
eqn.goToForm({ form: '2', delay: 1, duration: 1.5, animate: 'move' });
|
|
306
317
|
```
|
|
307
318
|
|
|
319
|
+
Equation publishes a `formChanged` notification with payload `{ phase, form, fromForm?, progress? }`, where `phase` is `'showForm'`, `'goToFormStart'`, `'goToFormStep'` (with `progress` 0–1), or `'goToFormEnd'`. Use `eqn.getFunctionElements(name)` to fetch elements inside a named layout function.
|
|
320
|
+
|
|
308
321
|
Use `formSeries` to define an ordered list of forms, then navigate with `eqn.nextForm()` and `eqn.prevForm()`.
|
|
309
322
|
|
|
310
323
|
Use `phrases` to define reusable sub-expressions:
|
|
@@ -529,6 +542,10 @@ new Fig.Transform() // Transform builder
|
|
|
529
542
|
.scale(sx, sy)
|
|
530
543
|
Fig.round(value, precision) // Round to N decimal places
|
|
531
544
|
|
|
545
|
+
// Convert a LaTeX math expression to an equation form (basic support)
|
|
546
|
+
const { elements, form } = Fig.latexToFigureOne('\\frac{a}{b} = c');
|
|
547
|
+
figure.add({ make: 'equation', elements, forms: { base: form } });
|
|
548
|
+
|
|
532
549
|
// Color format: [r, g, b, a] with values 0 to 1
|
|
533
550
|
// [1, 0, 0, 1] = red, [0, 0, 1, 0.5] = semi-transparent blue
|
|
534
551
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "figureone",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
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",
|
|
@@ -503,6 +503,7 @@ declare class FigureElement {
|
|
|
503
503
|
drawNumber: number;
|
|
504
504
|
moveSetTransform: boolean;
|
|
505
505
|
allowSetColor: string;
|
|
506
|
+
ignoreSetColor: string | Array<string>;
|
|
506
507
|
/**
|
|
507
508
|
* @hideconstructor
|
|
508
509
|
*/
|
|
@@ -588,12 +589,20 @@ declare class FigureElement {
|
|
|
588
589
|
clear(_canvasIndex?: number): void;
|
|
589
590
|
cleanup(deleteTexture?: boolean): void;
|
|
590
591
|
willStartAnimating(): boolean;
|
|
592
|
+
/**
|
|
593
|
+
* Returns `true` if a `setColor` command tagged with source `from` should be
|
|
594
|
+
* ignored by this element (per `ignoreSetColor`). Untagged commands
|
|
595
|
+
* (`from == null`) are never ignored.
|
|
596
|
+
*/
|
|
597
|
+
isSetColorIgnored(from?: string | null): boolean;
|
|
591
598
|
/**
|
|
592
599
|
Set element color.
|
|
593
600
|
@param {[number, number, number, number]} color RGBA color from 0 to 1
|
|
594
601
|
@param {boolean} [setDefault] also set the default color to this color
|
|
602
|
+
@param {string | null} [from] source label of this color command; if it
|
|
603
|
+
matches `ignoreSetColor` the command is ignored
|
|
595
604
|
*/
|
|
596
|
-
setColor(color: TypeColor, setDefault?: boolean): void;
|
|
605
|
+
setColor(color: TypeColor, setDefault?: boolean, from?: string | null): void;
|
|
597
606
|
/**
|
|
598
607
|
* Set element color to `dimColor`
|
|
599
608
|
*/
|
|
@@ -879,7 +888,7 @@ declare class FigureElementPrimitive extends FigureElement {
|
|
|
879
888
|
_dup(transform?: Transform | null): FigureElementPrimitive;
|
|
880
889
|
clear(canvasIndex?: number): void;
|
|
881
890
|
resize(figureHTMLElement?: HTMLElement | null | undefined): void;
|
|
882
|
-
setColor(color: TypeColor, setDefault?: boolean): void;
|
|
891
|
+
setColor(color: TypeColor, setDefault?: boolean, from?: string | null): void;
|
|
883
892
|
setOpacity(opacity: number): void;
|
|
884
893
|
show(): void;
|
|
885
894
|
hide(): void;
|
|
@@ -1138,7 +1147,7 @@ declare class FigureElementCollection extends FigureElement {
|
|
|
1138
1147
|
getSelectionFromBorders(glLocation: Point): FigureElement | null;
|
|
1139
1148
|
stop(how?: 'freeze' | 'cancel' | 'complete' | 'animateToComplete' | 'dissolveToComplete', elementOnly?: boolean): void;
|
|
1140
1149
|
setFont(fontSize: number): void;
|
|
1141
|
-
setColor(color?: TypeColor, setDefault?: boolean): void;
|
|
1150
|
+
setColor(color?: TypeColor, setDefault?: boolean, from?: string | null): void;
|
|
1142
1151
|
setDimColor(color?: TypeColor): void;
|
|
1143
1152
|
undim(children?: TypeElementPath | null | undefined): void;
|
|
1144
1153
|
dim(children?: TypeElementPath | null | undefined): void;
|
|
@@ -89,6 +89,7 @@ export default class BaseAnnotationFunction implements ElementInterface {
|
|
|
89
89
|
scale: number;
|
|
90
90
|
showContent: boolean;
|
|
91
91
|
color: TypeColor | null;
|
|
92
|
+
opacity: number | null;
|
|
92
93
|
fullSize: {
|
|
93
94
|
leftOffset: number;
|
|
94
95
|
width: number;
|
|
@@ -107,7 +108,9 @@ export default class BaseAnnotationFunction implements ElementInterface {
|
|
|
107
108
|
cleanup(): void;
|
|
108
109
|
getAllElements(includeHidden?: boolean): any[];
|
|
109
110
|
setPositions(): void;
|
|
110
|
-
setColor(colorIn?: TypeColor | null): void;
|
|
111
|
+
setColor(colorIn?: TypeColor | null, from?: string | null): void;
|
|
112
|
+
setOpacity(opacityIn?: number | null): void;
|
|
113
|
+
collectDrawOrder(ops: Array<any>): void;
|
|
111
114
|
offsetLocation(offset?: Point): void;
|
|
112
115
|
calcSize(location: Point, scale: number): void;
|
|
113
116
|
setEncompassGlyph(scale: number, contentBoundsIn: Bounds): [Bounds, Bounds];
|
|
@@ -15,7 +15,8 @@ export default class BaseEquationFunction extends Elements {
|
|
|
15
15
|
_dup(namedCollection?: Record<string, any>): any;
|
|
16
16
|
getAllElements(includeHidden?: boolean): any[];
|
|
17
17
|
setPositions(): void;
|
|
18
|
-
setColor(colorIn?: TypeColor | null): void;
|
|
18
|
+
setColor(colorIn?: TypeColor | null, from?: string | null): void;
|
|
19
|
+
setOpacity(opacityIn?: number | null): void;
|
|
19
20
|
offsetLocation(offset?: Point): void;
|
|
20
21
|
calcSize(location: Point, scale: number): void;
|
|
21
22
|
}
|
|
@@ -25,7 +25,9 @@ export interface ElementInterface {
|
|
|
25
25
|
offsetLocation(offset: Point): void;
|
|
26
26
|
getBounds(useFullSize?: boolean): Bounds;
|
|
27
27
|
cleanup(): void;
|
|
28
|
-
setColor(colorIn: TypeColor | null): void;
|
|
28
|
+
setColor(colorIn: TypeColor | null, from?: string | null): void;
|
|
29
|
+
setOpacity(opacityIn: number | null): void;
|
|
30
|
+
collectDrawOrder(ops: Array<any>): void;
|
|
29
31
|
}
|
|
30
32
|
declare class BlankElement {
|
|
31
33
|
ascent: number;
|
|
@@ -48,6 +50,7 @@ declare class Element implements ElementInterface {
|
|
|
48
50
|
showContent: boolean;
|
|
49
51
|
color: TypeColor | null;
|
|
50
52
|
defaultColor: TypeColor;
|
|
53
|
+
opacity: number | null;
|
|
51
54
|
fullSize: {
|
|
52
55
|
leftOffset: number;
|
|
53
56
|
width: number;
|
|
@@ -61,7 +64,9 @@ declare class Element implements ElementInterface {
|
|
|
61
64
|
_dup(namedCollection?: Record<string, any>): Element;
|
|
62
65
|
getAllElements(includeHidden?: boolean): (FigureElementCollection | FigureElementPrimitive)[];
|
|
63
66
|
setPositions(): void;
|
|
64
|
-
setColor(colorIn?: TypeColor | null): void;
|
|
67
|
+
setColor(colorIn?: TypeColor | null, from?: string | null): void;
|
|
68
|
+
setOpacity(opacityIn?: number | null): void;
|
|
69
|
+
collectDrawOrder(ops: Array<any>): void;
|
|
65
70
|
offsetLocation(offset?: Point): void;
|
|
66
71
|
getBounds(useFullSize?: boolean): Bounds;
|
|
67
72
|
}
|
|
@@ -75,6 +80,7 @@ declare class Elements implements ElementInterface {
|
|
|
75
80
|
fnMap: FunctionMap;
|
|
76
81
|
showContent: boolean;
|
|
77
82
|
color: TypeColor | null;
|
|
83
|
+
opacity: number | null;
|
|
78
84
|
fullSize: {
|
|
79
85
|
leftOffset: number;
|
|
80
86
|
width: number;
|
|
@@ -88,7 +94,9 @@ declare class Elements implements ElementInterface {
|
|
|
88
94
|
calcSize(location: Point, scale: number): void;
|
|
89
95
|
getAllElements(includeHidden?: boolean): (FigureElementCollection | FigureElementPrimitive | ElementInterface)[];
|
|
90
96
|
setPositions(): void;
|
|
91
|
-
setColor(colorIn?: TypeColor | null): void;
|
|
97
|
+
setColor(colorIn?: TypeColor | null, from?: string | null): void;
|
|
98
|
+
setOpacity(opacityIn?: number | null): void;
|
|
99
|
+
collectDrawOrder(ops: Array<any>): void;
|
|
92
100
|
offsetLocation(offset?: Point): void;
|
|
93
101
|
getBounds(useFullSize?: boolean): Bounds;
|
|
94
102
|
}
|
|
@@ -31,6 +31,16 @@ export type EQN_UpdateElementText = {
|
|
|
31
31
|
* Object where keys are property names of a {@link FigureElement} and values
|
|
32
32
|
* are the values to set the properties to.
|
|
33
33
|
*
|
|
34
|
+
* Two keys are treated specially as draw-order operations rather than element
|
|
35
|
+
* properties: `back` and `front`. Each takes an options object (`{}` for the
|
|
36
|
+
* full extreme, `{ num }` to move a set number of places, or `{ before }` /
|
|
37
|
+
* `{ after }` to position relative to an anchor element) and reorders the
|
|
38
|
+
* element in the equation's draw stack - paralleling the {@link EQN_Back} and
|
|
39
|
+
* {@link EQN_Front} equation functions. When several elements declare `back` or
|
|
40
|
+
* `front` mods, they are applied in definition order, so
|
|
41
|
+
* `{ a: { back: {} }, b: { back: {} } }` sends `a` to the back and then `b` to
|
|
42
|
+
* the back.
|
|
43
|
+
*
|
|
34
44
|
* @property {any} [_propertyName]
|
|
35
45
|
* @interface
|
|
36
46
|
* @group Misc Figure Element
|
|
@@ -392,6 +402,11 @@ export type EQN_FromForms = {
|
|
|
392
402
|
* automatically in the equation based on EQN_Color equation functions. In such
|
|
393
403
|
* cases, colors that are set external to the equation will be overridden. Use
|
|
394
404
|
* `true` to allow setting of colors externally only. (`false`)
|
|
405
|
+
* @property {boolean} [ignoreOpacity] when `false`, opacity will be set
|
|
406
|
+
* automatically in the equation based on EQN_Opacity equation functions
|
|
407
|
+
* (multiplicative cascade). Element opacities set externally will be
|
|
408
|
+
* overridden. Use `true` to allow setting of opacities externally only.
|
|
409
|
+
* (`false`)
|
|
395
410
|
*
|
|
396
411
|
* @example
|
|
397
412
|
* // Simple form definition of two different forms of the same equation and one
|
|
@@ -483,6 +498,7 @@ type EQN_FormObjectDefinition = {
|
|
|
483
498
|
elementMods?: OBJ_ElementMods;
|
|
484
499
|
fromForm: EQN_FromForms;
|
|
485
500
|
ignoreColor?: boolean;
|
|
501
|
+
ignoreOpacity?: boolean;
|
|
486
502
|
};
|
|
487
503
|
/**
|
|
488
504
|
* A form definition can either be:
|
|
@@ -588,6 +604,7 @@ export type EQN_FormDefaults = {
|
|
|
588
604
|
onTransition?: null | string | (() => void);
|
|
589
605
|
layout?: 'lazy' | 'init' | 'always';
|
|
590
606
|
ignoreColor?: boolean;
|
|
607
|
+
ignoreOpacity?: boolean;
|
|
591
608
|
};
|
|
592
609
|
/**
|
|
593
610
|
* Options objects to construct an {@link Equation} class.
|
|
@@ -825,6 +842,7 @@ export declare class Equation extends FigureElementCollection {
|
|
|
825
842
|
onTransition?: null | string | (() => void);
|
|
826
843
|
layout?: 'always' | 'lazy' | 'init';
|
|
827
844
|
ignoreColor?: boolean;
|
|
845
|
+
ignoreOpacity?: boolean;
|
|
828
846
|
};
|
|
829
847
|
isAnimating: boolean;
|
|
830
848
|
descriptionElement: FigureElementPrimitive | null;
|
|
@@ -103,6 +103,7 @@ export default class EquationForm extends Elements {
|
|
|
103
103
|
positionsSet: boolean;
|
|
104
104
|
layout: 'always' | 'lazy' | 'init';
|
|
105
105
|
ignoreColor: boolean;
|
|
106
|
+
ignoreOpacity: boolean;
|
|
106
107
|
fromForm: {
|
|
107
108
|
[key: string]: {
|
|
108
109
|
onTransition?: string | (() => void);
|
|
@@ -122,6 +123,9 @@ export default class EquationForm extends Elements {
|
|
|
122
123
|
getNamedElements(): Record<string, any>;
|
|
123
124
|
rearrange(): void;
|
|
124
125
|
setPositions(noArrange?: boolean): void;
|
|
126
|
+
collectElementModDrawOrder(ops: Array<any>): void;
|
|
127
|
+
setDrawOrder(): void;
|
|
128
|
+
applyDrawOrderOp(collection: any, op: any): void;
|
|
125
129
|
_dup(elements?: TypeElements, collectionMethods?: TypeCollectionMethods): EquationForm;
|
|
126
130
|
arrange(scale?: number, xAlign?: TypeHAlign | null, yAlign?: TypeVAlign | null, fixTo?: FigureElementPrimitive | FigureElementCollection | Point): void;
|
|
127
131
|
lazyArrange(scale?: number, xAlign?: TypeHAlign | null, yAlign?: TypeVAlign | null, fixTo?: FigureElementPrimitive | FigureElementCollection | Point): void;
|