Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

Commit

Permalink
Misc fixes (#311)
Browse files Browse the repository at this point in the history
* Fix photo.toggleStar to update the parent album

* Hide the rotation buttons for non-editable albums
  • Loading branch information
kamil4 authored Aug 11, 2022
1 parent 142b71b commit aa5bb70
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
4 changes: 2 additions & 2 deletions scripts/main/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,11 @@ header.setMode = function (mode) {
}

if (album.isUploadable()) {
const e = $("#button_trash, #button_move, #button_visibility, #button_star");
const e = $("#button_trash, #button_move, #button_visibility, #button_star, #button_rotate_cwise, #button_rotate_ccwise");
e.show();
tabindex.makeFocusable(e);
} else {
const e = $("#button_trash, #button_move, #button_visibility, #button_star");
const e = $("#button_trash, #button_move, #button_visibility, #button_star, #button_rotate_cwise, #button_rotate_ccwise");
e.hide();
tabindex.makeUnfocusable(e);
}
Expand Down
6 changes: 5 additions & 1 deletion scripts/main/photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ photo.load = function (photoID, albumID, autoplay) {
// TODO: Why do we overwrite the true album ID of a photo, by the externally provided one? I guess we need it, because the album which the user came from might also be a smart album or a tag album. However, in this case I would prefer to leave the `album_id untouched (don't rename it to `original_album_id`) and call this one `effective_album_id` instead.
photo.json.album_id = albumID;

if (!visible.photo()) view.photo.show();
view.photo.show();
view.photo.init(autoplay);
lychee.imageview.show();

Expand Down Expand Up @@ -521,6 +521,10 @@ photo.setAlbum = function (photoIDs, albumID) {
photo.toggleStar = function () {
photo.json.is_starred = !photo.json.is_starred;
view.photo.star();

album.getByID(photo.json.id).is_starred = photo.json.is_starred;
view.album.content.star(photo.json.id);

albums.refresh();

api.post("Photo::setStar", {
Expand Down
48 changes: 24 additions & 24 deletions scripts/main/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,31 +707,33 @@ view.photo = {
lychee.content.addClass("view");
header.setMode("photo");

// Make body not scrollable
// use bodyScrollLock package to enable locking on iOS
// Simple overflow: hidden not working on iOS Safari
// Only the info pane needs scrolling
// Touch event for swiping of photo still work

scrollLock.disablePageScroll($(".sidebar__wrapper").get());

// Fullscreen
let timeout = null;
$(document).bind("mousemove", function () {
clearTimeout(timeout);
// For live Photos: header animation only if LivePhoto is not playing
if (!photo.isLivePhotoPlaying() && lychee.header_auto_hide) {
header.show();
timeout = setTimeout(header.hideIfLivePhotoNotPlaying, 2500);
if (!visible.photo()) {
// Make body not scrollable
// use bodyScrollLock package to enable locking on iOS
// Simple overflow: hidden not working on iOS Safari
// Only the info pane needs scrolling
// Touch event for swiping of photo still work

scrollLock.disablePageScroll($(".sidebar__wrapper").get());

// Fullscreen
let timeout = null;
$(document).bind("mousemove", function () {
clearTimeout(timeout);
// For live Photos: header animation only if LivePhoto is not playing
if (!photo.isLivePhotoPlaying() && lychee.header_auto_hide) {
header.show();
timeout = setTimeout(header.hideIfLivePhotoNotPlaying, 2500);
}
});

// we also put this timeout to enable it by default when you directly click on a picture.
if (lychee.header_auto_hide) {
setTimeout(header.hideIfLivePhotoNotPlaying, 2500);
}
});

// we also put this timeout to enable it by default when you directly click on a picture.
if (lychee.header_auto_hide) {
setTimeout(header.hideIfLivePhotoNotPlaying, 2500);
lychee.animate(lychee.imageview, "fadeIn");
}

lychee.animate(lychee.imageview, "fadeIn");
},

/**
Expand Down Expand Up @@ -970,8 +972,6 @@ view.photo = {
(photo.json.live_photo_url !== "" && photo.json.live_photo_url !== null)
) {
$("#button_rotate_cwise, #button_rotate_ccwise").hide();
} else {
$("#button_rotate_cwise, #button_rotate_ccwise").show();
}
},

Expand Down

0 comments on commit aa5bb70

Please sign in to comment.