@pie-element/graphing 3.5.3 → 3.5.4-next.1016

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 (41) hide show
  1. package/CHANGELOG.md +163 -0
  2. package/configure/CHANGELOG.md +152 -0
  3. package/configure/lib/configure.js +108 -47
  4. package/configure/lib/configure.js.map +1 -1
  5. package/configure/lib/correct-response.js +287 -54
  6. package/configure/lib/correct-response.js.map +1 -1
  7. package/configure/lib/defaults.js +49 -7
  8. package/configure/lib/defaults.js.map +1 -1
  9. package/configure/lib/graphing-config.js +160 -184
  10. package/configure/lib/graphing-config.js.map +1 -1
  11. package/configure/lib/index.js +43 -18
  12. package/configure/lib/index.js.map +1 -1
  13. package/configure/lib/utils.js +94 -0
  14. package/configure/lib/utils.js.map +1 -0
  15. package/configure/package.json +4 -4
  16. package/controller/CHANGELOG.md +40 -0
  17. package/controller/lib/defaults.js +9 -1
  18. package/controller/lib/defaults.js.map +1 -1
  19. package/controller/lib/index.js +48 -23
  20. package/controller/lib/index.js.map +1 -1
  21. package/controller/lib/utils.js +8 -6
  22. package/controller/lib/utils.js.map +1 -1
  23. package/controller/package.json +1 -1
  24. package/docs/config-schema.json +282 -0
  25. package/docs/config-schema.json.md +213 -1
  26. package/docs/demo/generate.js +8 -1
  27. package/docs/pie-schema.json +228 -3
  28. package/docs/pie-schema.json.md +166 -2
  29. package/lib/index.js +4 -1
  30. package/lib/index.js.map +1 -1
  31. package/lib/main.js +15 -19
  32. package/lib/main.js.map +1 -1
  33. package/lib/utils.js +3 -1
  34. package/lib/utils.js.map +1 -1
  35. package/package.json +6 -6
  36. package/module/configure.js +0 -1260
  37. package/module/controller.js +0 -21893
  38. package/module/demo.js +0 -92
  39. package/module/element.js +0 -245
  40. package/module/index.html +0 -16
  41. package/module/manifest.json +0 -14
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils.js"],"names":["equalPoint","A","B","equalLabel","label","x","y","equalSegment","segment1","segment2","from","to","equalVector","vector1","vector2","sortedAnswers","answers","Object","keys","sort","reduce","result","key","returnLineEquationCoefficients","line","xA","yA","xB","yB","a","b","c","getSignificantDecimals","number","Math","round","equalLine","line1","line2","a1","b1","c1","a2","b2","c2","proportions","push","lodash","uniq","length","equalRay","ray1","ray2","mRay1","mRay2","angleRay1","atan2","PI","angleRay2","constructSegmentsFromPoints","points","map","point","index","removeDuplicateSegments","segments","s1","s2","removeInvalidSegments","filter","segment","equalPolygon","poly1","poly2","points1","points2","segments1","segments2","segments1NoDuplicates","segments2NoDuplicates","differentSegments1","differentSegments2","equalCircle","equalRootAndEdge","edge","root","rC1","sqrt","rC2","equalSine","sine1","sine2","getPoints","amplitude","freq","tY","abs","tXRoot","tX","edgeAboveZeroX","edgeAboveZeroY","min","max","studentAnswerBpY","correctAnswerBpY","amplitude1","freq1","min1","max1","edgeAboveZeroX1","edgeAboveZeroY1","amplitude2","freq2","min2","max2","edgeAboveZeroX2","edgeAboveZeroY2","equalParabola","p1","p2","edgeP1","rootP1","edgeP2","rootP2","p1edge","p2edge","p1mirrorEdge","p2mirrorEdge","equalMarks","circle","sessAnswer","mark","parabola","polygon","poly","ray","sine","vector"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEO,IAAMA,UAAU,GAAG,SAAbA,UAAa,CAACC,CAAD,EAAIC,CAAJ,EAAU;AAClC;AACA,MAAIC,UAAU,GAAG,IAAjB;;AAEA,MAAIF,CAAC,CAACG,KAAF,IAAWF,CAAC,CAACE,KAAjB,EAAwB;AACtBD,IAAAA,UAAU,GAAG,yBAAQF,CAAC,CAACG,KAAV,EAAiBF,CAAC,CAACE,KAAnB,CAAb;AACD;;AAED,SAAO,yBAAQH,CAAC,CAACI,CAAV,EAAaH,CAAC,CAACG,CAAf,KAAqB,yBAAQJ,CAAC,CAACK,CAAV,EAAaJ,CAAC,CAACI,CAAf,CAArB,IAA0CH,UAAjD;AACD,CATM;;;;AAWA,IAAMI,YAAY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port lodash from 'lodash';\nimport uniqWith from 'lodash/uniqWith';\nimport differenceWith from 'lodash/differenceWith';\nimport { getAmplitudeAndFreq, pointsToABC } from '@pie-lib/graphing-utils';\n\nexport const equalPoint = (A, B) => {\n // x1 = x2 & y1 = y2\n let equalLabel = true;\n\n if (A.label || B.label) {\n equalLabel = isEqual(A.label, B.label);\n }\n\n return isEqual(A.x, B.x) && isEqual(A.y, B.y) && equalLabel;\n};\n\nexport const equalSegment = (segment1, segment2) => {\n // A.from = B.from, A.to = B.to OR A.from = B.to, A.to = B.from\n // x1 = x3 & y1 = y3 & x2 = x4 & y2 = y4\n return ((isEqual(segment1.from, segment2.from) && isEqual(segment1.to, segment2.to)) ||\n ((isEqual(segment1.to, segment2.from) && isEqual(segment1.from, segment2.to))));\n};\n\nexport const equalVector = (vector1, vector2) => {\n // A.from = B.from, A.to = B.to;\n // x1 = x3 & y1 = y3 & x2 = x4 & y2 = y4\n return ((isEqual(vector1.from, vector2.from) && isEqual(vector1.to, vector2.to)));\n};\n\n// this function is implemented in configure as well\nexport const sortedAnswers = (answers) => {\n answers = answers || {};\n\n return Object.keys(answers).sort().reduce((result, key) => {\n result[key] = answers[key];\n\n return result;\n }, {});\n};\n\nconst returnLineEquationCoefficients = line => {\n const xA = line.from.x;\n const yA = line.from.y;\n const xB = line.to.x;\n const yB = line.to.y;\n\n return {\n a: yB - yA,\n b: xA - xB,\n c: (xB * yA) - (xA * yB)\n };\n};\n\nconst getSignificantDecimals = number => Math.round(number * 10000) / 10000;\n\nexport const equalLine = (line1, line2) => {\n // line equation: ax + by + c = 0\n // 2 lines are equal if a1/a2 = b1/b2 = c1/c2, where a, b, c are the coefficients in line equation\n\n // line equation knowing 2 points: (y - yA) / (yB - yA) = (x - xA) / (xB - xA)\n // extending this equation, we get: x * (yB - yA) + y * (xA - xB) + (xB * yA - xA * yB) = 0\n // where a = yB - yA; b = xA - xB; c = xB * yA - xA * yB\n\n const { a: a1, b: b1, c: c1 } = returnLineEquationCoefficients(line1);\n const { a: a2, b: b2, c: c2 } = returnLineEquationCoefficients(line2);\n\n const proportions = [];\n\n if (a2 !== 0) {\n proportions.push(getSignificantDecimals((a1 / a2)));\n } else if (a1 !== a2) {\n return false;\n }\n\n if (b2 !== 0) {\n proportions.push(getSignificantDecimals((b1 / b2)));\n } else if (b1 !== b2) {\n return false;\n }\n\n if (c2 !== 0) {\n proportions.push(getSignificantDecimals(c1 / c2));\n } else if (c1 !== c2) {\n return false;\n }\n\n return lodash.uniq(proportions).length === 1;\n\n // (y2 - y1)/(x2 - x1) = (y4 - y3)/(x4 - x3);\n // return ((Math.abs((line1.to.y - line1.from.y) / (line1.to.x - line1.from.x))) === (Math.abs((line2.to.y - line2.from.y) / (line2.to.x - line2.from.x))));\n};\n\nexport const equalRay = (ray1, ray2) => {\n // slope: m = (y2-y1)/(x2-x1)\n // slope & x1 = x3 & y1 = y3 & angle between (x1, y1) (x2, y2) is same as angle between (x3, y3) (x4, y4)\n const mRay1 = (ray1.to.y - ray1.from.y) / (ray1.to.x - ray1.from.x);\n const mRay2 = (ray2.to.y - ray2.from.y) / (ray2.to.x - ray2.from.x);\n const angleRay1 = Math.atan2(ray1.to.y - ray1.from.y, ray1.to.x - ray1.from.x) * 180 / Math.PI;\n const angleRay2 = Math.atan2(ray2.to.y - ray2.from.y, ray2.to.x - ray2.from.x) * 180 / Math.PI;\n\n return mRay1 === mRay2 && ray1.from.x === ray2.from.x && ray1.from.y === ray2.from.y && angleRay1 === angleRay2;\n};\n\nexport const constructSegmentsFromPoints = points => {\n // takes the list of points that represent a polygon and transforms it into a list of segments; eg.:\n // points: A, B, C, D => segments: AB, BC, CD, DA\n return (points || []).map((point, index) => ({ from: point, to: points[(index + 1) % points.length] }));\n};\n\nexport const removeDuplicateSegments = segments => {\n segments = segments || [];\n // removes segments that are duplicates; eg. These segments are the same, so one will be removed:\n // segment1: from: { x: 1, y: 1 }, to: { x: 2, y: 1 }\n // segment2: from: { x: 2, y: 1 }, to: { x: 1, y: 1 }\n return uniqWith(segments, (s1, s2) => equalSegment(s1, s2));\n};\n\nexport const removeInvalidSegments = segments => {\n segments = segments || [];\n // removes segments that start in a point and end in the same point (eg.: from: { x: 1, y: 1 }, to: { x: 1, y: 1 })\n\n return segments.filter(segment => !isEqual(segment.from, segment.to));\n};\n\nexport const equalPolygon = (poly1, poly2) => {\n const { points: points1 } = poly1;\n const { points: points2 } = poly2;\n\n // generate segments\n const segments1 = constructSegmentsFromPoints(points1);\n const segments2 = constructSegmentsFromPoints(points2);\n\n const segments1NoDuplicates = removeDuplicateSegments(removeInvalidSegments(segments1));\n const segments2NoDuplicates = removeDuplicateSegments(removeInvalidSegments(segments2));\n\n const differentSegments1 = differenceWith(segments1NoDuplicates, segments2NoDuplicates, equalSegment);\n const differentSegments2 = differenceWith(segments2NoDuplicates, segments1NoDuplicates, equalSegment);\n\n return (!differentSegments1 || !differentSegments1.length) && (!differentSegments2 || !differentSegments2.length);\n};\n\nexport const equalCircle = (c1, c2) => {\n const equalRootAndEdge = isEqual(c2.edge, c1.edge) && isEqual(c2.root, c1.root);\n\n // if both edge and root are the same, it means the shapes are exactly the same\n if (equalRootAndEdge) return true;\n\n const rC1 = Math.sqrt(((c1.edge.x - c1.root.x) ** 2) + ((c1.edge.y - c1.root.y) ** 2));\n const rC2 = Math.sqrt(((c2.edge.x - c2.root.x) ** 2) + ((c2.edge.y - c2.root.y) ** 2));\n\n // if both root and radius are the same, it means the shapes are equal\n return isEqual(c2.root, c1.root) && isEqual(rC1, rC2);\n};\n\nexport const equalSine = (sine1, sine2) => {\n const getPoints = ({ root, edge }) => {\n const { amplitude, freq } = getAmplitudeAndFreq(root, edge);\n // the height of the sine wave\n const tY = Math.abs(root.y - edge.y) * 2;\n // the distance on x axis between edge and root\n const tXRoot = Math.abs(root.x - edge.x);\n // the distance on x axis between 2 edges for sine wave (min & max)\n const tX = tXRoot * 2;\n // the first edge placed east side of root\n let edgeAboveZeroX = edge.x;\n let edgeAboveZeroY = edge.y;\n\n // if edge less then 0, find out the appropriate edge placed east side of zero (0)\n while (edgeAboveZeroX < 0 && tX !== 0) {\n edgeAboveZeroX = edgeAboveZeroX + tX;\n edgeAboveZeroY = edgeAboveZeroY < root.y ? edgeAboveZeroY + tY : edgeAboveZeroY - tY;\n }\n\n // if edge more then 0, find out the appropriate edge placed east side of zero (0)\n while (edgeAboveZeroX - tX > 0 && tX !== 0) {\n edgeAboveZeroX = edgeAboveZeroX - tX;\n edgeAboveZeroY = edgeAboveZeroY < root.y ? edgeAboveZeroY + tY : edgeAboveZeroY - tY;\n }\n\n return {\n amplitude: getSignificantDecimals(amplitude),\n freq: getSignificantDecimals(freq),\n min: getSignificantDecimals(edge.y < root.y ? edge.y : edge.y - tY),\n max: getSignificantDecimals(edge.y < root.y ? edge.y + tY : edge.y),\n edgeAboveZeroX: getSignificantDecimals(edgeAboveZeroX),\n edgeAboveZeroY: getSignificantDecimals(edgeAboveZeroY)\n };\n };\n\n const studentAnswerBpY = getPoints(sine1);\n const correctAnswerBpY = getPoints(sine2);\n\n const {\n amplitude: amplitude1,\n freq: freq1,\n min: min1,\n max: max1,\n edgeAboveZeroX: edgeAboveZeroX1,\n edgeAboveZeroY: edgeAboveZeroY1\n } = studentAnswerBpY;\n const {\n amplitude: amplitude2,\n freq: freq2,\n min: min2,\n max: max2,\n edgeAboveZeroX: edgeAboveZeroX2,\n edgeAboveZeroY: edgeAboveZeroY2\n } = correctAnswerBpY;\n\n return (Math.abs(amplitude1) === Math.abs(amplitude2) &&\n Math.abs(freq1) === Math.abs(freq2) &&\n min1 === min2 && max1 === max2 &&\n edgeAboveZeroX1 === edgeAboveZeroX2 &&\n edgeAboveZeroY1 === edgeAboveZeroY2);\n // rootDiff1 === rootDiff2);\n};\n\nexport const equalParabola = (p1, p2) => {\n const { edge: edgeP1, root: rootP1 } = p1;\n const { edge: edgeP2, root: rootP2 } = p2;\n const p1edge = edgeP1 || { ...rootP1 };\n const p2edge = edgeP2 || { ...rootP2 };\n\n const p1mirrorEdge = { x: rootP1.x - (p1edge.x - rootP1.x), y: p1edge.y };\n const p2mirrorEdge = { x: rootP2.x - (p2edge.x - rootP2.x), y: p2edge.y };\n\n const { a: a1, b: b1, c: c1 } = pointsToABC(rootP1, edgeP1, p1mirrorEdge);\n const { a: a2, b: b2, c: c2 } = pointsToABC(rootP2, edgeP2, p2mirrorEdge);\n\n // sometimes numbers have this form: 1.00000000002 because of calculations, we have to round them\n const round = number => Math.round(number * 10000) / 10000;\n\n return round(a1) === round(a2) && round(b1) === round(b2) && round(c1) === round(c2);\n};\n\nexport const equalMarks = {\n circle: (sessAnswer, mark) => equalCircle(sessAnswer, mark),\n line: (sessAnswer, mark) => equalLine(sessAnswer, mark),\n parabola: (sessAnswer, mark) => equalParabola(sessAnswer, mark),\n point: (sessAnswer, mark) => equalPoint(sessAnswer, mark),\n polygon: (sessAnswer, poly) => equalPolygon(sessAnswer, poly),\n ray: (sessAnswer, mark) => equalRay(sessAnswer, mark),\n segment: (sessAnswer, mark) => equalSegment(sessAnswer, mark),\n sine: (sessAnswer, mark) => equalSine(sessAnswer, mark),\n vector: (sessAnswer, mark) => equalVector(sessAnswer, mark),\n};\n"],"file":"utils.js"}
1
+ {"version":3,"sources":["../src/utils.js"],"names":["equalPoint","A","B","equalLabel","label","x","y","equalSegment","segment1","segment2","from","to","equalVector","vector1","vector2","sortedAnswers","answers","Object","keys","sort","reduce","result","key","returnLineEquationCoefficients","line","xA","yA","xB","yB","a","b","c","getSignificantDecimals","number","Math","round","equalLine","line1","line2","a1","b1","c1","a2","b2","c2","proportions","push","lodash","uniq","length","equalRay","ray1","ray2","mRay1","mRay2","angleRay1","atan2","PI","angleRay2","constructSegmentsFromPoints","points","map","point","index","removeDuplicateSegments","segments","s1","s2","removeInvalidSegments","filter","segment","equalPolygon","poly1","poly2","points1","points2","segments1","segments2","segments1NoDuplicates","segments2NoDuplicates","differentSegments1","differentSegments2","equalCircle","equalRootAndEdge","edge","root","rC1","sqrt","rC2","equalSine","sine1","sine2","getPoints","amplitude","freq","tY","abs","tXRoot","tX","edgeAboveZeroX","edgeAboveZeroY","min","max","studentAnswerBpY","correctAnswerBpY","amplitude1","freq1","min1","max1","edgeAboveZeroX1","edgeAboveZeroY1","amplitude2","freq2","min2","max2","edgeAboveZeroX2","edgeAboveZeroY2","equalParabola","p1","p2","edgeP1","rootP1","edgeP2","rootP2","p1edge","p2edge","p1mirrorEdge","p2mirrorEdge","equalMarks","circle","sessAnswer","mark","parabola","polygon","poly","ray","sine","vector"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEO,IAAMA,UAAU,GAAG,SAAbA,UAAa,CAACC,CAAD,EAAIC,CAAJ,EAAU;AAClC;AACA,MAAIC,UAAU,GAAG,IAAjB;;AAEA,MAAIF,CAAC,CAACG,KAAF,IAAWF,CAAC,CAACE,KAAjB,EAAwB;AACtBD,IAAAA,UAAU,GAAG,yBAAQF,CAAC,CAACG,KAAV,EAAiBF,CAAC,CAACE,KAAnB,CAAb;AACD;;AAED,SAAO,yBAAQH,CAAC,CAACI,CAAV,EAAaH,CAAC,CAACG,CAAf,KAAqB,yBAAQJ,CAAC,CAACK,CAAV,EAAaJ,CAAC,CAACI,CAAf,CAArB,IAA0CH,UAAjD;AACD,CATM;;;;AAWA,IAAMI,YAAY,GAAG,SAAfA,YAAe,CAACC,QAAD,EAAWC,QAAX,EAAwB;AAClD;AACA;AACA,SAAS,yBAAQD,QAAQ,CAACE,IAAjB,EAAuBD,QAAQ,CAACC,IAAhC,KAAyC,yBAAQF,QAAQ,CAACG,EAAjB,EAAqBF,QAAQ,CAACE,EAA9B,CAA1C,IACJ,yBAAQH,QAAQ,CAACG,EAAjB,EAAqBF,QAAQ,CAACC,IAA9B,KAAuC,yBAAQF,QAAQ,CAACE,IAAjB,EAAuBD,QAAQ,CAACE,EAAhC,CAD3C;AAED,CALM;;;;AAOA,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACC,OAAD,EAAUC,OAAV,EA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,CAACkI,UAAD,EAAaC,IAAb,CAAhC;AAAA,GAJiB;AAKxBE,EAAAA,OAAO,EAAE,iBAACH,UAAD,EAAaI,IAAb;AAAA,WAAsB/D,YAAY,CAAC2D,UAAD,EAAaI,IAAb,CAAlC;AAAA,GALe;AAMxBC,EAAAA,GAAG,EAAE,aAACL,UAAD,EAAaC,IAAb;AAAA,WAAsBjF,QAAQ,CAACgF,UAAD,EAAaC,IAAb,CAA9B;AAAA,GANmB;AAOxB7D,EAAAA,OAAO,EAAE,iBAAC4D,UAAD,EAAaC,IAAb;AAAA,WAAsB5H,YAAY,CAAC2H,UAAD,EAAaC,IAAb,CAAlC;AAAA,GAPe;AAQxBK,EAAAA,IAAI,EAAE,cAACN,UAAD,EAAaC,IAAb;AAAA,WAAsB1C,SAAS,CAACyC,UAAD,EAAaC,IAAb,CAA/B;AAAA,GARkB;AASxBM,EAAAA,MAAM,EAAE,gBAACP,UAAD,EAAaC,IAAb;AAAA,WAAsBvH,WAAW,CAACsH,UAAD,EAAaC,IAAb,CAAjC;AAAA;AATgB,CAAnB","sourcesContent":["import isEqual from 'lodash/isEqual';\nimport lodash from 'lodash';\nimport uniqWith from 'lodash/uniqWith';\nimport differenceWith from 'lodash/differenceWith';\nimport { getAmplitudeAndFreq, pointsToABC } from '@pie-lib/graphing-utils';\n\nexport const equalPoint = (A, B) => {\n // x1 = x2 & y1 = y2\n let equalLabel = true;\n\n if (A.label || B.label) {\n equalLabel = isEqual(A.label, B.label);\n }\n\n return isEqual(A.x, B.x) && isEqual(A.y, B.y) && equalLabel;\n};\n\nexport const equalSegment = (segment1, segment2) => {\n // A.from = B.from, A.to = B.to OR A.from = B.to, A.to = B.from\n // x1 = x3 & y1 = y3 & x2 = x4 & y2 = y4\n return ((isEqual(segment1.from, segment2.from) && isEqual(segment1.to, segment2.to)) ||\n ((isEqual(segment1.to, segment2.from) && isEqual(segment1.from, segment2.to))));\n};\n\nexport const equalVector = (vector1, vector2) => {\n // A.from = B.from, A.to = B.to;\n // x1 = x3 & y1 = y3 & x2 = x4 & y2 = y4\n return ((isEqual(vector1.from, vector2.from) && isEqual(vector1.to, vector2.to)));\n};\n\n// this function is implemented in configure as well\nexport const sortedAnswers = answers => Object.keys(answers || {}).sort().reduce((result, key) => {\n if (key !== 'correctAnswer') {\n result[key] = answers[key];\n }\n\n return result;\n}, {});\n\nconst returnLineEquationCoefficients = line => {\n const xA = line.from.x;\n const yA = line.from.y;\n const xB = line.to.x;\n const yB = line.to.y;\n\n return {\n a: yB - yA,\n b: xA - xB,\n c: (xB * yA) - (xA * yB)\n };\n};\n\nconst getSignificantDecimals = number => Math.round(number * 10000) / 10000;\n\nexport const equalLine = (line1, line2) => {\n // line equation: ax + by + c = 0\n // 2 lines are equal if a1/a2 = b1/b2 = c1/c2, where a, b, c are the coefficients in line equation\n\n // line equation knowing 2 points: (y - yA) / (yB - yA) = (x - xA) / (xB - xA)\n // extending this equation, we get: x * (yB - yA) + y * (xA - xB) + (xB * yA - xA * yB) = 0\n // where a = yB - yA; b = xA - xB; c = xB * yA - xA * yB\n\n const { a: a1, b: b1, c: c1 } = returnLineEquationCoefficients(line1);\n const { a: a2, b: b2, c: c2 } = returnLineEquationCoefficients(line2);\n\n const proportions = [];\n\n if (a2 !== 0) {\n proportions.push(getSignificantDecimals((a1 / a2)));\n } else if (a1 !== a2) {\n return false;\n }\n\n if (b2 !== 0) {\n proportions.push(getSignificantDecimals((b1 / b2)));\n } else if (b1 !== b2) {\n return false;\n }\n\n if (c2 !== 0) {\n proportions.push(getSignificantDecimals(c1 / c2));\n } else if (c1 !== c2) {\n return false;\n }\n\n return lodash.uniq(proportions).length === 1;\n\n // (y2 - y1)/(x2 - x1) = (y4 - y3)/(x4 - x3);\n // return ((Math.abs((line1.to.y - line1.from.y) / (line1.to.x - line1.from.x))) === (Math.abs((line2.to.y - line2.from.y) / (line2.to.x - line2.from.x))));\n};\n\nexport const equalRay = (ray1, ray2) => {\n // slope: m = (y2-y1)/(x2-x1)\n // slope & x1 = x3 & y1 = y3 & angle between (x1, y1) (x2, y2) is same as angle between (x3, y3) (x4, y4)\n const mRay1 = (ray1.to.y - ray1.from.y) / (ray1.to.x - ray1.from.x);\n const mRay2 = (ray2.to.y - ray2.from.y) / (ray2.to.x - ray2.from.x);\n const angleRay1 = Math.atan2(ray1.to.y - ray1.from.y, ray1.to.x - ray1.from.x) * 180 / Math.PI;\n const angleRay2 = Math.atan2(ray2.to.y - ray2.from.y, ray2.to.x - ray2.from.x) * 180 / Math.PI;\n\n return mRay1 === mRay2 && ray1.from.x === ray2.from.x && ray1.from.y === ray2.from.y && angleRay1 === angleRay2;\n};\n\nexport const constructSegmentsFromPoints = points => {\n // takes the list of points that represent a polygon and transforms it into a list of segments; eg.:\n // points: A, B, C, D => segments: AB, BC, CD, DA\n return (points || []).map((point, index) => ({ from: point, to: points[(index + 1) % points.length] }));\n};\n\nexport const removeDuplicateSegments = segments => {\n segments = segments || [];\n // removes segments that are duplicates; eg. These segments are the same, so one will be removed:\n // segment1: from: { x: 1, y: 1 }, to: { x: 2, y: 1 }\n // segment2: from: { x: 2, y: 1 }, to: { x: 1, y: 1 }\n return uniqWith(segments, (s1, s2) => equalSegment(s1, s2));\n};\n\nexport const removeInvalidSegments = segments => {\n segments = segments || [];\n // removes segments that start in a point and end in the same point (eg.: from: { x: 1, y: 1 }, to: { x: 1, y: 1 })\n\n return segments.filter(segment => !isEqual(segment.from, segment.to));\n};\n\nexport const equalPolygon = (poly1, poly2) => {\n const { points: points1 } = poly1;\n const { points: points2 } = poly2;\n\n // generate segments\n const segments1 = constructSegmentsFromPoints(points1);\n const segments2 = constructSegmentsFromPoints(points2);\n\n const segments1NoDuplicates = removeDuplicateSegments(removeInvalidSegments(segments1));\n const segments2NoDuplicates = removeDuplicateSegments(removeInvalidSegments(segments2));\n\n const differentSegments1 = differenceWith(segments1NoDuplicates, segments2NoDuplicates, equalSegment);\n const differentSegments2 = differenceWith(segments2NoDuplicates, segments1NoDuplicates, equalSegment);\n\n return (!differentSegments1 || !differentSegments1.length) && (!differentSegments2 || !differentSegments2.length);\n};\n\nexport const equalCircle = (c1, c2) => {\n const equalRootAndEdge = isEqual(c2.edge, c1.edge) && isEqual(c2.root, c1.root);\n\n // if both edge and root are the same, it means the shapes are exactly the same\n if (equalRootAndEdge) return true;\n\n const rC1 = Math.sqrt(((c1.edge.x - c1.root.x) ** 2) + ((c1.edge.y - c1.root.y) ** 2));\n const rC2 = Math.sqrt(((c2.edge.x - c2.root.x) ** 2) + ((c2.edge.y - c2.root.y) ** 2));\n\n // if both root and radius are the same, it means the shapes are equal\n return isEqual(c2.root, c1.root) && isEqual(rC1, rC2);\n};\n\nexport const equalSine = (sine1, sine2) => {\n const getPoints = ({ root, edge }) => {\n const { amplitude, freq } = getAmplitudeAndFreq(root, edge);\n // the height of the sine wave\n const tY = Math.abs(root.y - edge.y) * 2;\n // the distance on x axis between edge and root\n const tXRoot = Math.abs(root.x - edge.x);\n // the distance on x axis between 2 edges for sine wave (min & max)\n const tX = tXRoot * 2;\n // the first edge placed east side of root\n let edgeAboveZeroX = edge.x;\n let edgeAboveZeroY = edge.y;\n\n // if edge less then 0, find out the appropriate edge placed east side of zero (0)\n while (edgeAboveZeroX < 0 && tX !== 0) {\n edgeAboveZeroX = edgeAboveZeroX + tX;\n edgeAboveZeroY = edgeAboveZeroY < root.y ? edgeAboveZeroY + tY : edgeAboveZeroY - tY;\n }\n\n // if edge more then 0, find out the appropriate edge placed east side of zero (0)\n while (edgeAboveZeroX - tX > 0 && tX !== 0) {\n edgeAboveZeroX = edgeAboveZeroX - tX;\n edgeAboveZeroY = edgeAboveZeroY < root.y ? edgeAboveZeroY + tY : edgeAboveZeroY - tY;\n }\n\n return {\n amplitude: getSignificantDecimals(amplitude),\n freq: getSignificantDecimals(freq),\n min: getSignificantDecimals(edge.y < root.y ? edge.y : edge.y - tY),\n max: getSignificantDecimals(edge.y < root.y ? edge.y + tY : edge.y),\n edgeAboveZeroX: getSignificantDecimals(edgeAboveZeroX),\n edgeAboveZeroY: getSignificantDecimals(edgeAboveZeroY)\n };\n };\n\n const studentAnswerBpY = getPoints(sine1);\n const correctAnswerBpY = getPoints(sine2);\n\n const {\n amplitude: amplitude1,\n freq: freq1,\n min: min1,\n max: max1,\n edgeAboveZeroX: edgeAboveZeroX1,\n edgeAboveZeroY: edgeAboveZeroY1\n } = studentAnswerBpY;\n const {\n amplitude: amplitude2,\n freq: freq2,\n min: min2,\n max: max2,\n edgeAboveZeroX: edgeAboveZeroX2,\n edgeAboveZeroY: edgeAboveZeroY2\n } = correctAnswerBpY;\n\n return (Math.abs(amplitude1) === Math.abs(amplitude2) &&\n Math.abs(freq1) === Math.abs(freq2) &&\n min1 === min2 && max1 === max2 &&\n edgeAboveZeroX1 === edgeAboveZeroX2 &&\n edgeAboveZeroY1 === edgeAboveZeroY2);\n // rootDiff1 === rootDiff2);\n};\n\nexport const equalParabola = (p1, p2) => {\n const { edge: edgeP1, root: rootP1 } = p1;\n const { edge: edgeP2, root: rootP2 } = p2;\n const p1edge = edgeP1 || { ...rootP1 };\n const p2edge = edgeP2 || { ...rootP2 };\n\n const p1mirrorEdge = { x: rootP1.x - (p1edge.x - rootP1.x), y: p1edge.y };\n const p2mirrorEdge = { x: rootP2.x - (p2edge.x - rootP2.x), y: p2edge.y };\n\n const { a: a1, b: b1, c: c1 } = pointsToABC(rootP1, edgeP1, p1mirrorEdge);\n const { a: a2, b: b2, c: c2 } = pointsToABC(rootP2, edgeP2, p2mirrorEdge);\n\n // sometimes numbers have this form: 1.00000000002 because of calculations, we have to round them\n const round = number => Math.round(number * 10000) / 10000;\n\n return round(a1) === round(a2) && round(b1) === round(b2) && round(c1) === round(c2);\n};\n\nexport const equalMarks = {\n circle: (sessAnswer, mark) => equalCircle(sessAnswer, mark),\n line: (sessAnswer, mark) => equalLine(sessAnswer, mark),\n parabola: (sessAnswer, mark) => equalParabola(sessAnswer, mark),\n point: (sessAnswer, mark) => equalPoint(sessAnswer, mark),\n polygon: (sessAnswer, poly) => equalPolygon(sessAnswer, poly),\n ray: (sessAnswer, mark) => equalRay(sessAnswer, mark),\n segment: (sessAnswer, mark) => equalSegment(sessAnswer, mark),\n sine: (sessAnswer, mark) => equalSine(sessAnswer, mark),\n vector: (sessAnswer, mark) => equalVector(sessAnswer, mark),\n};\n"],"file":"utils.js"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/graphing-controller",
3
3
  "private": true,
4
- "version": "3.2.16",
4
+ "version": "3.4.5",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -25,6 +25,66 @@
25
25
  }
26
26
  },
27
27
  "arrows": {
28
+ "title": "ArrowsConfigProp",
29
+ "type": "object",
30
+ "properties": {
31
+ "settings": {
32
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
33
+ "type": "boolean",
34
+ "title": "settings"
35
+ },
36
+ "label": {
37
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
38
+ "type": "string",
39
+ "title": "label"
40
+ },
41
+ "left": {
42
+ "title": "ArrowsProp",
43
+ "type": "object",
44
+ "properties": {
45
+ "label": {
46
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
47
+ "type": "string",
48
+ "title": "label"
49
+ }
50
+ }
51
+ },
52
+ "right": {
53
+ "title": "ArrowsProp",
54
+ "type": "object",
55
+ "properties": {
56
+ "label": {
57
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
58
+ "type": "string",
59
+ "title": "label"
60
+ }
61
+ }
62
+ },
63
+ "up": {
64
+ "title": "ArrowsProp",
65
+ "type": "object",
66
+ "properties": {
67
+ "label": {
68
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
69
+ "type": "string",
70
+ "title": "label"
71
+ }
72
+ }
73
+ },
74
+ "down": {
75
+ "title": "ArrowsProp",
76
+ "type": "object",
77
+ "properties": {
78
+ "label": {
79
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
80
+ "type": "string",
81
+ "title": "label"
82
+ }
83
+ }
84
+ }
85
+ }
86
+ },
87
+ "coordinatesOnHover": {
28
88
  "title": "ConfigureProp",
29
89
  "type": "object",
30
90
  "properties": {
@@ -40,6 +100,42 @@
40
100
  }
41
101
  }
42
102
  },
