mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-05 19:42:47 +00:00
Refactoring of GLSelectionRectangle
This commit is contained in:
@@ -7,38 +7,38 @@ namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
struct Camera;
|
||||
class GLCanvas3D;
|
||||
|
||||
class GLSelectionRectangle {
|
||||
public:
|
||||
enum EState {
|
||||
Off,
|
||||
SlaSelect,
|
||||
SlaDeselect
|
||||
};
|
||||
Select,
|
||||
Deselect
|
||||
};
|
||||
|
||||
// Initiates the rectangle. Width and height describe canvas size.
|
||||
void start_dragging(const Vec2d& mouse_position, float width, float height, EState status);
|
||||
// Initiates the rectangle.
|
||||
void start_dragging(const Vec2d& mouse_position, EState state);
|
||||
|
||||
// To be called on mouse move.
|
||||
void dragging(const Vec2d& mouse_position);
|
||||
|
||||
// Given a vector of points in world coordinates, the function returns indices of those
|
||||
// that are in the rectangle. It then disables the rectangle.
|
||||
std::vector<unsigned int> end_dragging(const Camera& camera, const std::vector<Vec3d>& points);
|
||||
std::vector<unsigned int> stop_dragging(const GLCanvas3D& canvas, const std::vector<Vec3d>& points);
|
||||
|
||||
void render() const;
|
||||
// Disables the rectangle.
|
||||
void stop_dragging();
|
||||
|
||||
bool is_dragging() const { return m_status != Off; }
|
||||
EState get_status() const { return m_status; }
|
||||
void render(const GLCanvas3D& canvas) const;
|
||||
|
||||
bool is_dragging() const { return m_state != Off; }
|
||||
EState get_state() const { return m_state; }
|
||||
|
||||
|
||||
|
||||
private:
|
||||
EState m_status = Off;
|
||||
EState m_state = Off;
|
||||
Vec2d m_start_corner;
|
||||
Vec2d m_end_corner;
|
||||
float m_width;
|
||||
float m_height;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user