From f7a9f8c97560610ea5a9f987895e5f28ab42870e Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Thu, 19 Dec 2024 12:53:58 -0500 Subject: [PATCH] Make sure to account for extra param in click handlers Previously if the user clicked the Accept button it would pass the command datum into the event handler as the second param, instead of the 'nextMode'. Event handlers in d3 are passed (event, datum, ...) so we need to account for both params even though we don't use the bound datum in this case. --- modules/ui/UiRapidInspector.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/ui/UiRapidInspector.js b/modules/ui/UiRapidInspector.js index bbdb3eb1f..bbba829c7 100644 --- a/modules/ui/UiRapidInspector.js +++ b/modules/ui/UiRapidInspector.js @@ -61,8 +61,8 @@ export class UiRapidInspector { this._setupKeybinding = this._setupKeybinding.bind(this); // accept and enter one of these modes: - this.moveFeature = (e) => this.acceptFeature(e, 'move'); - this.rotateFeature = (e) => this.acceptFeature(e, 'rotate'); + this.moveFeature = (e, d) => this.acceptFeature(e, d, 'move'); + this.rotateFeature = (e, d) => this.acceptFeature(e, d, 'rotate'); // Setup event handlers const l10n = context.systems.l10n; @@ -159,9 +159,10 @@ export class UiRapidInspector { * acceptFeature * Called when the user presses Add Feature. * @param {Event} e? - triggering event (if any) + * @param {Object} d? - object bound to the selection (i.e. the command) (not used) * @param {string} nextMode? - optional next mode to enter after accepting ('move' or 'rotate') */ - acceptFeature(e, nextMode) { + acceptFeature(e, d, nextMode) { const datum = this.datum; if (!datum) return; @@ -253,6 +254,7 @@ export class UiRapidInspector { * ignoreFeature * Called when the user presses "Ignore Feature". * @param {Event} e? - triggering event (if any) + * @param {Object} d? - object bound to the selection (i.e. the command) (not used) */ ignoreFeature(e) { const datum = this.datum;