103
+ "graphDimensions": {
104
+ "title": "DimensionsConfigProp",
105
+ "type": "object",
106
+ "properties": {
107
+ "settings": {
108
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
109
+ "type": "boolean",
110
+ "title": "settings"
111
+ },
112
+ "label": {
113
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
114
+ "type": "string",
115
+ "title": "label"
116
+ },
117
+ "enabled": {
118
+ "description": "Indicates if the graph dimensions are included in the Grid Setup Panel",
119
+ "type": "boolean",
120
+ "title": "enabled"
121
+ },
122
+ "min": {
123
+ "description": "Indicates the minimum value for the graph width and height",
124
+ "type": "number",
125
+ "title": "min"
126
+ },
127
+ "max": {
128
+ "description": "Indicates the maximum value for the graph width and height",
129
+ "type": "number",
130
+ "title": "max"
131
+ },
132
+ "step": {
133
+ "description": "Indicates the increase/decrease value for the graph width and height",
134
+ "type": "number",
135
+ "title": "step"
136
+ }
137
+ }
138
+ },
43
139
  "padding": {
44
140
  "title": "ConfigureProp",
45
141
  "type": "object",
@@ -88,6 +184,22 @@
88
184
  }
89
185
  }
90
186
  },
187
+ "spellCheck": {
188
+ "title": "ConfigureProp",
189
+ "type": "object",
190
+ "properties": {
191
+ "settings": {
192
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
193
+ "type": "boolean",
194
+ "title": "settings"
195
+ },
196
+ "label": {
197
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
198
+ "type": "string",
199
+ "title": "label"
200
+ }
201
+ }
202
+ },
91
203
  "rationale": {
92
204
  "title": "ConfigureProp",
93
205
  "type": "object",
@@ -173,6 +285,48 @@
173
285
  }
