Skip to content

fix(renderer): respect text z-index ordering - #93

Open
Komzpa wants to merge 1 commit into
masterfrom
codex/fix-text-z-index-order
Open

fix(renderer): respect text z-index ordering#93
Komzpa wants to merge 1 commit into
masterfrom
codex/fix-text-z-index-order

Conversation

@Komzpa

@Komzpa Komzpa commented May 8, 2026

Copy link
Copy Markdown
Member

Summary

  • decouple text/icon collision priority from canvas paint order
  • evaluate text/icon/shield candidates from high to low z-index, then replay accepted canvas commands from low to high z-index
  • add a regression test for both reported cases: high-z text wins collisions over low-z icons, and allow-overlap features paint high-z labels last

Fixes #63.

Validation

  • npm test

@Komzpa
Komzpa marked this pull request as ready for review May 17, 2026 16:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0896fdee22

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/kothic.js
Comment on lines +250 to +252
recorder.measureText = function(text) {
return ctx.measureText(text);
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Measure text with pending style updates

The command recorder defers style assignments (including font) until replay(), but recorder.measureText() calls ctx.measureText() immediately against the live canvas state. In _renderTextAndIcons, text/shield collision checks and placement run before replay, so widths are computed with stale fonts whenever a feature sets a different font size/family, which can incorrectly reject labels or allow overlaps. This regression is introduced by the new recording path and affects any map with mixed text styles.

Useful? React with 👍 / 👎.

Signed-off-by: Darafei Praliaskouski <me@komzpa.net>
@Komzpa
Komzpa force-pushed the codex/fix-text-z-index-order branch from 0896fde to 797a3f1 Compare May 20, 2026 02:41
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.

z-index issues

1 participant