Skip to content

Open source CapCut alternative.

TypeScript

fix(site): every element wears the same resize frame

David Le6466924b29c0
diff --git a/site/src/cut/components/OverlayLayer.tsx b/site/src/cut/components/OverlayLayer.tsx
index 0ed092b5..67bfeb2a 100644
--- a/site/src/cut/components/OverlayLayer.tsx
+++ b/site/src/cut/components/OverlayLayer.tsx
@@ -954,8 +954,10 @@ function OverlayItem({
rotation={live?.rotation ?? o.rotation ?? 0}
angle={spin}
rotateCursor={rotateCursor(live?.rotation ?? o.rotation ?? 0)}
+ // Every element wears the whole frame; a line has only its own
+ // length to pull on.
handles={
- o.kind === "shape" && !lineLikeShape(o.shape) ? FRAME_HANDLES : BOX_HANDLES
+ o.kind === "shape" && lineLikeShape(o.shape) ? BOX_HANDLES : FRAME_HANDLES
}
onResize={resizeFrom}
onRotate={rotateFrom}
diff --git a/site/src/cut/components/TransformHandles.tsx b/site/src/cut/components/TransformHandles.tsx
index cc2f22f4..12f94805 100644
--- a/site/src/cut/components/TransformHandles.tsx
+++ b/site/src/cut/components/TransformHandles.tsx
@@ -16,10 +16,9 @@ import { cn } from "@/lib/utils";
* width, the top/bottom pair pulls height. */
export type ResizeHandle = "nw" | "n" | "ne" | "e" | "se" | "s" | "sw" | "w";
-/** The default set: four corners and the two side grips. */
+/** Corners and the side pair, for a box with no height to pull on. */
export const BOX_HANDLES: ResizeHandle[] = ["nw", "ne", "se", "sw", "w", "e"];
-/** Corners and all four sides, for a box whose width and height each pull on
- * their own. */
+/** The default set: four corners and all four sides. */
export const FRAME_HANDLES: ResizeHandle[] = ["nw", "ne", "se", "sw", "w", "e", "n", "s"];
/** Corners alone, for a box whose axes are locked together. */
export const CORNER_HANDLES: ResizeHandle[] = ["nw", "ne", "se", "sw"];
@@ -49,7 +48,7 @@ export function resizeCursor(handle: ResizeHandle, rotation = 0): string {
export function TransformHandles({
color = "#0a84ff",
- handles = BOX_HANDLES,
+ handles = FRAME_HANDLES,
rotation = 0,
angle = null,
onResize,