Skip to content

Commit

Permalink
Make sure to account for extra param in click handlers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bhousel committed Dec 19, 2024
1 parent 7b630c9 commit f7a9f8c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/ui/UiRapidInspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f7a9f8c

Please sign in to comment.