@teachinglab/omd 0.7.22 → 0.7.24

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.
@@ -117,6 +117,8 @@ export class omdCanvas {
117
117
  this.svg.setAttribute('viewBox', `0 0 ${this.config.width} ${this.config.height}`);
118
118
  this.svg.style.cssText = `
119
119
  display: block;
120
+ width: 100%;
121
+ height: 100%;
120
122
  background: ${this.config.backgroundColor};
121
123
  cursor: none;
122
124
  touch-action: none;
@@ -441,11 +443,16 @@ export class omdCanvas {
441
443
  }
442
444
 
443
445
  /**
444
- * Handle window resize
446
+ * Handle window resize — resize the canvas to match the container.
445
447
  * @private
446
448
  */
447
449
  _handleResize() {
448
- // Optional: implement responsive behavior
450
+ if (!this.container) return;
451
+ const w = Math.max(400, this.container.clientWidth || this.container.getBoundingClientRect().width || 0);
452
+ const h = Math.max(400, this.container.clientHeight || this.container.getBoundingClientRect().height || 0);
453
+ if (!w || !h) return;
454
+ if (Math.abs(w - this.config.width) < 1 && Math.abs(h - this.config.height) < 1) return;
455
+ this.resize(w, h);
449
456
  }
450
457
 
451
458
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teachinglab/omd",
3
- "version": "0.7.22",
3
+ "version": "0.7.24",
4
4
  "description": "omd",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",
package/src/omd.js CHANGED
@@ -28,6 +28,7 @@ import { omdRectangle } from "./omdShapes.js";
28
28
  import { omdEllipse } from "./omdShapes.js";
29
29
  import { omdCircle } from "./omdShapes.js";
30
30
  import { omdRegularPolygon } from "./omdShapes.js";
31
+ import { omdLabel } from "./omdLabel.js";
31
32
  import { jsvgContainer } from "@teachinglab/jsvg";
32
33
 
33
34
  export class omd extends jsvgContainer
@@ -172,6 +173,9 @@ export class omd extends jsvgContainer
172
173
  case "regularPolygon":
173
174
  N = new omdRegularPolygon();
174
175
  break;
176
+ case "label":
177
+ N = new omdLabel();
178
+ break;
175
179
  default:
176
180
  console.error(`Unsupported OMD type: ${omdType}. Available types: number, variable, operator, term, expression, powerExpression, rationalExpression, function, equation, numberLine, balanceHanger, tapeDiagram, numberTile, ratioChart, coordinatePlane, spinner, table, tileEquation, rightTriangle, isoscelesTriangle, rectangle, ellipse, circle, regularPolygon`);
177
181
  return;