fixed crop/size/pivot issue when no region selected

This commit is contained in:
2026-04-14 10:23:40 -04:00
parent 8fbccb2257
commit 15f85b84a9

View File

@@ -112,7 +112,8 @@ namespace anm2ed::imgui
} }
else else
{ {
bool isRegionSet = frame && frame->regionID != -1; bool isRegionSet = frame && displayFrame.regionID != -1 && displayFrame.crop == frame->crop &&
displayFrame.size == frame->size && displayFrame.pivot == frame->pivot;
ImGui::BeginDisabled(type == anm2::ROOT || type == anm2::NULL_ || isRegionSet); ImGui::BeginDisabled(type == anm2::ROOT || type == anm2::NULL_ || isRegionSet);
{ {
auto cropDisplay = frame ? displayFrame.crop : vec2(); auto cropDisplay = frame ? displayFrame.crop : vec2();
@@ -121,7 +122,8 @@ namespace anm2ed::imgui
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.crop) : ""); DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.crop) : "");
if (cropEdit == edit::START) if (cropEdit == edit::START)
document.snapshot(localize.get(EDIT_FRAME_CROP)); document.snapshot(localize.get(EDIT_FRAME_CROP));
else if (cropEdit == edit::END) if (frame && cropEdit != edit::NONE) frame->crop = cropDisplay;
if (cropEdit == edit::END)
document.change(Document::FRAMES); document.change(Document::FRAMES);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CROP)); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CROP));
@@ -131,7 +133,8 @@ namespace anm2ed::imgui
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.size) : ""); DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.size) : "");
if (sizeEdit == edit::START) if (sizeEdit == edit::START)
document.snapshot(localize.get(EDIT_FRAME_SIZE)); document.snapshot(localize.get(EDIT_FRAME_SIZE));
else if (sizeEdit == edit::END) if (frame && sizeEdit != edit::NONE) frame->size = sizeDisplay;
if (sizeEdit == edit::END)
document.change(Document::FRAMES); document.change(Document::FRAMES);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SIZE)); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SIZE));
} }
@@ -154,7 +157,8 @@ namespace anm2ed::imgui
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.pivot) : ""); DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.pivot) : "");
if (pivotEdit == edit::START) if (pivotEdit == edit::START)
document.snapshot(localize.get(EDIT_FRAME_PIVOT)); document.snapshot(localize.get(EDIT_FRAME_PIVOT));
else if (pivotEdit == edit::END) if (frame && pivotEdit != edit::NONE) frame->pivot = pivotDisplay;
if (pivotEdit == edit::END)
document.change(Document::FRAMES); document.change(Document::FRAMES);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PIVOT)); ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PIVOT));
} }