Skip to content

Commit cd2bc60

Browse files
committed
Fix drag and drop
... no idea how this worked in prior testing, or why it stopped working :/
1 parent 39b323f commit cd2bc60

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/GUI.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,16 @@ void GUI::GUILayersList() {
185185
}
186186

187187
if (ImGui::BeginDragDropSource()) {
188-
ImGui::SetDragDropPayload("APILayer*", &layer, sizeof(layer));
188+
const size_t index = i;
189+
ImGui::SetDragDropPayload("APILayerIndex", &index, sizeof(index));
189190
ImGui::EndDragDropSource();
190191
}
191192

192193
if (ImGui::BeginDragDropTarget()) {
193-
if (const auto payload = ImGui::AcceptDragDropPayload("APILayer*")) {
194-
const auto source = *reinterpret_cast<APILayer*>(payload->Data);
194+
if (
195+
const auto payload = ImGui::AcceptDragDropPayload("APILayerIndex")) {
196+
auto sourceIndex = *reinterpret_cast<const size_t*>(payload->Data);
197+
const auto& source = mLayers.at(sourceIndex);
195198
DragDropReorder(source, layer);
196199
}
197200
ImGui::EndDragDropTarget();

0 commit comments

Comments
 (0)