Improve change stroke color performance
This commit is contained in:
parent
04e9180fe8
commit
a13c96ce0a
2 changed files with 11 additions and 2 deletions
|
|
@ -187,10 +187,10 @@ void DrawingProgramSelection::update_selection_stroke_color() {
|
||||||
if(c->obj->get_comp().get_stroke_color() != std::nullopt) {
|
if(c->obj->get_comp().get_stroke_color() != std::nullopt) {
|
||||||
strokeColorChangeData.oldColorData.emplace(c->obj.get_net_id(), c->obj->get_comp().get_stroke_color().value());
|
strokeColorChangeData.oldColorData.emplace(c->obj.get_net_id(), c->obj->get_comp().get_stroke_color().value());
|
||||||
c->obj->get_comp().change_stroke_color(strokeColorChangeData.newColor);
|
c->obj->get_comp().change_stroke_color(strokeColorChangeData.newColor);
|
||||||
c->obj->commit_update_dont_invalidate_cache(drawP); // Object isn't in the cache since it's selected
|
c->obj->send_comp_update(drawP, false); // Might be deselected, so make sure to send update before its deselected
|
||||||
c->obj->send_comp_update(drawP, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
commitChangeColorUpdate = true;
|
||||||
strokeColorChangeData.oldColor = strokeColorChangeData.newColor;
|
strokeColorChangeData.oldColor = strokeColorChangeData.newColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -480,6 +480,13 @@ void DrawingProgramSelection::commit_transform_selection() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingProgramSelection::update() {
|
void DrawingProgramSelection::update() {
|
||||||
|
if(commitChangeColorUpdate) {
|
||||||
|
for(auto& c : selectedSet) {
|
||||||
|
if(c->obj->get_comp().get_stroke_color() != std::nullopt)
|
||||||
|
c->obj->commit_update_dont_invalidate_cache(drawP); // Object isn't in the cache since it's selected
|
||||||
|
}
|
||||||
|
commitChangeColorUpdate = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingProgramSelection::input_key_callback_modify_selection(const InputManager::KeyCallbackArgs& key) {
|
void DrawingProgramSelection::input_key_callback_modify_selection(const InputManager::KeyCallbackArgs& key) {
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ class DrawingProgramSelection {
|
||||||
void input_mouse_button_on_canvas_callback_modify_selection(const InputManager::MouseButtonCallbackArgs& button);
|
void input_mouse_button_on_canvas_callback_modify_selection(const InputManager::MouseButtonCallbackArgs& button);
|
||||||
void input_mouse_motion_callback_modify_selection(const InputManager::MouseMotionCallbackArgs& motion);
|
void input_mouse_motion_callback_modify_selection(const InputManager::MouseMotionCallbackArgs& motion);
|
||||||
private:
|
private:
|
||||||
|
bool commitChangeColorUpdate = false;
|
||||||
|
|
||||||
void phone_bottom_toolbar_gui(PhoneDrawingProgramScreen& t);
|
void phone_bottom_toolbar_gui(PhoneDrawingProgramScreen& t);
|
||||||
void translate_key(unsigned keyPressed, bool pressed);
|
void translate_key(unsigned keyPressed, bool pressed);
|
||||||
bool mouse_collided_with_selection_aabb();
|
bool mouse_collided_with_selection_aabb();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue