Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added arrows to scroll between images #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const ImageService = ($mdDialog, $timeout) => {
vm.keyDown = keyDown;
vm.nextImage = nextImage;
vm.prevImage = prevImage;
vm.activate_scroll = params.activate_scroll

init();
$timeout(() => { vm.loaded = true; }, 150);
Expand Down
24 changes: 24 additions & 0 deletions src/components/image/image.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@
opacity: .75;
}

.dialog__next_img {
position: absolute;
width: 70px;
height: 70px;
top: 50%;
right: 0;
margin: 0;
margin-top: -35px;
padding: 15px;
opacity: .75;
}

.dialog__prev_img {
position: absolute;
width: 70px;
height: 70px;
top: 50%;
left: 0;
margin: 0;
margin-top: -35px;
padding: 15px;
opacity: .75;
}

.dialog__image-container {
position: relative;
background: black;
Expand Down
12 changes: 9 additions & 3 deletions src/components/image/image.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
layout="row" layout-align="center center"
ng-swipe-right="nextImage()"
ng-swipe-left="prevImage()">
<md-button class="md-icon-button dialog__close" ng-click="close()">
<md-icon>close</md-icon>
</md-button>
<md-button class="md-icon-button dialog__close" ng-click="close()">
<md-icon>close</md-icon>
</md-button>
<md-button ng-if="activate_scroll && " class="md-icon-button dialog__next_img" ng-click="nextImage()">
<md-icon>skip_next</md-icon>
</md-button>
<md-button ng-if="activate_scroll" class="md-icon-button dialog__prev_img" ng-click="prevImage()">
<md-icon>skip_previous</md-icon>
</md-button>
<img load-src="{{ image.thumburlbig }}">
</div>
<div class="dialog__image-description"
Expand Down
4 changes: 2 additions & 2 deletions src/components/main/monument/monument.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h3 class="md-headline">Saving</h3>
layout="row"
layout-align="center center"
ng-repeat="image in $ctrl.image"
ng-click="$ctrl.openImage(image, $event)"
ng-click="$ctrl.openImage(image, $event,false)"
>
<img load-src="{{image.thumburl}}" />
</a>
Expand Down Expand Up @@ -359,7 +359,7 @@ <h4 class="monument__subtitle md-headline muted">
<div class="monument__images" ng-if="$ctrl.images && $ctrl.images.length">
<a
ng-repeat="image in $ctrl.images"
ng-click="$ctrl.openImage(image, $event)"
ng-click="$ctrl.openImage(image, $event,$ctrl.images.length>1)"
>
<img class="image" ng-src="{{image.thumburl}}" />
</a>
Expand Down
3 changes: 2 additions & 1 deletion src/components/main/monument/monument.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,12 @@ ${getCategory()}
});
}

function openImage(image, event) {
function openImage(image, event,activate_scroll) {
imageService.openImage({
image,
event,
list: vm.images,
activate_scroll:activate_scroll,
});
}

Expand Down