Fixed erase_it_list order, and fixed Emscripten bug

This commit is contained in:
Yousef Khadadeh 2026-02-10 11:33:19 +03:00
parent ed931f0a78
commit 9d539367ec
5 changed files with 20 additions and 6 deletions

View file

@ -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();

View file

@ -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)