@khanacademy/perseus-editor 6.5.0 → 6.6.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.
package/dist/index.js CHANGED
@@ -67,7 +67,7 @@ var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
67
67
 
68
68
  // This file is processed by a Rollup plugin (replace) to inject the production
69
69
  const libName = "@khanacademy/perseus-editor";
70
- const libVersion = "6.5.0";
70
+ const libVersion = "6.6.0";
71
71
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
72
72
 
73
73
  function _extends() {
@@ -30737,7 +30737,9 @@ const LockedLineSettings = props => {
30737
30737
  const capitalizeKind = kind.charAt(0).toUpperCase() + kind.slice(1);
30738
30738
  const lineLabel = `${capitalizeKind} (${point1.coord[0]},
30739
30739
  ${point1.coord[1]}), (${point2.coord[0]}, ${point2.coord[1]})`;
30740
- const isInvalid = point1.coord[0] === point2.coord[0] && point1.coord[1] === point2.coord[1];
30740
+
30741
+ // Check if the line has length 0.
30742
+ const isInvalid = kmath.vector.equal(point1.coord, point2.coord);
30741
30743
  function handleChangePoint(newPointProps, index) {
30742
30744
  const newPoints = [...points];
30743
30745
  newPoints[index] = {
@@ -31486,6 +31488,17 @@ class InteractiveGraphEditor extends React__namespace.Component {
31486
31488
  // @ts-expect-error TS2739 Type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "step" | "gridStep" | "snapStep" | "backgroundImage" | "markings" | "labels" | ... 5 more ... | "range">' is missing the following properties from type 'PerseusInteractiveGraphWidgetOptions': graph, correct
31487
31489
  return json;
31488
31490
  }
31491
+ getSaveWarnings = () => {
31492
+ const issues = [];
31493
+
31494
+ // A locked line on the graph cannot have length 0.
31495
+ for (const figure of this.props.lockedFigures ?? []) {
31496
+ if (figure.type === "line" && kmath.vector.equal(figure.points[0].coord, figure.points[1].coord)) {
31497
+ issues.push("The line cannot have length 0.");
31498
+ }
31499
+ }
31500
+ return issues;
31501
+ };
31489
31502
  }
31490
31503
  const styles$a = aphrodite.StyleSheet.create({
31491
31504
  singleSelectShort: {