174
286
  }
175
287
  },
288
+ "maxImageWidth": {
289
+ "title": "ConfigureMaxImageDimensionsProp",
290
+ "type": "object",
291
+ "properties": {
292
+ "teacherInstructions": {
293
+ "description": "Indicates the max dimension for images in teacher instructions",
294
+ "type": "number",
295
+ "title": "teacherInstructions"
296
+ },
297
+ "prompt": {
298
+ "description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
299
+ "type": "number",
300
+ "title": "prompt"
301
+ },
302
+ "rationale": {
303
+ "description": "Indicates the max dimension for images in rationale",
304
+ "type": "number",
305
+ "title": "rationale"
306
+ }
307
+ }
308
+ },
309
+ "maxImageHeight": {
310
+ "title": "ConfigureMaxImageDimensionsProp",
311
+ "type": "object",
312
+ "properties": {
313
+ "teacherInstructions": {
314
+ "description": "Indicates the max dimension for images in teacher instructions",
315
+ "type": "number",
316
+ "title": "teacherInstructions"
317
+ },
318
+ "prompt": {
319
+ "description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
320
+ "type": "number",
321
+ "title": "prompt"
322
+ },
323
+ "rationale": {
324
+ "description": "Indicates the max dimension for images in rationale",
325
+ "type": "number",
326
+ "title": "rationale"
327
+ }
328
+ }
329
+ },
176
330
  "showPrompt": {
177
331
  "description": "Determines whether prompt field will be displayed or not",
178
332
  "default": true,
@@ -214,6 +368,77 @@
214
368
  }
