Speed up searching for info to send to network
This commit is contained in:
parent
eb00125f01
commit
241a0a9588
11 changed files with 75 additions and 87 deletions
|
|
@ -127,28 +127,34 @@ void DrawComponent::final_update(DrawingProgram& drawP) {
|
|||
updateDraw = true;
|
||||
}
|
||||
|
||||
void DrawComponent::client_send_place(DrawingProgram& drawP, uint64_t placement) {
|
||||
drawP.world.con.client_send_items_to_server(RELIABLE_COMMAND_CHANNEL, SERVER_PLACE_COMPONENT, placement, get_type(), this->coords, *this);
|
||||
void DrawComponent::client_send_place(DrawingProgram& drawP) {
|
||||
//if(collabListInfo.lock()) If this fails, then there's a real issue
|
||||
drawP.world.con.client_send_items_to_server(RELIABLE_COMMAND_CHANNEL, SERVER_PLACE_COMPONENT, collabListInfo.lock()->pos, get_type(), this->coords, *this);
|
||||
}
|
||||
|
||||
void DrawComponent::client_send_erase(DrawingProgram& drawP, ServerClientID id) {
|
||||
drawP.world.con.client_send_items_to_server(RELIABLE_COMMAND_CHANNEL, SERVER_ERASE_COMPONENT, id);
|
||||
void DrawComponent::client_send_erase(DrawingProgram& drawP) {
|
||||
if(collabListInfo.lock())
|
||||
drawP.world.con.client_send_items_to_server(RELIABLE_COMMAND_CHANNEL, SERVER_ERASE_COMPONENT, collabListInfo.lock()->id);
|
||||
}
|
||||
|
||||
void DrawComponent::client_send_update_temp(DrawingProgram& drawP, ServerClientID id) {
|
||||
drawP.world.con.client_send_items_to_server(UNRELIABLE_COMMAND_CHANNEL, SERVER_UPDATE_COMPONENT, true, id, *this);
|
||||
void DrawComponent::client_send_update_temp(DrawingProgram& drawP) {
|
||||
if(collabListInfo.lock())
|
||||
drawP.world.con.client_send_items_to_server(UNRELIABLE_COMMAND_CHANNEL, SERVER_UPDATE_COMPONENT, true, collabListInfo.lock()->id, *this);
|
||||
}
|
||||
|
||||
void DrawComponent::client_send_update_final(DrawingProgram& drawP, ServerClientID id) {
|
||||
drawP.world.con.client_send_items_to_server(RELIABLE_COMMAND_CHANNEL, SERVER_UPDATE_COMPONENT, false, id, *this);
|
||||
void DrawComponent::client_send_update_final(DrawingProgram& drawP) {
|
||||
if(collabListInfo.lock())
|
||||
drawP.world.con.client_send_items_to_server(RELIABLE_COMMAND_CHANNEL, SERVER_UPDATE_COMPONENT, false, collabListInfo.lock()->id, *this);
|
||||
}
|
||||
|
||||
void DrawComponent::client_send_transform_temp(DrawingProgram& drawP, ServerClientID id) {
|
||||
drawP.world.con.client_send_items_to_server(UNRELIABLE_COMMAND_CHANNEL, SERVER_TRANSFORM_COMPONENT, true, id, this->coords);
|
||||
void DrawComponent::client_send_transform_temp(DrawingProgram& drawP) {
|
||||
if(collabListInfo.lock())
|
||||
drawP.world.con.client_send_items_to_server(UNRELIABLE_COMMAND_CHANNEL, SERVER_TRANSFORM_COMPONENT, true, collabListInfo.lock()->id, this->coords);
|
||||
}
|
||||
|
||||
void DrawComponent::client_send_transform_final(DrawingProgram& drawP, ServerClientID id) {
|
||||
drawP.world.con.client_send_items_to_server(RELIABLE_COMMAND_CHANNEL, SERVER_TRANSFORM_COMPONENT, false, id, this->coords);
|
||||
void DrawComponent::client_send_transform_final(DrawingProgram& drawP) {
|
||||
if(collabListInfo.lock())
|
||||
drawP.world.con.client_send_items_to_server(RELIABLE_COMMAND_CHANNEL, SERVER_TRANSFORM_COMPONENT, false, collabListInfo.lock()->id, this->coords);
|
||||
}
|
||||
|
||||
void DrawComponent::finalize_update(DrawingProgram& drawP, bool invalidateCache) {
|
||||
|
|
|
|||
|
|
@ -87,12 +87,12 @@ class DrawComponent {
|
|||
bool bounds_draw_check(const DrawData& drawData) const;
|
||||
|
||||
void check_timers(DrawingProgram& drawP);
|
||||
void client_send_place(DrawingProgram& drawP, uint64_t placement);
|
||||
static void client_send_erase(DrawingProgram& drawP, ServerClientID id);
|
||||
void client_send_update_temp(DrawingProgram& drawP, ServerClientID id);
|
||||
void client_send_update_final(DrawingProgram& drawP, ServerClientID id);
|
||||
void client_send_transform_temp(DrawingProgram& drawP, ServerClientID id);
|
||||
void client_send_transform_final(DrawingProgram& drawP, ServerClientID id);
|
||||
void client_send_place(DrawingProgram& drawP);
|
||||
void client_send_erase(DrawingProgram& drawP);
|
||||
void client_send_update_temp(DrawingProgram& drawP);
|
||||
void client_send_update_final(DrawingProgram& drawP);
|
||||
void client_send_transform_temp(DrawingProgram& drawP);
|
||||
void client_send_transform_final(DrawingProgram& drawP);
|
||||
|
||||
std::optional<SCollision::AABB<WorldScalar>> worldAABB;
|
||||
|
||||
|
|
|
|||
|
|
@ -107,9 +107,9 @@ void BrushTool::tool_update() {
|
|||
controls.intermediateItem->coords = drawP.world.drawData.cam.c;
|
||||
controls.intermediateItem->lastUpdateTime = std::chrono::steady_clock::now();
|
||||
uint64_t placement = drawP.components.client_list().size();
|
||||
controls.intermediateID = drawP.components.client_insert(placement, controls.intermediateItem);
|
||||
drawP.components.client_insert(placement, controls.intermediateItem);
|
||||
controls.intermediateItem->temp_update(drawP);
|
||||
controls.intermediateItem->client_send_place(drawP, placement);
|
||||
controls.intermediateItem->client_send_place(drawP);
|
||||
// NOTE: The data isnt finallized at this point, so a BVH isn't generated for an object that you undo while youre drawing (this isnt just for brush strokes)
|
||||
// The fix for now is to generate a BVH for an object when you redo it
|
||||
drawP.add_undo_place_component(placement, controls.intermediateItem);
|
||||
|
|
@ -142,7 +142,7 @@ void BrushTool::tool_update() {
|
|||
if((!controls.drawingMinimumRelativeToSize && distToPrev >= 10.0) || (controls.drawingMinimumRelativeToSize && distToPrev >= drawP.controls.relativeWidth * DRAW_MINIMUM_LIMIT)) {
|
||||
controls.intermediateItem->d.points.back() = p;
|
||||
controls.addedTemporaryPoint = false;
|
||||
controls.intermediateItem->client_send_update_temp(drawP, controls.intermediateID);
|
||||
controls.intermediateItem->client_send_update_temp(drawP);
|
||||
|
||||
if(controls.midwayInterpolation) {
|
||||
if(controls.intermediateItem->d.points.size() != 2) // Don't interpolate the first point
|
||||
|
|
@ -174,7 +174,7 @@ void BrushTool::gui_toolbox() {
|
|||
void BrushTool::commit_stroke() {
|
||||
if(controls.intermediateItem) {
|
||||
if(!controls.intermediateItem->d.points.empty()) {
|
||||
controls.intermediateItem->client_send_update_final(drawP, controls.intermediateID);
|
||||
controls.intermediateItem->client_send_update_final(drawP);
|
||||
controls.intermediateItem->final_update(drawP);
|
||||
controls.intermediateItem = nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ class BrushTool {
|
|||
std::deque<SmoothingPoint> penSmoothingData;
|
||||
|
||||
std::shared_ptr<DrawBrushStroke> intermediateItem;
|
||||
ServerClientID intermediateID;
|
||||
bool isDrawing = false;
|
||||
bool hasRoundCaps = true;
|
||||
bool drawingMinimumRelativeToSize = true;
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ void DrawingProgram::add_file_to_canvas_by_path_execute(const std::string& fileP
|
|||
img->final_update(*this);
|
||||
uint64_t placement = components.client_list().size();
|
||||
components.client_insert(placement, img);
|
||||
img->client_send_place(*this, placement);
|
||||
img->client_send_place(*this);
|
||||
add_undo_place_component(placement, img);
|
||||
}
|
||||
|
||||
|
|
@ -423,7 +423,7 @@ void DrawingProgram::add_file_to_canvas_by_data(const std::string& fileName, std
|
|||
img->final_update(*this);
|
||||
uint64_t placement = components.client_list().size();
|
||||
components.client_insert(placement, img);
|
||||
img->client_send_place(*this, placement);
|
||||
img->client_send_place(*this);
|
||||
add_undo_place_component(placement, img);
|
||||
}
|
||||
|
||||
|
|
@ -461,19 +461,17 @@ void DrawingProgram::add_undo_place_component(uint64_t placement, const std::sha
|
|||
world.undo.push(UndoManager::UndoRedoPair{
|
||||
[&, comp]() {
|
||||
ServerClientID compID;
|
||||
comp->client_send_erase(*this);
|
||||
components.client_erase(comp, compID);
|
||||
if(compID == ServerClientID{0, 0})
|
||||
return false;
|
||||
DrawComponent::client_send_erase(*this, compID);
|
||||
reset_tools();
|
||||
return true;
|
||||
},
|
||||
[&, comp, placement]() {
|
||||
if(components.get_id(comp) != ServerClientID{0, 0})
|
||||
if(comp->collabListInfo.lock())
|
||||
return false;
|
||||
components.client_insert(placement, comp);
|
||||
comp->final_update(*this); // Method to recover after an undo that happened while drawing a component
|
||||
comp->client_send_place(*this, placement);
|
||||
comp->client_send_place(*this);
|
||||
reset_tools();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -483,30 +481,27 @@ void DrawingProgram::add_undo_place_component(uint64_t placement, const std::sha
|
|||
void DrawingProgram::add_undo_place_components(uint64_t placement, const std::vector<std::shared_ptr<DrawComponent>>& comps) {
|
||||
world.undo.push(UndoManager::UndoRedoPair{
|
||||
[&, comps]() {
|
||||
std::vector<ServerClientID> compIDs;
|
||||
for(auto& c : comps) {
|
||||
ServerClientID compID;
|
||||
components.client_erase(c, compID);
|
||||
compIDs.emplace_back(compID);
|
||||
}
|
||||
bool toRet = true;
|
||||
for(auto& compID : compIDs) {
|
||||
if(compID == ServerClientID{0, 0})
|
||||
for(auto& c : comps) {
|
||||
if(!c->collabListInfo.lock())
|
||||
toRet = false;
|
||||
else
|
||||
DrawComponent::client_send_erase(*this, compID);
|
||||
else {
|
||||
ServerClientID compID;
|
||||
c->client_send_erase(*this);
|
||||
components.client_erase(c, compID);
|
||||
}
|
||||
}
|
||||
reset_tools();
|
||||
return toRet;
|
||||
},
|
||||
[&, comps, placement]() {
|
||||
for(auto& c : comps)
|
||||
if(components.get_id(c) != ServerClientID{0, 0})
|
||||
if(c->collabListInfo.lock())
|
||||
return false;
|
||||
for(auto& c : comps | std::views::reverse) {
|
||||
components.client_insert(placement, c);
|
||||
c->final_update(*this); // Method to recover after an undo that happened while drawing a component
|
||||
c->client_send_place(*this, placement);
|
||||
c->client_send_place(*this);
|
||||
}
|
||||
reset_tools();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ void EditTool::gui_toolbox() {
|
|||
}
|
||||
if(editHappened) {
|
||||
a->temp_update(drawP);
|
||||
a->client_send_update_temp(drawP, drawP.components.get_id(a));
|
||||
a->client_send_update_temp(drawP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -84,7 +84,7 @@ void EditTool::reset_tool() {
|
|||
break;
|
||||
}
|
||||
a->final_update(drawP);
|
||||
a->client_send_update_final(drawP, drawP.components.get_id(a));
|
||||
a->client_send_update_final(drawP);
|
||||
}
|
||||
controls.compToEdit.reset();
|
||||
controls.pointHandles.clear();
|
||||
|
|
@ -165,7 +165,7 @@ void EditTool::tool_update() {
|
|||
newPos = cwise_vec_min(*controls.pointDragging->max, newPos);
|
||||
*controls.pointDragging->p = newPos;
|
||||
a->temp_update(drawP);
|
||||
a->client_send_update_temp(drawP, drawP.components.get_id(a));
|
||||
a->client_send_update_temp(drawP);
|
||||
}
|
||||
isMovingPoint = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,18 +70,14 @@ void EllipseDrawTool::commit_edit_updates(const std::shared_ptr<DrawEllipse>& a,
|
|||
drawP.world.undo.push(UndoManager::UndoRedoPair{
|
||||
[&, a, pData]() {
|
||||
a->d = pData;
|
||||
ServerClientID compID = drawP.components.get_id(a);
|
||||
if(compID != ServerClientID{0, 0})
|
||||
a->client_send_update_final(drawP, compID);
|
||||
a->client_send_update_final(drawP);
|
||||
a->final_update(drawP);
|
||||
drawP.reset_tools();
|
||||
return true;
|
||||
},
|
||||
[&, a, cData]() {
|
||||
ServerClientID compID = drawP.components.get_id(a);
|
||||
a->d = cData;
|
||||
if(compID != ServerClientID{0, 0})
|
||||
a->client_send_update_final(drawP, compID);
|
||||
a->client_send_update_final(drawP);
|
||||
a->final_update(drawP);
|
||||
drawP.reset_tools();
|
||||
return true;
|
||||
|
|
@ -114,7 +110,7 @@ void EllipseDrawTool::tool_update() {
|
|||
controls.intermediateItem->lastUpdateTime = std::chrono::steady_clock::now();
|
||||
uint64_t placement = drawP.components.client_list().size();
|
||||
drawP.components.client_insert(placement, controls.intermediateItem);
|
||||
controls.intermediateItem->client_send_place(drawP, placement);
|
||||
controls.intermediateItem->client_send_place(drawP);
|
||||
drawP.add_undo_place_component(placement, controls.intermediateItem);
|
||||
controls.intermediateItem->temp_update(drawP);
|
||||
controls.drawStage = 1;
|
||||
|
|
@ -131,7 +127,7 @@ void EllipseDrawTool::tool_update() {
|
|||
}
|
||||
controls.intermediateItem->d.p1 = cwise_vec_min(controls.startAt, newPos);
|
||||
controls.intermediateItem->d.p2 = cwise_vec_max(controls.startAt, newPos);
|
||||
controls.intermediateItem->client_send_update_temp(drawP, drawP.components.get_id(controls.intermediateItem));
|
||||
controls.intermediateItem->client_send_update_temp(drawP);
|
||||
controls.intermediateItem->temp_update(drawP);
|
||||
}
|
||||
else {
|
||||
|
|
@ -145,7 +141,7 @@ void EllipseDrawTool::tool_update() {
|
|||
|
||||
void EllipseDrawTool::commit() {
|
||||
if(controls.intermediateItem) {
|
||||
controls.intermediateItem->client_send_update_final(drawP, drawP.components.get_id(controls.intermediateItem));
|
||||
controls.intermediateItem->client_send_update_final(drawP);
|
||||
controls.intermediateItem->final_update(drawP);
|
||||
controls.intermediateItem = nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ void EraserTool::tool_update() {
|
|||
drawP.components.client_erase_if([&](uint64_t oldPlacement, const auto& c) {
|
||||
if(c->obj->globalCollisionCheck) {
|
||||
erasedComponents.emplace_back(oldPlacement, c->obj);
|
||||
DrawComponent::client_send_erase(drawP, c->id);
|
||||
c->obj->client_send_erase(drawP);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -48,7 +48,7 @@ void EraserTool::tool_update() {
|
|||
|
||||
for(auto& comp : erasedCompVal | std::views::reverse) {
|
||||
drawP.components.client_insert(comp.first, comp.second);
|
||||
comp.second->client_send_place(drawP, comp.first);
|
||||
comp.second->client_send_place(drawP);
|
||||
}
|
||||
drawP.reset_tools();
|
||||
return true;
|
||||
|
|
@ -60,8 +60,8 @@ void EraserTool::tool_update() {
|
|||
|
||||
for(auto& comp : erasedCompVal) {
|
||||
ServerClientID compID;
|
||||
comp.second->client_send_erase(drawP);
|
||||
drawP.components.client_erase(comp.second, compID);
|
||||
DrawComponent::client_send_erase(drawP, compID);
|
||||
}
|
||||
drawP.reset_tools();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -74,18 +74,14 @@ void RectDrawTool::commit_edit_updates(const std::shared_ptr<DrawRectangle>& a,
|
|||
drawP.world.undo.push(UndoManager::UndoRedoPair{
|
||||
[&, a, pData]() {
|
||||
a->d = pData;
|
||||
ServerClientID compID = drawP.components.get_id(a);
|
||||
if(compID != ServerClientID{0, 0})
|
||||
a->client_send_update_final(drawP, compID);
|
||||
a->client_send_update_final(drawP);
|
||||
a->final_update(drawP);
|
||||
drawP.reset_tools();
|
||||
return true;
|
||||
},
|
||||
[&, a, cData]() {
|
||||
ServerClientID compID = drawP.components.get_id(a);
|
||||
a->d = cData;
|
||||
if(compID != ServerClientID{0, 0})
|
||||
a->client_send_update_final(drawP, compID);
|
||||
a->client_send_update_final(drawP);
|
||||
a->final_update(drawP);
|
||||
drawP.reset_tools();
|
||||
return true;
|
||||
|
|
@ -115,7 +111,7 @@ void RectDrawTool::tool_update() {
|
|||
uint64_t placement = drawP.components.client_list().size();
|
||||
controls.intermediateID = drawP.components.client_insert(placement, controls.intermediateItem);
|
||||
controls.intermediateItem->temp_update(drawP);
|
||||
controls.intermediateItem->client_send_place(drawP, placement);
|
||||
controls.intermediateItem->client_send_place(drawP);
|
||||
drawP.add_undo_place_component(placement, controls.intermediateItem);
|
||||
controls.drawStage = 1;
|
||||
}
|
||||
|
|
@ -131,7 +127,7 @@ void RectDrawTool::tool_update() {
|
|||
}
|
||||
controls.intermediateItem->d.p1 = cwise_vec_min(controls.startAt, newPos);
|
||||
controls.intermediateItem->d.p2 = cwise_vec_max(controls.startAt, newPos);
|
||||
controls.intermediateItem->client_send_update_temp(drawP, controls.intermediateID);
|
||||
controls.intermediateItem->client_send_update_temp(drawP);
|
||||
controls.intermediateItem->temp_update(drawP);
|
||||
}
|
||||
else {
|
||||
|
|
@ -145,7 +141,7 @@ void RectDrawTool::tool_update() {
|
|||
|
||||
void RectDrawTool::commit_rectangle() {
|
||||
if(controls.intermediateItem) {
|
||||
controls.intermediateItem->client_send_update_final(drawP, controls.intermediateID);
|
||||
controls.intermediateItem->client_send_update_final(drawP);
|
||||
controls.intermediateItem->final_update(drawP);
|
||||
controls.intermediateItem = nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ void RectSelectTool::tool_update() {
|
|||
drawP.components.client_erase_if([&](uint64_t oldPlacement, const auto& c) {
|
||||
if(c->obj->selected) {
|
||||
erasedCompVal.emplace_back(std::pair<uint64_t, std::shared_ptr<DrawComponent>>{oldPlacement, c->obj});
|
||||
DrawComponent::client_send_erase(drawP, c->id);
|
||||
c->obj->client_send_erase(drawP);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -112,7 +112,7 @@ void RectSelectTool::tool_update() {
|
|||
|
||||
for(auto& comp : erasedCompVal | std::views::reverse) {
|
||||
drawP.components.client_insert(comp.first, comp.second);
|
||||
comp.second->client_send_place(drawP, comp.first);
|
||||
comp.second->client_send_place(drawP);
|
||||
}
|
||||
drawP.reset_tools();
|
||||
return true;
|
||||
|
|
@ -124,8 +124,8 @@ void RectSelectTool::tool_update() {
|
|||
|
||||
for(auto& comp : erasedCompVal) {
|
||||
ServerClientID compID;
|
||||
comp.second->client_send_erase(drawP);
|
||||
drawP.components.client_erase(comp.second, compID);
|
||||
DrawComponent::client_send_erase(drawP, compID);
|
||||
}
|
||||
drawP.reset_tools();
|
||||
return true;
|
||||
|
|
@ -149,7 +149,7 @@ void RectSelectTool::tool_update() {
|
|||
newCoords.translate(translationVec);
|
||||
item.comp->coords = newCoords;
|
||||
item.comp->transform_temp_update(drawP);
|
||||
item.comp->client_send_transform_temp(drawP, item.id);
|
||||
item.comp->client_send_transform_temp(drawP);
|
||||
item.comp->lastTransformTime = std::chrono::steady_clock::now();
|
||||
}
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ void RectSelectTool::tool_update() {
|
|||
auto newCoords = item.oldCoords;
|
||||
newCoords.scale_about(controls.scaleCenterPoint, scaleAmount, flipScale);
|
||||
item.comp->coords = newCoords;
|
||||
item.comp->client_send_transform_temp(drawP, item.id);
|
||||
item.comp->client_send_transform_temp(drawP);
|
||||
item.comp->transform_temp_update(drawP);
|
||||
item.comp->lastTransformTime = std::chrono::steady_clock::now();
|
||||
}
|
||||
|
|
@ -213,7 +213,7 @@ void RectSelectTool::tool_update() {
|
|||
newCoords.rotate_about(controls.rotationCenter, controls.rotationPointAngle);
|
||||
item.comp->coords = newCoords;
|
||||
item.comp->transform_temp_update(drawP);
|
||||
item.comp->client_send_transform_temp(drawP, item.id);
|
||||
item.comp->client_send_transform_temp(drawP);
|
||||
item.comp->lastTransformTime = std::chrono::steady_clock::now();
|
||||
}
|
||||
}
|
||||
|
|
@ -251,7 +251,7 @@ void RectSelectTool::paste_clipboard() {
|
|||
|
||||
drawP.components.client_insert(placement, newC);
|
||||
newC->final_update(drawP);
|
||||
newC->client_send_place(drawP, placement);
|
||||
newC->client_send_place(drawP);
|
||||
placedComponents.emplace_back(newC);
|
||||
}
|
||||
set_selected_items();
|
||||
|
|
@ -321,7 +321,7 @@ void RectSelectTool::set_selected_items() {
|
|||
void RectSelectTool::commit_transformation() {
|
||||
std::vector<CoordSpaceHelper> finalCoords;
|
||||
for(auto& item : controls.selectedItems) {
|
||||
item.comp->client_send_transform_final(drawP, item.id);
|
||||
item.comp->client_send_transform_final(drawP);
|
||||
item.comp->finalize_update(drawP);
|
||||
finalCoords.emplace_back(item.comp->coords);
|
||||
}
|
||||
|
|
@ -332,7 +332,7 @@ void RectSelectTool::commit_transformation() {
|
|||
[&, sItems, finalCoords]() {
|
||||
for(auto& item : sItems) {
|
||||
item.comp->coords = item.oldCoords;
|
||||
item.comp->client_send_transform_final(drawP, drawP.components.get_id(item.comp));
|
||||
item.comp->client_send_transform_final(drawP);
|
||||
item.comp->finalize_update(drawP);
|
||||
}
|
||||
drawP.reset_tools();
|
||||
|
|
@ -341,7 +341,7 @@ void RectSelectTool::commit_transformation() {
|
|||
[&, sItems, finalCoords]() {
|
||||
for(auto [item, finalCoord] : std::views::zip(sItems, finalCoords)) {
|
||||
item.comp->coords = finalCoord;
|
||||
item.comp->client_send_transform_final(drawP, drawP.components.get_id(item.comp));
|
||||
item.comp->client_send_transform_final(drawP);
|
||||
item.comp->finalize_update(drawP);
|
||||
}
|
||||
drawP.reset_tools();
|
||||
|
|
|
|||
|
|
@ -57,20 +57,16 @@ void TextBoxTool::commit_edit_updates(const std::shared_ptr<DrawTextBox>& a, std
|
|||
a->d = pData;
|
||||
a->set_textbox_string(pData.currentText);
|
||||
a->d.editing = false;
|
||||
ServerClientID compID = drawP.components.get_id(a);
|
||||
if(compID != ServerClientID{0, 0})
|
||||
a->client_send_update_final(drawP, compID);
|
||||
a->client_send_update_final(drawP);
|
||||
a->final_update(drawP);
|
||||
drawP.reset_tools();
|
||||
return true;
|
||||
},
|
||||
[&, a, cData]() {
|
||||
ServerClientID compID = drawP.components.get_id(a);
|
||||
a->d = cData;
|
||||
a->set_textbox_string(cData.currentText);
|
||||
a->d.editing = false;
|
||||
if(compID != ServerClientID{0, 0})
|
||||
a->client_send_update_final(drawP, compID);
|
||||
a->client_send_update_final(drawP);
|
||||
a->final_update(drawP);
|
||||
drawP.reset_tools();
|
||||
return true;
|
||||
|
|
@ -86,7 +82,7 @@ void TextBoxTool::edit_start(const std::shared_ptr<DrawTextBox>& a, std::any& pr
|
|||
cur.pos = cur.selectionBeginPos = cur.selectionEndPos = textbox.getPosition(p);
|
||||
prevData = a->d;
|
||||
a->d.editing = true;
|
||||
a->client_send_update_temp(drawP, drawP.components.get_id(a));
|
||||
a->client_send_update_temp(drawP);
|
||||
drawP.editTool.add_point_handle({&a->d.p1, nullptr, &a->d.p2});
|
||||
drawP.editTool.add_point_handle({&a->d.p2, &a->d.p1, nullptr});
|
||||
}
|
||||
|
|
@ -232,7 +228,7 @@ void TextBoxTool::tool_update() {
|
|||
controls.intermediateItem->lastUpdateTime = std::chrono::steady_clock::now();
|
||||
uint64_t placement = drawP.components.client_list().size();
|
||||
drawP.components.client_insert(placement, controls.intermediateItem);
|
||||
controls.intermediateItem->client_send_place(drawP, placement);
|
||||
controls.intermediateItem->client_send_place(drawP);
|
||||
drawP.add_undo_place_component(placement, controls.intermediateItem);
|
||||
controls.drawStage = 1;
|
||||
}
|
||||
|
|
@ -257,7 +253,7 @@ void TextBoxTool::tool_update() {
|
|||
drawP.editTool.edit_start(i);
|
||||
}
|
||||
else {
|
||||
controls.intermediateItem->client_send_update_temp(drawP, drawP.components.get_id(controls.intermediateItem));
|
||||
controls.intermediateItem->client_send_update_temp(drawP);
|
||||
controls.intermediateItem->temp_update(drawP);
|
||||
}
|
||||
break;
|
||||
|
|
@ -273,13 +269,13 @@ void TextBoxTool::edit_text(std::function<void()> toRun, const std::shared_ptr<D
|
|||
}
|
||||
|
||||
void TextBoxTool::update_textbox_network(const std::shared_ptr<DrawTextBox>& textBox) {
|
||||
textBox->client_send_update_temp(drawP, drawP.components.get_id(textBox));
|
||||
textBox->client_send_update_temp(drawP);
|
||||
textBox->temp_update(drawP);
|
||||
}
|
||||
|
||||
void TextBoxTool::commit() {
|
||||
if(controls.intermediateItem) {
|
||||
controls.intermediateItem->client_send_update_final(drawP, drawP.components.get_id(controls.intermediateItem));
|
||||
controls.intermediateItem->client_send_update_final(drawP);
|
||||
controls.intermediateItem->final_update(drawP);
|
||||
//controls.intermediateItem->currentlyUpdating = true; // It remains true, as we are about to start writing into the text box we just placed
|
||||
controls.intermediateItem = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue