-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix imprecise-detected token's identity being revealed by the combat …
…tracker
- Loading branch information
1 parent
4da15e9
commit 1fd2deb
Showing
3 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
"email": "[email protected]" | ||
} | ||
], | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"compatibility": { | ||
"minimum": "12", | ||
"verified": "12" | ||
|
@@ -60,8 +60,8 @@ | |
}, | ||
"url": "https://github.com/dev7355608/vision-5e", | ||
"manifest": "https://github.com/dev7355608/vision-5e/releases/latest/download/module.json", | ||
"download": "https://github.com/dev7355608/vision-5e/releases/download/v2.3.2/module.zip", | ||
"changelog": "https://github.com/dev7355608/vision-5e/releases/tag/v2.3.2", | ||
"download": "https://github.com/dev7355608/vision-5e/releases/download/v2.3.3/module.zip", | ||
"changelog": "https://github.com/dev7355608/vision-5e/releases/tag/v2.3.3", | ||
"bugs": "https://github.com/dev7355608/vision-5e/issues", | ||
"readme": "https://raw.githubusercontent.com/dev7355608/vision-5e/main/README.md", | ||
"license": "https://raw.githubusercontent.com/dev7355608/vision-5e/main/LICENSE" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { DETECTION_LEVELS } from "./const.mjs"; | ||
|
||
export default (CombatTracker) => class extends CombatTracker { | ||
|
||
/** @override */ | ||
_onCombatantHoverIn(event) { | ||
event.preventDefault(); | ||
|
||
if (!canvas.ready) { | ||
return; | ||
} | ||
|
||
const li = event.currentTarget; | ||
const combatant = this.viewed.combatants.get(li.dataset.combatantId); | ||
const token = combatant.token?.object; | ||
|
||
if (token?.detectionLevel === DETECTION_LEVELS.PRECISE) { | ||
if (!token.controlled) { | ||
token._onHoverIn(event, { hoverOutOthers: true }); | ||
} | ||
|
||
this._highlighted = token; | ||
} | ||
} | ||
|
||
/** @override */ | ||
hoverCombatant(combatant, hover) { | ||
const token = combatant.token.object; | ||
|
||
if (token.detectionLevel !== DETECTION_LEVELS.PRECISE) { | ||
hover = false; | ||
} | ||
|
||
const trackers = [this.element[0]]; | ||
|
||
if (this._popout) { | ||
trackers.push(this._popout.element[0]); | ||
} | ||
|
||
for (const tracker of trackers) { | ||
const li = tracker.querySelector(`.combatant[data-combatant-id="${combatant.id}"]`); | ||
|
||
if (!li) { | ||
continue; | ||
} | ||
|
||
if (hover) { | ||
li.classList.add("hover"); | ||
} else { | ||
li.classList.remove("hover"); | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters