MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / MoveItem

Function MoveItem

lib/macro/macro-tree.cpp:980–992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

978}
979
980static inline void MoveItem(std::deque<std::shared_ptr<Macro>> &items,
981 std::shared_ptr<Macro> &item, int to)
982{
983 auto it = std::find(items.begin(), items.end(), item);
984 if (it == items.end()) {
985 blog(LOG_ERROR,
986 "something went wrong during drag & drop reordering");
987 return;
988 }
989
990 items.erase(it);
991 items.insert(std::next(items.begin(), to), item);
992}
993
994// Logic mostly based on OBS's source-tree dropEvent() with a few modifications
995// regarding group handling

Callers 1

dropEventMethod · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected