Kruptein / PlanarAlly

A companion tool for when you travel into the planes.
https://www.planarally.io/
MIT License
392 stars 71 forks source link

feat(LocationSettings): Add drop ratio to grid settings #1347

Closed Kruptein closed 6 months ago

Kruptein commented 6 months ago

[This performs a database migration]

This is a new feature that at the same time also is a bugfix. It adds a new setting to the location grid setting.

context: PA has an option to auto scale assets when dropped if they have a specific format in their name. For example goblin_1x1 should in normal circumstances fit exactly 1 grid cell, dragon_3x3 should be resized to 3 by 3 grid cells.

The existing implementation was erroneously using a method to do this based on the common 5ft system to automatically adjust this when a location had a bigger size (e.g. 10ft maps would automatically make something_2x2 fit in 1 cell)

This however completely breaks for everything that does not use the 5ft system, be it because you use SI units or because your system uses something custom or you enjoy defining your sizes in terms of pizzas.

The simple fix is to disable that system, but then dropping assets on maps that have a different scale no longer works properly. So to address that as well, a new setting is added that defines how these assets should be scaled when dropped on the map.

A drop ratio of 1 is the default, it means the asset will resize purely on it's specified dimensions. A drop ratio of 0.5 would resize a something_2x2 to 1x1.

This fixes #1345.