In the function MouseInCanvas:
const bool is_window_hovered_or_focused = ImGui::IsWindowHovered() || ImGui::IsWindowFocused();
Needs to be changed to:
const bool is_window_hovered_or_focused = ImGui::IsWindowHovered();
The reason is because if the editor window is focused it will still perform the selection even if another window is in front of it while dragging the other window's title bar.