mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-17 15:24:19 +00:00
fix(studio): hold canvas movement from inspector
This commit is contained in:
@@ -2880,6 +2880,7 @@ export function StudioApp() {
|
||||
selection={
|
||||
!rightCollapsed && rightPanelTab === "design" ? domEditSelection : null
|
||||
}
|
||||
allowCanvasMovement={false}
|
||||
onCanvasMouseDown={handlePreviewCanvasMouseDown}
|
||||
onCanvasDoubleClick={handlePreviewCanvasDoubleClick}
|
||||
onSelectedDoubleClick={handleSelectedOverlayDoubleClick}
|
||||
@@ -2974,6 +2975,7 @@ export function StudioApp() {
|
||||
onImportAssets={handleImportFiles}
|
||||
fontAssets={fontAssets}
|
||||
onImportFonts={handleImportFonts}
|
||||
allowLayoutDetach={false}
|
||||
/>
|
||||
) : (
|
||||
<RenderQueue
|
||||
|
||||
@@ -14,6 +14,7 @@ interface OverlayRect {
|
||||
interface DomEditOverlayProps {
|
||||
iframeRef: RefObject<HTMLIFrameElement | null>;
|
||||
selection: DomEditSelection | null;
|
||||
allowCanvasMovement?: boolean;
|
||||
onCanvasMouseDown: (
|
||||
event: React.MouseEvent<HTMLDivElement>,
|
||||
options?: { preferClipAncestor?: boolean },
|
||||
@@ -125,6 +126,7 @@ interface BlockedMoveState {
|
||||
export const DomEditOverlay = memo(function DomEditOverlay({
|
||||
iframeRef,
|
||||
selection,
|
||||
allowCanvasMovement = true,
|
||||
onCanvasMouseDown,
|
||||
onCanvasDoubleClick,
|
||||
onSelectedDoubleClick,
|
||||
@@ -403,9 +405,10 @@ export const DomEditOverlay = memo(function DomEditOverlay({
|
||||
top: overlayRect.top,
|
||||
width: overlayRect.width,
|
||||
height: overlayRect.height,
|
||||
cursor: selection.capabilities.canMove ? "move" : "default",
|
||||
cursor: allowCanvasMovement && selection.capabilities.canMove ? "move" : "default",
|
||||
}}
|
||||
onPointerDown={(e) => {
|
||||
if (!allowCanvasMovement) return;
|
||||
if (selection.capabilities.canMove) {
|
||||
startGesture("drag", e);
|
||||
return;
|
||||
@@ -424,7 +427,7 @@ export const DomEditOverlay = memo(function DomEditOverlay({
|
||||
onDoubleClick={onSelectedDoubleClick}
|
||||
>
|
||||
{/* Resize handle — bottom-right corner */}
|
||||
{selection.capabilities.canResize && (
|
||||
{allowCanvasMovement && selection.capabilities.canResize && (
|
||||
<div
|
||||
className="absolute -right-1.5 -bottom-1.5 w-3 h-3 rounded-sm bg-studio-accent border border-studio-accent/60"
|
||||
style={{ cursor: "se-resize", touchAction: "none" }}
|
||||
|
||||
@@ -64,6 +64,7 @@ interface PropertyPanelProps {
|
||||
onImportAssets?: (files: FileList) => Promise<string[]>;
|
||||
fontAssets?: ImportedFontAsset[];
|
||||
onImportFonts?: (files: FileList | File[]) => Promise<ImportedFontAsset[]>;
|
||||
allowLayoutDetach?: boolean;
|
||||
}
|
||||
|
||||
const FIELD =
|
||||
@@ -1984,6 +1985,7 @@ export const PropertyPanel = memo(function PropertyPanel({
|
||||
onImportAssets,
|
||||
fontAssets = [],
|
||||
onImportFonts,
|
||||
allowLayoutDetach = true,
|
||||
}: PropertyPanelProps) {
|
||||
const styles = element?.computedStyles ?? EMPTY_STYLES;
|
||||
const selectionColors = useMemo(() => collectSelectionColors(styles), [styles]);
|
||||
@@ -2020,7 +2022,7 @@ export const PropertyPanel = memo(function PropertyPanel({
|
||||
<p className="text-sm font-medium text-neutral-200">Select an element in the preview.</p>
|
||||
<p className="mt-2 max-w-[260px] text-xs leading-5 text-neutral-500">
|
||||
The inspector is tuned for direct DOM edits with safer geometry controls, color picking,
|
||||
and cleaner Paper-style grouping.
|
||||
and cleaner grouped layer controls.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
@@ -2036,7 +2038,9 @@ export const PropertyPanel = memo(function PropertyPanel({
|
||||
const sourceLabel = element.id ? `#${element.id}` : element.selector;
|
||||
const showEditableSections = element.capabilities.canEditStyles;
|
||||
const disabledMoveReason =
|
||||
element.capabilities.reasonIfDisabled && !element.capabilities.canDetachFromLayout
|
||||
allowLayoutDetach &&
|
||||
element.capabilities.reasonIfDisabled &&
|
||||
!element.capabilities.canDetachFromLayout
|
||||
? element.capabilities.reasonIfDisabled
|
||||
: null;
|
||||
|
||||
@@ -2131,7 +2135,7 @@ export const PropertyPanel = memo(function PropertyPanel({
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{element.capabilities.canDetachFromLayout && (
|
||||
{allowLayoutDetach && element.capabilities.canDetachFromLayout && (
|
||||
<div className="mt-4 flex min-w-0 flex-wrap items-center justify-between gap-3 border-l border-amber-500/40 pl-3">
|
||||
<div className="min-w-0 text-[11px] leading-5 text-neutral-400">
|
||||
<div className="font-medium text-neutral-200">
|
||||
|
||||
Reference in New Issue
Block a user