Skip to content

refactor: centralize anchored graphic placement#3757

Open
VladaHarbour wants to merge 2 commits into
sd-3420_anchor-graphic-refactorfrom
sd-3420_anchor-graphic-placement-refactor-p2
Open

refactor: centralize anchored graphic placement#3757
VladaHarbour wants to merge 2 commits into
sd-3420_anchor-graphic-refactorfrom
sd-3420_anchor-graphic-placement-refactor-p2

Conversation

@VladaHarbour

Copy link
Copy Markdown
Contributor
  • Added a shared resolveGraphicPlacement() in layout-engine to centralize anchored graphic placement for images, drawings, and tables.
  • The resolver now produces one placement result for paint coordinates, text-wrap exclusion coordinates, layer data (behindDoc, zIndex), and measurement impact flags.
  • Refactored paragraph anchoring, pre-registered/page-relative anchors, paragraphless anchored fallback, and float registration to consume the same resolved placement instead of recomputing X/Y separately.
  • Removed duplicated table anchor X logic from the floating object manager.

@VladaHarbour VladaHarbour self-assigned this Jun 18, 2026
@VladaHarbour VladaHarbour requested a review from a team as a code owner June 18, 2026 15:55
@linear-code

linear-code Bot commented Jun 18, 2026

Copy link
Copy Markdown

SD-3420

@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: 91054858eb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

typeof anchoredBlock.zIndex === 'number'
? anchoredBlock.zIndex
: (normalizeZIndex(anchoredBlock.attrs?.originalAttributes) ?? (behindDoc ? -1 : 1));
const zIndex = getFragmentZIndex(anchoredBlock);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve wrap-only behindDoc z-index in cells

When a table-cell anchored block uses the legacy/wrap-only behind-doc form (wrap.type === 'None' with wrap.behindDoc, but no anchor.behindDoc or zIndex), the behindDoc variable above is true and wrap exclusions are skipped, but getFragmentZIndex() only consults anchor.behindDoc/block.zIndex, so the wrapper falls back to z-index 1 and is appended after the text instead of behind it. Please feed the computed behindDoc state into the z-index fallback (or preserve the old behind-doc fallback) so these supported blocks still render behind cell content.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant