You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/02/18 13:06:07 UTC

[GitHub] [echarts] pissang commented on a change in pull request #16540: fix the icon of legend is overflow.When the selector option is turned on

pissang commented on a change in pull request #16540:
URL: https://github.com/apache/echarts/pull/16540#discussion_r809980295



##########
File path: src/component/legend/LegendView.ts
##########
@@ -467,6 +467,14 @@ class LegendView extends ComponentView {
         const contentGroup = this.getContentGroup();
         const selectorGroup = this.getSelectorGroup();
 
+        const selectorButtonGap = legendModel.get('selectorButtonGap', true);
+        if (selector && legendModel.get('orient') === 'horizontal') {

Review comment:
       It's better to cache the `legendModel.get('orient')` in a temporary variable

##########
File path: src/util/layout.ts
##########
@@ -84,7 +84,7 @@ function boxLayout(
             nextX = x + moveX;
             // Wrap when width exceeds maxWidth or meet a `newline` group
             // FIXME compare before adding gap?
-            if (nextX > maxWidth || (child as NewlineElement).newline) {
+            if (nextX > maxWidth || (child as NewlineElement).newline || (nextX + rect.width > maxWidth)) {

Review comment:
       `next.x` already includes `rect.width`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org