#include "GLSelectionRectangle.hpp" #include "Camera.hpp" #include "3DScene.hpp" #include "GLCanvas3D.hpp" #include namespace Slic3r { namespace GUI { void GLSelectionRectangle::start_dragging(const Vec2d& mouse_position, EState state) { if (is_dragging() || (state == Off)) return; m_state = state; m_start_corner = mouse_position; m_end_corner = mouse_position; } void GLSelectionRectangle::dragging(const Vec2d& mouse_position) { if (!is_dragging()) return; m_end_corner = mouse_position; } std::vector GLSelectionRectangle::stop_dragging(const GLCanvas3D& canvas, const std::vector& points) { std::vector out; if (!is_dragging()) return out; m_state = Off; const Camera& camera = canvas.get_camera(); const std::array& viewport = camera.get_viewport(); const Transform3d& modelview_matrix = camera.get_view_matrix(); const Transform3d& projection_matrix = camera.get_projection_matrix(); // bounding box created from the rectangle corners - will take care of order of the corners BoundingBox rectangle(Points{ Point(m_start_corner.cast()), Point(m_end_corner.cast()) }); // Iterate over all points and determine whether they're in the rectangle. for (unsigned int i = 0; i