215
369
  }
216
370
  },
371
+ "ArrowsConfigProp": {
372
+ "title": "ArrowsConfigProp",
373
+ "type": "object",
374
+ "properties": {
375
+ "settings": {
376
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
377
+ "type": "boolean",
378
+ "title": "settings"
379
+ },
380
+ "label": {
381
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
382
+ "type": "string",
383
+ "title": "label"
384
+ },
385
+ "left": {
386
+ "title": "ArrowsProp",
387
+ "type": "object",
388
+ "properties": {
389
+ "label": {
390
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
391
+ "type": "string",
392
+ "title": "label"
393
+ }
394
+ }
395
+ },
396
+ "right": {
397
+ "title": "ArrowsProp",
398
+ "type": "object",
399
+ "properties": {
400
+ "label": {
401
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
402
+ "type": "string",
403
+ "title": "label"
404
+ }
405
+ }
406
+ },
407
+ "up": {
408
+ "title": "ArrowsProp",
409
+ "type": "object",
410
+ "properties": {
411
+ "label": {
412
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
413
+ "type": "string",
414
+ "title": "label"
415
+ }
416
+ }
417
+ },
418
+ "down": {
419
+ "title": "ArrowsProp",
420
+ "type": "object",
421
+ "properties": {
422
+ "label": {
423
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
424
+ "type": "string",
425
+ "title": "label"
426
+ }
427
+ }
428
+ }
429
+ }
430
+ },
431
+ "ArrowsProp": {
432
+ "title": "ArrowsProp",
433
+ "type": "object",
434
+ "properties": {
435
+ "label": {
436
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
437
+ "type": "string",
438
+ "title": "label"
439
+ }
440
+ }
441
+ },
217
442
  "ConfigureProp": {
218
443
  "title": "ConfigureProp",
219
444
  "type": "object",
@@ -229,6 +454,63 @@
229
454
  "title": "label"
230
455
  }
