Skip to content

[#2874] Update Transform on Zone entity to outline's centroid on setPoints()#2875

Merged
daid merged 2 commits into
daid:masterfrom
oznogon:update-zone-centroid
Jun 8, 2026
Merged

[#2874] Update Transform on Zone entity to outline's centroid on setPoints()#2875
daid merged 2 commits into
daid:masterfrom
oznogon:update-zone-centroid

Conversation

@oznogon

@oznogon oznogon commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

When setting a Zone's points via Lua setPoints(), also set its Transform's position to the outline's centroid.

Before: all Zones' transforms are at the same set of coordinates, typically 0,0

Screencast_20260606_112640.webm

After: each Zone's transform is at its centroid

Screencast_20260606_112235.webm

oznogon added 2 commits June 6, 2026 11:20
Reposition a Zone's transform to its centroid when modifying Zone points
with the Lua API setPoints() function.

setPoints() still accepts absolute coordinates as arguments, resulting
in no change to the API. It then transforms and stores them as offsets
relative to the Zone's Transform position.

This is in line with how Zone functions and rendering already treat Zone
outline points, and prevents all Zones from sharing the same 0,0
Transform position coordinates.

This commit also modifies __exportZone to set the Transform position.

Note that modifying Zone coordinates directly in the component member
values does NOT update the Transform to the new centroid.
@oznogon oznogon changed the title Update Transform on Zone entity to outline's centroid on setPoints() [#2874] Update Transform on Zone entity to outline's centroid on setPoints() Jun 6, 2026
@oznogon

oznogon commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

A potential workaround to #2874, but doesn't change the behavior when directly manipulating the Zone component's outline points via Lua member access.

@daid daid merged commit 19c8296 into daid:master Jun 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants