2025-07-06 20:43:53 +03:00
|
|
|
#pragma once
|
|
|
|
|
#include <include/core/SkCanvas.h>
|
|
|
|
|
#include "../DrawData.hpp"
|
|
|
|
|
#include "../DrawComponents/DrawEllipse.hpp"
|
|
|
|
|
#include <Helpers/SCollision.hpp>
|
|
|
|
|
#include <any>
|
|
|
|
|
|
|
|
|
|
class DrawingProgram;
|
|
|
|
|
|
|
|
|
|
class EditTool {
|
|
|
|
|
public:
|
|
|
|
|
struct HandleData {
|
|
|
|
|
Vector2f* p;
|
|
|
|
|
Vector2f* min;
|
|
|
|
|
Vector2f* max;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
EditTool(DrawingProgram& initDrawP);
|
|
|
|
|
void gui_toolbox();
|
|
|
|
|
void tool_update();
|
|
|
|
|
void reset_tool();
|
|
|
|
|
void draw(SkCanvas* canvas, const DrawData& drawData);
|
|
|
|
|
void add_point_handle(const HandleData& handle);
|
|
|
|
|
void edit_start(const std::shared_ptr<DrawComponent>& comp);
|
2025-07-27 16:53:22 +03:00
|
|
|
bool prevent_undo_or_redo();
|
2025-07-06 20:43:53 +03:00
|
|
|
|
|
|
|
|
struct EditControls {
|
|
|
|
|
std::vector<HandleData> pointHandles;
|
|
|
|
|
std::weak_ptr<DrawComponent> compToEdit;
|
|
|
|
|
bool isEditing = false;
|
|
|
|
|
HandleData* pointDragging = nullptr;
|
|
|
|
|
std::any prevData;
|
|
|
|
|
} controls;
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
DrawingProgram& drawP;
|
|
|
|
|
};
|