Coder Social home page Coder Social logo

Comments (3)

Silvertower avatar Silvertower commented on July 17, 2024

I am working to implement this as a pull request, though I do not understand enough about Tactical Grid to know how to test the functionality. It is easy enough to merge and adjust the code from the DnD5e module and see that the events are firing. @Aedif Can you describe a scenario where this could be used from Token Action HUD and how I might test it? Also, which UI elements would be useful for firing the hover events; 'action', 'feat', 'item', and 'spell' seem obvious choices. Perhaps 'elementalBlast', 'familiarAttack' and 'strike' as well? Thank you.

from fvtt-token-action-hud-pf2e.

Aedif avatar Aedif commented on July 17, 2024

What Tactical Grid does is highlight the range of an item if it has one.

All I need from these hover events is the instance or reference to an Item on mouseover, and for mouseleave it would suffice that it just fires.

Tactical Grid would be calling the following method on mouseover:

TacticalGrid.rangeHighlight(token, { item });

and this on mouseleave:

TacticalGrid.clearRangeHighlight(token);

With the hooks provided by the DnD5e version the module currently does this:

  // Get the token the Action HUD has been opened for
  let token;
  Hooks.on('renderTokenActionHud', (hud, html, opts) => {
    if (!itemRangeHighlightEnabled()) {
      token = null;
      return;
    }
    token = hud.token;
  });

  // Highlight Item range if it has one
  Hooks.on('tokenActionHudSystemActionHoverOn', (event, item) => {
    if (token) TacticalGrid.rangeHighlight(token, { item });
  });

  // Clear range highlight
  Hooks.on('tokenActionHudSystemActionHoverOff', (event, item) => {
    if (token) TacticalGrid.clearRangeHighlight(token);
  });

I'd be nice to have these hooks fire for any item that could conceivably have a range. Tactical Grid's support is not completel for PF2e yet, but I will be improving it, so it'd be nice if some future proofing was in place and you registered these hooks for items with ranges even if TG is not currently showing them.

from fvtt-token-action-hud-pf2e.

Larkinabout avatar Larkinabout commented on July 17, 2024

Added in 1.5.5.

from fvtt-token-action-hud-pf2e.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.