feat: Add option to flip single element on the context menu (#2520)

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Riley Schnee 2021-03-26 11:45:08 -04:00 committed by GitHub
parent 458e6d6c24
commit b0d7ff290f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 872 additions and 4 deletions

View file

@ -6,6 +6,7 @@ import {
import { CODES } from "../../keys";
import { ToolName } from "../queries/toolQueries";
import { fireEvent, GlobalTestState } from "../test-utils";
import { mutateElement } from "../../element/mutateElement";
import { API } from "./api";
const { h } = window;
@ -202,6 +203,7 @@ export class UI {
size = 10,
width = size,
height = width,
angle = 0,
}: {
position?: number;
x?: number;
@ -209,6 +211,7 @@ export class UI {
size?: number;
width?: number;
height?: number;
angle?: number;
} = {},
): (T extends "arrow" | "line" | "draw"
? ExcalidrawLinearElement
@ -231,6 +234,10 @@ export class UI {
const origElement = h.elements[h.elements.length - 1] as any;
if (angle !== 0) {
mutateElement(origElement, { angle });
}
return new Proxy(
{},
{