Reliable channel used to finalize component updates
This commit is contained in:
parent
14c6e7ceac
commit
278792a0ff
11 changed files with 36 additions and 28 deletions
|
|
@ -141,7 +141,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(drawP);
|
||||
controls.intermediateItem->client_send_update(drawP, false);
|
||||
|
||||
if(controls.midwayInterpolation) {
|
||||
if(controls.intermediateItem->d->points.size() != 2) // Don't interpolate the first point
|
||||
|
|
@ -175,7 +175,7 @@ bool BrushTool::prevent_undo_or_redo() {
|
|||
void BrushTool::commit_stroke() {
|
||||
if(controls.intermediateItem && controls.intermediateItem->collabListInfo.lock()) {
|
||||
if(!controls.intermediateItem->d->points.empty()) {
|
||||
controls.intermediateItem->client_send_update(drawP);
|
||||
controls.intermediateItem->client_send_update(drawP, true);
|
||||
controls.intermediateItem->commit_update(drawP);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ void EditTool::gui_toolbox() {
|
|||
bool editHappened = controls.compEditTool->edit_gui(a);
|
||||
if(editHappened) {
|
||||
a->commit_update(drawP);
|
||||
a->client_send_update(drawP);
|
||||
a->client_send_update(drawP, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ void EditTool::switch_tool(DrawingProgramToolType newTool) {
|
|||
if(a && a->collabListInfo.lock()) {
|
||||
controls.compEditTool->commit_edit_updates(a, controls.prevData);
|
||||
a->commit_update(drawP);
|
||||
a->client_send_update(drawP);
|
||||
a->client_send_update(drawP, true);
|
||||
}
|
||||
controls.compToEdit.reset();
|
||||
controls.pointHandles.clear();
|
||||
|
|
@ -162,7 +162,7 @@ void EditTool::tool_update() {
|
|||
newPos = cwise_vec_min((*controls.pointDragging->max - Vector2f{controls.pointDragging->minimumDistanceBetweenBoundsAndPoint, controls.pointDragging->minimumDistanceBetweenBoundsAndPoint}).eval(), newPos);
|
||||
*controls.pointDragging->p = newPos;
|
||||
a->commit_update(drawP);
|
||||
a->client_send_update(drawP);
|
||||
a->client_send_update(drawP, false);
|
||||
}
|
||||
isMovingPoint = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@ void EllipseDrawEditTool::commit_edit_updates(const std::shared_ptr<DrawComponen
|
|||
drawP.world.undo.push(UndoManager::UndoRedoPair{
|
||||
[&, a, pData]() {
|
||||
a->d = pData;
|
||||
a->client_send_update(drawP);
|
||||
a->client_send_update(drawP, true);
|
||||
a->commit_update(drawP);
|
||||
return true;
|
||||
},
|
||||
[&, a, cData]() {
|
||||
a->d = cData;
|
||||
a->client_send_update(drawP);
|
||||
a->client_send_update(drawP, true);
|
||||
a->commit_update(drawP);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,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->d.p2 = ensure_points_have_distance(controls.intermediateItem->d.p1, controls.intermediateItem->d.p2, MINIMUM_DISTANCE_BETWEEN_BOUNDS);
|
||||
controls.intermediateItem->client_send_update(drawP);
|
||||
controls.intermediateItem->client_send_update(drawP, false);
|
||||
controls.intermediateItem->commit_update(drawP);
|
||||
}
|
||||
else {
|
||||
|
|
@ -89,7 +89,7 @@ bool EllipseDrawTool::prevent_undo_or_redo() {
|
|||
|
||||
void EllipseDrawTool::commit() {
|
||||
if(controls.intermediateItem && controls.intermediateItem->collabListInfo.lock()) {
|
||||
controls.intermediateItem->client_send_update(drawP);
|
||||
controls.intermediateItem->client_send_update(drawP, true);
|
||||
controls.intermediateItem->commit_update(drawP);
|
||||
}
|
||||
controls.intermediateItem = nullptr;
|
||||
|
|
|
|||
|
|
@ -59,13 +59,13 @@ void RectDrawEditTool::commit_edit_updates(const std::shared_ptr<DrawComponent>&
|
|||
drawP.world.undo.push(UndoManager::UndoRedoPair{
|
||||
[&, a, pData]() {
|
||||
a->d = pData;
|
||||
a->client_send_update(drawP);
|
||||
a->client_send_update(drawP, true);
|
||||
a->commit_update(drawP);
|
||||
return true;
|
||||
},
|
||||
[&, a, cData]() {
|
||||
a->d = cData;
|
||||
a->client_send_update(drawP);
|
||||
a->client_send_update(drawP, true);
|
||||
a->commit_update(drawP);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,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->d.p2 = ensure_points_have_distance(controls.intermediateItem->d.p1, controls.intermediateItem->d.p2, MINIMUM_DISTANCE_BETWEEN_BOUNDS);
|
||||
controls.intermediateItem->client_send_update(drawP);
|
||||
controls.intermediateItem->client_send_update(drawP, false);
|
||||
controls.intermediateItem->commit_update(drawP);
|
||||
}
|
||||
else {
|
||||
|
|
@ -85,7 +85,7 @@ bool RectDrawTool::prevent_undo_or_redo() {
|
|||
|
||||
void RectDrawTool::commit_rectangle() {
|
||||
if(controls.intermediateItem && controls.intermediateItem->collabListInfo.lock()) {
|
||||
controls.intermediateItem->client_send_update(drawP);
|
||||
controls.intermediateItem->client_send_update(drawP, true);
|
||||
controls.intermediateItem->commit_update(drawP);
|
||||
}
|
||||
controls.intermediateItem = nullptr;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ void TextBoxEditTool::commit_edit_updates(const std::shared_ptr<DrawComponent>&
|
|||
a->d = pData;
|
||||
a->set_textbox_string(pData.currentText);
|
||||
a->d.editing = false;
|
||||
a->client_send_update(drawP);
|
||||
a->client_send_update(drawP, true);
|
||||
a->commit_update(drawP);
|
||||
return true;
|
||||
},
|
||||
|
|
@ -50,7 +50,7 @@ void TextBoxEditTool::commit_edit_updates(const std::shared_ptr<DrawComponent>&
|
|||
a->d = cData;
|
||||
a->set_textbox_string(cData.currentText);
|
||||
a->d.editing = false;
|
||||
a->client_send_update(drawP);
|
||||
a->client_send_update(drawP, true);
|
||||
a->commit_update(drawP);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ void TextBoxEditTool::edit_start(EditTool& editTool, const std::shared_ptr<DrawC
|
|||
cur.pos = cur.selectionBeginPos = cur.selectionEndPos = textbox.getPosition(p);
|
||||
prevData = a->d;
|
||||
a->d.editing = true;
|
||||
a->client_send_update(drawP);
|
||||
a->client_send_update(drawP, false);
|
||||
editTool.add_point_handle({&a->d.p1, nullptr, &a->d.p2});
|
||||
editTool.add_point_handle({&a->d.p2, &a->d.p1, nullptr});
|
||||
}
|
||||
|
|
@ -202,6 +202,6 @@ void TextBoxEditTool::edit_text(std::function<void()> toRun, const std::shared_p
|
|||
}
|
||||
|
||||
void TextBoxEditTool::update_textbox_network(const std::shared_ptr<DrawTextBox>& textBox) {
|
||||
textBox->client_send_update(drawP);
|
||||
textBox->client_send_update(drawP, false);
|
||||
textBox->commit_update(drawP);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ void TextBoxTool::tool_update() {
|
|||
return;
|
||||
}
|
||||
else {
|
||||
controls.intermediateItem->client_send_update(drawP);
|
||||
controls.intermediateItem->client_send_update(drawP, false);
|
||||
controls.intermediateItem->commit_update(drawP);
|
||||
}
|
||||
break;
|
||||
|
|
@ -85,7 +85,7 @@ bool TextBoxTool::prevent_undo_or_redo() {
|
|||
|
||||
void TextBoxTool::commit() {
|
||||
if(controls.intermediateItem && controls.intermediateItem->collabListInfo.lock()) {
|
||||
controls.intermediateItem->client_send_update(drawP);
|
||||
controls.intermediateItem->client_send_update(drawP, true);
|
||||
controls.intermediateItem->commit_update(drawP);
|
||||
}
|
||||
controls.intermediateItem = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue