refactor: remove dead tangent handle variant

The { kind: "tangent" } MaskHandleId variant was never constructed — neither
getFreeformDisplayHandles nor any other code ever produced a tangent handle
object. The in/out control-arm branches in computeFreeformParamUpdate, the
tangent case in maskHandleIdKey, and the CUSTOM_MASK_TANGENT_SIZE rendering
path in mask-handles.tsx were all unreachable. Removed all four dead paths
and removed "tangent" from MaskHandleKind.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Maze Winther 2026-05-02 01:33:20 +02:00
parent f66cdbfeb2
commit 23187b0b6a
3 changed files with 22 additions and 49 deletions

View File

@ -257,7 +257,7 @@ function computeFreeformParamUpdate({
}; };
} }
if (handleId.kind !== "anchor" && handleId.kind !== "tangent") { if (handleId.kind !== "anchor") {
return {}; return {};
} }
@ -279,29 +279,11 @@ function computeFreeformParamUpdate({
path: updateFreeformPathMaskPoint({ path: updateFreeformPathMaskPoint({
points, points,
pointId: handleId.pointId, pointId: handleId.pointId,
updater: (point) => { updater: (point) => ({
if (handleId.kind === "anchor") { ...point,
return { x: localPoint.x,
...point, y: localPoint.y,
x: localPoint.x, }),
y: localPoint.y,
};
}
if (handleId.side === "in") {
return {
...point,
inX: localPoint.x - point.x,
inY: localPoint.y - point.y,
};
}
return {
...point,
outX: localPoint.x - point.x,
outY: localPoint.y - point.y,
};
},
}), }),
}; };
} }

View File

@ -187,11 +187,10 @@ export interface MaskFeatures {
export type MaskHandleIcon = "rotate" | "feather"; export type MaskHandleIcon = "rotate" | "feather";
export type MaskHandleKind = "corner" | "edge" | "icon" | "point" | "tangent"; export type MaskHandleKind = "corner" | "edge" | "icon" | "point";
type Side = "left" | "right" | "top" | "bottom"; type Side = "left" | "right" | "top" | "bottom";
type CornerXY = { x: "left" | "right"; y: "top" | "bottom" }; type CornerXY = { x: "left" | "right"; y: "top" | "bottom" };
type CustomTangent = "in" | "out";
export type MaskHandleId = export type MaskHandleId =
| { kind: "position" } | { kind: "position" }
@ -201,7 +200,6 @@ export type MaskHandleId =
| { kind: "edge"; side: Side } | { kind: "edge"; side: Side }
| { kind: "corner"; corner: CornerXY } | { kind: "corner"; corner: CornerXY }
| { kind: "anchor"; pointId: string } | { kind: "anchor"; pointId: string }
| { kind: "tangent"; pointId: string; side: CustomTangent }
| { kind: "segment"; index: number }; | { kind: "segment"; index: number };
export function maskHandleIdKey({ id }: { id: MaskHandleId }): string { export function maskHandleIdKey({ id }: { id: MaskHandleId }): string {
@ -217,8 +215,6 @@ export function maskHandleIdKey({ id }: { id: MaskHandleId }): string {
return `${id.corner.y}-${id.corner.x}`; return `${id.corner.y}-${id.corner.x}`;
case "anchor": case "anchor":
return `point:${id.pointId}:anchor`; return `point:${id.pointId}:anchor`;
case "tangent":
return `point:${id.pointId}:${id.side}`;
case "segment": case "segment":
return `segment:${id.index}`; return `segment:${id.index}`;
} }

View File

@ -17,7 +17,6 @@ import {
} from "./handle-primitives"; } from "./handle-primitives";
const CUSTOM_MASK_ANCHOR_SIZE = 7; const CUSTOM_MASK_ANCHOR_SIZE = 7;
const CUSTOM_MASK_TANGENT_SIZE = 6;
import { Rotate01Icon, FeatherIcon } from "@hugeicons/core-free-icons"; import { Rotate01Icon, FeatherIcon } from "@hugeicons/core-free-icons";
export function MaskHandles({ export function MaskHandles({
@ -258,25 +257,21 @@ export function MaskHandles({
); );
} }
if (handle.kind === "point" || handle.kind === "tangent") { if (handle.kind === "point") {
return ( return (
<CircleHandle <CircleHandle
key={key} key={key}
screen={screen} screen={screen}
size={ size={CUSTOM_MASK_ANCHOR_SIZE}
handle.kind === "tangent" isSelected={handle.isSelected}
? CUSTOM_MASK_TANGENT_SIZE onPointerDown={(event) =>
: CUSTOM_MASK_ANCHOR_SIZE handleMaskPointerDown({ event, handleId: handle.id })
} }
isSelected={handle.isSelected} onPointerMove={onPointerMove}
onPointerDown={(event) => onPointerUp={onPointerUp}
handleMaskPointerDown({ event, handleId: handle.id }) />
} );
onPointerMove={onPointerMove} }
onPointerUp={onPointerUp}
/>
);
}
if (handle.kind === "corner") { if (handle.kind === "corner") {
return ( return (