* @brief Applies a resize delta to the focused window, clamped to canvas bounds. */
| 1853 | * @brief Applies a resize delta to the focused window, clamped to canvas bounds. |
| 1854 | */ |
| 1855 | void UI::WindowManager::handleResizeMove(QMouseEvent* event, const QPoint& delta) |
| 1856 | { |
| 1857 | QRect geometry = computeResizedGeometry(delta); |
| 1858 | |
| 1859 | const QRect unclamped = geometry; |
| 1860 | geometry.setX(qMax(0, geometry.x())); |
| 1861 | geometry.setY(qMax(0, geometry.y())); |
| 1862 | if (geometry.right() > int(width()) - 1) |
| 1863 | geometry.setWidth(int(width()) - geometry.x()); |
| 1864 | |
| 1865 | if (geometry.bottom() > int(height()) - 1) |
| 1866 | geometry.setHeight(int(height()) - geometry.y()); |
| 1867 | |
| 1868 | if (geometry == unclamped) { |
| 1869 | m_resizeWindow->setX(geometry.x()); |
| 1870 | m_resizeWindow->setY(geometry.y()); |
| 1871 | m_resizeWindow->setWidth(geometry.width()); |
| 1872 | m_resizeWindow->setHeight(geometry.height()); |
| 1873 | event->accept(); |
| 1874 | } |
| 1875 | } |
| 1876 | |
| 1877 | /** |
| 1878 | * @brief Manual-mode press logic: hit-tests the topmost window at pos, raises it, |