David-Zvekic / DragTransfer

module for Foundry VTT - enable moving (rather than cloning) inventory between actors by dragging.
2 stars 4 forks source link

Multiple alt key names #9

Closed playest closed 2 years ago

playest commented 2 years ago

Change the way the isAlt check is done to support "AltLeft". Also use "downKeys" instead of "_downKeys" because it will be deprecated in v10.

It was:

  const alt = new Set(["Alt"]);
  return (isSuperset(alt,game.keyboard._downKeys) && isSuperset(game.keyboard._downKeys,alt));

which because of the checking with isSuperset in both "directions" would match when just the "alt" key was pressed (which was intended). But it also makes more complex introducing new names for alt keys, like "AltLeft".

It was changed to:

   const alts = new Set(["Alt", "AltLeft"]);
   return (game.keyboard.downKeys.size == 1 && game.keyboard.downKeys.intersects(alts));

which as far as I know has the same behavior of working only when just "alt" is pressed (because we check for length == 1) but let us define "other" alt keys.

For the switch from _downKeys to downKeys it was according to this warning message in the browser console: "Deprecated in favor of `downKeys`. Will be removed in V10."

David-Zvekic commented 2 years ago

I implemented v 0.9 compatibility a different way