#include "GLSelectionRectangle.hpp" #include "Camera.hpp" #include "3DScene.hpp" #include namespace Slic3r { namespace GUI { void GLSelectionRectangle::start_dragging(const Vec2d& mouse_position, float width, float height, EState status) { if (is_dragging() || status == Off) return; m_width = width; m_height = height; m_status = status; m_start_corner = mouse_position; m_end_corner = mouse_position; } void GLSelectionRectangle::dragging(const Vec2d& mouse_position) { if (is_dragging()) m_end_corner = mouse_position; } std::vector GLSelectionRectangle::end_dragging(const Camera& camera, const std::vector& points) { if (!is_dragging()) return std::vector(); m_status = Off; std::vector out; 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