Updating ellipse and rectangle colors updates cache as well

This commit is contained in:
Yousef Khadadeh 2025-07-31 18:05:40 +03:00
parent 75a614946c
commit 069fc66565
4 changed files with 10 additions and 4 deletions

View file

@ -28,7 +28,6 @@ void EllipseDrawTool::gui_toolbox() {
}
bool EllipseDrawTool::edit_gui(const std::shared_ptr<DrawEllipse>& a) {
DrawEllipse::Data oldData = a->d;
Toolbar& t = drawP.world.main.toolbar;
t.gui.push_id("edit tool ellipse");
t.gui.text_label_centered("Edit Ellipse");
@ -55,7 +54,10 @@ bool EllipseDrawTool::edit_gui(const std::shared_ptr<DrawEllipse>& a) {
});
}
t.gui.pop_id();
return a->d != oldData;
bool editHappened = a->d != controls.oldData;
controls.oldData = a->d;
return editHappened;
}
void EllipseDrawTool::edit_start(const std::shared_ptr<DrawEllipse>& a, std::any& prevData) {

View file

@ -25,6 +25,7 @@ class EllipseDrawTool {
void commit();
struct EllipseDrawControls {
DrawEllipse::Data oldData;
Vector2f startAt;
int fillStrokeMode = 1;
int drawStage = 0;

View file

@ -26,7 +26,6 @@ void RectDrawTool::gui_toolbox() {
}
bool RectDrawTool::edit_gui(const std::shared_ptr<DrawRectangle>& a) {
DrawRectangle::Data oldData = a->d;
Toolbar& t = drawP.world.main.toolbar;
t.gui.push_id("edit tool rectangle");
t.gui.text_label_centered("Edit Rectangle");
@ -54,7 +53,10 @@ bool RectDrawTool::edit_gui(const std::shared_ptr<DrawRectangle>& a) {
});
}
t.gui.pop_id();
return a->d != oldData;
bool editHappened = a->d != controls.oldData;
controls.oldData = a->d;
return editHappened;
}
void RectDrawTool::reset_tool() {

View file

@ -25,6 +25,7 @@ class RectDrawTool {
void commit_rectangle();
struct RectDrawControls {
DrawRectangle::Data oldData;
Vector2f startAt;
float relativeRadiusWidth = 10.0f;
int fillStrokeMode = 1;