* @brief Returns the manual-mode snap rectangle for the dragged window's edges. */
| 166 | * @brief Returns the manual-mode snap rectangle for the dragged window's edges. |
| 167 | */ |
| 168 | static std::optional<QRect> computeSnapRect( |
| 169 | int left, int top, int right, int bottom, int cw, int ch) |
| 170 | { |
| 171 | if (left <= 0 && top <= 0) |
| 172 | return QRect(0, 0, cw / 2, ch / 2); |
| 173 | |
| 174 | if (right >= cw && top <= 0) |
| 175 | return QRect(cw / 2, 0, cw / 2, ch / 2); |
| 176 | |
| 177 | if (left <= 0 && bottom >= ch) |
| 178 | return liftSnapBottom(QRect(0, ch / 2, cw / 2, ch / 2), ch); |
| 179 | |
| 180 | if (right >= cw && bottom >= ch) |
| 181 | return liftSnapBottom(QRect(cw / 2, ch / 2, cw / 2, ch / 2), ch); |
| 182 | |
| 183 | if (top <= 0) |
| 184 | return QRect(0, 0, cw, ch); |
| 185 | |
| 186 | if (left <= 0) |
| 187 | return liftSnapBottom(QRect(0, 0, cw / 2, ch), ch); |
| 188 | |
| 189 | if (right >= cw) |
| 190 | return liftSnapBottom(QRect(cw / 2, 0, cw / 2, ch), ch); |
| 191 | |
| 192 | return std::nullopt; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * @brief Returns manual anchor margins for a geometry within a canvas. |
no test coverage detected