ctrl+click will select the book cover (#1133)
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
<div class="book-card"
|
<div class="book-card"
|
||||||
[class.selected]="isSelected"
|
[class.selected]="isSelected"
|
||||||
(mouseover)="isHovered = true"
|
(mouseover)="isHovered = true"
|
||||||
(mouseout)="isHovered = false">
|
(mouseout)="isHovered = false"
|
||||||
|
(click)="onCardClick($event)">
|
||||||
|
|
||||||
<div class="cover-container" [ngClass]="{ 'shimmer': !isImageLoaded, 'center-info-btn': readButtonHidden }">
|
<div class="cover-container" [ngClass]="{ 'shimmer': !isImageLoaded, 'center-info-btn': readButtonHidden }">
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -698,21 +698,38 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.lastMouseEvent = event;
|
this.lastMouseEvent = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleSelection(event: CheckboxChangeEvent): void {
|
onCardClick(event: MouseEvent): void {
|
||||||
if (this.isCheckboxEnabled) {
|
if (!event.ctrlKey) {
|
||||||
this.isSelected = event.checked;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.toggleCardSelection(!this.isSelected)
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleCardSelection(selected: boolean):void {
|
||||||
|
if (!this.isCheckboxEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isSelected = selected;
|
||||||
const shiftKey = this.lastMouseEvent?.shiftKey ?? false;
|
const shiftKey = this.lastMouseEvent?.shiftKey ?? false;
|
||||||
|
|
||||||
this.checkboxClick.emit({
|
this.checkboxClick.emit({
|
||||||
index: this.index,
|
index: this.index,
|
||||||
bookId: this.book.id,
|
bookId: this.book.id,
|
||||||
selected: event.checked,
|
selected: selected,
|
||||||
shiftKey: shiftKey,
|
shiftKey: shiftKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.onBookSelect) {
|
if (this.onBookSelect) {
|
||||||
this.onBookSelect(this.book.id, event.checked);
|
this.onBookSelect(this.book.id, selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lastMouseEvent = null;
|
this.lastMouseEvent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleSelection(event: CheckboxChangeEvent): void {
|
||||||
|
this.toggleCardSelection(event.checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user