@khanacademy/perseus 20.1.0 → 20.2.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/components/graph.d.ts +1 -2
- package/dist/es/index.css +57 -3
- package/dist/es/index.js +127 -69
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +57 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +116 -59
- package/dist/index.js.map +1 -1
- package/dist/perseus-types.d.ts +1 -0
- package/dist/util.d.ts +1 -0
- package/dist/widgets/interactive-graphs/graph-locked-layer.d.ts +7 -0
- package/dist/widgets/interactive-graphs/movable-point.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { Coord } from "../interactive2/types";
|
|
3
|
-
import type { PerseusImageBackground
|
|
3
|
+
import type { PerseusImageBackground } from "../perseus-types";
|
|
4
4
|
import type { GridDimensions } from "../util";
|
|
5
5
|
type Props = {
|
|
6
6
|
box: [number, number];
|
|
@@ -17,7 +17,6 @@ type Props = {
|
|
|
17
17
|
rulerTicks: number;
|
|
18
18
|
instructions?: string;
|
|
19
19
|
isMobile: boolean;
|
|
20
|
-
lockedFigures?: ReadonlyArray<LockedFigure>;
|
|
21
20
|
onGraphieUpdated?: (graphie: any) => void;
|
|
22
21
|
onClick?: (Coord: any) => void;
|
|
23
22
|
onMouseDown?: (Coord: any) => void;
|
package/dist/es/index.css
CHANGED
|
@@ -4258,18 +4258,24 @@ html body .mq-editable-field .mq-selection .mq-nthroot-container * {
|
|
|
4258
4258
|
--mafs-bg: transparent;
|
|
4259
4259
|
--mafs-fg: rgb(33, 36, 44); /* WB color.offBlack */
|
|
4260
4260
|
|
|
4261
|
-
--mafs-line-color:
|
|
4262
|
-
--grid-line-subdivision-color: rgba(33, 36, 44, 0.16);
|
|
4261
|
+
--mafs-line-color: rgba(33, 36, 44, 0.16); /* WB color.offBlack16*/
|
|
4263
4262
|
|
|
4264
4263
|
--mafs-blue: #1865f2; /* WB color.blue */
|
|
4265
4264
|
--mafs-red: #d92916; /* WB color.red */
|
|
4266
4265
|
--mafs-green: #00a60e; /* WB color.green */
|
|
4267
4266
|
--mafs-violet: #9059ff; /* WB color.purple */
|
|
4268
4267
|
--mafs-yellow: #ffb100; /* WB color.gold */
|
|
4268
|
+
|
|
4269
|
+
/* overridden on a per-point basis */
|
|
4270
|
+
--movable-point-color: var(--mafs-blue);
|
|
4271
|
+
--movable-point-center-radius: 6px;
|
|
4272
|
+
--movable-point-ring-radius: calc(2px + var(--movable-point-center-radius));
|
|
4273
|
+
--movable-point-halo-radius: calc(3px + var(--movable-point-ring-radius));
|
|
4274
|
+
--movable-point-hover-expansion: 2px;
|
|
4269
4275
|
}
|
|
4270
4276
|
|
|
4271
4277
|
.MafsView .movable-segment {
|
|
4272
|
-
--mafs-segment-stroke-color:
|
|
4278
|
+
--mafs-segment-stroke-color: rgba(33, 36, 44, 0.64); /* offBlack64 */
|
|
4273
4279
|
--mafs-segment-stroke-weight: 2px;
|
|
4274
4280
|
}
|
|
4275
4281
|
|
|
@@ -4282,3 +4288,51 @@ html body .mq-editable-field .mq-selection .mq-nthroot-container * {
|
|
|
4282
4288
|
.MafsView .movable-segment:focus {
|
|
4283
4289
|
outline: none;
|
|
4284
4290
|
}
|
|
4291
|
+
|
|
4292
|
+
.MafsView .movable-point-hitbox {
|
|
4293
|
+
fill: transparent;
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
.MafsView :is(.movable-point-center, .movable-point-ring, .movable-point-halo) {
|
|
4297
|
+
transition: r 0.15s ease-out;
|
|
4298
|
+
}
|
|
4299
|
+
|
|
4300
|
+
.MafsView .movable-point-center {
|
|
4301
|
+
r: var(--movable-point-center-radius);
|
|
4302
|
+
}
|
|
4303
|
+
|
|
4304
|
+
.MafsView .movable-point-halo {
|
|
4305
|
+
r: var(--movable-point-halo-radius);
|
|
4306
|
+
fill: var(--movable-point-color);
|
|
4307
|
+
opacity: 0.25;
|
|
4308
|
+
filter: drop-shadow(0 5px 5px #0008);
|
|
4309
|
+
}
|
|
4310
|
+
|
|
4311
|
+
.MafsView .movable-point-ring {
|
|
4312
|
+
r: var(--movable-point-ring-radius);
|
|
4313
|
+
fill: #fff;
|
|
4314
|
+
}
|
|
4315
|
+
|
|
4316
|
+
.MafsView .movable-point:hover .movable-point-center {
|
|
4317
|
+
r: calc(
|
|
4318
|
+
var(--movable-point-hover-expansion) +
|
|
4319
|
+
var(--movable-point-center-radius)
|
|
4320
|
+
);
|
|
4321
|
+
}
|
|
4322
|
+
|
|
4323
|
+
.MafsView .movable-point:hover .movable-point-ring {
|
|
4324
|
+
r: calc(
|
|
4325
|
+
var(--movable-point-hover-expansion) + var(--movable-point-ring-radius)
|
|
4326
|
+
);
|
|
4327
|
+
}
|
|
4328
|
+
|
|
4329
|
+
.MafsView .movable-point:hover .movable-point-halo {
|
|
4330
|
+
r: calc(
|
|
4331
|
+
var(--movable-point-hover-expansion) + var(--movable-point-halo-radius)
|
|
4332
|
+
);
|
|
4333
|
+
}
|
|
4334
|
+
|
|
4335
|
+
.MafsView .movable-point:focus-visible .movable-point-halo {
|
|
4336
|
+
outline: 2px solid blue;
|
|
4337
|
+
border-radius: 99px;
|
|
4338
|
+
}
|
package/dist/es/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import { Strut } from '@khanacademy/wonder-blocks-layout';
|
|
|
29
29
|
import Banner from '@khanacademy/wonder-blocks-banner';
|
|
30
30
|
import { OptionItem, SingleSelect, MultiSelect } from '@khanacademy/wonder-blocks-dropdown';
|
|
31
31
|
import debounce$2 from 'lodash.debounce';
|
|
32
|
-
import {
|
|
32
|
+
import { Point as Point$2, useMovable, useTransformContext, vec, Coordinates, Mafs } from 'mafs';
|
|
33
33
|
import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
34
34
|
import questionIcon from '@phosphor-icons/core/regular/question.svg';
|
|
35
35
|
import { LabelSmall, LabelMedium } from '@khanacademy/wonder-blocks-typography';
|
|
@@ -2680,11 +2680,14 @@ function combineScores(scoreA, scoreB) {
|
|
|
2680
2680
|
}
|
|
2681
2681
|
});
|
|
2682
2682
|
}
|
|
2683
|
+
function isCorrect(score) {
|
|
2684
|
+
return score.type === "points" && score.earned >= score.total;
|
|
2685
|
+
}
|
|
2683
2686
|
function keScoreFromPerseusScore(score, guess, state) {
|
|
2684
2687
|
if (score.type === "points") {
|
|
2685
2688
|
return {
|
|
2686
2689
|
empty: false,
|
|
2687
|
-
correct: score
|
|
2690
|
+
correct: isCorrect(score),
|
|
2688
2691
|
message: score.message,
|
|
2689
2692
|
guess: guess,
|
|
2690
2693
|
state: state
|
|
@@ -14981,7 +14984,7 @@ const DEFAULT_STATE$1 = {
|
|
|
14981
14984
|
// TODO(benchristel): this is a memory leak. We add items to
|
|
14982
14985
|
// tooltipResetFunctions, but never remove them.
|
|
14983
14986
|
const tooltipResetFunctions = [];
|
|
14984
|
-
class MovablePoint$
|
|
14987
|
+
class MovablePoint$5 {
|
|
14985
14988
|
constructor(graphie, movable, options) {
|
|
14986
14989
|
this.graphie = void 0;
|
|
14987
14990
|
this.movable = void 0;
|
|
@@ -15498,15 +15501,15 @@ class MovablePoint$4 {
|
|
|
15498
15501
|
this.movable.toFront();
|
|
15499
15502
|
}
|
|
15500
15503
|
}
|
|
15501
|
-
MovablePoint$
|
|
15502
|
-
MovablePoint$
|
|
15503
|
-
MovablePoint$
|
|
15504
|
-
MovablePoint$
|
|
15505
|
-
MovablePoint$
|
|
15506
|
-
MovablePoint$
|
|
15507
|
-
MovablePoint$
|
|
15508
|
-
MovablePoint$
|
|
15509
|
-
MovablePoint$
|
|
15504
|
+
MovablePoint$5.add = MovablePointOptions.add;
|
|
15505
|
+
MovablePoint$5.modify = MovablePointOptions.modify;
|
|
15506
|
+
MovablePoint$5.draw = MovablePointOptions.draw;
|
|
15507
|
+
MovablePoint$5.remove = MovablePointOptions.remove;
|
|
15508
|
+
MovablePoint$5.onMoveStart = MovablePointOptions.onMoveStart;
|
|
15509
|
+
MovablePoint$5.constraints = MovablePointOptions.constraints;
|
|
15510
|
+
MovablePoint$5.onMove = MovablePointOptions.onMove;
|
|
15511
|
+
MovablePoint$5.onMoveEnd = MovablePointOptions.onMoveEnd;
|
|
15512
|
+
MovablePoint$5.onClick = MovablePointOptions.onClick;
|
|
15510
15513
|
function getKey(eventName, id) {
|
|
15511
15514
|
return eventName + ":" + id;
|
|
15512
15515
|
}
|
|
@@ -16100,10 +16103,10 @@ _.extend(MovablePolygon.prototype, {
|
|
|
16100
16103
|
});
|
|
16101
16104
|
|
|
16102
16105
|
const Interactive2 = {
|
|
16103
|
-
MovablePoint: MovablePoint$
|
|
16106
|
+
MovablePoint: MovablePoint$5,
|
|
16104
16107
|
addMovablePoint: function (graphie, options) {
|
|
16105
16108
|
const movable = new Movable(graphie, {});
|
|
16106
|
-
return new MovablePoint$
|
|
16109
|
+
return new MovablePoint$5(graphie, movable, options);
|
|
16107
16110
|
},
|
|
16108
16111
|
MovableLine: MovableLine$3,
|
|
16109
16112
|
addMovableLine: function (graphie, options) {
|
|
@@ -16144,7 +16147,7 @@ const Interactive2 = {
|
|
|
16144
16147
|
}
|
|
16145
16148
|
};
|
|
16146
16149
|
|
|
16147
|
-
const MovablePoint$
|
|
16150
|
+
const MovablePoint$4 = GraphieClasses.createClass({
|
|
16148
16151
|
displayName: "MovablePoint",
|
|
16149
16152
|
movableProps: ["children"],
|
|
16150
16153
|
_getProps: function () {
|
|
@@ -16201,7 +16204,7 @@ const MovablePoint$3 = GraphieClasses.createClass({
|
|
|
16201
16204
|
});
|
|
16202
16205
|
|
|
16203
16206
|
// Include helper methods, such as MovablePoint.constrain.snap()
|
|
16204
|
-
_.extend(MovablePoint$
|
|
16207
|
+
_.extend(MovablePoint$4, Interactive2.MovablePoint);
|
|
16205
16208
|
const MovableLine$2 = GraphieClasses.createClass({
|
|
16206
16209
|
displayName: "MovableLine",
|
|
16207
16210
|
movableProps: ["children"],
|
|
@@ -16371,7 +16374,7 @@ var Movables = {
|
|
|
16371
16374
|
Label: Label$1,
|
|
16372
16375
|
Line: Line$2,
|
|
16373
16376
|
MovableLine: MovableLine$2,
|
|
16374
|
-
MovablePoint: MovablePoint$
|
|
16377
|
+
MovablePoint: MovablePoint$4,
|
|
16375
16378
|
Parabola: Parabola,
|
|
16376
16379
|
Path: Path,
|
|
16377
16380
|
Plot: Plot$2,
|
|
@@ -26348,7 +26351,7 @@ var util = /*#__PURE__*/Object.freeze({
|
|
|
26348
26351
|
});
|
|
26349
26352
|
|
|
26350
26353
|
// @ts-expect-error - TS2339 - Property 'MovablePoint' does not exist on type 'typeof Graphie'.
|
|
26351
|
-
const MovablePoint$
|
|
26354
|
+
const MovablePoint$3 = Graphie.MovablePoint;
|
|
26352
26355
|
// @ts-expect-error - TS2339 - Property 'MovableLine' does not exist on type 'typeof Graphie'.
|
|
26353
26356
|
const MovableLine$1 = Graphie.MovableLine;
|
|
26354
26357
|
function isFlipped(newCoord, oldCoord, line) {
|
|
@@ -26430,7 +26433,7 @@ class FunctionGrapher extends React.Component {
|
|
|
26430
26433
|
}],
|
|
26431
26434
|
normalStyle: dashed,
|
|
26432
26435
|
highlightStyle: dashed
|
|
26433
|
-
}, _.map(asymptote, (coord, i) => /*#__PURE__*/React.createElement(MovablePoint$
|
|
26436
|
+
}, _.map(asymptote, (coord, i) => /*#__PURE__*/React.createElement(MovablePoint$3, {
|
|
26434
26437
|
key: `asymptoteCoord-${i}`,
|
|
26435
26438
|
coord: coord,
|
|
26436
26439
|
static: true,
|
|
@@ -26445,7 +26448,7 @@ class FunctionGrapher extends React.Component {
|
|
|
26445
26448
|
}
|
|
26446
26449
|
render() {
|
|
26447
26450
|
const pointForCoord = (coord, i) => {
|
|
26448
|
-
return /*#__PURE__*/React.createElement(MovablePoint$
|
|
26451
|
+
return /*#__PURE__*/React.createElement(MovablePoint$3, {
|
|
26449
26452
|
key: i,
|
|
26450
26453
|
coord: coord,
|
|
26451
26454
|
static: this.props.static,
|
|
@@ -27279,7 +27282,7 @@ const Label = Graphie.Label;
|
|
|
27279
27282
|
// @ts-expect-error - TS2339 - Property 'Line' does not exist on type 'typeof Graphie'.
|
|
27280
27283
|
const Line$1 = Graphie.Line;
|
|
27281
27284
|
// @ts-expect-error - TS2339 - Property 'MovablePoint' does not exist on type 'typeof Graphie'.
|
|
27282
|
-
const MovablePoint$
|
|
27285
|
+
const MovablePoint$2 = Graphie.MovablePoint;
|
|
27283
27286
|
// @ts-expect-error - TS2339 - Property 'MovableLine' does not exist on type 'typeof Graphie'.
|
|
27284
27287
|
const MovableLine = Graphie.MovableLine;
|
|
27285
27288
|
// @ts-expect-error - TS2339 - Property 'Plot' does not exist on type 'typeof Graphie'.
|
|
@@ -27528,7 +27531,7 @@ class Interaction extends React.Component {
|
|
|
27528
27531
|
return [coordX, coordY];
|
|
27529
27532
|
}];
|
|
27530
27533
|
if (element.options.constraint === "snap") {
|
|
27531
|
-
constraints.push(MovablePoint$
|
|
27534
|
+
constraints.push(MovablePoint$2.constraints.snap(element.options.snap));
|
|
27532
27535
|
} else if (element.options.constraint === "x") {
|
|
27533
27536
|
constraints.push(coord => {
|
|
27534
27537
|
return [
|
|
@@ -27550,7 +27553,7 @@ class Interaction extends React.Component {
|
|
|
27550
27553
|
// TODO(eater): foo_[xyz] are hacky non-props to
|
|
27551
27554
|
// get the component to update when constraints
|
|
27552
27555
|
// change
|
|
27553
|
-
return /*#__PURE__*/React.createElement(MovablePoint$
|
|
27556
|
+
return /*#__PURE__*/React.createElement(MovablePoint$2, {
|
|
27554
27557
|
key: element.key,
|
|
27555
27558
|
coord: [
|
|
27556
27559
|
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
@@ -27585,7 +27588,7 @@ class Interaction extends React.Component {
|
|
|
27585
27588
|
return [coordX, coordY];
|
|
27586
27589
|
}];
|
|
27587
27590
|
if (element.options.constraint === "snap") {
|
|
27588
|
-
constraints.push(MovablePoint$
|
|
27591
|
+
constraints.push(MovablePoint$2.constraints.snap(element.options.snap));
|
|
27589
27592
|
} else if (element.options.constraint === "x") {
|
|
27590
27593
|
constraints.push(coord => {
|
|
27591
27594
|
return [
|
|
@@ -27626,14 +27629,14 @@ class Interaction extends React.Component {
|
|
|
27626
27629
|
foo_x: element.options.constraint,
|
|
27627
27630
|
foo_y: element.options.constraintFn,
|
|
27628
27631
|
foo_z: element.options.snap
|
|
27629
|
-
}, /*#__PURE__*/React.createElement(MovablePoint$
|
|
27632
|
+
}, /*#__PURE__*/React.createElement(MovablePoint$2, {
|
|
27630
27633
|
coord: start,
|
|
27631
27634
|
static: true,
|
|
27632
27635
|
normalStyle: {
|
|
27633
27636
|
stroke: "none",
|
|
27634
27637
|
fill: "none"
|
|
27635
27638
|
}
|
|
27636
|
-
}), /*#__PURE__*/React.createElement(MovablePoint$
|
|
27639
|
+
}), /*#__PURE__*/React.createElement(MovablePoint$2, {
|
|
27637
27640
|
coord: end,
|
|
27638
27641
|
static: true,
|
|
27639
27642
|
normalStyle: {
|
|
@@ -28054,33 +28057,6 @@ class Graph extends React.Component {
|
|
|
28054
28057
|
allowScratchpad: true,
|
|
28055
28058
|
setDrawingAreaAvailable: this.props.setDrawingAreaAvailable
|
|
28056
28059
|
});
|
|
28057
|
-
|
|
28058
|
-
// Maybe move this out later
|
|
28059
|
-
if (this.props.lockedFigures) {
|
|
28060
|
-
for (const lockedFigure of this.props.lockedFigures) {
|
|
28061
|
-
switch (lockedFigure.type) {
|
|
28062
|
-
case "point":
|
|
28063
|
-
graphie.circle(
|
|
28064
|
-
// center
|
|
28065
|
-
lockedFigure.coord,
|
|
28066
|
-
// radius
|
|
28067
|
-
0.2,
|
|
28068
|
-
// style
|
|
28069
|
-
lockedFigure.style);
|
|
28070
|
-
break;
|
|
28071
|
-
default:
|
|
28072
|
-
/**
|
|
28073
|
-
* Devlopment-time future-proofing: This `never` should
|
|
28074
|
-
* fail during type-checking if we add a new locked
|
|
28075
|
-
* shape type and forget to handle it in any other
|
|
28076
|
-
* switch case here.
|
|
28077
|
-
*/
|
|
28078
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28079
|
-
lockedFigure.type;
|
|
28080
|
-
throw new Error(`Unknown locked shape type: ${lockedFigure.type}`);
|
|
28081
|
-
}
|
|
28082
|
-
}
|
|
28083
|
-
}
|
|
28084
28060
|
this._updateProtractor();
|
|
28085
28061
|
this._updateRuler();
|
|
28086
28062
|
|
|
@@ -28206,6 +28182,35 @@ Graph.defaultProps = {
|
|
|
28206
28182
|
isMobile: false
|
|
28207
28183
|
};
|
|
28208
28184
|
|
|
28185
|
+
const GraphLockedLayer = props => {
|
|
28186
|
+
const {
|
|
28187
|
+
lockedFigures
|
|
28188
|
+
} = props;
|
|
28189
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, lockedFigures.map((figure, index) => {
|
|
28190
|
+
switch (figure.type) {
|
|
28191
|
+
case "point":
|
|
28192
|
+
const [x, y] = figure.coord;
|
|
28193
|
+
return /*#__PURE__*/React.createElement(Point$2, {
|
|
28194
|
+
key: `${figure.type}-${index}`,
|
|
28195
|
+
x: x,
|
|
28196
|
+
y: y,
|
|
28197
|
+
svgCircleProps: {
|
|
28198
|
+
style: figure.style
|
|
28199
|
+
}
|
|
28200
|
+
});
|
|
28201
|
+
}
|
|
28202
|
+
|
|
28203
|
+
/**
|
|
28204
|
+
* Devlopment-time future-proofing: This `never` should
|
|
28205
|
+
* fail during type-checking if we add a new locked
|
|
28206
|
+
* shape type and forget to handle it in any other
|
|
28207
|
+
* switch case here.
|
|
28208
|
+
*/
|
|
28209
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28210
|
+
throw new UnreachableCaseError(figure.type);
|
|
28211
|
+
}));
|
|
28212
|
+
};
|
|
28213
|
+
|
|
28209
28214
|
const MOVE_CONTROL_POINT = "move-control-point";
|
|
28210
28215
|
function moveControlPoint(objectIndex, pointIndex, destination) {
|
|
28211
28216
|
return {
|
|
@@ -28224,6 +28229,59 @@ function moveSegment(segmentIndex, delta) {
|
|
|
28224
28229
|
};
|
|
28225
28230
|
}
|
|
28226
28231
|
|
|
28232
|
+
const MovablePoint$1 = props => {
|
|
28233
|
+
const hitboxRef = useRef(null);
|
|
28234
|
+
const {
|
|
28235
|
+
point,
|
|
28236
|
+
onMove
|
|
28237
|
+
} = props;
|
|
28238
|
+
const {
|
|
28239
|
+
dragging
|
|
28240
|
+
} = useMovable({
|
|
28241
|
+
gestureTarget: hitboxRef,
|
|
28242
|
+
point,
|
|
28243
|
+
onMove,
|
|
28244
|
+
constrain: p => p
|
|
28245
|
+
});
|
|
28246
|
+
const {
|
|
28247
|
+
viewTransform,
|
|
28248
|
+
userTransform
|
|
28249
|
+
} = useTransformContext();
|
|
28250
|
+
const transformToPx = vec.matrixMult(viewTransform, userTransform);
|
|
28251
|
+
const [x, y] = vec.transform(point, transformToPx);
|
|
28252
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
28253
|
+
ref: hitboxRef,
|
|
28254
|
+
className: "movable-point",
|
|
28255
|
+
tabIndex: 0,
|
|
28256
|
+
style: {
|
|
28257
|
+
cursor: dragging ? "grabbing" : "grab",
|
|
28258
|
+
touchAction: "none",
|
|
28259
|
+
outline: "none",
|
|
28260
|
+
"--movable-point-color": Color.blue
|
|
28261
|
+
}
|
|
28262
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
28263
|
+
className: "movable-point-hitbox",
|
|
28264
|
+
r: 30,
|
|
28265
|
+
cx: x,
|
|
28266
|
+
cy: y
|
|
28267
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
28268
|
+
className: "movable-point-halo",
|
|
28269
|
+
cx: x,
|
|
28270
|
+
cy: y
|
|
28271
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
28272
|
+
className: "movable-point-ring",
|
|
28273
|
+
cx: x,
|
|
28274
|
+
cy: y
|
|
28275
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
28276
|
+
className: "movable-point-center",
|
|
28277
|
+
cx: x,
|
|
28278
|
+
cy: y,
|
|
28279
|
+
style: {
|
|
28280
|
+
fill: Color.blue
|
|
28281
|
+
}
|
|
28282
|
+
}));
|
|
28283
|
+
};
|
|
28284
|
+
|
|
28227
28285
|
const SegmentGraph = props => {
|
|
28228
28286
|
const {
|
|
28229
28287
|
dispatch
|
|
@@ -28266,9 +28324,9 @@ const SegmentView = props => {
|
|
|
28266
28324
|
viewTransform,
|
|
28267
28325
|
userTransform
|
|
28268
28326
|
} = useTransformContext();
|
|
28269
|
-
const
|
|
28270
|
-
const
|
|
28271
|
-
const
|
|
28327
|
+
const transformToPx = vec.matrixMult(viewTransform, userTransform);
|
|
28328
|
+
const pt1Px = vec.transform(pt1, transformToPx);
|
|
28329
|
+
const pt2Px = vec.transform(pt2, transformToPx);
|
|
28272
28330
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("g", {
|
|
28273
28331
|
ref: segment,
|
|
28274
28332
|
tabIndex: 0,
|
|
@@ -28277,28 +28335,26 @@ const SegmentView = props => {
|
|
|
28277
28335
|
cursor: isDraggingSegment ? "grabbing" : "grab"
|
|
28278
28336
|
}
|
|
28279
28337
|
}, /*#__PURE__*/React.createElement(SVGLine, {
|
|
28280
|
-
start:
|
|
28281
|
-
end:
|
|
28338
|
+
start: pt1Px,
|
|
28339
|
+
end: pt2Px,
|
|
28282
28340
|
style: {
|
|
28283
28341
|
stroke: "transparent",
|
|
28284
28342
|
strokeWidth: 30
|
|
28285
28343
|
}
|
|
28286
28344
|
}), /*#__PURE__*/React.createElement(SVGLine, {
|
|
28287
|
-
start:
|
|
28288
|
-
end:
|
|
28345
|
+
start: pt1Px,
|
|
28346
|
+
end: pt2Px,
|
|
28289
28347
|
style: {
|
|
28290
28348
|
stroke: "var(--mafs-segment-stroke-color)",
|
|
28291
28349
|
strokeWidth: "var(--mafs-segment-stroke-weight)"
|
|
28292
28350
|
}
|
|
28293
|
-
})), /*#__PURE__*/React.createElement(MovablePoint$
|
|
28351
|
+
})), /*#__PURE__*/React.createElement(MovablePoint$1, {
|
|
28294
28352
|
point: pt1,
|
|
28295
|
-
color: Color.blue,
|
|
28296
28353
|
onMove: newPoint => {
|
|
28297
28354
|
props.onMovePoint(0, newPoint);
|
|
28298
28355
|
}
|
|
28299
|
-
}), /*#__PURE__*/React.createElement(MovablePoint$
|
|
28356
|
+
}), /*#__PURE__*/React.createElement(MovablePoint$1, {
|
|
28300
28357
|
point: pt2,
|
|
28301
|
-
color: Color.blue,
|
|
28302
28358
|
onMove: newPoint => {
|
|
28303
28359
|
props.onMovePoint(1, newPoint);
|
|
28304
28360
|
}
|
|
@@ -29230,7 +29286,9 @@ const MafsGraph = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
29230
29286
|
zoom: false,
|
|
29231
29287
|
width: width,
|
|
29232
29288
|
height: height
|
|
29233
|
-
}, !legacyGrid && /*#__PURE__*/React.createElement(Grid, props),
|
|
29289
|
+
}, !legacyGrid && /*#__PURE__*/React.createElement(Grid, props), props.lockedFigures && /*#__PURE__*/React.createElement(GraphLockedLayer, {
|
|
29290
|
+
lockedFigures: props.lockedFigures
|
|
29291
|
+
}), renderGraph({
|
|
29234
29292
|
state,
|
|
29235
29293
|
dispatch
|
|
29236
29294
|
}))));
|
|
@@ -29369,12 +29427,13 @@ class InteractiveGraph extends React.Component {
|
|
|
29369
29427
|
}
|
|
29370
29428
|
};
|
|
29371
29429
|
this.resetGraphie = () => {
|
|
29430
|
+
var _this$refs$graph;
|
|
29372
29431
|
this.shouldResetGraphie = false;
|
|
29373
29432
|
this.parabola = null;
|
|
29374
29433
|
this.sinusoid = null;
|
|
29375
29434
|
// eslint-disable-next-line react/no-string-refs
|
|
29376
29435
|
// @ts-expect-error - TS2339 - Property 'reset' does not exist on type 'ReactInstance'.
|
|
29377
|
-
this.refs.graph.reset();
|
|
29436
|
+
(_this$refs$graph = this.refs.graph) == null || _this$refs$graph.reset();
|
|
29378
29437
|
};
|
|
29379
29438
|
this.setupGraphie = () => {
|
|
29380
29439
|
this.setTrashCanVisibility(0);
|
|
@@ -30507,8 +30566,7 @@ class InteractiveGraph extends React.Component {
|
|
|
30507
30566
|
onMouseDown: onMouseDown,
|
|
30508
30567
|
onGraphieUpdated: this.setGraphie,
|
|
30509
30568
|
setDrawingAreaAvailable: this.props.apiOptions.setDrawingAreaAvailable,
|
|
30510
|
-
isMobile: isMobile
|
|
30511
|
-
lockedFigures: this.props.lockedFigures
|
|
30569
|
+
isMobile: isMobile
|
|
30512
30570
|
}));
|
|
30513
30571
|
}
|
|
30514
30572
|
static getQuadraticCoefficients(coords) {
|
|
@@ -41239,7 +41297,7 @@ const init = function init(options) {
|
|
|
41239
41297
|
|
|
41240
41298
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41241
41299
|
const libName = "@khanacademy/perseus";
|
|
41242
|
-
const libVersion = "20.
|
|
41300
|
+
const libVersion = "20.2.0";
|
|
41243
41301
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41244
41302
|
|
|
41245
41303
|
const apiVersion = {
|