(null);
// Stop native touch events from reaching the canvas listener so it can't
// call preventDefault on touchend (which would kill the synthetic click).
useEffect(() => {
const el = containerRef.current;
if (!el) return;
const stop = (e: Event) => e.stopPropagation();
el.addEventListener('touchstart', stop, { passive: false });
el.addEventListener('touchmove', stop, { passive: false });
el.addEventListener('touchend', stop, { passive: false });
el.addEventListener('mousedown', stop);
return () => {
el.removeEventListener('touchstart', stop);
el.removeEventListener('touchmove', stop);
el.removeEventListener('touchend', stop);
el.removeEventListener('mousedown', stop);
};
}, [kind]);
useTouchSafeAction(deleteRef, onDelete);
useTouchSafeAction(rotateRef, onRotate ?? noop);
useTouchSafeAction(deselectRef, onDeselect);
if (!kind) return null;
return (
{label}
{canRotate && onRotate && (
)}
);
};
const noop = () => {};
const buttonStyle: React.CSSProperties = {
display: 'inline-flex',
alignItems: 'center',
gap: 6,
padding: '6px 10px',
background: 'transparent',
border: '1px solid transparent',
borderRadius: 6,
color: 'inherit',
cursor: 'pointer',
fontSize: 13,
lineHeight: 1,
minHeight: 36, // touch-friendly hit target
};
const buttonLabelStyle: React.CSSProperties = {
// Hidden on very narrow toolbars; kept visible by default for clarity
};