@teachinglab/omd 0.3.2 → 0.3.3

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.
@@ -536,4 +536,12 @@ export class omdEquationStack extends jsvgGroup {
536
536
  this.updateLayout();
537
537
  return true;
538
538
  }
539
+
540
+ /**
541
+ * Returns the SVG element for the entire equation stack.
542
+ * @returns {SVGElement} The SVG element representing the equation stack.
543
+ */
544
+ getSvg() {
545
+ return this.svgObject;
546
+ }
539
547
  }
@@ -952,4 +952,12 @@ export class omdDisplay {
952
952
  getCurrentNode() {
953
953
  return this.node;
954
954
  }
955
+
956
+ /**
957
+ * Returns the SVG element for the entire display.
958
+ * @returns {SVGElement} The SVG element representing the display.
959
+ */
960
+ getSVG() {
961
+ return this.svg.svgObject;
962
+ }
955
963
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teachinglab/omd",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "omd",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",
@@ -114,6 +114,11 @@ export class omdEquation extends omdMetaExpression
114
114
 
115
115
  this.setWidthAndHeight( this.backRect.width, this.backRect.height );
116
116
 
117
+ // Set individual width/height properties and viewBox for API compatibility
118
+ this.width = this.backRect.width;
119
+ this.height = this.backRect.height;
120
+ this.svgObject.setAttribute('viewBox', `0 0 ${this.width} ${this.height}`);
121
+
117
122
  if ( this.centerEquation )
118
123
  {
119
124
  var leftShift = this.leftExpression.width + this.equalSign.width*0.50;
@@ -100,5 +100,10 @@ export class omdExpression extends omdMetaExpression
100
100
  this.backRect.setWidthAndHeight( W + this.inset*2, 30 );
101
101
 
102
102
  this.setWidthAndHeight( this.backRect.width, this.backRect.height );
103
+
104
+ // Set individual width/height properties and viewBox for API compatibility
105
+ this.width = this.backRect.width;
106
+ this.height = this.backRect.height;
107
+ this.svgObject.setAttribute('viewBox', `0 0 ${this.width} ${this.height}`);
103
108
  }
104
109
  }
package/src/omdShapes.js CHANGED
@@ -87,6 +87,11 @@ export class omdRightTriangle extends jsvgGroup
87
87
  L.initializeWithShapePath( this.shapePath, [A,B,C] );
88
88
  this.labelsHolder.addChild( L );
89
89
  }
90
+
91
+ // Set dimensions and viewBox for API compatibility
92
+ this.width = this.unitScale * this.horizontalLeg + 20;
93
+ this.height = this.unitScale * this.verticalLeg + 20;
94
+ this.svgObject.setAttribute('viewBox', `0 0 ${this.width} ${this.height}`);
90
95
  }
91
96
  }
92
97
 
@@ -154,6 +159,11 @@ export class omdIsoscelesTriangle extends jsvgGroup
154
159
  L.initializeWithShapePath( this.shapePath );
155
160
  this.labelsHolder.addChild( L );
156
161
  }
162
+
163
+ // Set dimensions and viewBox for API compatibility
164
+ this.width = this.unitScale * this.triangleBase + 20;
165
+ this.height = this.unitScale * this.triangleHeight + 20;
166
+ this.svgObject.setAttribute('viewBox', `0 0 ${this.width} ${this.height}`);
157
167
  }
158
168
  }
159
169
 
@@ -222,6 +232,11 @@ export class omdRectangle extends jsvgGroup
222
232
  L.initializeWithShapePath( this.shapePath, [A,B,"",""] );
223
233
  this.labelsHolder.addChild( L );
224
234
  }
235
+
236
+ // Set dimensions and viewBox for API compatibility
237
+ this.width = this.unitScale * this.rectWidth + 20;
238
+ this.height = this.unitScale * this.rectHeight + 20;
239
+ this.svgObject.setAttribute('viewBox', `0 0 ${this.width} ${this.height}`);
225
240
  }
226
241
  }
227
242
 
@@ -266,6 +281,11 @@ export class omdEllipse extends jsvgGroup
266
281
  updateLayout()
267
282
  {
268
283
  this.shapePath.setWidthAndHeight( this.rectWidth*this.unitScale, this.rectHeight*this.unitScale );
284
+
285
+ // Set dimensions and viewBox for API compatibility
286
+ this.width = this.rectWidth * this.unitScale + 20;
287
+ this.height = this.rectHeight * this.unitScale + 20;
288
+ this.svgObject.setAttribute('viewBox', `0 0 ${this.width} ${this.height}`);
269
289
  }
270
290
  }
271
291
 
@@ -305,6 +325,11 @@ export class omdCircle extends jsvgGroup
305
325
  updateLayout()
306
326
  {
307
327
  this.shapePath.setWidthAndHeight( 2.0*this.radius*this.unitScale, 2.0*this.radius*this.unitScale );
328
+
329
+ // Set dimensions and viewBox for API compatibility
330
+ this.width = 2.0 * this.radius * this.unitScale + 20;
331
+ this.height = 2.0 * this.radius * this.unitScale + 20;
332
+ this.svgObject.setAttribute('viewBox', `0 0 ${this.width} ${this.height}`);
308
333
  }
309
334
  }
310
335
 
@@ -387,6 +412,11 @@ export class omdRegularPolygon extends jsvgGroup
387
412
  L.initializeWithShapePath( this.shapePath, [ A ] );
388
413
  this.labelsHolder.addChild( L );
389
414
  }
415
+
416
+ // Set dimensions and viewBox for API compatibility
417
+ this.width = 2.0 * this.radius * this.unitScale + 20;
418
+ this.height = 2.0 * this.radius * this.unitScale + 20;
419
+ this.svgObject.setAttribute('viewBox', `0 0 ${this.width} ${this.height}`);
390
420
  }
391
421
  }
392
422
 
package/src/omdSpinner.js CHANGED
@@ -136,7 +136,10 @@ export class omdSpinner extends jsvgGroup
136
136
  var A = -90 + 360.0 / this.divisions * (this.arrowPosition-0.5);
137
137
  this.arrow.setRotation( A );
138
138
 
139
-
139
+ // Set dimensions and viewBox for API compatibility
140
+ this.width = circleSize;
141
+ this.height = circleSize;
142
+ this.svgObject.setAttribute('viewBox', `0 0 ${this.width} ${this.height}`);
140
143
 
141
144
  // var L = new jsvgLine();
142
145
  // var lineLength = circleSize*0.4;