231
456
  }
457
+ },
458
+ "DimensionsConfigProp": {
459
+ "title": "DimensionsConfigProp",
460
+ "type": "object",
461
+ "properties": {
462
+ "settings": {
463
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
464
+ "type": "boolean",
465
+ "title": "settings"
466
+ },
467
+ "label": {
468
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
469
+ "type": "string",
470
+ "title": "label"
471
+ },
472
+ "enabled": {
473
+ "description": "Indicates if the graph dimensions are included in the Grid Setup Panel",
474
+ "type": "boolean",
475
+ "title": "enabled"
476
+ },
477
+ "min": {
478
+ "description": "Indicates the minimum value for the graph width and height",
479
+ "type": "number",
480
+ "title": "min"
481
+ },
482
+ "max": {
483
+ "description": "Indicates the maximum value for the graph width and height",
484
+ "type": "number",
485
+ "title": "max"
486
+ },
487
+ "step": {
488
+ "description": "Indicates the increase/decrease value for the graph width and height",
489
+ "type": "number",
490
+ "title": "step"
491
+ }
492
+ }
493
+ },
494
+ "ConfigureMaxImageDimensionsProp": {
495
+ "title": "ConfigureMaxImageDimensionsProp",
496
+ "type": "object",
497
+ "properties": {
498
+ "teacherInstructions": {
499
+ "description": "Indicates the max dimension for images in teacher instructions",
500
+ "type": "number",
501
+ "title": "teacherInstructions"
502
+ },
503
+ "prompt": {
504
+ "description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
505
+ "type": "number",
506
+ "title": "prompt"
507
+ },
508
+ "rationale": {
509
+ "description": "Indicates the max dimension for images in rationale",
510
+ "type": "number",
511
+ "title": "rationale"
512
+ }
513
+ }
232
514
  }
