@khanacademy/perseus-editor 6.5.1 → 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/es/index.js CHANGED
@@ -14,7 +14,7 @@ import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
14
14
  import caretRight from '@phosphor-icons/core/bold/caret-right-bold.svg';
15
15
  import classNames from 'classnames';
16
16
  import ReactDOM from 'react-dom';
17
- import { point, number } from '@khanacademy/kmath';
17
+ import { point, vector, number } from '@khanacademy/kmath';
18
18
  import * as KAS from '@khanacademy/kas';
19
19
  import { isTruthy, UnreachableCaseError } from '@khanacademy/wonder-stuff-core';
20
20
  import { useMathInputI18n, createMathField } from '@khanacademy/math-input';
@@ -29,7 +29,7 @@ import trashIcon from '@phosphor-icons/core/bold/trash-bold.svg';
29
29
 
30
30
  // This file is processed by a Rollup plugin (replace) to inject the production
31
31
  const libName = "@khanacademy/perseus-editor";
32
- const libVersion = "6.5.1";
32
+ const libVersion = "6.6.0";
33
33
  addLibraryVersionToPerseusDebug(libName, libVersion);
34
34
 
35
35
  function _extends() {
@@ -30642,7 +30642,9 @@ const LockedLineSettings = props => {
30642
30642
  const capitalizeKind = kind.charAt(0).toUpperCase() + kind.slice(1);
30643
30643
  const lineLabel = `${capitalizeKind} (${point1.coord[0]},
30644
30644
  ${point1.coord[1]}), (${point2.coord[0]}, ${point2.coord[1]})`;
30645
- const isInvalid = point1.coord[0] === point2.coord[0] && point1.coord[1] === point2.coord[1];
30645
+
30646
+ // Check if the line has length 0.
30647
+ const isInvalid = vector.equal(point1.coord, point2.coord);
30646
30648
  function handleChangePoint(newPointProps, index) {
30647
30649
  const newPoints = [...points];
30648
30650
  newPoints[index] = _extends({}, points[index], newPointProps);
@@ -31079,6 +31081,18 @@ class InteractiveGraphEditor extends React.Component {
31079
31081
  correct: correct
31080
31082
  });
31081
31083
  };
31084
+ this.getSaveWarnings = () => {
31085
+ const issues = [];
31086
+
31087
+ // A locked line on the graph cannot have length 0.
31088
+ for (const figure of (_this$props$lockedFig = this.props.lockedFigures) != null ? _this$props$lockedFig : []) {
31089
+ var _this$props$lockedFig;
31090
+ if (figure.type === "line" && vector.equal(figure.points[0].coord, figure.points[1].coord)) {
31091
+ issues.push("The line cannot have length 0.");
31092
+ }
31093
+ }
31094
+ return issues;
31095
+ };
31082
31096
  }
31083
31097
  // TODO(jangmi, CP-3288): Remove usage of `UNSAFE_componentWillMount`
31084
31098
  UNSAFE_componentWillMount() {