Skip to content

Commit

Permalink
Hotkey and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxxer committed Jan 30, 2022
1 parent 98b8e45 commit cb6a626
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ Like what we've done? Buy us a coffee!

This module allows you to put unique tags on objects in scenes and use Tagger's powerful API to quickly retrieve them.

## Supported Modules

- [Token Attacher](https://foundryvtt.com/packages/token-attacher/) - If you have tag rules (like `{#}`) on attached objects, they will get applied when the prefab is first created, even on nested attached objects
- [Monks Active Tile Triggers](https://foundryvtt.com/packages/monks-active-tiles) - This module also integrates Tagger to be able to select objects in the scene in its actions, and similarly to above, tag rules are evaluated when an active tile is created, either manually or through Token Attacher!

## Download

`https://github.com/fantasycalendar/FoundryVTT-Tagger/releases/latest/download/module.json`
Expand Down
24 changes: 11 additions & 13 deletions scripts/hotkeys.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import CONSTANTS from "./constants.js";

export const hotkeyState = {
ctrlDown: false,
altDown: false,
shiftDown: false
dropNoRules: false,
}

function isVersion9() {
Expand All @@ -15,17 +13,17 @@ export function registerHotkeysPre() {
if (isVersion9()) {

game.keybindings.register(CONSTANTS.MODULE_NAME, "do-not-apply-tag-rules", {
name: "Force drop one item",
uneditable: [
{ key: "AltLeft" },
name: "Don't apply tag rules on drop",
editable: [
{ key: "ControlLeft" },
],
onDown: () => {
hotkeyState.altDown = true;
hotkeyState.dropNoRules = true;
},
onUp: () => {
hotkeyState.altDown = false;
hotkeyState.dropNoRules = false;
},
reservedModifiers: ["SHIFT", "CONTROL"]
precedence: CONST.KEYBINDING_PRECEDENCE.PRIORITY
});

}
Expand All @@ -38,16 +36,16 @@ export function registerHotkeysPost() {

window.addEventListener("keydown", (event) => {
switch(event.code){
case "AltLeft":
hotkeyState.altDown = true;
case "ControlLeft":
hotkeyState.dropNoRules = true;
break;
}
});

window.addEventListener("keyup", (event) => {
switch(event.code){
case "AltLeft":
hotkeyState.altDown = false;
case "ControlLeft":
hotkeyState.dropNoRules = false;
break;
}
});
Expand Down
3 changes: 2 additions & 1 deletion scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ class TaggerHandler {
}

static preCreateApplyTags(inDocument){
if(hotkeyState.altDown) return;
console.log(hotkeyState)
if(hotkeyState.dropNoRules) return;
let documentData = inDocument.data.toObject()
temporaryIds = {};
this.applyCreateTags(documentData);
Expand Down

0 comments on commit cb6a626

Please sign in to comment.