233
515
  },
234
516
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -31,6 +31,78 @@ Indicates if the item has to be displayed in the Settings Panel
31
31
 
32
32
  Indicates the label for the item that has to be displayed in the Settings Panel
33
33
 
34
+ ## `left` (object)
35
+
36
+ Properties of the `left` object:
37
+
38
+ ### `label` (string)
39
+
40
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
41
+
42
+ ## `right` (object)
43
+
44
+ Properties of the `right` object:
45
+
46
+ ### `label` (string)
47
+
48
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
49
+
50
+ ## `up` (object)
51
+
52
+ Properties of the `up` object:
53
+
54
+ ### `label` (string)
55
+
56
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
57
+
58
+ ## `down` (object)
59
+
60
+ Properties of the `down` object:
61
+
62
+ ### `label` (string)
63
+
64
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
65
+
66
+ # `coordinatesOnHover` (object)
67
+
68
+ Properties of the `coordinatesOnHover` object:
69
+
70
+ ## `settings` (boolean)
71
+
72
+ Indicates if the item has to be displayed in the Settings Panel
73
+
74
+ ## `label` (string)
75
+
76
+ Indicates the label for the item that has to be displayed in the Settings Panel
77
+
78
+ # `graphDimensions` (object)
79
+
80
+ Properties of the `graphDimensions` object:
81
+
82
+ ## `settings` (boolean)
83
+
84
+ Indicates if the item has to be displayed in the Settings Panel
85
+
86
+ ## `label` (string)
87
+
88
+ Indicates the label for the item that has to be displayed in the Settings Panel
89
+
90
+ ## `enabled` (boolean)
91
+
92
+ Indicates if the graph dimensions are included in the Grid Setup Panel
93
+
94
+ ## `min` (number)
95
+
96
+ Indicates the minimum value for the graph width and height
97
+
98
+ ## `max` (number)
99
+
100
+ Indicates the maximum value for the graph width and height
101
+
102
+ ## `step` (number)
103
+
104
+ Indicates the increase/decrease value for the graph width and height
105
+
34
106
  # `padding` (object)
