mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
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:
parent
458e6d6c24
commit
b0d7ff290f
12 changed files with 872 additions and 4 deletions
|
@ -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(
|
||||
{},
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue