From b3eba8bd14dd039b675f4733ea5f4842c19ab047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 12 Feb 2022 14:25:25 +0100 Subject: [PATCH] add original event to control events. --- src/component/internal/control.ts | 4 ++-- src/component/main.vue | 2 +- src/component/overlay.vue | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/component/internal/control.ts b/src/component/internal/control.ts index f9bde5d1..974ea6f0 100644 --- a/src/component/internal/control.ts +++ b/src/component/internal/control.ts @@ -8,8 +8,8 @@ import { NekoConnection } from './connection' import { Control } from '../types/state' export interface NekoControlEvents { - ['overlay.click']: () => void - ['overlay.contextmenu']: () => void + ['overlay.click']: (e: MouseEvent) => void + ['overlay.contextmenu']: (e: MouseEvent) => void } export class NekoControl extends EventEmitter { diff --git a/src/component/main.vue b/src/component/main.vue index d226eb80..de763a8d 100644 --- a/src/component/main.vue +++ b/src/component/main.vue @@ -34,7 +34,7 @@ @implicitControlRelease="control.release()" @updateKeyboardModifiers="updateKeyboardModifiers($event)" @uploadDrop="uploadDrop($event)" - @onAction="control.emit('overlay.' + $event)" + @onAction="control.emit('overlay.' + $event.action, $event.target)" /> diff --git a/src/component/overlay.vue b/src/component/overlay.vue index 69591a81..fe38d7a6 100644 --- a/src/component/overlay.vue +++ b/src/component/overlay.vue @@ -4,8 +4,8 @@ class="neko-overlay" tabindex="0" :style="{ cursor }" - @click.stop.prevent="$emit('onAction', 'click')" - @contextmenu.stop.prevent="$emit('onAction', 'contextmenu')" + @click.stop.prevent="$emit('onAction', { action: 'click', target: $event })" + @contextmenu.stop.prevent="$emit('onAction', { action: 'contextmenu', target: $event })" @wheel.stop.prevent="onWheel" @mousemove.stop.prevent="onMouseMove" @mousedown.stop.prevent="onMouseDown"