[#6763] Implement TemplatePlacement to replace AbilityTemplate#6778
[#6763] Implement TemplatePlacement to replace AbilityTemplate#6778
TemplatePlacement to replace AbilityTemplate#6778Conversation
dev7355608 left a comment
There was a problem hiding this comment.
What is the reason that we don't use the new RegionLayer#placeRegion API?
We need to support placing more than one shape at a time would be the big one. I also have plans for adding additional UI that is shared with our token placement system. |
| Could you write up a feature request for the limitations you currently facing with |
These cover much of it:
But I will say our implementation also shares a bunch of the internals with our There are also other features for placement restriction/guidance that might not make sense in core:
|
| At least one of those are mentioned in foundryvtt/foundryvtt#9840 |
The options |
7335281 to 54aa781 Compare Adds a new `dnd5e.canvas.TemplatePlacement` API to handle placing shapes within a scene. This base API deals with basic shape data but the `fromActivity` factory method behaves similar to the old method on `AbilityTemplate` to create a full measured template region. The created regions are set up to work as similar as possible to the old measured templates, using `coverage` highlight mode and the user's color. When the area of effect count is larger than one, all of the shapes are combined into a single measured template. `TokenPlacement` has been refactored and much of its code has been shifted into a new `BasePlacement` class that is shared between the two canvas placement systems. Closes #6763
Rewrites both placement APIs to rely on core's `placeToken` and `placeRegion` mathods rather than a new implementation. Removes `BasePlacement` since there is no longer much shared code.
Finds all applications that are not minimized, have a frame, and are not detached and minimizes them until placement is completed. This behavior can be disabled using the `minimizeWindows` option in the placement configuration. Also adds a `restoreLayer` option to the configuration to control whether the original canvas layer is made active after placement. Both of these options are enabled by default. Closes #6763
494ddb3 to e0507eb Compare
Adds a new
dnd5e.canvas.TemplatePlacementAPI to handle placing shapes within a scene. This base API deals with basic shape data but thefromActivityfactory method behaves similar to the old method onAbilityTemplateto create a full measured template region.The created regions are set up to work as similar as possible to the old measured templates, using
coveragehighlight mode and the user's color. When the area of effect count is larger than one, all of the shapes are combined into a single measured template.TokenPlacementhas been refactored and much of its code has been shifted into a newBasePlacementclass that is shared between the two canvas placement systems.Closes #6763