mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: don't recreate picture thumbnails on zoom / scroll
The picture thumbnails were recreated on every profile render, even when zooming / scrolling. In that case, we should only change the positions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
71629521b7
commit
51be326879
2 changed files with 11 additions and 1 deletions
|
@ -218,7 +218,12 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, int flags)
|
|||
repositionDiveHandlers();
|
||||
plannerModel->deleteTemporaryPlan();
|
||||
}
|
||||
plotPicturesInternal(d, flags & RenderFlags::Instant);
|
||||
|
||||
// On zoom / pan don't recreate the picture thumbnails, only change their position.
|
||||
if (flags & RenderFlags::DontRecalculatePlotInfo)
|
||||
updateThumbnails();
|
||||
else
|
||||
plotPicturesInternal(d, flags & RenderFlags::Instant);
|
||||
|
||||
toolTipItem->refresh(d, mapToScene(mapFromGlobal(QCursor::pos())), currentState == PLAN);
|
||||
#endif
|
||||
|
@ -1195,7 +1200,11 @@ void ProfileWidget2::plotPicturesInternal(const struct dive *d, bool synchronous
|
|||
// Sort pictures by timestamp (and filename if equal timestamps).
|
||||
// This will allow for proper location of the pictures on the profile plot.
|
||||
std::sort(pictures.begin(), pictures.end());
|
||||
updateThumbnails();
|
||||
}
|
||||
|
||||
void ProfileWidget2::updateThumbnails()
|
||||
{
|
||||
// Calculate thumbnail positions. First the x-coordinates and and then the y-coordinates.
|
||||
for (PictureEntry &e: pictures)
|
||||
updateThumbnailXPos(e);
|
||||
|
|
|
@ -126,6 +126,7 @@ private:
|
|||
void addActionShortcut(const Qt::Key shortcut, void (ProfileWidget2::*slot)());
|
||||
void clearPictures();
|
||||
void plotPicturesInternal(const struct dive *d, bool synchronous);
|
||||
void updateThumbnails();
|
||||
void addDivemodeSwitch(int seconds, int divemode);
|
||||
void addBookmark(int seconds);
|
||||
void splitDive(int seconds);
|
||||
|
|
Loading…
Add table
Reference in a new issue