Added back infinite zoom scale up code

This commit is contained in:
Yousef Khadadeh 2025-12-31 16:30:56 +03:00
parent 108da82fd4
commit 85cc0c2457
26 changed files with 191 additions and 62 deletions

View file

@ -51,3 +51,8 @@ void DrawingProgramLayer::get_flattened_component_list(std::vector<CanvasCompone
for(auto& p : *components)
objList.emplace_back(&p);
}
void DrawingProgramLayer::scale_up(const WorldScalar& scaleUpAmount) {
for(auto& p : *components)
p.obj->scale_up(scaleUpAmount);
}

View file

@ -13,6 +13,7 @@ class DrawingProgramLayer {
void commit_update_dont_invalidate_cache(DrawingProgramLayerManager& layerMan) const;
void get_flattened_component_list(std::vector<CanvasComponentContainer::ObjInfo*>& objList) const;
void set_to_erase();
void scale_up(const WorldScalar& scaleUpAmount);
CanvasComponentContainer::NetListOwnerPtr components;
private:

View file

@ -49,3 +49,8 @@ NetworkingObjects::NetObjWeakPtr<DrawingProgramLayerListItem> DrawingProgramLaye
}
return {};
}
void DrawingProgramLayerFolder::scale_up(const WorldScalar& scaleUpAmount) {
for(auto& p : *folderList)
p.obj->scale_up(scaleUpAmount);
}

View file

@ -15,6 +15,7 @@ class DrawingProgramLayerFolder {
void get_flattened_component_list(std::vector<CanvasComponentContainer::ObjInfo*>& objList) const;
void set_to_erase();
NetworkingObjects::NetObjWeakPtr<DrawingProgramLayerListItem> get_initial_editing_layer() const;
void scale_up(const WorldScalar& scaleUpAmount);
NetworkingObjects::NetObjOwnerPtr<NetworkingObjects::NetObjOrderedList<DrawingProgramLayerListItem>> folderList;
bool isFolderOpen = false;

View file

@ -80,6 +80,13 @@ uint32_t DrawingProgramLayerListItem::get_component_count() const {
return layerData->components->size();
}
void DrawingProgramLayerListItem::scale_up(const WorldScalar& scaleUpAmount) {
if(folderData)
folderData->scale_up(scaleUpAmount);
else
layerData->scale_up(scaleUpAmount);
}
bool DrawingProgramLayerListItem::is_folder() const {
return folderData != nullptr;
}

View file

@ -29,6 +29,7 @@ class DrawingProgramLayerListItem {
const std::string& get_name() const;
void get_flattened_component_list(std::vector<CanvasComponentContainer::ObjInfo*>& objList) const;
void get_flattened_layer_list(std::vector<DrawingProgramLayerListItem*>& objList);
void scale_up(const WorldScalar& scaleUpAmount);
void set_alpha(DrawingProgramLayerManager& layerMan, float newAlpha) const;
float get_alpha() const;

View file

@ -15,6 +15,10 @@ void DrawingProgramLayerManager::init() {
}
}
void DrawingProgramLayerManager::scale_up(const WorldScalar& scaleUpAmount) {
layerTreeRoot->scale_up(scaleUpAmount);
}
void DrawingProgramLayerManager::write_components_server(cereal::PortableBinaryOutputArchive& a) {
layerTreeRoot.write_create_message(a);
}
@ -92,3 +96,4 @@ CanvasComponentContainer::ObjInfo* DrawingProgramLayerManager::add_component_to_
return nullptr;
return &(*editLayerPtr->get_layer().components->push_back_and_send_create(editLayerPtr->get_layer().components, newObj));
}

View file

@ -25,6 +25,7 @@ class DrawingProgramLayerManager {
void write_components_server(cereal::PortableBinaryOutputArchive& a);
void read_components_client(cereal::PortableBinaryInputArchive& a);
bool is_a_layer_being_edited();
void scale_up(const WorldScalar& scaleUpAmount);
template <typename List> void erase_component_container(const List& compsToErase) {
std::unordered_map<DrawingProgramLayerListItem*, std::vector<CanvasComponentContainer::ObjInfoIterator>> idsToEraseInSpecificLayers;
for(auto& c : compsToErase)