mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-4937] Viewer - Drag and Drop is not operable with keyboard alone (#5126)
* add keyboard event logic * tests * fix outline visibility
This commit is contained in:
committed by
Denys Vuika
parent
e0b1a3fe03
commit
8da16ea1a7
@@ -55,6 +55,7 @@ export class ImgViewerComponent implements OnInit, OnChanges, OnDestroy {
|
||||
scaleY: number = 1.0;
|
||||
offsetX: number = 0;
|
||||
offsetY: number = 0;
|
||||
step: number = 4;
|
||||
isDragged: boolean = false;
|
||||
|
||||
private drag = { x: 0, y: 0 };
|
||||
@@ -108,6 +109,27 @@ export class ImgViewerComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
onKeyDown(event: KeyboardEvent) {
|
||||
const scaleX = (this.scaleX !== 0 ? this.scaleX : 1.0);
|
||||
const scaleY = (this.scaleY !== 0 ? this.scaleY : 1.0);
|
||||
|
||||
if (event.key === 'ArrowDown') {
|
||||
this.offsetY += (this.step / scaleY);
|
||||
}
|
||||
|
||||
if (event.key === 'ArrowUp') {
|
||||
this.offsetY -= (this.step / scaleY);
|
||||
}
|
||||
|
||||
if (event.key === 'ArrowRight') {
|
||||
this.offsetX += (this.step / scaleX);
|
||||
}
|
||||
|
||||
if (event.key === 'ArrowLeft') {
|
||||
this.offsetX -= (this.step / scaleX);
|
||||
}
|
||||
}
|
||||
|
||||
onMouseDown(event: MouseEvent) {
|
||||
event.preventDefault();
|
||||
this.isDragged = true;
|
||||
|
Reference in New Issue
Block a user