35
107
 
36
108
  Properties of the `padding` object:
@@ -67,6 +139,18 @@ Indicates if the item has to be displayed in the Settings Panel
67
139
 
68
140
  Indicates the label for the item that has to be displayed in the Settings Panel
69
141
 
142
+ # `spellCheck` (object)
143
+
144
+ Properties of the `spellCheck` object:
145
+
146
+ ## `settings` (boolean)
147
+
148
+ Indicates if the item has to be displayed in the Settings Panel
149
+
150
+ ## `label` (string)
151
+
152
+ Indicates the label for the item that has to be displayed in the Settings Panel
153
+
70
154
  # `rationale` (object)
71
155
 
72
156
  Properties of the `rationale` object:
@@ -132,6 +216,38 @@ Indicates the label for the item that has to be displayed in the Settings Panel
132
216
  Indicates the value of the item if it affects config-ui
133
217
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
134
218
 
219
+ # `maxImageWidth` (object)
220
+
221
+ Properties of the `maxImageWidth` object:
222
+
223
+ ## `teacherInstructions` (number)
224
+
225
+ Indicates the max dimension for images in teacher instructions
226
+
227
+ ## `prompt` (number)
228
+
229
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
230
+
231
+ ## `rationale` (number)
232
+
233
+ Indicates the max dimension for images in rationale
234
+
235
+ # `maxImageHeight` (object)
236
+
237
+ Properties of the `maxImageHeight` object:
238
+
239
+ ## `teacherInstructions` (number)
240
+
241
+ Indicates the max dimension for images in teacher instructions
242
+
243
+ ## `prompt` (number)
244
+
245
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
246
+
247
+ ## `rationale` (number)
248
+
249
+ Indicates the max dimension for images in rationale
250
+
135
251
  # `showPrompt` (boolean)
