mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 17:27:52 -06:00
Refactoring of GLSelectionRectangle
This commit is contained in:
parent
d79a2b8d2d
commit
9d070410c2
3 changed files with 111 additions and 110 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue