Last Shakeout (#1342)

* Fixed a bug where series estimate reading time could be calculated before we restore esisting time.

* Cleaned up debug code for the reader

* Fixed an issue where pagination areas on wide images wasn't proper height

* Fixed a pagination height calc

* Small change
This commit is contained in:
Joseph Milazzo 2022-06-30 12:41:43 -05:00 committed by GitHub
parent 2786c21d12
commit 041cd22c8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 37 deletions

View File

@ -219,11 +219,11 @@ public class WordCountAnalyzerService : IWordCountAnalyzerService
} }
if (series.WordCount == 0 && series.WordCount != 0) series.WordCount = existingWordCount; // Restore original word count if the file hasn't changed
var seriesEstimate = _readerService.GetTimeEstimate(series.WordCount, series.Pages, isEpub); var seriesEstimate = _readerService.GetTimeEstimate(series.WordCount, series.Pages, isEpub);
series.MinHoursToRead = seriesEstimate.MinHours; series.MinHoursToRead = seriesEstimate.MinHours;
series.MaxHoursToRead = seriesEstimate.MaxHours; series.MaxHoursToRead = seriesEstimate.MaxHours;
series.AvgHoursToRead = seriesEstimate.AvgHours; series.AvgHoursToRead = seriesEstimate.AvgHours;
if (series.WordCount == 0) series.WordCount = existingWordCount; // Restore original word count if the file hasn't changed
_unitOfWork.SeriesRepository.Update(series); _unitOfWork.SeriesRepository.Update(series);
} }

View File

@ -13,9 +13,6 @@
</div> </div>
</div> </div>
{{readerService.imageUrlToPageNum(this.canvasImage.src)}}
{{readerService.imageUrlToPageNum(this.canvasImage2.src)}}
<div style="margin-left: auto; padding-right: 3%;"> <div style="margin-left: auto; padding-right: 3%;">
<button class="btn btn-icon btn-small" title="Shortcuts" (click)="openShortcutModal()"> <button class="btn btn-icon btn-small" title="Shortcuts" (click)="openShortcutModal()">
<i class="fa-regular fa-rectangle-list" aria-hidden="true"></i> <i class="fa-regular fa-rectangle-list" aria-hidden="true"></i>
@ -46,7 +43,8 @@
<div class="pagination-area"> <div class="pagination-area">
<!-- Pagination controls and screen hints--> <!-- Pagination controls and screen hints-->
<div class="{{readerMode === ReaderMode.LeftRight ? 'left' : 'top'}} {{clickOverlayClass('left')}}" (click)="handlePageChange($event, 'left')" [ngStyle]="{'height': (readerMode === ReaderMode.LeftRight ? ImageHeight: '25%')}"> <div class="{{readerMode === ReaderMode.LeftRight ? 'left' : 'top'}} {{clickOverlayClass('left')}}" (click)="handlePageChange($event, 'left')"
[ngStyle]="{'height': (readerMode === ReaderMode.LeftRight ? ImageHeight: '25%')}">
<div *ngIf="showClickOverlay"> <div *ngIf="showClickOverlay">
<i class="fa fa-angle-{{readingDirection === ReadingDirection.RightToLeft ? 'double-' : ''}}{{readerMode === ReaderMode.LeftRight ? 'left' : 'up'}}" <i class="fa fa-angle-{{readingDirection === ReadingDirection.RightToLeft ? 'double-' : ''}}{{readerMode === ReaderMode.LeftRight ? 'left' : 'up'}}"
title="Previous Page" aria-hidden="true"></i> title="Previous Page" aria-hidden="true"></i>

View File

