mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 17:27:52 -06:00
Selection rectangle moved into a separate class
This commit is contained in:
parent
08cb5bc2c7
commit
ae692635da
5 changed files with 198 additions and 91 deletions
49
src/slic3r/GUI/GLSelectionRectangle.hpp
Normal file
49
src/slic3r/GUI/GLSelectionRectangle.hpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
#ifndef slic3r_GLSelectionRectangle_hpp_
|
||||
#define slic3r_GLSelectionRectangle_hpp_
|
||||
|
||||
#include "libslic3r/Point.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
class Camera;
|
||||
|
||||
class GLSelectionRectangle {
|
||||
public:
|
||||
enum EState {
|
||||
Off,
|
||||
SlaSelect,
|
||||
SlaDeselect
|
||||
};
|
||||
|
||||
// Initiates the rectangle. Width and height describe canvas size.
|
||||
void start_dragging(const Vec2d& mouse_position, float width, float height, EState status);
|
||||
|
||||
// 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);
|
||||
|
||||
void render() const;
|
||||
|
||||
bool is_active() const { return m_status != Off; }
|
||||
EState get_status() const { return m_status; }
|
||||
|
||||
|
||||
|
||||
private:
|
||||
EState m_status = Off;
|
||||
Vec2d m_start_corner;
|
||||
Vec2d m_end_corner;
|
||||
float m_width;
|
||||
float m_height;
|
||||
};
|
||||
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
||||
|
||||
#endif // slic3r_GLGizmoSlaSupports_hpp_
|
Loading…
Add table
Add a link
Reference in a new issue