MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / setPosition

Method setPosition

Telegram/SourceFiles/ui/widgets/multi_select.cpp:288–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288void Item::setPosition(int x, int y, int outerWidth, int maxVisiblePadding) {
289 if (_x >= 0 && _y >= 0 && (_x != x || _y != y)) {
290 // Make an animation if it is not the first setPosition().
291 auto found = false;
292 auto leftHidden = -_width - maxVisiblePadding;
293 auto rightHidden = outerWidth + maxVisiblePadding;
294 for (auto i = _copies.begin(), e = _copies.end(); i != e;) {
295 if (i->x.animating()) {
296 if (i->y == y) {
297 i->x.start(_updateCallback, i->toX, x, _st.duration);
298 found = true;
299 } else {
300 i->x.start(
301 _updateCallback,
302 i->fromX,
303 (i->toX > i->fromX) ? rightHidden : leftHidden,
304 _st.duration);
305 }
306 ++i;
307 } else {
308 i = _copies.erase(i);
309 e = _copies.end();
310 }
311 }
312 if (_copies.empty()) {
313 if (_y == y) {
314 auto copy = SlideAnimation(
315 _updateCallback,
316 _x,
317 x,
318 _y,
319 _st.duration);
320 _copies.push_back(std::move(copy));
321 } else {
322 auto copyHiding = SlideAnimation(
323 _updateCallback,
324 _x,
325 (y > _y) ? rightHidden : leftHidden,
326 _y,
327 _st.duration);
328 _copies.push_back(std::move(copyHiding));
329 auto copyShowing = SlideAnimation(
330 _updateCallback,
331 (y > _y) ? leftHidden : rightHidden,
332 x,
333 y,
334 _st.duration);
335 _copies.push_back(std::move(copyShowing));
336 }
337 } else if (!found) {
338 auto copy = SlideAnimation(
339 _updateCallback,
340 (y > _y) ? leftHidden : rightHidden,
341 x,
342 y,
343 _st.duration);
344 _copies.push_back(std::move(copy));
345 }

Callers 15

applyToMethod · 0.45
setReplaceCallbackMethod · 0.45
updateGeometryMethod · 0.45
AddMiniStarsFunction · 0.45
SetupBioFunction · 0.45
ReplaceEmojiFunction · 0.45
ComputeMetricsFunction · 0.45
renderContentMethod · 0.45
computeItemsGeometryMethod · 0.45
sendTextAsFileMethod · 0.45

Calls 7

SlideAnimationClass · 0.70
beginMethod · 0.45
endMethod · 0.45
animatingMethod · 0.45
startMethod · 0.45
eraseMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected