mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Merge remote-tracking branch 'origin/release' into danieljgeiger-mathjax-maint-stage
This commit is contained in:
commit
62f5475c4a
91 changed files with 1575 additions and 604 deletions
|
@ -42,7 +42,7 @@ import {
|
|||
} from "./binding";
|
||||
import { tupleToCoors } from "../utils";
|
||||
import { isBindingElement } from "./typeChecks";
|
||||
import { shouldRotateWithDiscreteAngle } from "../keys";
|
||||
import { KEYS, shouldRotateWithDiscreteAngle } from "../keys";
|
||||
import { getBoundTextElement, handleBindTextResize } from "./textElement";
|
||||
import { DRAGGING_THRESHOLD } from "../constants";
|
||||
import { Mutable } from "../utility-types";
|
||||
|
@ -221,7 +221,7 @@ export class LinearElementEditor {
|
|||
element,
|
||||
referencePoint,
|
||||
[scenePointerX, scenePointerY],
|
||||
appState.gridSize,
|
||||
event[KEYS.CTRL_OR_CMD] ? null : appState.gridSize,
|
||||
);
|
||||
|
||||
LinearElementEditor.movePoints(element, [
|
||||
|
@ -238,7 +238,7 @@ export class LinearElementEditor {
|
|||
element,
|
||||
scenePointerX - linearElementEditor.pointerOffset.x,
|
||||
scenePointerY - linearElementEditor.pointerOffset.y,
|
||||
appState.gridSize,
|
||||
event[KEYS.CTRL_OR_CMD] ? null : appState.gridSize,
|
||||
);
|
||||
|
||||
const deltaX = newDraggingPointPosition[0] - draggingPoint[0];
|
||||
|
@ -254,7 +254,7 @@ export class LinearElementEditor {
|
|||
element,
|
||||
scenePointerX - linearElementEditor.pointerOffset.x,
|
||||
scenePointerY - linearElementEditor.pointerOffset.y,
|
||||
appState.gridSize,
|
||||
event[KEYS.CTRL_OR_CMD] ? null : appState.gridSize,
|
||||
)
|
||||
: ([
|
||||
element.points[pointIndex][0] + deltaX,
|
||||
|
@ -647,7 +647,7 @@ export class LinearElementEditor {
|
|||
element,
|
||||
scenePointer.x,
|
||||
scenePointer.y,
|
||||
appState.gridSize,
|
||||
event[KEYS.CTRL_OR_CMD] ? null : appState.gridSize,
|
||||
),
|
||||
],
|
||||
});
|
||||
|
@ -798,7 +798,7 @@ export class LinearElementEditor {
|
|||
element,
|
||||
lastCommittedPoint,
|
||||
[scenePointerX, scenePointerY],
|
||||
appState.gridSize,
|
||||
event[KEYS.CTRL_OR_CMD] ? null : appState.gridSize,
|
||||
);
|
||||
|
||||
newPoint = [
|
||||
|
@ -810,7 +810,7 @@ export class LinearElementEditor {
|
|||
element,
|
||||
scenePointerX - appState.editingLinearElement.pointerOffset.x,
|
||||
scenePointerY - appState.editingLinearElement.pointerOffset.y,
|
||||
appState.gridSize,
|
||||
event[KEYS.CTRL_OR_CMD] ? null : appState.gridSize,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1176,6 +1176,7 @@ export class LinearElementEditor {
|
|||
linearElementEditor: LinearElementEditor,
|
||||
pointerCoords: PointerCoords,
|
||||
appState: AppState,
|
||||
snapToGrid: boolean,
|
||||
) {
|
||||
const element = LinearElementEditor.getElement(
|
||||
linearElementEditor.elementId,
|
||||
|
@ -1196,7 +1197,7 @@ export class LinearElementEditor {
|
|||
element,
|
||||
pointerCoords.x,
|
||||
pointerCoords.y,
|
||||
appState.gridSize,
|
||||
snapToGrid ? appState.gridSize : null,
|
||||
);
|
||||
const points = [
|
||||
...element.points.slice(0, segmentMidpoint.index!),
|
||||
|
|
|
@ -203,7 +203,6 @@ describe("duplicating multiple elements", () => {
|
|||
);
|
||||
|
||||
clonedArrows.forEach((arrow) => {
|
||||
// console.log(arrow);
|
||||
expect(
|
||||
clonedRectangle.boundElements!.find((e) => e.id === arrow.id),
|
||||
).toEqual(
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { render } from "../../../../tests/test-utils";
|
||||
import { API } from "../../../../tests/helpers/api";
|
||||
import ExcalidrawApp from "../../../../excalidraw-app";
|
||||
import { Excalidraw } from "../../../../packages/excalidraw/index";
|
||||
|
||||
import { measureTextElement } from "../../../textElement";
|
||||
import { ensureSubtypesLoaded } from "../../";
|
||||
|
||||
describe("mathjax", () => {
|
||||
it("text-only measurements match", async () => {
|
||||
await render(<ExcalidrawApp />);
|
||||
await render(<Excalidraw />);
|
||||
await ensureSubtypesLoaded(["math"]);
|
||||
const text = "A quick brown fox jumps over the lazy dog.";
|
||||
const elements = [
|
||||
|
@ -19,7 +19,7 @@ describe("mathjax", () => {
|
|||
expect(metrics1).toStrictEqual(metrics2);
|
||||
});
|
||||
it("minimum height remains", async () => {
|
||||
await render(<ExcalidrawApp />);
|
||||
await render(<Excalidraw />);
|
||||
await ensureSubtypesLoaded(["math"]);
|
||||
const elements = [
|
||||
API.createElement({ type: "text", id: "A", text: "a" }),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import ReactDOM from "react-dom";
|
||||
import ExcalidrawApp from "../excalidraw-app";
|
||||
import { Excalidraw } from "../packages/excalidraw/index";
|
||||
import { GlobalTestState, render, screen } from "../tests/test-utils";
|
||||
import { Keyboard, Pointer, UI } from "../tests/helpers/ui";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
|
@ -41,7 +41,7 @@ describe("textWysiwyg", () => {
|
|||
describe("start text editing", () => {
|
||||
const { h } = window;
|
||||
beforeEach(async () => {
|
||||
await render(<ExcalidrawApp />);
|
||||
await render(<Excalidraw handleKeyboardGlobally={true} />);
|
||||
h.elements = [];
|
||||
});
|
||||
|
||||
|
@ -243,7 +243,7 @@ describe("textWysiwyg", () => {
|
|||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await render(<ExcalidrawApp />);
|
||||
await render(<Excalidraw handleKeyboardGlobally={true} />);
|
||||
//@ts-ignore
|
||||
h.app.refreshDeviceState(h.app.excalidrawContainerRef.current!);
|
||||
|
||||
|
@ -477,7 +477,7 @@ describe("textWysiwyg", () => {
|
|||
const { h } = window;
|
||||
|
||||
beforeEach(async () => {
|
||||
await render(<ExcalidrawApp />);
|
||||
await render(<Excalidraw handleKeyboardGlobally={true} />);
|
||||
h.elements = [];
|
||||
|
||||
rectangle = UI.createElement("rectangle", {
|
||||
|
@ -1511,7 +1511,7 @@ describe("textWysiwyg", () => {
|
|||
});
|
||||
|
||||
it("should bump the version of labelled arrow when label updated", async () => {
|
||||
await render(<ExcalidrawApp />);
|
||||
await render(<Excalidraw handleKeyboardGlobally={true} />);
|
||||
const arrow = UI.createElement("arrow", {
|
||||
width: 300,
|
||||
height: 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue