From 95711f4af78e41424a9e42144dc51de7a0c93948 Mon Sep 17 00:00:00 2001 From: Timon Lukas Date: Sun, 1 Aug 2021 21:49:12 +0200 Subject: [PATCH] Add "click-and-drag-to-buy" feature to upgrades --- js/components.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/components.js b/js/components.js index 8ba3b75..d952b19 100644 --- a/js/components.js +++ b/js/components.js @@ -172,7 +172,7 @@ function loadVue() { Vue.component('upgrade', { props: ['layer', 'data'], template: ` - - ` + `, + methods: { + handleMouseEvent(event) { + // event.buttons is a bitmask, 0b1 is primary mouse button (usually left) + if (event.buttons & 1) { + buyUpg(this.layer, this.data) + } + } + } }) Vue.component('milestones', {