Skip to content

Conversation

@100pah
Copy link
Contributor

@100pah 100pah commented Jun 2, 2025

Support ignoreHostSilent

Support ignoreHostSilent for some scenarios that textContent and its host require specifying silent separately.
By default the a textContent follows the silent of its ancestors or __hostTarget is silent: fasle, regardless of its own silent setting.

But they may need separate silent settings.
e.g., the host do not have fill but only stroke, or their mouse events serve for different features.

This PR introduce a new config ignoreHostSilent to convey that meaning.

The case is in apache/echarts#21005 , test/matrix3.html:
The cell text may overflow and truncated. The tooltip are needed for display the entire text, but the cell rect (border or background) may not be appropriate to trigger that tooltip (may bother users).

Fix lineOverflow content height

lineOverflow need to update contentHeight.
Otherwise the textContent layout is incorrect if textConfig.position: 'top' for long text.

Clarify plain text parsing

If text.style.width specified, the outerWidth use that specified width, rather than the contentWidth. After this modification, the behavior of plain text become consistent with plain text height and rich text width/height. And the rect text place will not be affected by the text content any more if style.width is specified.

Make text overflow truncate more precise

consider non-monospace font.
BEFORE: shorter than the give width.

Before: (text.style.padding: 10)
image

AFTER: close to the given width.

After: (text.style.padding: 10)
image

After: (text.style.padding: 0)
image

Optimize the text truncate and wrap performance.

Constantly visit LRU for each char from a long text is slower than using a static dictionary.
test case: test/test-overflow.html

On a certain device, wrapping a entire long en text.

BEFORE:
Constantly change text.style.width:
image

First render time is approximately 30 ms.

AFTER:
Constantly change text.style.width:
image

First render time is approximately 20 ms.

Support textConfig.autoOverflowArea

textConfig.autoOverflowArea auto calculate the text.style.x/y/width/height, based on the host element boundingRect, as the overflow break/breakAll/truncate boundary. Previously it's difficult to calculate it externally due to the numerous props in textConfig and text.style and internal processing.

BoundingRect and OrientedBoundingRect

  • Support the same features from OBB (directional MTV, touchThreshold) to BoundingRect, enable them using the same option to perform intersection detection (for performance optimization).
  • Fix OBB result abnormal in some edge cases.
  • Support that touchThreshold cause negative size to avoid intersection.
  • Support get intersection rect.
  • Add some static API.

100pah added 7 commits April 23, 2025 03:18
…directional MTV, touchThreshold) to BoundingRect, enable them using the same option to perform intersection detection (for performance optimization). (2) Fix OBB result abnormal in some edge cases.
…and its host require specifying silent separately.
@100pah 100pah closed this Jun 2, 2025
@100pah 100pah reopened this Jun 2, 2025
@100pah 100pah changed the base branch from master to v6 June 2, 2025 17:41
100pah added a commit to apache/echarts that referenced this pull request Jun 2, 2025
100pah added 14 commits June 5, 2025 18:41
…ified, the outerWidth use that specified width, rather than the contentWidth. After this modification, the behavior of plain text become consistent with plain text height and rich text width/height. And the rect text place will not be affected by the text content any more if style.width is specified. (2) Fix comment typos and add comments. (3) Add more test cases.
…r non-monospace font. BEFORE: shorter than the give width. AFTER: close to the given width). (2) Optimize the text truncate and wrap performance. (constantly visit LRU for each char from a long text is slower than using a static dictionary. In test/test-overflow.html, wrapping a entire long en text, each frame is optimize like from 15ms -> 4ms, in a certain machine).
…and copy it to local due to the instability of CDN
…culate the text.style.x/y/width/height, based on the host element boundingRect, as the overflow `break`/`breakAll`/`truncate` boundary. Previously it's difficult to calculate it externally due to the numerous props in textConfig and text.style and internal processing.
@100pah 100pah merged commit 4ebf34d into v6 Jun 9, 2025
2 of 3 checks passed
@Ovilia Ovilia deleted the feat/ignore-host-silent branch June 10, 2025 02:33
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.

3 participants