manim-web 0.3.0 → 0.3.2

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/dist/index.js CHANGED
@@ -37116,6 +37116,7 @@ class Zo extends Mt {
37116
37116
  _svgFillOpacity;
37117
37117
  _targetHeight;
37118
37118
  _macros;
37119
+ _svgViewBoxWidth = 1e3;
37119
37120
  /** Whether this is a multi-part MathTexSVG (created from string[]) */
37120
37121
  _isMultiPart = !1;
37121
37122
  /** Child part groups (only when _isMultiPart is true) */
@@ -37150,7 +37151,9 @@ class Zo extends Mt {
37150
37151
  */
37151
37152
  getPart(t) {
37152
37153
  if (!this._isMultiPart)
37153
- throw new Error("getPart() is only available on multi-part MathTexSVG (created with string[])");
37154
+ throw new Error(
37155
+ "getPart() is only available on multi-part MathTexSVG (created with string[])"
37156
+ );
37154
37157
  if (t < 0 || t >= this._parts.length)
37155
37158
  throw new Error(`Part index ${t} out of range [0, ${this._parts.length - 1}]`);
37156
37159
  return this._parts[t];
@@ -37195,15 +37198,20 @@ class Zo extends Mt {
37195
37198
  * Render the LaTeX to VMobject paths.
37196
37199
  */
37197
37200
  async _render() {
37198
- const e = (await Hr(this._latex, {
37201
+ const t = await Hr(this._latex, {
37199
37202
  displayMode: this._displayMode,
37200
37203
  color: this._color,
37201
37204
  fontScale: this._fontSize,
37202
37205
  macros: this._macros
37203
- })).vmobjectGroup;
37204
- this._restyleChildren(e);
37205
- for (const i of [...e.children])
37206
- e.remove(i), this.add(i);
37206
+ }), e = t.svgElement.getAttribute?.("viewBox");
37207
+ if (e) {
37208
+ const r = e.split(/\s+/).map(Number);
37209
+ this._svgViewBoxWidth = r[2] || 1e3;
37210
+ }
37211
+ const i = t.vmobjectGroup;
37212
+ this._restyleChildren(i);
37213
+ for (const r of [...i.children])
37214
+ i.remove(r), this.add(r);
37207
37215
  this._scaleToTarget(), this.fillOpacity = this._svgFillOpacity;
37208
37216
  }
37209
37217
  /**
@@ -37221,26 +37229,24 @@ class Zo extends Mt {
37221
37229
  * Scale and center the assembled paths by transforming actual point data.
37222
37230
  */
37223
37231
  _scaleToTarget() {
37224
- const t = [], e = (d) => {
37225
- if (d instanceof B && !(d instanceof Mt) && t.push(d), "children" in d)
37226
- for (const f of d.children)
37227
- e(f);
37232
+ const t = [], e = (u) => {
37233
+ if (u instanceof B && !(u instanceof Mt) && t.push(u), "children" in u)
37234
+ for (const d of u.children)
37235
+ e(d);
37228
37236
  };
37229
37237
  e(this);
37230
37238
  let i = 1 / 0, r = -1 / 0, n = 1 / 0, o = -1 / 0;
37231
- for (const d of t)
37232
- for (const f of d.getPoints())
37233
- f[0] < i && (i = f[0]), f[0] > r && (r = f[0]), f[1] < n && (n = f[1]), f[1] > o && (o = f[1]);
37239
+ for (const u of t)
37240
+ for (const d of u.getPoints())
37241
+ d[0] < i && (i = d[0]), d[0] > r && (r = d[0]), d[1] < n && (n = d[1]), d[1] > o && (o = d[1]);
37234
37242
  const a = o - n;
37235
37243
  if (a < 1e-4) return;
37236
- const l = (this._targetHeight ?? 0.5 * this._fontSize) / a, c = (i + r) / 2, u = (n + o) / 2;
37237
- for (const d of t) {
37238
- const g = d.getPoints().map((m) => [
37239
- (m[0] - c) * l,
37240
- (m[1] - u) * l,
37241
- m[2]
37242
- ]);
37243
- d.setPoints3D(g);
37244
+ let h;
37245
+ this._targetHeight !== void 0 ? h = this._targetHeight / a : h = 0.5 * this._svgViewBoxWidth / 1e3;
37246
+ const l = (i + r) / 2, c = (n + o) / 2;
37247
+ for (const u of t) {
37248
+ const f = u.getPoints().map((g) => [(g[0] - l) * h, (g[1] - c) * h, g[2]]);
37249
+ u.setPoints3D(f);
37244
37250
  }
37245
37251
  }
37246
37252
  /**
@@ -37255,38 +37261,42 @@ class Zo extends Mt {
37255
37261
  color: this._color,
37256
37262
  fontScale: this._fontSize,
37257
37263
  macros: this._macros
37258
- });
37264
+ }), r = i.svgElement.getAttribute?.("viewBox");
37265
+ if (r) {
37266
+ const h = r.split(/\s+/).map(Number);
37267
+ this._svgViewBoxWidth = h[2] || 1e3;
37268
+ }
37259
37269
  this._restyleChildren(i.vmobjectGroup);
37260
- const r = [];
37261
- for (const a of [...i.vmobjectGroup.children])
37262
- a instanceof B && r.push(a);
37263
37270
  const n = [];
37264
- for (const a of t) {
37265
- const h = await Hr(a, {
37271
+ for (const h of [...i.vmobjectGroup.children])
37272
+ h instanceof B && n.push(h);
37273
+ const o = [];
37274
+ for (const h of t) {
37275
+ const l = await Hr(h, {
37266
37276
  displayMode: !1,
37267
37277
  color: this._color,
37268
37278
  fontScale: this._fontSize,
37269
37279
  macros: this._macros
37270
37280
  });
37271
- let l = 0;
37272
- for (const c of h.vmobjectGroup.children)
37273
- c instanceof B && l++;
37274
- n.push(l);
37281
+ let c = 0;
37282
+ for (const u of l.vmobjectGroup.children)
37283
+ u instanceof B && c++;
37284
+ o.push(c);
37275
37285
  }
37276
- let o = 0;
37277
- for (let a = 0; a < t.length; a++) {
37278
- const h = new Zo._PartGroup(this);
37279
- h._latex = t[a], h._color = this._color;
37280
- const l = n[a];
37281
- for (let c = 0; c < l && o < r.length; c++) {
37282
- const u = r[o++];
37283
- i.vmobjectGroup.remove(u), h.add(u);
37286
+ let a = 0;
37287
+ for (let h = 0; h < t.length; h++) {
37288
+ const l = new Zo._PartGroup(this);
37289
+ l._latex = t[h], l._color = this._color;
37290
+ const c = o[h];
37291
+ for (let u = 0; u < c && a < n.length; u++) {
37292
+ const d = n[a++];
37293
+ i.vmobjectGroup.remove(d), l.add(d);
37284
37294
  }
37285
- this._parts.push(h), this.add(h);
37295
+ this._parts.push(l), this.add(l);
37286
37296
  }
37287
- for (; o < r.length; ) {
37288
- const a = this._parts[this._parts.length - 1], h = r[o++];
37289
- i.vmobjectGroup.remove(h), a.add(h);
37297
+ for (; a < n.length; ) {
37298
+ const h = this._parts[this._parts.length - 1], l = n[a++];
37299
+ i.vmobjectGroup.remove(l), h.add(l);
37290
37300
  }
37291
37301
  this._scaleToTarget(), this.fillOpacity = this._svgFillOpacity;
37292
37302
  }
@@ -39784,24 +39794,24 @@ class rd extends ze {
39784
39794
  shaftRadius: _ = 0.01
39785
39795
  } = t;
39786
39796
  this._xRange = [...e], this._yRange = [...i], this._zRange = [...r], this._xLength = n, this._yLength = o, this._zLength = a, this._showTicks = f, this._tickLength = g;
39787
- const y = l ?? h, x = c ?? h, w = u ?? h, M = n / 2, C = o / 2, P = a / 2;
39797
+ const y = l ?? h, x = c ?? h, w = u ?? h, M = this._graphToVisual(e[0], e, n), C = this._graphToVisual(e[1], e, n), P = this._graphToVisual(i[0], i, o), R = this._graphToVisual(i[1], i, o), O = this._graphToVisual(r[0], r, a), z = this._graphToVisual(r[1], r, a);
39788
39798
  this._xAxis = new gs({
39789
- start: [-M, 0, 0],
39790
- end: [M, 0, 0],
39799
+ start: [M, 0, 0],
39800
+ end: [C, 0, 0],
39791
39801
  color: y,
39792
39802
  tipLength: m,
39793
39803
  tipRadius: p,
39794
39804
  shaftRadius: _
39795
39805
  }), this._yAxis = new gs({
39796
- start: [0, 0, C],
39797
- end: [0, 0, -C],
39806
+ start: [0, 0, -P],
39807
+ end: [0, 0, -R],
39798
39808
  color: x,
39799
39809
  tipLength: m,
39800
39810
  tipRadius: p,
39801
39811
  shaftRadius: _
39802
39812
  }), this._zAxis = new gs({
39803
- start: [0, -P, 0],
39804
- end: [0, P, 0],
39813
+ start: [0, O, 0],
39814
+ end: [0, z, 0],
39805
39815
  color: w,
39806
39816
  tipLength: m,
39807
39817
  tipRadius: p,
@@ -39819,42 +39829,42 @@ class rd extends ze {
39819
39829
  * Create tick marks for all axes using Manim→THREE.js coordinate mapping
39820
39830
  */
39821
39831
  _createTicks(t, e, i) {
39822
- const r = this._xLength / 2, n = this._yLength / 2, o = this._zLength / 2, [a, h, l] = this._xRange, [c, u, d] = this._yRange, [f, g, m] = this._zRange, p = this._tickLength / 2;
39823
- for (let _ = a; _ <= h; _ += l) {
39824
- if (Math.abs(_) < 1e-3 || Math.abs(_ - a) < 1e-3 || Math.abs(_ - h) < 1e-3) continue;
39825
- const y = this._mapToVisual(_, a, h, -r, r), x = new Fs({
39826
- start: this._m2t(y, 0, -p),
39827
- end: this._m2t(y, 0, p),
39832
+ const [r, n, o] = this._xRange, [a, h, l] = this._yRange, [c, u, d] = this._zRange, f = this._tickLength / 2;
39833
+ for (let g = r; g <= n; g += o) {
39834
+ if (Math.abs(g) < 1e-3 || Math.abs(g - r) < 1e-3 || Math.abs(g - n) < 1e-3) continue;
39835
+ const m = this._graphToVisual(g, this._xRange, this._xLength), p = new Fs({
39836
+ start: this._m2t(m, 0, -f),
39837
+ end: this._m2t(m, 0, f),
39828
39838
  color: t
39829
39839
  });
39830
- this._ticks.push(x), this.add(x);
39840
+ this._ticks.push(p), this.add(p);
39831
39841
  }
39832
- for (let _ = c; _ <= u; _ += d) {
39833
- if (Math.abs(_) < 1e-3 || Math.abs(_ - c) < 1e-3 || Math.abs(_ - u) < 1e-3) continue;
39834
- const y = this._mapToVisual(_, c, u, -n, n), x = new Fs({
39835
- start: this._m2t(0, y, -p),
39836
- end: this._m2t(0, y, p),
39842
+ for (let g = a; g <= h; g += l) {
39843
+ if (Math.abs(g) < 1e-3 || Math.abs(g - a) < 1e-3 || Math.abs(g - h) < 1e-3) continue;
39844
+ const m = this._graphToVisual(g, this._yRange, this._yLength), p = new Fs({
39845
+ start: this._m2t(0, m, -f),
39846
+ end: this._m2t(0, m, f),
39837
39847
  color: e
39838
39848
  });
39839
- this._ticks.push(x), this.add(x);
39849
+ this._ticks.push(p), this.add(p);
39840
39850
  }
39841
- for (let _ = f; _ <= g; _ += m) {
39842
- if (Math.abs(_) < 1e-3 || Math.abs(_ - f) < 1e-3 || Math.abs(_ - g) < 1e-3) continue;
39843
- const y = this._mapToVisual(_, f, g, -o, o), x = new Fs({
39844
- start: this._m2t(-p, 0, y),
39845
- end: this._m2t(p, 0, y),
39851
+ for (let g = c; g <= u; g += d) {
39852
+ if (Math.abs(g) < 1e-3 || Math.abs(g - c) < 1e-3 || Math.abs(g - u) < 1e-3) continue;
39853
+ const m = this._graphToVisual(g, this._zRange, this._zLength), p = new Fs({
39854
+ start: this._m2t(-f, 0, m),
39855
+ end: this._m2t(f, 0, m),
39846
39856
  color: i
39847
39857
  });
39848
- this._ticks.push(x), this.add(x);
39858
+ this._ticks.push(p), this.add(p);
39849
39859
  }
39850
39860
  }
39851
39861
  /**
39852
- * Map a value from graph coordinates to visual coordinates
39862
+ * Map a graph coordinate value to visual position such that graph 0 maps to visual 0.
39863
+ * visual = value * (length / (max - min))
39853
39864
  */
39854
- _mapToVisual(t, e, i, r, n) {
39855
- if (i === e) return (r + n) / 2;
39856
- const o = (t - e) / (i - e);
39857
- return r + o * (n - r);
39865
+ _graphToVisual(t, e, i) {
39866
+ const [r, n] = e;
39867
+ return n === r ? 0 : t * (i / (n - r));
39858
39868
  }
39859
39869
  /**
39860
39870
  * Convert graph coordinates (Manim space) to visual point coordinates (THREE.js space).
@@ -39865,8 +39875,8 @@ class rd extends ze {
39865
39875
  * @returns The visual point [x, y, z] in THREE.js space
39866
39876
  */
39867
39877
  coordsToPoint(t, e, i) {
39868
- const [r, n] = this._xRange, [o, a] = this._yRange, [h, l] = this._zRange, c = this._xLength / 2, u = this._yLength / 2, d = this._zLength / 2, f = this._mapToVisual(t, r, n, -c, c), g = this._mapToVisual(e, o, a, -u, u), m = this._mapToVisual(i, h, l, -d, d);
39869
- return [f + this.position.x, m + this.position.y, -g + this.position.z];
39878
+ const r = this._graphToVisual(t, this._xRange, this._xLength), n = this._graphToVisual(e, this._yRange, this._yLength), o = this._graphToVisual(i, this._zRange, this._zLength);
39879
+ return [r + this.position.x, o + this.position.y, -n + this.position.z];
39870
39880
  }
39871
39881
  /**
39872
39882
  * Convert visual point coordinates (THREE.js space) to graph coordinates (Manim space).
@@ -39875,8 +39885,8 @@ class rd extends ze {
39875
39885
  * @returns The graph coordinates [x, y, z] in Manim space
39876
39886
  */
39877
39887
  pointToCoords(t) {
39878
- const [e, i] = this._xRange, [r, n] = this._yRange, [o, a] = this._zRange, h = this._xLength / 2, l = this._yLength / 2, c = this._zLength / 2, u = t[0] - this.position.x, d = t[1] - this.position.y, f = t[2] - this.position.z, g = this._mapToVisual(u, -h, h, e, i), m = this._mapToVisual(-f, -l, l, r, n), p = this._mapToVisual(d, -c, c, o, a);
39879
- return [g, m, p];
39888
+ const [e, i] = this._xRange, [r, n] = this._yRange, [o, a] = this._zRange, h = t[0] - this.position.x, l = t[1] - this.position.y, c = t[2] - this.position.z, u = h * (i - e) / this._xLength, d = -c * (n - r) / this._yLength, f = l * (a - o) / this._zLength;
39889
+ return [u, d, f];
39880
39890
  }
39881
39891
  /**
39882
39892
  * Get the X-axis arrow
@@ -29,6 +29,7 @@ export declare class MathTexSVG extends VGroup {
29
29
  protected _svgFillOpacity: number;
30
30
  protected _targetHeight: number | undefined;
31
31
  protected _macros: Record<string, string> | undefined;
32
+ protected _svgViewBoxWidth: number;
32
33
  /** Whether this is a multi-part MathTexSVG (created from string[]) */
33
34
  protected _isMultiPart: boolean;
34
35
  /** Child part groups (only when _isMultiPart is true) */
@@ -1 +1 @@
1
- {"version":3,"file":"MathTexSVG.d.ts","sourceRoot":"","sources":["../../../src/mobjects/text/MathTexSVG.ts"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,KAAK,EAAW,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIhE,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,kDAAkD;IAClD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  */
93
93
  private _createTicks;
94
94
  /**
95
- * Map a value from graph coordinates to visual coordinates
95
+ * Map a graph coordinate value to visual position such that graph 0 maps to visual 0.
96
+ * visual = value * (length / (max - min))
96
97
  */
97
- private _mapToVisual;
98
+ private _graphToVisual;
98
99
  /**
99
100
  * Convert graph coordinates (Manim space) to visual point coordinates (THREE.js space).
100
101
  * Applies Manim→THREE.js mapping: (mx, my, mz) → (mx, mz, -my)
@@ -1 +1 @@
1
- {"version":3,"file":"ThreeDAxes.d.ts","sourceRoot":"","sources":["../../../src/mobjects/three-d/ThreeDAxes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,OAAO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AE,MAAM,GAAG,YAAY;IAS5D;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY;IAmBhD;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,SAAS,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAIrC;;OAEG;IACH,SAAS,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAIrC;;OAEG;IACH,SAAS,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAIrC;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACH,SAAS,IAAI,YAAY;IAIzB;;OAEG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAIvB;;OAEG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAIvB;;OAEG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAIvB;;OAEG;cACgB,WAAW,IAAI,UAAU;CAY7C;AAED,eAAe,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "manim-web",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Manim-like mathematical animation library for the web",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",