Skip to content
This repository

slideshow: allow moving between pictures when not zoomed enough #1373

Merged
merged 1 commit into from over 1 year ago

2 participants

Sascha Montellese jmarshallnz
Sascha Montellese
Collaborator

On request of @cptspiff I looked into http://trac.xbmc.org/ticket/10144 as I recently did some work on zooming/rotating in the slideshow implementation. Currently swipe left/right only works to change between pictures if the current picture is not zoomed. But often you can zoom a picture a bit without making it's width bigger than the screen width so you are still left with black bars on the left and right side of the picture. If you then try to swipe left/right it will most likely move the picture a bit up or down (because the swipe was not perfectly horizontal) but it stays on the same picture. With these changes it is possible to change between pictures using swipe left/right as long as there are black bars left/right of the picture so even if the picture is a bit zoomed.

jmarshallnz

Looks good to me.

Sascha Montellese Montellese merged commit dfaed24 into from September 06, 2012
Sascha Montellese Montellese closed this September 06, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Sep 05, 2012
Sascha Montellese slideshow: allow moving between pictures when not zoomed enough (clos…
…es #10144)
266f4d8
This page is out of date. Refresh to see the latest.
17  xbmc/pictures/GUIWindowSlideShow.cpp
@@ -222,6 +222,9 @@ void CGUIWindowSlideShow::ShowNext()
222 222
     m_iNextSlide = 0;
223 223
 
224 224
   m_iDirection   = 1;
  225
+  m_iZoomFactor  = 1;
  226
+  m_fZoom        = 1.0f;
  227
+  m_fRotate      = 0.0f;
225 228
   m_bLoadNextPic = true;
226 229
 }
227 230
 
@@ -233,7 +236,11 @@ void CGUIWindowSlideShow::ShowPrevious()
233 236
   m_iNextSlide = m_iCurrentSlide - 1;
234 237
   if (m_iNextSlide < 0)
235 238
     m_iNextSlide = m_slides->Size() - 1;
  239
+
236 240
   m_iDirection   = -1;
  241
+  m_iZoomFactor  = 1;
  242
+  m_fZoom        = 1.0f;
  243
+  m_fRotate      = 0.0f;
237 244
   m_bLoadNextPic = true;
238 245
 }
239 246
 
@@ -480,7 +487,8 @@ void CGUIWindowSlideShow::Process(unsigned int currentTime, CDirtyRegionList &re
480 487
     m_iCurrentSlide = m_iNextSlide;
481 488
     m_iNextSlide    = GetNextSlide();
482 489
 
483  
-//    m_iZoomFactor = 1;
  490
+    m_iZoomFactor = 1;
  491
+    m_fZoom = 1.0f;
484 492
     m_fRotate = 0.0f;
485 493
   }
486 494
 
@@ -531,7 +539,7 @@ EVENT_RESULT CGUIWindowSlideShow::OnMouseEvent(const CPoint &point, const CMouse
531 539
   }
532 540
   else if (event.m_id == ACTION_GESTURE_PAN)
533 541
   { // on zoomlevel 1 just detect swipe left and right
534  
-    if (m_iZoomFactor == 1)
  542
+    if (m_iZoomFactor == 1 || !m_Image[m_iCurrentPic].m_bCanMoveHorizontally)
535 543
     {
536 544
       if (m_firstGesturePoint.x > 0 && fabs(point.x - m_firstGesturePoint.x) > 100)
537 545
       {
@@ -616,14 +624,14 @@ bool CGUIWindowSlideShow::OnAction(const CAction &action)
616 624
     break;
617 625
 
618 626
   case ACTION_MOVE_RIGHT:
619  
-    if (m_iZoomFactor == 1)
  627
+    if (m_iZoomFactor == 1 || !m_Image[m_iCurrentPic].m_bCanMoveHorizontally)
620 628
       ShowNext();
621 629
     else
622 630
       Move(PICTURE_MOVE_AMOUNT, 0);
623 631
     break;
624 632
 
625 633
   case ACTION_MOVE_LEFT:
626  
-    if (m_iZoomFactor == 1)
  634
+    if (m_iZoomFactor == 1 || !m_Image[m_iCurrentPic].m_bCanMoveHorizontally)
627 635
       ShowPrevious();
628 636
     else
629 637
       Move( -PICTURE_MOVE_AMOUNT, 0);
@@ -919,7 +927,6 @@ void CGUIWindowSlideShow::OnLoadPic(int iPic, int iSlideNumber, CBaseTexture* pT
919 927
       else
920 928
         m_Image[iPic].SetTexture(iSlideNumber, pTexture, CSlideShowPic::EFFECT_NO_TIMEOUT);
921 929
       m_Image[iPic].SetOriginalSize(iOriginalWidth, iOriginalHeight, bFullSize);
922  
-      m_Image[iPic].Zoom(m_fZoom, true);
923 930
 
924 931
       m_Image[iPic].m_bIsComic = false;
925 932
       if (URIUtils::IsInRAR(m_slides->Get(m_iCurrentSlide)->GetPath()) || URIUtils::IsInZIP(m_slides->Get(m_iCurrentSlide)->GetPath())) // move to top for cbr/cbz
1  xbmc/pictures/SlideShowPicture.cpp
@@ -439,6 +439,7 @@ void CSlideShowPic::Process(unsigned int currentTime, CDirtyRegionList &dirtyreg
439 439
     }
440 440
     float w = maxx - minx;
441 441
     float h = maxy - miny;
  442
+    m_bCanMoveHorizontally = (w >= fScreenWidth);
442 443
     if (w >= fScreenWidth)
443 444
     { // must have no black bars
444 445
       if (minx + m_fZoomLeft*w > fOffsetX)
1  xbmc/pictures/SlideShowPicture.h
@@ -79,6 +79,7 @@ class CSlideShowPic
79 79
   float GetZoom() const { return m_fZoomAmount;};
80 80
 
81 81
   bool m_bIsComic;
  82
+  bool m_bCanMoveHorizontally;
82 83
 private:
83 84
   void UpdateVertices(float cur_x[4], float cur_y[4], const float new_x[4], const float new_y[4], CDirtyRegionList &dirtyregions);
84 85
   void Render(float *x, float *y, CBaseTexture* pTexture, color_t color);
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.