@ -373,8 +373,8 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
} }
get ImageHeight() { get ImageHeight() {
// If we are a cover image and implied fit to screen, then we need to take screen height rather than image height // If we are a wide image and implied fit to screen, then we need to take screen height rather than image height
if (this.isCoverImage() || this.FittingOption === FITTING_OPTION.WIDTH) { if (this.isWideImage() || this.FittingOption === FITTING_OPTION.WIDTH) {
return this.WindowHeight; return this.WindowHeight;
} }
return this.image?.nativeElement.height + 'px'; return this.image?.nativeElement.height + 'px';
@ -995,12 +995,6 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
const notInSplit = this.currentImageSplitPart !== (this.isSplitLeftToRight() ? SPLIT_PAGE_PART.LEFT_PART : SPLIT_PAGE_PART.RIGHT_PART); const notInSplit = this.currentImageSplitPart !== (this.isSplitLeftToRight() ? SPLIT_PAGE_PART.LEFT_PART : SPLIT_PAGE_PART.RIGHT_PART);
// console.log('Current, Next: ', this.readerService.imageUrlToPageNum(this.canvasImage.src), ',', this.readerService.imageUrlToPageNum(this.canvasImageNext.src));
// console.log('Is canvasImage wide: ', this.isWideImage(this.canvasImage));
// console.log('Is canvasImage next wide: ', this.isWideImage(this.canvasImageNext));
// console.log('PRev: ', this.readerService.imageUrlToPageNum(this.canvasImagePrev.src));
let pageAmount = 1; let pageAmount = 1;
if (this.layoutMode === LayoutMode.Double) { if (this.layoutMode === LayoutMode.Double) {
pageAmount = ( pageAmount = (
@ -1012,7 +1006,6 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
? 2 : 1); ? 2 : 1);
} else if (this.layoutMode === LayoutMode.DoubleReversed) { } else if (this.layoutMode === LayoutMode.DoubleReversed) {
pageAmount = ( pageAmount = (
//!this.isCoverImage(this.pageNum - 1) && //
!this.isWideImage(this.canvasImageNext) && !this.isWideImage(this.canvasImageNext) &&
!this.isWideImage(this.canvasImageAheadBy2) && // Remember we are doing this logic before we've hit the next page, so we need this !this.isWideImage(this.canvasImageAheadBy2) && // Remember we are doing this logic before we've hit the next page, so we need this
!this.isSecondLastImage() && !this.isSecondLastImage() &&
@ -1054,23 +1047,12 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
let pageAmount = 1; let pageAmount = 1;
if (this.layoutMode === LayoutMode.Double) { if (this.layoutMode === LayoutMode.Double) {
// Current is current and next is current + 1 (current is the page we are paging from)
// console.log('Current, Next: ', this.readerService.imageUrlToPageNum(this.canvasImage.src), ',', this.readerService.imageUrlToPageNum(this.canvasImageNext.src));
// console.log('Is canvasImage wide: ', this.isWideImage(this.canvasImage));
// console.log('Is canvasImage next wide: ', this.isWideImage(this.canvasImageNext));
// console.log('PRev: ', this.readerService.imageUrlToPageNum(this.canvasImagePrev.src)); // Prev is actually currentPage - 1 on double
pageAmount = ( pageAmount = (
!this.isCoverImage() && !this.isCoverImage() &&
!this.isWideImage(this.canvasImagePrev) !this.isWideImage(this.canvasImagePrev)
? 2 : 1); ? 2 : 1);
} }
if (this.layoutMode === LayoutMode.DoubleReversed) { if (this.layoutMode === LayoutMode.DoubleReversed) {
// Current is current - 1 and next is current -2 (current is the page we are paging from)
// console.log('Current, Next: ', this.readerService.imageUrlToPageNum(this.canvasImage.src), ',', this.readerService.imageUrlToPageNum(this.canvasImageNext.src));
// console.log('Is canvasImage wide: ', this.isWideImage(this.canvasImage));
// console.log('Is canvasImage next wide: ', this.isWideImage(this.canvasImageNext));
// console.log('PRev: ', this.readerService.imageUrlToPageNum(this.canvasImagePrev.src)); // Prev is actually currentPage + 1 on double reversed
pageAmount = ( pageAmount = (
!this.isCoverImage() && !this.isCoverImage() &&
!this.isCoverImage(this.pageNum - 1) && !this.isCoverImage(this.pageNum - 1) &&
@ -1318,8 +1300,6 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
index += 1; index += 1;
} }
}, this.cachedImages.size() - 3); }, this.cachedImages.size() - 3);
//console.log('cachedImages: ', this.cachedImages.arr.map(img => this.readerService.imageUrlToPageNum(img.src) + ': ' + img.complete));
} }
@ -1349,16 +1329,6 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.canvasImage2.src = this.canvasImagePrev.src; this.canvasImage2.src = this.canvasImagePrev.src;
} }
} }
// console.log('======================================================');
// console.log('Page History: ', this.pageDimensionHistory);
// console.log('Current Page: ', this.pageNum);
// console.log('CanvasImage page: ', this.readerService.imageUrlToPageNum(this.canvasImage.src));
// console.log('CanvasImage2 page: ', this.readerService.imageUrlToPageNum(this.canvasImage2.src));
// console.log('Canvas Image Next:', this.readerService.imageUrlToPageNum(this.canvasImageNext.src));
// console.log('Canvas Image Next Ahead by 2:', this.readerService.imageUrlToPageNum(this.canvasImageAheadBy2.src));
// console.log('Canvas Image Prev:', this.readerService.imageUrlToPageNum(this.canvasImagePrev.src));
// console.log('======================================================');
} }
this.renderPage(); this.renderPage();
this.prefetch(); this.prefetch();