diff --git a/packages/element/src/linearElementEditor.ts b/packages/element/src/linearElementEditor.ts index 07bab96e97..75d0d3dc9d 100644 --- a/packages/element/src/linearElementEditor.ts +++ b/packages/element/src/linearElementEditor.ts @@ -1569,7 +1569,9 @@ export class LinearElementEditor { const updatedOriginPoint = pointUpdates.get(0)?.point ?? pointFrom(0, 0); - const [offsetX, offsetY] = updatedOriginPoint; + // Handle non-normalized points + const offsetX = element.points[0][0] - updatedOriginPoint[0]; + const offsetY = element.points[0][1] - updatedOriginPoint[1]; const nextPoints = isElbowArrow(element) ? [ @@ -1586,7 +1588,14 @@ export class LinearElementEditor { idx !== points.length - 1 && !pointUpdates.has(idx) ) { - return pointFrom(current[0], current[1]); + return current; + } + + // Since we're subtracting the offset coming from the first point + // from all other points, we need to skip the first point here to avoid + // double-subtracting the offset. + if (idx === 0) { + return pointFrom(0, 0); } return pointFrom( diff --git a/packages/excalidraw/components/Stats/index.tsx b/packages/excalidraw/components/Stats/index.tsx index 47fcd64bea..08c1f64970 100644 --- a/packages/excalidraw/components/Stats/index.tsx +++ b/packages/excalidraw/components/Stats/index.tsx @@ -4,7 +4,7 @@ import throttle from "lodash.throttle"; import { useEffect, useMemo, useState, memo } from "react"; import { STATS_PANELS } from "@excalidraw/common"; -import { getCommonBounds, isBindingElement } from "@excalidraw/element"; +import { getCommonBounds } from "@excalidraw/element"; import { getUncroppedWidthAndHeight } from "@excalidraw/element"; import { isImageElement } from "@excalidraw/element"; @@ -333,16 +333,14 @@ export const StatsInner = memo( appState={appState} /> - {!isBindingElement(singleElement) && ( - - - - )} + + + - LinearElementEditor.pointFromAbsoluteCoords( - element as ExcalidrawArrowElement, - pointRotateRads( - point, - elementCenterPoint(element, elementsMap), - angle, - ), - elementsMap, - ), - ); - } - const base = { type: element.type, startBinding: repairBinding( @@ -443,7 +421,6 @@ export const restoreElement = ( y, elbowed: (element as ExcalidrawArrowElement).elbowed, ...getSizeFromPoints(points), - angle: 0 as Radians, }; // TODO: Separate arrow from linear element