버튼 그룹 위치 수정
This commit is contained in:
parent
eb17309b50
commit
2f9b4f27b8
|
|
@ -310,7 +310,7 @@ export default function ScreenViewPage() {
|
||||||
|
|
||||||
// 🔧 임시: 버튼 그룹 기능 완전 비활성화
|
// 🔧 임시: 버튼 그룹 기능 완전 비활성화
|
||||||
// TODO: 사용자가 명시적으로 그룹을 원하는 경우에만 활성화하도록 UI 개선 필요
|
// TODO: 사용자가 명시적으로 그룹을 원하는 경우에만 활성화하도록 UI 개선 필요
|
||||||
const DISABLE_BUTTON_GROUPS = true;
|
const DISABLE_BUTTON_GROUPS = false;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!DISABLE_BUTTON_GROUPS &&
|
!DISABLE_BUTTON_GROUPS &&
|
||||||
|
|
@ -457,20 +457,36 @@ export default function ScreenViewPage() {
|
||||||
const groupConfig = (firstButton as any).webTypeConfig
|
const groupConfig = (firstButton as any).webTypeConfig
|
||||||
?.flowVisibilityConfig as FlowVisibilityConfig;
|
?.flowVisibilityConfig as FlowVisibilityConfig;
|
||||||
|
|
||||||
// 그룹의 위치는 모든 버튼 중 가장 왼쪽/위쪽 버튼의 위치 사용
|
// 🔍 버튼 그룹 설정 확인
|
||||||
const groupPosition = buttons.reduce(
|
console.log("🔍 버튼 그룹 설정:", {
|
||||||
(min, button) => ({
|
groupId,
|
||||||
x: Math.min(min.x, button.position.x),
|
buttonCount: buttons.length,
|
||||||
y: Math.min(min.y, button.position.y),
|
buttons: buttons.map((b) => ({
|
||||||
z: min.z,
|
id: b.id,
|
||||||
}),
|
label: b.label,
|
||||||
{ x: buttons[0].position.x, y: buttons[0].position.y, z: buttons[0].position.z || 2 },
|
x: b.position.x,
|
||||||
);
|
y: b.position.y,
|
||||||
|
})),
|
||||||
|
groupConfig: {
|
||||||
|
layoutBehavior: groupConfig.layoutBehavior,
|
||||||
|
groupDirection: groupConfig.groupDirection,
|
||||||
|
groupAlign: groupConfig.groupAlign,
|
||||||
|
groupGap: groupConfig.groupGap,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
// 버튼 그룹 위치에도 widthOffset 적용 (테이블이 늘어난 만큼 오른쪽으로 이동)
|
// 🔧 수정: 그룹 컨테이너는 첫 번째 버튼 위치를 기준으로 하되,
|
||||||
|
// 각 버튼의 상대 위치는 원래 위치를 유지
|
||||||
|
const firstButtonPosition = {
|
||||||
|
x: buttons[0].position.x,
|
||||||
|
y: buttons[0].position.y,
|
||||||
|
z: buttons[0].position.z || 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
// 버튼 그룹 위치에도 widthOffset 적용
|
||||||
const adjustedGroupPosition = {
|
const adjustedGroupPosition = {
|
||||||
...groupPosition,
|
...firstButtonPosition,
|
||||||
x: groupPosition.x + widthOffset,
|
x: firstButtonPosition.x + widthOffset,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 그룹의 크기 계산: 버튼들의 실제 크기 + 간격을 기준으로 계산
|
// 그룹의 크기 계산: 버튼들의 실제 크기 + 간격을 기준으로 계산
|
||||||
|
|
@ -501,9 +517,9 @@ export default function ScreenViewPage() {
|
||||||
key={`flow-button-group-${groupId}`}
|
key={`flow-button-group-${groupId}`}
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
left: `${groupPosition.x}px`,
|
left: `${adjustedGroupPosition.x}px`,
|
||||||
top: `${groupPosition.y}px`,
|
top: `${adjustedGroupPosition.y}px`,
|
||||||
zIndex: groupPosition.z,
|
zIndex: adjustedGroupPosition.z,
|
||||||
width: `${groupWidth}px`,
|
width: `${groupWidth}px`,
|
||||||
height: `${groupHeight}px`,
|
height: `${groupHeight}px`,
|
||||||
}}
|
}}
|
||||||
|
|
@ -513,9 +529,14 @@ export default function ScreenViewPage() {
|
||||||
groupConfig={groupConfig}
|
groupConfig={groupConfig}
|
||||||
isDesignMode={false}
|
isDesignMode={false}
|
||||||
renderButton={(button) => {
|
renderButton={(button) => {
|
||||||
|
// 🔧 각 버튼의 상대 위치 = 버튼의 원래 위치 - 첫 번째 버튼 위치
|
||||||
const relativeButton = {
|
const relativeButton = {
|
||||||
...button,
|
...button,
|
||||||
position: { x: 0, y: 0, z: button.position.z || 1 },
|
position: {
|
||||||
|
x: button.position.x - firstButtonPosition.x,
|
||||||
|
y: button.position.y - firstButtonPosition.y,
|
||||||
|
z: button.position.z || 1,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue