@khanacademy/perseus 57.0.1 → 57.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/index.js
CHANGED
|
@@ -28376,10 +28376,11 @@ function AxisLabels(_ref) {
|
|
|
28376
28376
|
const [xAxisLabelLocation, yAxisLabelLocation] = getLabelPosition(graphInfo, labelLocation);
|
|
28377
28377
|
const [xAxisLabelText, yAxisLabelText] = labels;
|
|
28378
28378
|
|
|
28379
|
-
//
|
|
28380
|
-
|
|
28381
|
-
|
|
28382
|
-
|
|
28379
|
+
// Get the transform for the labels
|
|
28380
|
+
const {
|
|
28381
|
+
xLabelTransform,
|
|
28382
|
+
yLabelTransform
|
|
28383
|
+
} = getLabelTransform(labelLocation);
|
|
28383
28384
|
const {
|
|
28384
28385
|
TeX
|
|
28385
28386
|
} = getDependencies();
|
|
@@ -28403,6 +28404,24 @@ function AxisLabels(_ref) {
|
|
|
28403
28404
|
}
|
|
28404
28405
|
}, /*#__PURE__*/React__default["default"].createElement(TeX, null, replaceOutsideTeX(yAxisLabelText))));
|
|
28405
28406
|
}
|
|
28407
|
+
|
|
28408
|
+
/* Get the transform for the labels based on the labelLocation
|
|
28409
|
+
* Exported for testing purposes.
|
|
28410
|
+
*/
|
|
28411
|
+
const getLabelTransform = labelLocation => {
|
|
28412
|
+
// onAxis is the default label location
|
|
28413
|
+
const isOnAxis = labelLocation === undefined || labelLocation === "onAxis";
|
|
28414
|
+
const xLabelTransform = isOnAxis ? "translate(7px, -50%)" : "translate(-50%, -50%)";
|
|
28415
|
+
const yLabelTransform = isOnAxis ? "translate(-50%, 0px)" : "translate(-50%, 0px) rotate(-90deg)";
|
|
28416
|
+
return {
|
|
28417
|
+
xLabelTransform,
|
|
28418
|
+
yLabelTransform
|
|
28419
|
+
};
|
|
28420
|
+
};
|
|
28421
|
+
|
|
28422
|
+
/* Calculate the position of the main axis labels based on the labelLocation
|
|
28423
|
+
* and the ranges of the graph. Exported for testing purposes.
|
|
28424
|
+
*/
|
|
28406
28425
|
const getLabelPosition = (graphInfo, labelLocation) => {
|
|
28407
28426
|
// If the labels are placed along the edge of the graph, we need to place them at the
|
|
28408
28427
|
// center of the graph, which is the average of the min and max values of the axes.
|
|
@@ -41992,7 +42011,7 @@ const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => {
|
|
|
41992
42011
|
|
|
41993
42012
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41994
42013
|
const libName = "@khanacademy/perseus";
|
|
41995
|
-
const libVersion = "57.0
|
|
42014
|
+
const libVersion = "57.2.0";
|
|
41996
42015
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41997
42016
|
|
|
41998
42017
|
const apiVersion = {
|