76 auto animationIt = m_animations.constFind(w);
77 if (animationIt != m_animations.constEnd()) {
79 const qreal progress = (*animationIt).timeLine.value();
83 IconPosition position = Top;
85 if (!icon.isValid()) {
89 if (extG.contains(pt)) {
90 const int d[2][2] = {{pt.x() - extG.x(), extG.right() - pt.x()},
91 {pt.y() - extG.y(), extG.bottom() - pt.y()}};
113 pt.setY(extG.bottom());
116 pt.setX(extG.right());
120 if (pt.y() < geo.y()) {
122 }
else if (pt.x() < geo.x()) {
124 }
else if (pt.y() > geo.bottom()) {
126 }
else if (pt.x() > geo.right()) {
130 icon = QRect(pt, QSize(0, 0));
136 if (!window->isDock()) {
141 if (window->frameGeometry().intersects(icon)) {
152 if (icon.center().y() <= windowScreen.center().y()) {
159 if (icon.center().x() <= windowScreen.center().x()) {
171 icon.moveTop(panelScreen.y() + panelScreen.height());
174 icon.moveTop(panelScreen.y() - icon.height());
177 icon.moveLeft(panelScreen.x() - icon.width());
180 icon.moveLeft(panelScreen.x() + panelScreen.width());
188 QRectF rect = iconScreen.intersected(icon);
193 if (rect.x() == iconScreen.x()) {
195 }
else if (rect.x() + rect.width() == iconScreen.x() + iconScreen.width()) {
197 }
else if (rect.y() == iconScreen.y()) {
210 float offset[2] = {0, 0};
211 float p_progress[2] = {0, 0};
214 lastQuad[0].setX(-1);
215 lastQuad[0].setY(-1);
216 lastQuad[1].setX(-1);
217 lastQuad[1].setY(-1);
218 lastQuad[2].setX(-1);
219 lastQuad[2].setY(-1);
221 if (position == Bottom) {
222 const float height_cube = float(geo.height()) * float(geo.height()) * float(geo.height());
223 const float maxY = icon.y() - geo.y();
227 if (quad[0].y() != lastQuad[0].y() || quad[2].y() != lastQuad[2].y()) {
228 quadFactor = quad[0].y() + (geo.height() - quad[0].y()) * progress;
229 offset[0] = (icon.y() + quad[0].y() - geo.y()) * progress * ((quadFactor * quadFactor * quadFactor) / height_cube);
230 quadFactor = quad[2].y() + (geo.height() - quad[2].y()) * progress;
231 offset[1] = (icon.y() + quad[2].y() - geo.y()) * progress * ((quadFactor * quadFactor * quadFactor) / height_cube);
232 p_progress[1] = std::min(offset[1] / (icon.y() - geo.y() -
float(quad[2].y())), 1.0f);
233 p_progress[0] = std::min(offset[0] / (icon.y() - geo.y() -
float(quad[0].y())), 1.0f);
238 p_progress[0] = std::abs(p_progress[0]);
239 p_progress[1] = std::abs(p_progress[1]);
242 quad[0].setX((icon.x() + icon.width() * (quad[0].x() / geo.width()) - (quad[0].x() + geo.x())) * p_progress[0] + quad[0].x());
243 quad[1].setX((icon.x() + icon.width() * (quad[1].x() / geo.width()) - (quad[1].x() + geo.x())) * p_progress[0] + quad[1].x());
244 quad[2].setX((icon.x() + icon.width() * (quad[2].x() / geo.width()) - (quad[2].x() + geo.x())) * p_progress[1] + quad[2].x());
245 quad[3].setX((icon.x() + icon.width() * (quad[3].x() / geo.width()) - (quad[3].x() + geo.x())) * p_progress[1] + quad[3].x());
247 quad[0].setY(std::min(maxY,
float(quad[0].y()) + offset[0]));
248 quad[1].setY(std::min(maxY,
float(quad[1].y()) + offset[0]));
249 quad[2].setY(std::min(maxY,
float(quad[2].y()) + offset[1]));
250 quad[3].setY(std::min(maxY,
float(quad[3].y()) + offset[1]));
252 }
else if (position == Top) {
253 const float height_cube = float(geo.height()) * float(geo.height()) * float(geo.height());
254 const float minY = icon.y() + icon.height() - geo.y();
258 if (quad[0].y() != lastQuad[0].y() || quad[2].y() != lastQuad[2].y()) {
259 quadFactor = geo.height() - quad[0].y() + (quad[0].y()) * progress;
260 offset[0] = (geo.y() - icon.height() + geo.height() + quad[0].y() - icon.y()) * progress * ((quadFactor * quadFactor * quadFactor) / height_cube);
261 quadFactor = geo.height() - quad[2].y() + (quad[2].y()) * progress;
262 offset[1] = (geo.y() - icon.height() + geo.height() + quad[2].y() - icon.y()) * progress * ((quadFactor * quadFactor * quadFactor) / height_cube);
263 p_progress[0] = std::min(offset[0] / (geo.y() - icon.height() + geo.height() - icon.y() -
float(geo.height() - quad[0].y())), 1.0f);
264 p_progress[1] = std::min(offset[1] / (geo.y() - icon.height() + geo.height() - icon.y() -
float(geo.height() - quad[2].y())), 1.0f);
269 offset[0] = -offset[0];
270 offset[1] = -offset[1];
272 p_progress[0] = std::abs(p_progress[0]);
273 p_progress[1] = std::abs(p_progress[1]);
276 quad[0].setX((icon.x() + icon.width() * (quad[0].x() / geo.width()) - (quad[0].x() + geo.x())) * p_progress[0] + quad[0].x());
277 quad[1].setX((icon.x() + icon.width() * (quad[1].x() / geo.width()) - (quad[1].x() + geo.x())) * p_progress[0] + quad[1].x());
278 quad[2].setX((icon.x() + icon.width() * (quad[2].x() / geo.width()) - (quad[2].x() + geo.x())) * p_progress[1] + quad[2].x());
279 quad[3].setX((icon.x() + icon.width() * (quad[3].x() / geo.width()) - (quad[3].x() + geo.x())) * p_progress[1] + quad[3].x());
281 quad[0].setY(std::max(minY,
float(quad[0].y()) + offset[0]));
282 quad[1].setY(std::max(minY,
float(quad[1].y()) + offset[0]));
283 quad[2].setY(std::max(minY,
float(quad[2].y()) + offset[1]));
284 quad[3].setY(std::max(minY,
float(quad[3].y()) + offset[1]));
286 }
else if (position == Left) {
287 const float width_cube = float(geo.width()) * float(geo.width()) * float(geo.width());
288 const float minX = icon.x() + icon.width() - geo.x();
292 if (quad[0].x() != lastQuad[0].x() || quad[1].x() != lastQuad[1].x()) {
293 quadFactor = geo.width() - quad[0].x() + (quad[0].x()) * progress;
294 offset[0] = (geo.x() - icon.width() + geo.width() + quad[0].x() - icon.x()) * progress * ((quadFactor * quadFactor * quadFactor) / width_cube);
295 quadFactor = geo.width() - quad[1].x() + (quad[1].x()) * progress;
296 offset[1] = (geo.x() - icon.width() + geo.width() + quad[1].x() - icon.x()) * progress * ((quadFactor * quadFactor * quadFactor) / width_cube);
297 p_progress[0] = std::min(offset[0] / (geo.x() - icon.width() + geo.width() - icon.x() -
float(geo.width() - quad[0].x())), 1.0f);
298 p_progress[1] = std::min(offset[1] / (geo.x() - icon.width() + geo.width() - icon.x() -
float(geo.width() - quad[1].x())), 1.0f);
303 offset[0] = -offset[0];
304 offset[1] = -offset[1];
306 p_progress[0] = std::abs(p_progress[0]);
307 p_progress[1] = std::abs(p_progress[1]);
310 quad[0].setY((icon.y() + icon.height() * (quad[0].y() / geo.height()) - (quad[0].y() + geo.y())) * p_progress[0] + quad[0].y());
311 quad[1].setY((icon.y() + icon.height() * (quad[1].y() / geo.height()) - (quad[1].y() + geo.y())) * p_progress[1] + quad[1].y());
312 quad[2].setY((icon.y() + icon.height() * (quad[2].y() / geo.height()) - (quad[2].y() + geo.y())) * p_progress[1] + quad[2].y());
313 quad[3].setY((icon.y() + icon.height() * (quad[3].y() / geo.height()) - (quad[3].y() + geo.y())) * p_progress[0] + quad[3].y());
315 quad[0].setX(std::max(minX,
float(quad[0].x()) + offset[0]));
316 quad[1].setX(std::max(minX,
float(quad[1].x()) + offset[1]));
317 quad[2].setX(std::max(minX,
float(quad[2].x()) + offset[1]));
318 quad[3].setX(std::max(minX,
float(quad[3].x()) + offset[0]));
320 }
else if (position == Right) {
321 const float width_cube = float(geo.width()) * float(geo.width()) * float(geo.width());
322 const float maxX = icon.x() - geo.x();
326 if (quad[0].x() != lastQuad[0].x() || quad[1].x() != lastQuad[1].x()) {
327 quadFactor = quad[0].x() + (geo.width() - quad[0].x()) * progress;
328 offset[0] = (icon.x() + quad[0].x() - geo.x()) * progress * ((quadFactor * quadFactor * quadFactor) / width_cube);
329 quadFactor = quad[1].x() + (geo.width() - quad[1].x()) * progress;
330 offset[1] = (icon.x() + quad[1].x() - geo.x()) * progress * ((quadFactor * quadFactor * quadFactor) / width_cube);
331 p_progress[0] = std::min(offset[0] / (icon.x() - geo.x() -
float(quad[0].x())), 1.0f);
332 p_progress[1] = std::min(offset[1] / (icon.x() - geo.x() -
float(quad[1].x())), 1.0f);
337 p_progress[0] = std::abs(p_progress[0]);
338 p_progress[1] = std::abs(p_progress[1]);
341 quad[0].setY((icon.y() + icon.height() * (quad[0].y() / geo.height()) - (quad[0].y() + geo.y())) * p_progress[0] + quad[0].y());
342 quad[1].setY((icon.y() + icon.height() * (quad[1].y() / geo.height()) - (quad[1].y() + geo.y())) * p_progress[1] + quad[1].y());
343 quad[2].setY((icon.y() + icon.height() * (quad[2].y() / geo.height()) - (quad[2].y() + geo.y())) * p_progress[1] + quad[2].y());
344 quad[3].setY((icon.y() + icon.height() * (quad[3].y() / geo.height()) - (quad[3].y() + geo.y())) * p_progress[0] + quad[3].y());
346 quad[0].setX(std::min(maxX,
float(quad[0].x()) + offset[0]));
347 quad[1].setX(std::min(maxX,
float(quad[1].x()) + offset[1]));
348 quad[2].setX(std::min(maxX,
float(quad[2].x()) + offset[1]));
349 quad[3].setX(std::min(maxX,
float(quad[3].x()) + offset[0]));