136
252
 
137
253
  Determines whether prompt field will be displayed or not
@@ -173,6 +289,58 @@ Indicates the label for the item that has to be displayed in the Settings Panel
173
289
  Indicates the value of the item if it affects config-ui
174
290
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
175
291
 
292
+ ## `ArrowsConfigProp` (object)
293
+
294
+ Properties of the `ArrowsConfigProp` object:
295
+
296
+ ### `settings` (boolean)
297
+
298
+ Indicates if the item has to be displayed in the Settings Panel
299
+
300
+ ### `label` (string)
301
+
302
+ Indicates the label for the item that has to be displayed in the Settings Panel
303
+
304
+ ### `left` (object)
305
+
306
+ Properties of the `left` object:
307
+
308
+ #### `label` (string)
309
+
310
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
311
+
312
+ ### `right` (object)
313
+
314
+ Properties of the `right` object:
315
+
316
+ #### `label` (string)
317
+
318
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
319
+
320
+ ### `up` (object)
321
+
322
+ Properties of the `up` object:
323
+
324
+ #### `label` (string)
325
+
326
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
327
+
328
+ ### `down` (object)
329
+
330
+ Properties of the `down` object:
331
+
332
+ #### `label` (string)
333
+
334
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
335
+
336
+ ## `ArrowsProp` (object)
337
+
338
+ Properties of the `ArrowsProp` object:
339
+
340
+ ### `label` (string)
341
+
342
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
343
+
176
344
  ## `ConfigureProp` (object)
177
345
 
178
346
  Properties of the `ConfigureProp` object:
@@ -183,4 +351,48 @@ Indicates if the item has to be displayed in the Settings Panel
183
351
 
184
352
  ### `label` (string)
185
353
 
186
- Indicates the label for the item that has to be displayed in the Settings Panel
354
+ Indicates the label for the item that has to be displayed in the Settings Panel
355
+
356
+ ## `DimensionsConfigProp` (object)
357
+
358
+ Properties of the `DimensionsConfigProp` object:
359
+
360
+ ### `settings` (boolean)
361
+
362
+ Indicates if the item has to be displayed in the Settings Panel
363
+
364
+ ### `label` (string)
365
+
366
+ Indicates the label for the item that has to be displayed in the Settings Panel
367
+
368
+ ### `enabled` (boolean)
369
+
370
+ Indicates if the graph dimensions are included in the Grid Setup Panel
371
+
372
+ ### `min` (number)
373
+
374
+ Indicates the minimum value for the graph width and height
375
+
376
+ ### `max` (number)
377
+
378
+ Indicates the maximum value for the graph width and height
379
+
380
+ ### `step` (number)
381
+
382
+ Indicates the increase/decrease value for the graph width and height
383
+
384
+ ## `ConfigureMaxImageDimensionsProp` (object)
385
+
386
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
387
+
388
+ ### `teacherInstructions` (number)
389
+
390
+ Indicates the max dimension for images in teacher instructions
391
+
392
+ ### `prompt` (number)
393
+
394
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
395
+
396
+ ### `rationale` (number)
397
+
398
+ Indicates the max dimension for images in rationale