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

large thumbs were being cropped a touch #980

Merged
merged 1 commit into from
Sep 15, 2020
Merged
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
17 changes: 10 additions & 7 deletions www/js/EventCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3389,27 +3389,30 @@ angular.module('zmApp.controllers')
}
var ld = NVR.getLogin();
var landscape = ($rootScope.devWidth > $rootScope.devHeight) ? true:false;
var maxRowHeight;
var maxThumbHeight;
var maxThumbWidth;

if (ld.eventViewThumbsSize == 'large') {
maxRowHeight = Math.min(0.7* $rootScope.devHeight, 450);
maxThumbHeight = Math.min(0.7* $rootScope.devHeight, 450);
maxThumbWidth = Math.min(0.95* $rootScope.devWidth, $rootScope.devWidth - 44);
if (landscape) {
// go till 90% of width in large landscape, but restricted to useable row height
return calculateAspectRatioFit(mw, mh, 0.95* $rootScope.devWidth, maxRowHeight);
return calculateAspectRatioFit(mw, mh, maxThumbWidth, maxThumbHeight);
} else {
// go till 80% of width in large portrait, but restricted to useable row height

return calculateAspectRatioFit(mw, mh, 0.95* $rootScope.devWidth, maxRowHeight);
return calculateAspectRatioFit(mw, mh, maxThumbWidth, maxThumbHeight);
}

} else { // small
maxRowHeight = 250;
maxThumbHeight = 250;
maxThumbWidth = 0.5* $rootScope.devWidth;
if (landscape) {
// go till 50% of width in small landscape, but restricted to useable row height
return calculateAspectRatioFit(mw, mh, 0.5* $rootScope.devWidth, maxRowHeight);
return calculateAspectRatioFit(mw, mh, maxThumbWidth, maxThumbHeight);
} else {
// go till 30% of width in small portrait, but restricted to useable row height
return calculateAspectRatioFit(mw, mh, 0.5* $rootScope.devWidth, maxRowHeight);
return calculateAspectRatioFit(mw, mh, maxThumbWidth, maxThumbHeight);
}

}
Expand Down
3 changes: 2 additions & 1 deletion www/templates/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
<div class="col events-list-text">
<!-- data -->
<!-- for largeThumbs show image in this column -->
<div ng-if="loginData.eventViewThumbs!='none' && thumbClass=='large'" width="100%" style="padding: 5px;">
<div ng-if="loginData.eventViewThumbs!='none' && thumbClass=='large'" width="100%"
style="padding-top: 5px; padding-bottom: 5px; margin-left: -5px; margin-right: -5px;">
<img bg-color="#6C7A89" ng-src="{{constructThumbnail(event)}}"
on-tap="closeIfOpen(event);openModalWithSnapshot(event)" width="{{event.Event.thumbWidth}}px"
height="{{event.Event.thumbHeight}}px" fallback-src="img/noimage.png"
Expand Down