Repository navigation
Conversation
… inlining removeIds inlining composed translate(x,y) before the <use> transform for element targets, and copied the transform onto a nested <svg> for symbol/svg targets, which SVG 1.1 consumers (WebKit) ignore.
With `direction: 'rtl'` the rendered infographic is mirrored horizontally in a post-render pass; text, item icons and illustrations are flipped back in place so they stay readable. SVG text gets swapped anchors and `unicode-bidi: plaintext`; foreignObject text gets `dir="auto"` with physical alignment. Left and right padding are swapped. Editing in RTL emits a warning. Designs are untouched and LTR output is unchanged.
`direction ltr|rtl` in the syntax sets the layout direction and overrides the `direction` option passed to the Infographic constructor.
Box atoms (foreignObject text, icon and illustration uses) are flipped back by a wrapping group owned by the RTL pass, so the editor reads, writes and persists their own geometry unchanged; the flip is re-centred wherever the editor writes geometry. Pointer input is mapped into the layout's own (mirrored) space, while pan and zoom keep the viewBox space; overlays live in the layout space. Align buttons and resize cursors act on screen sides; stored alignment stays logical. Editing in RTL no longer emits a warning.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds RTL rendering via a new
direction: 'ltr' | 'rtl'option (also a top-leveldirectionkey in the syntax). It is implemented as a single post-render pass (src/renderer/rtl.ts) that mirrors the whole layout with an SVG transform and flips text, icons and illustrations back in place, swaps alignment and asymmetric padding, and lets the browser's native bidi pick each text's base direction — so it applies automatically to every existing and future chart, with no changes tosrc/designs/and no RTL work for chart authors, while LTR output stays byte-identical. The editor works on RTL layouts too, and a latent<use>transform-order bug inexportToSVG({ removeIds: true })that RTL exposed is fixed generically.