[nostalgia/core/studio] Adjust size of SubSheet Editor in cases without size input
This commit is contained in:
parent
94653cb9af
commit
e0b2f37925
@ -248,10 +248,12 @@ void TileSheetEditorImGui::SubSheetEditor::draw() noexcept {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ImGui::OpenPopup(popupName);
|
ImGui::OpenPopup(popupName);
|
||||||
ImGui::SetNextWindowSize(ImVec2(235, 125));
|
const auto modSize = m_cols > 0;
|
||||||
|
const auto popupHeight = modSize ? 125.f : 80.f;
|
||||||
|
ImGui::SetNextWindowSize(ImVec2(235, popupHeight));
|
||||||
if (ImGui::BeginPopupModal(popupName, &m_show, modalFlags)) {
|
if (ImGui::BeginPopupModal(popupName, &m_show, modalFlags)) {
|
||||||
ImGui::InputText("Name", m_name.data(), m_name.cap());
|
ImGui::InputText("Name", m_name.data(), m_name.cap());
|
||||||
if (m_cols != -1) {
|
if (modSize) {
|
||||||
ImGui::InputInt("Columns", &m_cols);
|
ImGui::InputInt("Columns", &m_cols);
|
||||||
ImGui::InputInt("Rows", &m_rows);
|
ImGui::InputInt("Rows", &m_rows);
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,12 @@ struct UpdateSubSheetCommand: public studio::UndoCommand {
|
|||||||
sheet.name = m_newName;
|
sheet.name = m_newName;
|
||||||
sheet.columns = m_newCols;
|
sheet.columns = m_newCols;
|
||||||
sheet.rows = m_newRows;
|
sheet.rows = m_newRows;
|
||||||
oxLogError(sheet.setPixelCount(m_img->bpp, static_cast<std::size_t>(m_newCols * m_newRows)));
|
oxDebugf("old cols: {}, old rows: {}", sheet.columns, sheet.rows);
|
||||||
|
oxDebugf("new cols: {}, new rows: {}", m_newCols, m_newRows);
|
||||||
|
oxDebugf("bpp: {}", m_img->bpp);
|
||||||
|
oxDebugf("pixel count before: {}", sheet.pixels.size());
|
||||||
|
oxLogError(sheet.setPixelCount(m_img->bpp, static_cast<std::size_t>(PixelsPerTile * m_newCols * m_newRows)));
|
||||||
|
oxDebugf("pixel count after: {}", sheet.pixels.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void undo() noexcept final {
|
void undo() noexcept final {
|
||||||
|
Loading…
Reference in New Issue
Block a user