From 3d9d39837899dfdfc07492418a64940b3d4f7b76 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Thu, 4 Aug 2022 18:41:31 +0530 Subject: [PATCH] fix: flip linear elements after redesign (#5538) --- src/element/transformHandles.ts | 16 +--------------- src/renderer/renderScene.ts | 5 ++++- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/element/transformHandles.ts b/src/element/transformHandles.ts index 715dcb3d..1d20e2c6 100644 --- a/src/element/transformHandles.ts +++ b/src/element/transformHandles.ts @@ -62,18 +62,6 @@ const OMIT_SIDES_FOR_LINE_BACKSLASH = { w: true, }; -const OMIT_SIDES_FOR_LINEAR_ELEMENT = { - e: true, - s: true, - n: true, - w: true, - nw: true, - se: true, - ne: true, - sw: true, - rotation: true, -}; - const generateTransformHandle = ( x: number, y: number, @@ -241,9 +229,7 @@ export const getTransformHandles = ( } let omitSides: { [T in TransformHandleType]?: boolean } = {}; - if (isLinearElement(element)) { - omitSides = OMIT_SIDES_FOR_LINEAR_ELEMENT; - } else if (element.type === "freedraw") { + if (element.type === "freedraw" || isLinearElement(element)) { if (element.points.length === 2) { // only check the last point because starting point is always (0,0) const [, p1] = element.points; diff --git a/src/renderer/renderScene.ts b/src/renderer/renderScene.ts index e2f3a74e..8cabc00f 100644 --- a/src/renderer/renderScene.ts +++ b/src/renderer/renderScene.ts @@ -447,7 +447,10 @@ export const _renderScene = ( renderConfig.zoom, "mouse", // when we render we don't know which pointer type so use mouse ); - if (!appState.viewModeEnabled) { + if ( + !appState.viewModeEnabled && + !isLinearElement(locallySelectedElements[0]) + ) { renderTransformHandles( context, renderConfig,