Skip to content

[Bug]: setTokenImage and Freesize #5908

@Jmr3366

Description

@Jmr3366

Describe the Bug

setTokenImage can break the token footprint.
If I set a token as freesize, size the token the way I want. If I change the image of the token, overwrites my manual setting and changes the footprint to match the image size.

If you change a token to freesize, it should retain the size it was initially set at and not change the token footprint based off the image size.

To Reproduce

Open a new campaign.
Make sure the default preferences for object, is Start Freesize is checked.
Drag a token to the object layer and size the token.
Use setTokenImage to change the tokens images to a smaller image.
The token foot print conform to the image, and break the token footprint away from you set it at.

Expected Behaviour

Token footprints should never dynamically change without specific instruction from someone. setTokenHeight, setTokenWidth, mouse-down drag the sizer, token properties panel, etc should be the only viable methods to change the token footprint.

Screenshots

setTokenImage-ObjectLayer.mp4

MapTool Info

1.15.x - current (likely always been this way)

Desktop

Win 11

Additional Context

These lines (1282-1283) in token.java seem to be the root cause of the issue I described above:

public void setImageAsset(String name, MD5Key assetId) 
{
    imageAssetMap.put(name, assetId);
    BufferedImage image = ImageManager.getImageAndWait(assetId);
    setWidth(image.getWidth(null));
    setHeight(image.getHeight(null));
  }

In my simple testing, removing these resolved the issue and may resolve this one too:2195

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions