Misc Fixes and Changes (#927)
* Cleaned up a ton of warnings/suggestions from the IDE. * Fixed a bug when clearing the filters some presets could be undone. * Renamed a class in the OPDS spec * Simplified logic for when Fit To Screen rendering logic occurs. It now works always rather than only on cover images. * Give some additional info to the user on what the differences between Library Types are * Don't scan .qpkg folders (QNAP devices) * Refactored some code to enable ability to test CoverImage Test. This is a broken test, test.zip is waiting on an issue in NetVips. * Fixed an issue where Extra might get flagged as special too early, if in a word like Extraordinary * Cleaned up the regex for the extra issue to be more flexible
This commit is contained in:
parent
6afc17e93e
commit
fb71d54fe6
30 changed files with 162 additions and 361 deletions
|
|
@ -16,8 +16,10 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="library-type">Type</label>
|
||||
<select class="form-control" id="library-type" formControlName="type" [attr.disabled]="this.library">
|
||||
<label for="library-type">Type</label> <i class="fa fa-info-circle" placement="right" [ngbTooltip]="typeTooltip" role="button" tabindex="0"></i>
|
||||
<ng-template #typeTooltip>Library type determines how filenames are parsed and if the UI shows Chapters (Manga) vs Issues (Comics). Book work the same way as Manga but fall back to embedded data.</ng-template>
|
||||
<span class="sr-only" id="library-type-help">Library type determines how filenames are parsed and if the UI shows Chapters (Manga) vs Issues (Comics). Book work the same way as Manga but fall back to embedded data.</span>
|
||||
<select class="form-control" id="library-type" formControlName="type" [attr.disabled]="this.library" aria-describedby="library-type-help">
|
||||
<option [value]="i" *ngFor="let opt of libraryTypes; let i = index">{{opt}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -157,8 +157,6 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy {
|
|||
if (this.filterSettings === undefined) {
|
||||
this.filterSettings = new FilterSettings();
|
||||
}
|
||||
|
||||
this.setupGenreTypeahead();
|
||||
|
||||
this.libraryService.getLibrariesForMember().subscribe(libs => {
|
||||
this.libraries = libs.map(lib => {
|
||||
|
|
@ -168,15 +166,10 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy {
|
|||
selected: true,
|
||||
}
|
||||
});
|
||||
this.setupLibraryTypeahead();
|
||||
this.setupTypeaheads();
|
||||
});
|
||||
|
||||
this.setupCollectionTagTypeahead();
|
||||
this.setupPersonTypeahead();
|
||||
this.setupAgeRatingSettings();
|
||||
this.setupPublicationStatusSettings();
|
||||
this.setupTagSettings();
|
||||
this.setupLanguageSettings();
|
||||
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
|
@ -184,6 +177,17 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy {
|
|||
this.onDestory.complete();
|
||||
}
|
||||
|
||||
setupTypeaheads() {
|
||||
this.setupLibraryTypeahead();
|
||||
this.setupCollectionTagTypeahead();
|
||||
this.setupPersonTypeahead();
|
||||
this.setupAgeRatingSettings();
|
||||
this.setupPublicationStatusSettings();
|
||||
this.setupTagSettings();
|
||||
this.setupLanguageSettings();
|
||||
this.setupGenreTypeahead();
|
||||
}
|
||||
|
||||
|
||||
setupFormatTypeahead() {
|
||||
this.formatSettings.minCharacters = 0;
|
||||
|
|
@ -355,6 +359,7 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy {
|
|||
const f = filter.toLowerCase();
|
||||
return options.filter(m => m.title.toLowerCase() === f);
|
||||
}
|
||||
|
||||
if (this.filterSettings.presetCollectionId > 0) {
|
||||
this.collectionSettings.fetchFn('').subscribe(tags => {
|
||||
this.collectionSettings.savedData = tags.filter(item => item.value.id === this.filterSettings.presetCollectionId);
|
||||
|
|
@ -364,6 +369,17 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
applyPresets() {
|
||||
|
||||
// if (this.filterSettings.presetCollectionId > 0) {
|
||||
// this.collectionSettings.fetchFn('').subscribe(tags => {
|
||||
// this.collectionSettings.savedData = tags.filter(item => item.value.id === this.filterSettings.presetCollectionId);
|
||||
// this.filter.collectionTags = this.collectionSettings.savedData.map(item => item.value.id);
|
||||
// this.resetTypeaheads.next(true);
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
setupPersonTypeahead() {
|
||||
this.peopleSettings = {};
|
||||
|
||||
|
|
@ -579,6 +595,8 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy {
|
|||
this.readProgressGroup.get('inProgress')?.setValue(true);
|
||||
this.sortGroup.get('sortField')?.setValue(SortField.SortName);
|
||||
this.isAscendingSort = true;
|
||||
// Apply any presets
|
||||
this.setupTypeaheads();
|
||||
this.resetTypeaheads.next(true);
|
||||
|
||||
this.applyFilter.emit(this.filter);
|
||||
|
|
|
|||
|
|
@ -865,35 +865,35 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
}
|
||||
|
||||
// Fit Split on a page that needs splitting
|
||||
if (this.shouldRenderAsFitSplit()) {
|
||||
const windowWidth = window.innerWidth
|
||||
|| document.documentElement.clientWidth
|
||||
|| document.body.clientWidth;
|
||||
const windowHeight = window.innerHeight
|
||||
|| document.documentElement.clientHeight
|
||||
|| document.body.clientHeight;
|
||||
// If the user's screen is wider than the image, just pretend this is no split, as it will render nicer
|
||||
this.canvas.nativeElement.width = windowWidth;
|
||||
this.canvas.nativeElement.height = windowHeight;
|
||||
const ratio = this.canvasImage.width / this.canvasImage.height;
|
||||
let newWidth = windowWidth;
|
||||
let newHeight = newWidth / ratio;
|
||||
if (newHeight > windowHeight) {
|
||||
newHeight = windowHeight;
|
||||
newWidth = newHeight * ratio;
|
||||
}
|
||||
|
||||
// Optimization: When the screen is larger than newWidth, allow no split rendering to occur for a better fit
|
||||
if (windowWidth > newWidth) {
|
||||
this.setCanvasSize();
|
||||
this.ctx.drawImage(this.canvasImage, 0, 0);
|
||||
} else {
|
||||
this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
|
||||
this.ctx.drawImage(this.canvasImage, 0, 0, newWidth, newHeight);
|
||||
}
|
||||
} else {
|
||||
if (!this.shouldRenderAsFitSplit()) {
|
||||
this.ctx.drawImage(this.canvasImage, 0, 0);
|
||||
}
|
||||
|
||||
const windowWidth = window.innerWidth
|
||||
|| document.documentElement.clientWidth
|
||||
|| document.body.clientWidth;
|
||||
const windowHeight = window.innerHeight
|
||||
|| document.documentElement.clientHeight
|
||||
|| document.body.clientHeight;
|
||||
// If the user's screen is wider than the image, just pretend this is no split, as it will render nicer
|
||||
this.canvas.nativeElement.width = windowWidth;
|
||||
this.canvas.nativeElement.height = windowHeight;
|
||||
const ratio = this.canvasImage.width / this.canvasImage.height;
|
||||
let newWidth = windowWidth;
|
||||
let newHeight = newWidth / ratio;
|
||||
if (newHeight > windowHeight) {
|
||||
newHeight = windowHeight;
|
||||
newWidth = newHeight * ratio;
|
||||
}
|
||||
|
||||
// Optimization: When the screen is larger than newWidth, allow no split rendering to occur for a better fit
|
||||
if (windowWidth > newWidth) {
|
||||
this.setCanvasSize();
|
||||
this.ctx.drawImage(this.canvasImage, 0, 0);
|
||||
} else {
|
||||
this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
|
||||
this.ctx.drawImage(this.canvasImage, 0, 0, newWidth, newHeight);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset scroll on non HEIGHT Fits
|
||||
|
|
@ -936,7 +936,9 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
|
||||
|
||||
shouldRenderAsFitSplit() {
|
||||
if (!this.isCoverImage() || parseInt(this.generalSettingsForm?.get('pageSplitOption')?.value, 10) !== PageSplitOption.FitSplit) return false;
|
||||
// Some pages aren't cover images but might need fit split renderings
|
||||
if (parseInt(this.generalSettingsForm?.get('pageSplitOption')?.value, 10) !== PageSplitOption.FitSplit) return false;
|
||||
//if (!this.isCoverImage() || parseInt(this.generalSettingsForm?.get('pageSplitOption')?.value, 10) !== PageSplitOption.FitSplit) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue