Press this key along with mouse movement/scrolling to accelerate/decelerate the speed of the action.
You can set the multiplier in the settings.
diff --git a/src/components/popover/tab/mouse/mouse-tab.component.ts b/src/components/popover/tab/mouse/mouse-tab.component.ts
index 8c57b796..05db35a2 100644
--- a/src/components/popover/tab/mouse/mouse-tab.component.ts
+++ b/src/components/popover/tab/mouse/mouse-tab.component.ts
@@ -1,4 +1,4 @@
-import { Component, Input, OnChanges } from '@angular/core';
+import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
import { KeyAction, MouseAction, MouseActionParam } from '../../../../config-serializer/config-items/key-action';
import { Tab } from '../tab';
@@ -8,7 +8,7 @@ import { Tab } from '../tab';
template: require('./mouse-tab.component.html'),
styles: [require('./mouse-tab.component.scss')]
})
-export class MouseTabComponent implements OnChanges, Tab {
+export class MouseTabComponent extends Tab implements OnChanges {
@Input() defaultKeyAction: KeyAction;
private mouseActionParam: MouseActionParam;
@@ -21,12 +21,14 @@ export class MouseTabComponent implements OnChanges, Tab {
private pages: string[];
constructor() {
+ super();
this.selectedPageIndex = 0;
this.pages = ['Move', 'Scroll', 'Click', 'Speed'];
}
ngOnChanges() {
this.fromKeyAction(this.defaultKeyAction);
+ this.validAction.emit(this.keyActionValid());
}
keyActionValid(): boolean {
@@ -37,12 +39,14 @@ export class MouseTabComponent implements OnChanges, Tab {
if (!(keyAction instanceof MouseAction)) {
return false;
}
+
let mouseAction: MouseAction =
keyAction;
this.mouseActionParam = mouseAction.mouseAction;
if (mouseAction.mouseAction === MouseActionParam.moveUp) {
this.selectedPageIndex = 0;
}
+
switch (mouseAction.mouseAction) {
case MouseActionParam.moveDown:
case MouseActionParam.moveUp:
@@ -68,13 +72,11 @@ export class MouseTabComponent implements OnChanges, Tab {
default:
return false;
}
+
return true;
}
toKeyAction(): MouseAction {
- if (!this.keyActionValid()) {
- throw new Error('KeyAction is not valid. No selected mouse action!');
- }
let mouseAction: MouseAction = new MouseAction();
mouseAction.mouseAction = this.mouseActionParam;
return mouseAction;
@@ -85,12 +87,14 @@ export class MouseTabComponent implements OnChanges, Tab {
console.error(`Invalid index error: ${index}`);
return;
}
+
this.selectedPageIndex = index;
this.mouseActionParam = undefined;
+ this.validAction.emit(false);
}
setMouseActionParam(mouseActionParam: MouseActionParam) {
this.mouseActionParam = mouseActionParam;
+ this.validAction.emit(true);
}
-
}
diff --git a/src/components/popover/tab/none/none-tab.component.ts b/src/components/popover/tab/none/none-tab.component.ts
index e6270727..55105afb 100644
--- a/src/components/popover/tab/none/none-tab.component.ts
+++ b/src/components/popover/tab/none/none-tab.component.ts
@@ -1,4 +1,4 @@
-import { Component } from '@angular/core';
+import { Component, EventEmitter, OnChanges, Output } from '@angular/core';
import { Tab } from '../tab';
@@ -7,7 +7,11 @@ import { Tab } from '../tab';
template: require('./none-tab.component.html'),
styles: [require('./none-tab.component.scss')]
})
-export class NoneTabComponent implements Tab {
+export class NoneTabComponent extends Tab implements OnChanges {
+ ngOnChanges(event: any) {
+ this.validAction.emit(true);
+ }
+
keyActionValid(): boolean {
return true;
}
diff --git a/src/components/popover/tab/tab.ts b/src/components/popover/tab/tab.ts
index c73470d2..9e75d544 100644
--- a/src/components/popover/tab/tab.ts
+++ b/src/components/popover/tab/tab.ts
@@ -1,7 +1,11 @@
+import { EventEmitter, Output } from '@angular/core';
+
import { KeyAction } from '../../../config-serializer/config-items/key-action';
-export interface Tab {
- keyActionValid(): boolean;
- fromKeyAction(keyAction: KeyAction): boolean;
- toKeyAction(): KeyAction;
+export abstract class Tab {
+ @Output() validAction = new EventEmitter();
+
+ abstract keyActionValid(): boolean;
+ abstract fromKeyAction(keyAction: KeyAction): boolean;
+ abstract toKeyAction(): KeyAction;
}