Skip to content

Commit 6965d02

Browse files
committed
Fix handle icon and thumbnail scroll loading for mobile layout
1 parent 34fabdf commit 6965d02

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

css/app.css

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,14 +551,22 @@ span.sp-thumb-el {
551551
.collapse-left, .collapse-right {
552552
position: absolute;
553553
left: 5px;
554-
bottom: -5px;
554+
bottom: -9px;
555555
cursor: pointer;
556-
width: 15px;
557-
height: 15px;
556+
width: 17px;
557+
height: 17px;
558+
border-radius: 5px;
559+
background: url('images/expand.png') no-repeat scroll center center #fff;
560+
background-size: 100%;
558561
}
559562
.collapse-right {
563+
bottom: -2px;
560564
background: url('images/expand.png') no-repeat scroll center center #fff;
561565
}
566+
/* rotate the V down arrow to point up */
567+
.arrowsUp {
568+
transform: rotate(180deg);
569+
}
562570
}
563571

564572
.viewer {
@@ -650,6 +658,7 @@ span.sp-thumb-el {
650658
width: 80px;
651659
height: 80px;
652660
margin: 5px;
661+
flex: auto 0 0;
653662
}
654663
thumbnail-slider img {
655664
margin: 0;

src/app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ <h4 class="modal-title">Confirmation</h4>
6363
</thumbnail-slider>
6464

6565
<div class="col-splitter left-split">
66-
<div class="collapse-left"></div>
66+
<div class="collapse-left arrowsUp"></div>
6767
</div>
6868

6969
<div class="frame col-xs-12"

src/app/thumbnail-slider.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,14 +410,19 @@ export default class ThumbnailSlider extends EventSubscriber {
410410
* @memberof ThumbnailSlider
411411
*/
412412
loadVisibleThumbnails(scrollTop, init = false, refresh = false) {
413+
const panel = document.querySelector('.thumbnail-scroll-panel');
413414
if (scrollTop === undefined) {
414-
const panel = document.querySelector('.thumbnail-scroll-panel');
415-
if (panel)
416-
scrollTop = panel.scrollTop;
415+
if (panel) {
416+
scrollTop = panel.scrollTop;
417+
}
417418
}
419+
// handle horizontal scrolling (mobile layout) or vertical scrolling (desktop layout)
420+
let slider_width = document.querySelector('.thumbnail-scroll-panel').clientWidth;
421+
let sliderSize = Math.max(slider_width, this.slider_height);
422+
let scrollStart = Math.max(scrollTop, panel.scrollLeft);
418423

419-
let thumb_start_index = parseInt(scrollTop / this.thumbnail_size);
420-
let thumb_end_index = parseInt((scrollTop + this.slider_height) / this.thumbnail_size);
424+
let thumb_start_index = parseInt(scrollStart / this.thumbnail_size);
425+
let thumb_end_index = parseInt((scrollStart + sliderSize) / this.thumbnail_size);
421426

422427
let unloaded = [];
423428
for (var idx=thumb_start_index; idx<=thumb_end_index; idx++){

src/utils/ui.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export default class Ui {
123123
static collapseSidePanel(eventbus, leftSplit) {
124124

125125
let el = leftSplit ? $('.thumbnail-panel') : $('.right-hand-panel');
126+
let handle = leftSplit ? $('.collapse-left') : $('.collapse-right');
126127

127128
let width = parseInt(el.css('--panelWidth'));
128129
let height = parseInt(el.css('--panelHeight'));
@@ -141,6 +142,14 @@ export default class Ui {
141142
// update css - the appropriate width/height var will be used depending on layout
142143
el.css('--panelHeight', newHeight + "px");
143144
el.css('--panelWidth', newWidth + "px");
145+
// class used to set the collapse-handle icon
146+
if (leftSplit) {
147+
if (newHeight > 0) {handle.addClass("arrowsUp");}
148+
else {handle.removeClass("arrowsUp");}
149+
} else {
150+
if (newHeight == 0) {handle.addClass("arrowsUp");}
151+
else {handle.removeClass("arrowsUp");}
152+
}
144153
eventbus.publish(IMAGE_VIEWER_RESIZE, {config_id: -1});
145154
}
146155

0 commit comments

Comments
 (0)