Working on moving canvas code to net objects (broken build)

This commit is contained in:
Yousef Khadadeh 2025-12-14 18:57:40 +03:00
parent d2a0bfcda9
commit 45ba26446a
42 changed files with 605 additions and 3186 deletions

View file

@ -27,9 +27,9 @@ bool EraserTool::right_click_popup_gui(Vector2f popupPos) {
}
void EraserTool::switch_tool(DrawingProgramToolType newTool) {
DrawingProgramCache::move_components_from_bvh_nodes_to_set(erasedComponents, erasedBVHNodes);
if(!erasedComponents.empty()) {
DrawingProgramCache::move_components_from_bvh_nodes_to_set(erasedComponents, erasedBVHNodes);
drawP.client_erase_set(erasedComponents);
drawP.erase_component_set(erasedComponents);
// NOTE: Ideally, you would just recalculate the lastDrawnPos of every cache instead of invalidating and redrawing the caches
// However, the eraser might have other visual glitches during drawing that i am unaware of, so for now, just refresh the
// cache after a draw
@ -62,7 +62,7 @@ void EraserTool::tool_update() {
std::erase_if(comps, [&](auto& c) {
if(c->obj->collides_with(drawP.world.drawData.cam.c, cCWorld, cC)) {
erasedComponents.emplace(c);
drawP.compCache.invalidate_cache_at_aabb_before_pos(c->obj->worldAABB.value(), c->obj->collabListInfo.lock()->pos);
drawP.compCache.invalidate_cache_at_aabb_before_pos(c->obj->get_world_bounds(), c->pos);
return true;
}
return false;