diff --git a/.stylelintrc.json b/.stylelintrc.json index 3e1a34b2..7827a4f2 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -26,7 +26,7 @@ "unit-case": "lower", "unit-no-unknown": true, - "unit-whitelist": ["px", "%", "deg", "ms", "em", "rem", "vh", "vv", "s"], + "unit-whitelist": ["px", "%", "deg", "ms", "em", "rem", "vh", "vv", "s", "ch"], "value-list-comma-space-after": "always-single-line", "value-list-comma-space-before": "never", diff --git a/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.html b/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.html index f76baccb..0d0d32b7 100644 --- a/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.html +++ b/packages/uhk-web/src/app/components/keymap/header/keymap-header.component.html @@ -7,6 +7,7 @@ type="text" (change)="editKeymapName($event.target.value)" (keyup.enter)="name.blur()" + (keyup)="calculateHeaderTextWidth($event.target.value)" /> keymap (
-

Enter delay in seconds

+

Delay

-
- +
+
+ + +
-
Choose a preset
- +
Choose a preset
+
diff --git a/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.scss b/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.scss index 91c61376..49725d48 100644 --- a/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.scss +++ b/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.scss @@ -14,3 +14,12 @@ } } } + +.form-group { + margin-bottom: 0; +} + +.form-control { + width: 16ch; + display: inline-block; +} diff --git a/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.ts b/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.ts index 560a39ec..60d5de48 100644 --- a/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.ts +++ b/packages/uhk-web/src/app/components/macro/action-editor/tab/delay/macro-delay.component.ts @@ -23,9 +23,19 @@ export class MacroDelayTabComponent extends MacroBaseComponent implements OnInit @Input() macroAction: DelayMacroAction; @ViewChild('macroDelayInput') input: ElementRef; - delay: number; presets: number[] = [0.3, 0.5, 0.8, 1, 2, 3, 4, 5]; + get delay(): number { + return this._delay; + } + + set delay(value: number) { + this._delay = value; + this.validate(); + } + + private _delay: number; + constructor() { super(); } ngOnInit() { @@ -33,12 +43,11 @@ export class MacroDelayTabComponent extends MacroBaseComponent implements OnInit this.macroAction = new DelayMacroAction(); } this.delay = this.macroAction.delay > 0 ? this.macroAction.delay / 1000 : INITIAL_DELAY; - this.validate(); // initial validation as it has defaults } setDelay(value: number): void { - this.delay = value; - this.macroAction.delay = this.delay * 1000; + this._delay = value; + this.macroAction.delay = this._delay * 1000; this.validate(); } diff --git a/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.html b/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.html index a497f01c..f8f3b1b5 100644 --- a/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.html +++ b/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.html @@ -36,29 +36,55 @@

Move pointer

-

Use negative values to move down or left from current position.

- - pixels + + pixels
- - pixels + + pixels

Scroll

-

Use negative values to move down or left from current position.

- - pixels + + pixels
- - pixels + + pixels
@@ -66,11 +92,12 @@

Click mouse button

Hold mouse button

Release mouse button

-
+
+ (click)="setMouseClick(buttonIndex)">{{buttonLabel}} +
diff --git a/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.scss b/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.scss index 50596da0..c8ce1f3f 100644 --- a/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.scss +++ b/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.scss @@ -15,11 +15,6 @@ padding-left: 3rem; padding-bottom: 1rem; } - - &__buttons { - margin-top: 3rem; - margin-bottom: 1rem; - } } .fa { @@ -38,6 +33,6 @@ .form-control { display: inline-block; - width: 60%; + width: 10ch; } } diff --git a/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.ts b/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.ts index 3a8f31f9..1835c19a 100644 --- a/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.ts +++ b/packages/uhk-web/src/app/components/macro/action-editor/tab/mouse/macro-mouse.component.ts @@ -26,7 +26,7 @@ enum TabName { '../../macro-action-editor.component.scss', './macro-mouse.component.scss' ], - host: { 'class': 'macro__mouse' } + host: {'class': 'macro__mouse'} }) export class MacroMouseTabComponent extends MacroBaseComponent implements OnInit { @Input() macroAction: MouseMacroAction; @@ -130,14 +130,14 @@ export class MacroMouseTabComponent extends MacroBaseComponent implements OnInit switch (this.macroAction.constructor) { case MoveMouseMacroAction: case ScrollMouseMacroAction: - const { x, y } = this.macroAction as MoveMouseMacroAction; - return x !== undefined && x !== null && y !== undefined && y !== null; + const {x, y} = this.macroAction as MoveMouseMacroAction; + return x !== undefined && x !== null && y !== undefined && y !== null && + (x !== 0 || y !== 0) && x < 10000 && x > -10000 && y < 10000 && y > -10000; case MouseButtonMacroAction: - const { mouseButtonsMask } = this.macroAction as MouseButtonMacroAction; + const {mouseButtonsMask} = this.macroAction as MouseButtonMacroAction; return !!mouseButtonsMask; default: return true; } - } - + }; } diff --git a/packages/uhk-web/src/app/components/macro/action-editor/tab/text/macro-text.component.html b/packages/uhk-web/src/app/components/macro/action-editor/tab/text/macro-text.component.html index e503708d..7f771ba0 100644 --- a/packages/uhk-web/src/app/components/macro/action-editor/tab/text/macro-text.component.html +++ b/packages/uhk-web/src/app/components/macro/action-editor/tab/text/macro-text.component.html @@ -1,6 +1,5 @@

Type text

-

Input the text you want to type with this macro action.

diff --git a/packages/uhk-web/src/app/components/macro/header/macro-header.component.html b/packages/uhk-web/src/app/components/macro/header/macro-header.component.html index cd8b4274..f5887df0 100644 --- a/packages/uhk-web/src/app/components/macro/header/macro-header.component.html +++ b/packages/uhk-web/src/app/components/macro/header/macro-header.component.html @@ -7,7 +7,7 @@ type="text" (change)="editMacroName($event.target.value)" (keyup.enter)="macroName.blur()" - /> + (keyup)="calculateHeaderTextWidth($event.target.value)">