Fixed clipboard paste position and added back item count to debug menu

This commit is contained in:
Yousef Khadadeh 2025-12-29 20:11:24 +03:00
parent fb3b13d303
commit a3fb87332b
4 changed files with 16 additions and 2 deletions

View file

@ -360,8 +360,8 @@ void DrawingProgramSelection::paste_clipboard(Vector2f pasteScreenPos) {
for(auto& c : clipboard.components) {
CanvasComponentContainer* newComponentContainer = new CanvasComponentContainer(drawP.world.netObjMan, *c);
newComponentContainer->get_comp().remap_resource_ids(resourceRemapIDs);
c->coords.translate(-moveVec);
c->coords.scale_about(mousePos, scaleMultiplier);
newComponentContainer->coords.translate(-moveVec);
newComponentContainer->coords.scale_about(mousePos, scaleMultiplier);
placedComponents.emplace_back(drawP.layerMan.edited_layer_component_count() + placedComponents.size(), newComponentContainer);
}
auto newlyInsertedObjects = drawP.layerMan.add_many_components_to_layer_being_edited(placedComponents);

View file

@ -62,6 +62,17 @@ void DrawingProgramLayerListItem::get_flattened_layer_list(std::vector<DrawingPr
objList.emplace_back(this);
}
uint32_t DrawingProgramLayerListItem::get_component_count() const {
if(folderData) {
uint32_t toRet = 0;
for(auto& c : folderData->folderList->get_data())
toRet += c->obj->get_component_count();
return toRet;
}
else
return layerData->components->size();
}
bool DrawingProgramLayerListItem::is_folder() const {
return folderData != nullptr;
}

View file

@ -37,6 +37,8 @@ class DrawingProgramLayerListItem {
void set_blend_mode(DrawingProgramLayerManager& layerMan, SerializedBlendMode newBlendMode) const;
SerializedBlendMode get_blend_mode() const;
uint32_t get_component_count() const;
private:
static void write_constructor_func(const NetworkingObjects::NetObjTemporaryPtr<DrawingProgramLayerListItem>& o, cereal::PortableBinaryOutputArchive& a);
static void read_constructor_func(const NetworkingObjects::NetObjTemporaryPtr<DrawingProgramLayerListItem>& o, cereal::PortableBinaryInputArchive& a, const std::shared_ptr<NetServer::ClientData>& c);

View file

@ -1228,6 +1228,7 @@ void Toolbar::performance_metrics() {
std::stringstream a;
a << "FPS: " << std::fixed << std::setprecision(0) << (1.0 / main.deltaTime);
gui.text_label(a.str());
gui.text_label("Item Count: " + std::to_string(main.world->drawProg.layerMan.get_layer_root().get_component_count()));
std::stringstream b;
b << "Coord: " << main.world->drawData.cam.c.pos.x().display_int_str(5) << ", " << main.world->drawData.cam.c.pos.y().display_int_str(5);
gui.text_label(b.str());