Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the definition of CanvasLayer#name to always provide the root class name for a certain layer type as the immediate child of layerOptions.baseClass #8921

Closed
1 of 6 tasks
stwlam opened this issue Feb 21, 2023 · 0 comments
Assignees
Labels
api Issues related to the API used by Mod Devs bug Functionality which is not working as intended canvas Issues related to the PIXI canvas, rendering, and other WebGL functions.

Comments

@stwlam
Copy link

stwlam commented Feb 21, 2023

Implemented Feature

Each CanvasLayer subclass now returns a .name which can be treated as "canonical" for that layer as intended by the original design. Example usages:

canvas.tokens.name;  // TokenLayer

class TokenLayer2 extends TokenLayer {}
const tl2 = new TokenLayer2();
tl2.name; // TokenLayer

Original Request

What happened?

  /**
   * The canonical name of the CanvasLayer
   * @type {string}
   */
  get name() {
    return this.constructor.name;
  }

That it is called a "canonical" name suggests the getter was intended to be more than just a shortcut to somelayer.constructor.name. Some module authors have been surprised to learn that that is what they're actually getting.

What ways of accessing Foundry can you encounter this issue in?

  • Native App (Electron)
  • Chrome
  • Firefox
  • Safari
  • Other

Reproduction Steps

Call canvas.tokens.name in a system that registers a subclass for that layer.

What core version are you reporting this for?

10.291

Relevant log output

No response

Bug Checklist

  • The issue occurs while all Modules are disabled
@stwlam stwlam added the bug Functionality which is not working as intended label Feb 21, 2023
@aaclayton aaclayton added api Issues related to the API used by Mod Devs canvas Issues related to the PIXI canvas, rendering, and other WebGL functions. labels Feb 22, 2023
@aaclayton aaclayton self-assigned this Mar 22, 2023
@aaclayton aaclayton changed the title CanvasLayer returns a constructor name as the "canonical" name for a given layer Improve the definition of CanvasLayer#name to always provide the root class name for a certain layer type as the immediate child of layerOptions.baseClass Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues related to the API used by Mod Devs bug Functionality which is not working as intended canvas Issues related to the PIXI canvas, rendering, and other WebGL functions.
Projects
Status: Done
Development

No branches or pull requests

2 participants