[nostalgia/core/studio/tilesheeteditor] Add support for dragging palette to palette selector
All checks were successful
Build / build (push) Successful in 3m22s

This commit is contained in:
Gary Talent 2025-01-19 11:41:48 -06:00
parent 1cbc576286
commit d68e64931b

View File

@ -443,6 +443,16 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept {
if (ig::ComboBox("Palette", files, m_selectedPaletteIdx)) { if (ig::ComboBox("Palette", files, m_selectedPaletteIdx)) {
oxLogError(m_model.setPalette(files[m_selectedPaletteIdx])); oxLogError(m_model.setPalette(files[m_selectedPaletteIdx]));
} }
if (ig::DragDropTarget const dragDropTarget; dragDropTarget) {
auto const [ref, err] = ig::getDragDropPayload<studio::FileRef>("FileRef");
if (!err) {
auto const oldVal = m_selectedPaletteIdx;
std::ignore = ox::findIdx(files.begin(), files.end(), ref.path).moveTo(m_selectedPaletteIdx);
if (oldVal != m_selectedPaletteIdx) {
oxLogError(m_model.setPalette(files[m_selectedPaletteIdx]));
}
}
}
auto const pages = m_model.pal().pages.size(); auto const pages = m_model.pal().pages.size();
if (pages > 1) { if (pages > 1) {
ig::IndentStackItem const indentStackItem{20}; ig::IndentStackItem const indentStackItem{20};