@teachinglab/omd 0.1.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.
Files changed (144) hide show
  1. package/README.md +138 -0
  2. package/canvas/core/canvasConfig.js +203 -0
  3. package/canvas/core/omdCanvas.js +475 -0
  4. package/canvas/drawing/segment.js +168 -0
  5. package/canvas/drawing/stroke.js +386 -0
  6. package/canvas/events/eventManager.js +435 -0
  7. package/canvas/events/pointerEventHandler.js +263 -0
  8. package/canvas/features/focusFrameManager.js +287 -0
  9. package/canvas/index.js +49 -0
  10. package/canvas/tools/eraserTool.js +322 -0
  11. package/canvas/tools/pencilTool.js +319 -0
  12. package/canvas/tools/selectTool.js +457 -0
  13. package/canvas/tools/tool.js +223 -0
  14. package/canvas/tools/toolManager.js +394 -0
  15. package/canvas/ui/cursor.js +438 -0
  16. package/canvas/ui/toolbar.js +304 -0
  17. package/canvas/utils/boundingBox.js +378 -0
  18. package/canvas/utils/mathUtils.js +259 -0
  19. package/docs/api/configuration-options.md +104 -0
  20. package/docs/api/eventManager.md +68 -0
  21. package/docs/api/focusFrameManager.md +150 -0
  22. package/docs/api/index.md +91 -0
  23. package/docs/api/main.md +58 -0
  24. package/docs/api/omdBinaryExpressionNode.md +227 -0
  25. package/docs/api/omdCanvas.md +142 -0
  26. package/docs/api/omdConfigManager.md +192 -0
  27. package/docs/api/omdConstantNode.md +117 -0
  28. package/docs/api/omdDisplay.md +121 -0
  29. package/docs/api/omdEquationNode.md +161 -0
  30. package/docs/api/omdEquationSequenceNode.md +301 -0
  31. package/docs/api/omdEquationStack.md +139 -0
  32. package/docs/api/omdFunctionNode.md +141 -0
  33. package/docs/api/omdGroupNode.md +182 -0
  34. package/docs/api/omdHelpers.md +96 -0
  35. package/docs/api/omdLeafNode.md +163 -0
  36. package/docs/api/omdNode.md +101 -0
  37. package/docs/api/omdOperationDisplayNode.md +139 -0
  38. package/docs/api/omdOperatorNode.md +127 -0
  39. package/docs/api/omdParenthesisNode.md +122 -0
  40. package/docs/api/omdPopup.md +117 -0
  41. package/docs/api/omdPowerNode.md +127 -0
  42. package/docs/api/omdRationalNode.md +128 -0
  43. package/docs/api/omdSequenceNode.md +128 -0
  44. package/docs/api/omdSimplification.md +110 -0
  45. package/docs/api/omdSqrtNode.md +79 -0
  46. package/docs/api/omdStepVisualizer.md +115 -0
  47. package/docs/api/omdStepVisualizerHighlighting.md +61 -0
  48. package/docs/api/omdStepVisualizerInteractiveSteps.md +129 -0
  49. package/docs/api/omdStepVisualizerLayout.md +60 -0
  50. package/docs/api/omdStepVisualizerNodeUtils.md +140 -0
  51. package/docs/api/omdStepVisualizerTextBoxes.md +68 -0
  52. package/docs/api/omdToolbar.md +102 -0
  53. package/docs/api/omdTranscriptionService.md +76 -0
  54. package/docs/api/omdTreeDiff.md +134 -0
  55. package/docs/api/omdUnaryExpressionNode.md +174 -0
  56. package/docs/api/omdUtilities.md +70 -0
  57. package/docs/api/omdVariableNode.md +148 -0
  58. package/docs/api/selectTool.md +74 -0
  59. package/docs/api/simplificationEngine.md +98 -0
  60. package/docs/api/simplificationRules.md +77 -0
  61. package/docs/api/simplificationUtils.md +64 -0
  62. package/docs/api/transcribe.md +43 -0
  63. package/docs/api-reference.md +85 -0
  64. package/docs/index.html +454 -0
  65. package/docs/user-guide.md +9 -0
  66. package/index.js +67 -0
  67. package/omd/config/omdConfigManager.js +267 -0
  68. package/omd/core/index.js +150 -0
  69. package/omd/core/omdEquationStack.js +347 -0
  70. package/omd/core/omdUtilities.js +115 -0
  71. package/omd/display/omdDisplay.js +443 -0
  72. package/omd/display/omdToolbar.js +502 -0
  73. package/omd/nodes/omdBinaryExpressionNode.js +460 -0
  74. package/omd/nodes/omdConstantNode.js +142 -0
  75. package/omd/nodes/omdEquationNode.js +1223 -0
  76. package/omd/nodes/omdEquationSequenceNode.js +1273 -0
  77. package/omd/nodes/omdFunctionNode.js +352 -0
  78. package/omd/nodes/omdGroupNode.js +68 -0
  79. package/omd/nodes/omdLeafNode.js +77 -0
  80. package/omd/nodes/omdNode.js +557 -0
  81. package/omd/nodes/omdOperationDisplayNode.js +322 -0
  82. package/omd/nodes/omdOperatorNode.js +109 -0
  83. package/omd/nodes/omdParenthesisNode.js +293 -0
  84. package/omd/nodes/omdPowerNode.js +236 -0
  85. package/omd/nodes/omdRationalNode.js +295 -0
  86. package/omd/nodes/omdSqrtNode.js +308 -0
  87. package/omd/nodes/omdUnaryExpressionNode.js +178 -0
  88. package/omd/nodes/omdVariableNode.js +123 -0
  89. package/omd/simplification/omdSimplification.js +171 -0
  90. package/omd/simplification/omdSimplificationEngine.js +886 -0
  91. package/omd/simplification/package.json +6 -0
  92. package/omd/simplification/rules/binaryRules.js +1037 -0
  93. package/omd/simplification/rules/functionRules.js +111 -0
  94. package/omd/simplification/rules/index.js +48 -0
  95. package/omd/simplification/rules/parenthesisRules.js +19 -0
  96. package/omd/simplification/rules/powerRules.js +143 -0
  97. package/omd/simplification/rules/rationalRules.js +475 -0
  98. package/omd/simplification/rules/sqrtRules.js +48 -0
  99. package/omd/simplification/rules/unaryRules.js +37 -0
  100. package/omd/simplification/simplificationRules.js +32 -0
  101. package/omd/simplification/simplificationUtils.js +1056 -0
  102. package/omd/step-visualizer/omdStepVisualizer.js +597 -0
  103. package/omd/step-visualizer/omdStepVisualizerHighlighting.js +206 -0
  104. package/omd/step-visualizer/omdStepVisualizerLayout.js +245 -0
  105. package/omd/step-visualizer/omdStepVisualizerTextBoxes.js +163 -0
  106. package/omd/utils/omdNodeOverlay.js +638 -0
  107. package/omd/utils/omdPopup.js +1084 -0
  108. package/omd/utils/omdStepVisualizerInteractiveSteps.js +491 -0
  109. package/omd/utils/omdStepVisualizerNodeUtils.js +268 -0
  110. package/omd/utils/omdTranscriptionService.js +125 -0
  111. package/omd/utils/omdTreeDiff.js +734 -0
  112. package/package.json +46 -0
  113. package/src/index.js +62 -0
  114. package/src/json-schemas.md +109 -0
  115. package/src/omd-json-samples.js +115 -0
  116. package/src/omd.js +109 -0
  117. package/src/omdApp.js +391 -0
  118. package/src/omdAppCanvas.js +336 -0
  119. package/src/omdBalanceHanger.js +172 -0
  120. package/src/omdColor.js +13 -0
  121. package/src/omdCoordinatePlane.js +467 -0
  122. package/src/omdEquation.js +125 -0
  123. package/src/omdExpression.js +104 -0
  124. package/src/omdFunction.js +113 -0
  125. package/src/omdMetaExpression.js +287 -0
  126. package/src/omdNaturalExpression.js +564 -0
  127. package/src/omdNode.js +384 -0
  128. package/src/omdNumber.js +53 -0
  129. package/src/omdNumberLine.js +107 -0
  130. package/src/omdNumberTile.js +119 -0
  131. package/src/omdOperator.js +73 -0
  132. package/src/omdPowerExpression.js +92 -0
  133. package/src/omdProblem.js +55 -0
  134. package/src/omdRatioChart.js +232 -0
  135. package/src/omdRationalExpression.js +115 -0
  136. package/src/omdSampleData.js +215 -0
  137. package/src/omdShapes.js +476 -0
  138. package/src/omdSpinner.js +148 -0
  139. package/src/omdString.js +39 -0
  140. package/src/omdTable.js +369 -0
  141. package/src/omdTapeDiagram.js +245 -0
  142. package/src/omdTerm.js +92 -0
  143. package/src/omdTileEquation.js +349 -0
  144. package/src/omdVariable.js +51 -0
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@teachinglab/omd",
3
+ "version": "0.1.0",
4
+ "description": "omd",
5
+ "main": "./index.js",
6
+ "module": "./index.js",
7
+ "sideEffects": false,
8
+ "type": "module",
9
+ "exports": {
10
+ ".": "./index.js",
11
+ "./core": "./omd/core/index.js",
12
+ "./visualizations": "./src/index.js",
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "index.js",
17
+ "src/",
18
+ "omd/",
19
+ "jsvg/",
20
+ "docs/",
21
+ "canvas/"
22
+ ],
23
+ "keywords": [
24
+ "math",
25
+ "visualization",
26
+ "equations",
27
+ "educational",
28
+ "canvas",
29
+ "svg",
30
+ "interactive"
31
+ ],
32
+ "author": "jaredschiffman",
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "dotenv": "^17.2.1",
36
+ "express": "^4.18.2",
37
+ "mathjs": "^14.5.2",
38
+ "openai": "^4.28.0",
39
+ "@teachinglab/jsvg": "0.1.1"
40
+ },
41
+ "scripts": {
42
+ "start": "node --env-file=.env server.js",
43
+ "dev": "node --env-file=.env server.js"
44
+ },
45
+ "publishConfig": { "access": "public" }
46
+ }
package/src/index.js ADDED
@@ -0,0 +1,62 @@
1
+ // OMD Visualization Components
2
+ export { omdTable } from './omdTable.js';
3
+ export { omdBalanceHanger } from './omdBalanceHanger.js';
4
+ export { omdCoordinatePlane } from './omdCoordinatePlane.js';
5
+ export { omdTapeDiagram } from './omdTapeDiagram.js';
6
+ export { omdTileEquation } from './omdTileEquation.js';
7
+
8
+ // OMD Charts and Diagrams
9
+ export { omdRatioChart } from './omdRatioChart.js';
10
+ export { omdNumberLine } from './omdNumberLine.js';
11
+
12
+ // OMD Core Components
13
+ export { omdApp } from './omdApp.js';
14
+ export { omdAppCanvas } from './omdAppCanvas.js';
15
+ export { omd } from './omd.js';
16
+
17
+ // OMD Utilities and Helpers
18
+ export { omdColor } from './omdColor.js';
19
+ // OMD Shape Classes
20
+ export {
21
+ omdRightTriangle,
22
+ omdIsoscelesTriangle,
23
+ omdRectangle,
24
+ omdEllipse,
25
+ omdCircle,
26
+ omdRegularPolygon,
27
+ omdShapeLabelSet
28
+ } from './omdShapes.js';
29
+ export { omdSpinner } from './omdSpinner.js';
30
+ export { omdProblem } from './omdProblem.js';
31
+
32
+ // Default export for organized access
33
+ export default {
34
+ // Main visualizations (most commonly used)
35
+ visualizations: {
36
+ omdTable: () => import('./omdTable.js').then(m => m.omdTable),
37
+ omdBalanceHanger: () => import('./omdBalanceHanger.js').then(m => m.omdBalanceHanger),
38
+ omdCoordinatePlane: () => import('./omdCoordinatePlane.js').then(m => m.omdCoordinatePlane),
39
+ omdTapeDiagram: () => import('./omdTapeDiagram.js').then(m => m.omdTapeDiagram),
40
+ omdTileEquation: () => import('./omdTileEquation.js').then(m => m.omdTileEquation),
41
+ omdRatioChart: () => import('./omdRatioChart.js').then(m => m.omdRatioChart),
42
+ omdNumberLine: () => import('./omdNumberLine.js').then(m => m.omdNumberLine)
43
+ },
44
+
45
+ // Mathematical expressions
46
+ expressions: {
47
+ omdExpression: () => import('./omdExpression.js').then(m => m.omdExpression),
48
+ omdEquation: () => import('./omdEquation.js').then(m => m.omdEquation),
49
+ omdMetaExpression: () => import('./omdMetaExpression.js').then(m => m.omdMetaExpression),
50
+ omdNaturalExpression: () => import('./omdNaturalExpression.js').then(m => m.omdNaturalExpression),
51
+ omdPowerExpression: () => import('./omdPowerExpression.js').then(m => m.omdPowerExpression),
52
+ omdRationalExpression: () => import('./omdRationalExpression.js').then(m => m.omdRationalExpression),
53
+ omdFunction: () => import('./omdFunction.js').then(m => m.omdFunction)
54
+ },
55
+
56
+ // Core app components
57
+ app: {
58
+ omdApp: () => import('./omdApp.js').then(m => m.omdApp),
59
+ omdAppCanvas: () => import('./omdAppCanvas.js').then(m => m.omdAppCanvas),
60
+ omd: () => import('./omd.js').then(m => m.omd)
61
+ }
62
+ };
@@ -0,0 +1,109 @@
1
+ # OMD JSON Schemas
2
+
3
+ ## tapeDiagram
4
+ ```json
5
+ {
6
+ "omdType": "tapeDiagram",
7
+ "values": [number|string, ...], //any numbers should be inputted as NUMBERS, e.g 4 not '4'
8
+ "colors": [string, ...],
9
+ "labelSet": [
10
+ {
11
+ "omdType": "omdTapeLabel",
12
+ "startIndex": number, //inclusive
13
+ "endIndex": number, //exclusive
14
+ "label": string,
15
+ "showBelow": boolean
16
+ }
17
+ ],
18
+ "unitWidth": number,
19
+ "showValues": boolean
20
+ }
21
+ ```
22
+
23
+ - values: segment magnitudes or expressions (strings allowed).
24
+ - colors: per-segment fills (optional; falls back to lightGray).
25
+ - labelSet: range labels either by indices (startIndex/endIndex) or by absolute values (startValue/endValue).
26
+ - unitWidth: pixel width per numeric unit.
27
+
28
+ ## balanceHanger
29
+ ```json
30
+ {
31
+ "omdType": "balanceHanger",
32
+ "leftValues": [number|string, ...],
33
+ "rightValues": [number|string, ...],
34
+ "tilt": "left" | "right" | "none",
35
+ "fontFamily": string,
36
+ "fontSize": number
37
+ }
38
+ ```
39
+
40
+ - leftValues/rightValues: stacks rendered on each side.
41
+ - tilt: beam visual tilt.
42
+
43
+ ## coordinatePlane
44
+ ```json
45
+ {
46
+ "omdType": "coordinatePlane",
47
+ "xMin": number,
48
+ "xMax": number,
49
+ "yMin": number,
50
+ "yMax": number,
51
+ "xLabel": string,
52
+ "yLabel": string,
53
+ "axisLabelOffsetPx": number,
54
+ "size": "small" | "medium" | "large",
55
+ "tickInterval": number,
56
+ "tickLabelOffsetPx": number,
57
+ "forceAllTickLabels": boolean,
58
+ "graphEquations": [
59
+ {
60
+ "equation": string, // supports 'y = ...' or expression in x
61
+ "domain": { "min": number, "max": number },
62
+ "color": string,
63
+ "strokeWidth": number,
64
+ "label": string,
65
+ "labelAtX": number,
66
+ "labelPosition": "above" | "below" | "left" | "right"
67
+ }
68
+ ],
69
+ "lineSegments": [
70
+ { "point1": [number, number], "point2": [number, number], "color": string, "strokeWidth": number }
71
+ ],
72
+ "dotValues": [ [number, number, string?], ... ],
73
+ "shapeSet": [
74
+ { "omdType": "rightTriangle" | "isoscelesTriangle" | "rectangle" | "ellipse" | "circle" | "regularPolygon", /* shape-specific fields */ }
75
+ ]
76
+ }
77
+ ```
78
+
79
+ - graphEquations: each equation plotted within its domain.
80
+ - lineSegments: raw segment overlays.
81
+ - dotValues: points as [x, y, optionalColor].
82
+ - shapeSet: geometric overlays rendered in plane units.
83
+
84
+ ## table
85
+ ```json
86
+ {
87
+ "omdType": "table",
88
+ "title": string,
89
+ "headers": [string, ...],
90
+ "data": [ [any, ...], ... ], // array-of-arrays; columns align with headers
91
+ "equation": string, // optional; generates rows from y=f(x) takes precendence over any data provided
92
+ "xMin": number,
93
+ "xMax": number,
94
+ "stepSize": number,
95
+ "fontFamily": string,
96
+ "headerFontFamily": string,
97
+ "fontSize": number,
98
+ "headerFontSize": number,
99
+ "cellHeight": number,
100
+ "headerHeight": number,
101
+ "minCellWidth": number,
102
+ "maxCellWidth": number,
103
+ "padding": number
104
+ }
105
+ ```
106
+
107
+ - If equation is provided, rows are generated in range [xMin, xMax] with stepSize.
108
+ - When autoSizeCells is true, widths are inferred from content.
109
+
@@ -0,0 +1,115 @@
1
+ /**
2
+ * STREAMLINED OMD JSON SAMPLES
3
+ * One comprehensive example per visual type showing ALL properties
4
+ */
5
+
6
+ // COORDINATE PLANE - Complete example with all features
7
+ export const coordinatePlaneExample = {
8
+ "omdType": "coordinatePlane",
9
+ "size": "medium",
10
+ "xMin": -2,
11
+ "xMax": 6,
12
+ "yMin": -1,
13
+ "yMax": 8,
14
+ "xLabel": "Time (hours)",
15
+ "yLabel": "Temperature (°C)",
16
+ "tickInterval": 1,
17
+ "tickLabelOffsetPx": 5,
18
+ "axisLabelOffsetPx": 20,
19
+ "paddingLeft": 60,
20
+ "paddingRight": 30,
21
+ "paddingTop": 30,
22
+ "paddingBottom": 60,
23
+ "graphEquations": [
24
+ {
25
+ "equation": "2*x + 1",
26
+ "domain": { "min": 0, "max": 4 },
27
+ "color": "blue",
28
+ "strokeWidth": 3
29
+ },
30
+ {
31
+ "equation": "x**2 - 2*x + 3",
32
+ "domain": { "min": 1, "max": 5 },
33
+ "color": "red",
34
+ "strokeWidth": 2
35
+ }
36
+ ],
37
+ "dotValues": [
38
+ [1, 3, "green"],
39
+ [3, 5, "purple"],
40
+ [5, 7]
41
+ ],
42
+ "lineSegments": [
43
+ {
44
+ "point1": [0, 2],
45
+ "point2": [2, 6],
46
+ "color": "orange",
47
+ "strokeWidth": 2
48
+ }
49
+ ]
50
+ };
51
+
52
+ // TABLE - Complete example with all features
53
+ export const tableExample = {
54
+ "omdType": "table",
55
+ "title": "Student Scores",
56
+ "headers": ["Name", "Math", "Science", "Average"],
57
+ "data": [
58
+ ["Alice", 95, 88, 91.5],
59
+ ["Bob", 87, 92, 89.5],
60
+ ["Carol", 91, 85, 88]
61
+ ],
62
+ "highlightRows": [0],
63
+ "highlightCols": [3],
64
+ "cellColors": {
65
+ "1,1": "lightblue",
66
+ "2,2": "lightgreen"
67
+ },
68
+ "showBorders": true,
69
+ "alternateRowColors": true,
70
+ "headerBackgroundColor": "lightgray",
71
+ "width": 400,
72
+ "height": 250
73
+ };
74
+
75
+ // TABLE WITH EQUATION - Function table showing x/y values from equation
76
+ export const tableEquationExample = {
77
+ "omdType": "table",
78
+ "title": "Function Table: y = 2x + 3",
79
+ "headers": ["x", "y"],
80
+ "equation": "y = 2x + 3",
81
+ "width": 350,
82
+ "height": 300
83
+ };
84
+
85
+ // BALANCE HANGER - Complete example
86
+ export const balanceHangerExample = {
87
+ "omdType": "balanceHanger",
88
+ "leftValues": [3, "x", 5],
89
+ "rightValues": [2, "y", 8],
90
+ "tilt": "left",
91
+ "showLabels": true,
92
+ "equilibrium": false
93
+ };
94
+
95
+ // TAPE DIAGRAM - Complete example (canonical schema)
96
+ export const tapeDiagramExample = {
97
+ "omdType": "tapeDiagram",
98
+ "values": [2, 3],
99
+ "colors": ["#2386DB", "#DB2323"],
100
+ "labelSet": [
101
+ { "omdType": "omdTapeLabel", "startIndex": 0, "endIndex": 1, "label": "2x", "showBelow": false },
102
+ { "omdType": "omdTapeLabel", "startIndex": 1, "endIndex": 2, "label": "3", "showBelow": false },
103
+ { "omdType": "omdTapeLabel", "startIndex": 0, "endIndex": 2, "label": "5", "showBelow": true }
104
+ ],
105
+ "showValues": true
106
+ };
107
+
108
+ // Export all examples for AI reference
109
+ export const allExamples = {
110
+ coordinatePlane: coordinatePlaneExample,
111
+ table: tableExample,
112
+ tableEquation: tableEquationExample,
113
+ balanceHanger: balanceHangerExample,
114
+ tapeDiagram: tapeDiagramExample
115
+ };
package/src/omd.js ADDED
@@ -0,0 +1,109 @@
1
+
2
+
3
+ import { omdColor } from "./omdColor.js";
4
+ import { omdNumber } from "./omdNumber.js";
5
+ import { omdVariable } from "./omdVariable.js";
6
+ import { omdTerm } from "./omdTerm.js";
7
+ import { omdOperator } from "./omdOperator.js";
8
+ import { omdExpression } from "./omdExpression.js";
9
+ import { omdPowerExpression } from "./omdPowerExpression.js";
10
+ import { omdRationalExpression } from "./omdRationalExpression.js";
11
+ import { omdEquation } from "./omdEquation.js";
12
+ import { omdFunction } from "./omdFunction.js";
13
+ import { omdNumberLine } from "./omdNumberLine.js";
14
+ import { omdTapeDiagram } from "./omdTapeDiagram.js";
15
+ import { omdBalanceHanger } from "./omdBalanceHanger.js";
16
+ import { omdNumberTile } from "./omdNumberTile.js";
17
+ import { omdRatioChart } from "./omdRatioChart.js";
18
+ import { omdCoordinatePlane } from "./omdCoordinatePlane.js";
19
+ import { omdSpinner } from "./omdSpinner.js";
20
+ import { jsvgContainer } from "@teachinglab/jsvg";
21
+
22
+ export class omd extends jsvgContainer
23
+ {
24
+ constructor()
25
+ {
26
+ super();
27
+
28
+
29
+ this.setViewbox( 400,400 );
30
+ this.setBackgroundColor( "#F8F8F4" );
31
+ }
32
+
33
+ setCanvasSize( W, H )
34
+ {
35
+ this.setViewbox( W,H );
36
+ }
37
+
38
+ setBackgroundColor( C )
39
+ {
40
+ this.svgObject.style.backgroundColor = C;
41
+ }
42
+
43
+ generateGraphic( jsonData )
44
+ {
45
+ this.removeAllChildren();
46
+
47
+ var N = null;
48
+
49
+ if ( jsonData.omdType == "number" ) { var N = new omdNumber(); }
50
+
51
+ if ( jsonData.omdType == "variable" ) { var N = new omdVariable(); }
52
+
53
+ if ( jsonData.omdType == "operator" ) { var N = new omdOperator(); }
54
+
55
+ if ( jsonData.omdType == "term" ) { var N = new omdTerm(); }
56
+
57
+ if ( jsonData.omdType == "expression" ) { var N = new omdExpression(); }
58
+
59
+ if ( jsonData.omdType == "powerExpression" ) { var N = new omdPowerExpression(); }
60
+
61
+ if ( jsonData.omdType == "rationalExpression" ) { var N = new omdRationalExpression(); }
62
+
63
+ if ( jsonData.omdType == "function" ) { var N = new omdFunction(); }
64
+
65
+ if ( jsonData.omdType == "equation" ) { var N = new omdEquation(); }
66
+
67
+ if ( jsonData.omdType == "numberLine" ) { var N = new omdNumberLine(); }
68
+
69
+ if ( jsonData.omdType == "balanceHanger" )
70
+ {
71
+ var N = new omdBalanceHanger();
72
+ N.setPosition( 150, 0 );
73
+ }
74
+
75
+ if ( jsonData.omdType == "tapeDiagram" ) { var N = new omdTapeDiagram(); }
76
+
77
+ if ( jsonData.omdType == "numberTile" ) { var N = new omdNumberTile(); }
78
+
79
+ if ( jsonData.omdType == "ratioChart" ) { var N = new omdRatioChart(); }
80
+
81
+ if ( jsonData.omdType == "coordinatePlane" ) { var N = new omdCoordinatePlane(); }
82
+
83
+ if ( jsonData.omdType == "spinner" ) { var N = new omdSpinner(); }
84
+
85
+ N.setPosition( 0,30 );
86
+
87
+ // load from json
88
+ N.loadFromJSON( jsonData );
89
+
90
+ // add to the AI holder
91
+ this.addChild( N );
92
+ }
93
+
94
+ getSVG()
95
+ {
96
+ return this.svgObject;
97
+ }
98
+
99
+ getDiv()
100
+ {
101
+ const newDiv = document.createElement("div");
102
+ newDiv.style.width = this.width + 'px';
103
+ newDiv.style.height = this.height + 'px';
104
+ newDiv.style.overflow = 'visible'
105
+ newDiv.appendChild( this.svgObject );
106
+ return newDiv;
107
+ }
108
+ }
109
+