mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-29 23:39:26 -05:00
Merge branch 'master' into issue/2403
# Conflicts: # modules/skybrowser/src/wwtcommunicator.cpp
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2022 *
|
||||
* Copyright (c) 2014-2023 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2022 *
|
||||
* Copyright (c) 2014-2023 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2022 *
|
||||
* Copyright (c) 2014-2023 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2022 *
|
||||
* Copyright (c) 2014-2023 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2022 *
|
||||
* Copyright (c) 2014-2023 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2022 *
|
||||
* Copyright (c) 2014-2023 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <modules/webbrowser/include/webkeyboardhandler.h>
|
||||
#include <modules/webbrowser/webbrowsermodule.h>
|
||||
#include <ghoul/misc/dictionaryjsonformatter.h>
|
||||
#include <deque>
|
||||
|
||||
namespace {
|
||||
constexpr std::string_view _loggerCat = "WwtCommunicator";
|
||||
@@ -297,13 +298,30 @@ void WwtCommunicator::setImageOrder(const std::string& imageUrl, int order) {
|
||||
// Find in selected images list
|
||||
auto current = findSelectedImage(imageUrl);
|
||||
auto target = _selectedImages.begin() + order;
|
||||
int currentIndex = std::distance(_selectedImages.begin(), current);
|
||||
|
||||
// Make sure the image was found in the list
|
||||
if (current != _selectedImages.end() && target != _selectedImages.end()) {
|
||||
// Swap the two images
|
||||
std::iter_swap(current, target);
|
||||
std::deque<std::pair<std::string, double>> newDeque;
|
||||
|
||||
for (int i = 0; i < static_cast<int>(_selectedImages.size()); i++) {
|
||||
if (i == currentIndex) {
|
||||
continue;
|
||||
}
|
||||
else if (i == order) {
|
||||
if (order < currentIndex) {
|
||||
newDeque.push_back(*current);
|
||||
newDeque.push_back(_selectedImages[i]);
|
||||
}
|
||||
else {
|
||||
newDeque.push_back(_selectedImages[i]);
|
||||
newDeque.push_back(*current);
|
||||
}
|
||||
}
|
||||
else {
|
||||
newDeque.push_back(_selectedImages[i]);
|
||||
}
|
||||
}
|
||||
|
||||
_selectedImages = newDeque;
|
||||
int reverseOrder = static_cast<int>(_selectedImages.size()) - order - 1;
|
||||
ghoul::Dictionary message = setLayerOrderMessage(imageUrl, reverseOrder);
|
||||
sendMessageToWwt(message);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2022 *
|
||||
* Copyright (c) 2014-2023 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
|
||||
Reference in New Issue
Block a user