Merge pull request #171 from nanot1m/arrows-start-end-points

Adjust arrow start/end points
This commit is contained in:
Timur Khazamov 2020-01-06 00:30:57 +05:00 committed by GitHub
commit e7e676e1eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -196,7 +196,7 @@ function resizeTest(
y: number, y: number,
sceneState: SceneState sceneState: SceneState
): string | false { ): string | false {
if (element.type === "text" || element.type === "arrow") return false; if (element.type === "text") return false;
const handlers = handlerRectangles(element, sceneState); const handlers = handlerRectangles(element, sceneState);
@ -390,6 +390,13 @@ function handlerRectangles(element: ExcalidrawElement, sceneState: SceneState) {
8 8
]; // se ]; // se
if (element.type === "arrow") {
return {
nw: handlers.nw,
se: handlers.se
};
}
return handlers; return handlers;
} }
@ -449,11 +456,7 @@ function renderScene(
); );
context.setLineDash(lineDash); context.setLineDash(lineDash);
if ( if (element.type !== "text" && selectedIndices.length === 1) {
element.type !== "text" &&
element.type !== "arrow" &&
selectedIndices.length === 1
) {
const handlers = handlerRectangles(element, sceneState); const handlers = handlerRectangles(element, sceneState);
Object.values(handlers).forEach(handler => { Object.values(handlers).forEach(handler => {
context.strokeRect(handler[0], handler[1], handler[2], handler[3]); context.strokeRect(handler[0], handler[1], handler[2], handler[3]);