Fixed erase_it_list order, and fixed Emscripten bug
This commit is contained in:
parent
ed931f0a78
commit
9d539367ec
5 changed files with 20 additions and 6 deletions
|
|
@ -233,7 +233,7 @@ if(EMSCRIPTEN)
|
|||
endif()
|
||||
|
||||
target_compile_options(infinipaint PRIVATE -Wall -sUSE_HARFBUZZ=1 -fdiagnostics-color -sUSE_SDL=0 -include functional -fexceptions -pthread)
|
||||
target_link_options(infinipaint PRIVATE --emrun -sUSE_HARFBUZZ=1 -sUSE_SDL=0 -sFULL_ES2 -sUSE_WEBGL2=1 -sFETCH --embed-file data -sALLOW_MEMORY_GROWTH=1 -sEXPORTED_RUNTIME_METHODS=ccall,HEAPU8 -sEXPORTED_FUNCTIONS=[_main,_malloc,_free] -sMAXIMUM_MEMORY=4GB -sSINGLE_FILE -lidbfs.js -fexceptions -pthread) # -sINITIAL_MEMORY=67108864
|
||||
target_link_options(infinipaint PRIVATE --emrun -sUSE_HARFBUZZ=1 -sUSE_SDL=0 -sFULL_ES2 -sUSE_WEBGL2=1 -sFETCH --embed-file data -sALLOW_MEMORY_GROWTH=1 -sEXPORTED_RUNTIME_METHODS=ccall,HEAPU8,HEAPU32 -sEXPORTED_FUNCTIONS=[_main,_malloc,_free] -sMAXIMUM_MEMORY=4GB -sSINGLE_FILE -lidbfs.js -fexceptions -pthread) # -sINITIAL_MEMORY=67108864
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".js")
|
||||
message("In Emscripten Mode")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -374,10 +374,15 @@ namespace NetworkingObjects {
|
|||
return;
|
||||
|
||||
std::vector<std::pair<uint32_t, NetObjOwnerPtr<T>>> erasedObjectsWithPos;
|
||||
if(erasedObjects) {
|
||||
for(auto& it : itList)
|
||||
erasedObjectsWithPos.emplace_back(it->pos, NetObjOwnerPtr<T>());
|
||||
}
|
||||
|
||||
NetObjOrderedListIterator<T> smallestPosIt = data.end();
|
||||
std::vector<NetObjID> idListToSend;
|
||||
for(auto& it : itList) {
|
||||
for(size_t i = 0; i < itList.size(); i++) {
|
||||
auto& it = itList[i];
|
||||
if(smallestPosIt == data.end() || smallestPosIt->pos >= it->pos) {
|
||||
smallestPosIt = std::next(it);
|
||||
if(smallestPosIt != data.end())
|
||||
|
|
@ -387,7 +392,7 @@ namespace NetworkingObjects {
|
|||
this->call_erase_callback(it);
|
||||
idToDataMap.erase(it->obj.get_net_id());
|
||||
if(erasedObjects)
|
||||
erasedObjectsWithPos.emplace_back(it->pos, std::move(it->obj));
|
||||
erasedObjectsWithPos[i].second = std::move(it->obj);
|
||||
data.erase(it);
|
||||
}
|
||||
|
||||
|
|
@ -516,9 +521,15 @@ namespace NetworkingObjects {
|
|||
return;
|
||||
|
||||
std::vector<std::pair<uint32_t, NetObjOwnerPtr<T>>> erasedObjectsWithPos;
|
||||
if(erasedObjects) {
|
||||
for(auto& it : itList)
|
||||
erasedObjectsWithPos.emplace_back(it->pos, NetObjOwnerPtr<T>());
|
||||
}
|
||||
|
||||
NetObjOrderedListIterator<T> smallestPosIt = clientData.end();
|
||||
std::vector<NetObjID> idListToSend;
|
||||
for(auto& it : itList) {
|
||||
for(size_t i = 0; i < itList.size(); i++) {
|
||||
auto& it = itList[i];
|
||||
if(smallestPosIt == clientData.end() || smallestPosIt->pos >= it->pos) {
|
||||
smallestPosIt = std::next(it);
|
||||
if(smallestPosIt != clientData.end())
|
||||
|
|
@ -528,7 +539,7 @@ namespace NetworkingObjects {
|
|||
this->call_erase_callback(it);
|
||||
clientIdToDataMap.erase(it->obj.get_net_id());
|
||||
if(erasedObjects)
|
||||
erasedObjectsWithPos.emplace_back(it->pos, std::move(it->obj));
|
||||
erasedObjectsWithPos[i].second = std::move(it->obj);
|
||||
clientData.erase(it);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
namespace NetworkingObjects {
|
||||
template <typename T> NetObjOwnerPtr<T>::NetObjOwnerPtr():
|
||||
objMan(nullptr),
|
||||
id(NetObjID{0, 0}),
|
||||
rawPtr(nullptr)
|
||||
{}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class DrawingProgramSelection {
|
|||
void draw_gui(SkCanvas* canvas, const DrawData& drawData);
|
||||
bool is_being_transformed();
|
||||
void update();
|
||||
void sort_selection();
|
||||
void deselect_all();
|
||||
void paste_clipboard(Vector2f pasteScreenPos);
|
||||
void paste_image(Vector2f pasteScreenPos);
|
||||
|
|
@ -50,7 +51,6 @@ class DrawingProgramSelection {
|
|||
|
||||
void set_to_selection(const std::vector<CanvasComponentContainer::ObjInfo*>& newSelection);
|
||||
void add_to_selection(const std::vector<CanvasComponentContainer::ObjInfo*>& newSelection);
|
||||
void sort_selection();
|
||||
void calculate_aabb();
|
||||
void reset_all();
|
||||
void reset_transform_data();
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ void DrawingProgramLayer::set_component_list_callbacks(DrawingProgramLayerListIt
|
|||
components->set_erase_callback(eraseCallback);
|
||||
components->set_move_callback([&](const CanvasComponentContainer::ObjInfoIterator& c, uint32_t oldPos) {
|
||||
layerMan.drawP.drawCache.invalidate_cache_at_aabb(c->obj->get_world_bounds());
|
||||
if(layerMan.drawP.selection.is_selected(&(*c)))
|
||||
layerMan.drawP.selection.sort_selection(); // If item is selected, selected items will be unordered, so sort everything again
|
||||
});
|
||||
// Make sure the insert callback is called on existing objects
|
||||
for(auto it = components->begin(); it != components->end(); ++it)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue