Fix right and middle mouse click macro actions which were exchanged. Fixes #794.

This commit is contained in:
László Monda
2018-09-27 00:35:13 +02:00
parent 425f861451
commit 8afdeac306
4 changed files with 21 additions and 12 deletions

View File

@@ -3,9 +3,9 @@ import { UhkBuffer } from '../../uhk-buffer';
import { MacroAction, MacroActionId, MacroMouseSubAction, macroActionType } from './macro-action'; import { MacroAction, MacroActionId, MacroMouseSubAction, macroActionType } from './macro-action';
export enum MouseButtons { export enum MouseButtons {
Left = 1 << 0, Left = 0,
Middle = 1 << 1, Right = 1,
Right = 1 << 2 Middle = 2
} }
export interface JsObjectMouseButtonMacroAction { export interface JsObjectMouseButtonMacroAction {

View File

@@ -93,10 +93,17 @@
<h4 *ngIf="activeTab === TabName.Hold">Hold mouse button</h4> <h4 *ngIf="activeTab === TabName.Hold">Hold mouse button</h4>
<h4 *ngIf="activeTab === TabName.Release">Release mouse button</h4> <h4 *ngIf="activeTab === TabName.Release">Release mouse button</h4>
<div class="btn-group"> <div class="btn-group">
<button *ngFor="let buttonLabel of buttonLabels; let buttonIndex = index" <button class="btn btn-default"
class="btn btn-default" [class.btn-primary]="hasButton(MouseButtons.Left)"
[class.btn-primary]="hasButton(buttonIndex)" (click)="setMouseClick(MouseButtons.Left)">Left
(click)="setMouseClick(buttonIndex)">{{buttonLabel}} </button>
<button class="btn btn-default"
[class.btn-primary]="hasButton(MouseButtons.Middle)"
(click)="setMouseClick(MouseButtons.Middle)">Middle
</button>
<button class="btn btn-default"
[class.btn-primary]="hasButton(MouseButtons.Right)"
(click)="setMouseClick(MouseButtons.Right)">Right
</button> </button>
</div> </div>
</div> </div>

View File

@@ -1,10 +1,11 @@
import { Component, Input, OnInit, ViewChild } from '@angular/core'; import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { import {
MacroMouseSubAction,
MouseButtons,
MouseButtonMacroAction, MouseButtonMacroAction,
MoveMouseMacroAction, MoveMouseMacroAction,
ScrollMouseMacroAction, ScrollMouseMacroAction
MacroMouseSubAction
} from 'uhk-common'; } from 'uhk-common';
import { Tab } from '../../../../popover/tab'; import { Tab } from '../../../../popover/tab';
import { MacroBaseComponent } from '../macro-base.component'; import { MacroBaseComponent } from '../macro-base.component';
@@ -33,6 +34,7 @@ export class MacroMouseTabComponent extends MacroBaseComponent implements OnInit
@ViewChild('tab') selectedTab: Tab; @ViewChild('tab') selectedTab: Tab;
/* tslint:disable:variable-name: It is an enum type. So it can start with uppercase. */ /* tslint:disable:variable-name: It is an enum type. So it can start with uppercase. */
MouseButtons = MouseButtons;
TabName = TabName; TabName = TabName;
/* tslint:enable:variable-name */ /* tslint:enable:variable-name */
activeTab: TabName; activeTab: TabName;

View File

@@ -5,6 +5,7 @@ import {
KeyMacroAction, KeyMacroAction,
KeyModifiers, KeyModifiers,
MacroAction, MacroAction,
MouseButtons,
MouseButtonMacroAction, MouseButtonMacroAction,
MoveMouseMacroAction, MoveMouseMacroAction,
ScrollMouseMacroAction, ScrollMouseMacroAction,
@@ -197,12 +198,11 @@ export class MacroItemComponent implements OnInit, OnChanges {
this.title = 'Release mouse button: '; this.title = 'Release mouse button: ';
} }
const buttonLabels: string[] = ['Left', 'Middle', 'Right'];
const selectedButtons: boolean[] = action.getMouseButtons(); const selectedButtons: boolean[] = action.getMouseButtons();
const selectedButtonLabels: string[] = []; const selectedButtonLabels: string[] = [];
selectedButtons.forEach((isSelected, idx) => { selectedButtons.forEach((isSelected, idx) => {
if (isSelected && buttonLabels[idx]) { if (isSelected && MouseButtons[idx]) {
selectedButtonLabels.push(buttonLabels[idx]); selectedButtonLabels.push(MouseButtons[idx]);
} }
}); });
this.title += selectedButtonLabels.join(', '); this.title += selectedButtonLabels.join(', ');