plainheart commented on a change in pull request #14214:
URL: https://github.com/apache/echarts/pull/14214#discussion_r570666229



##########
File path: src/component/tooltip/TooltipRichContent.ts
##########
@@ -106,7 +106,10 @@ class TooltipRichContent {
                 fill: tooltipModel.get(['textStyle', 'color']),
                 padding: getPaddingFromTooltipModel(tooltipModel, 'richText'),
                 verticalAlign: 'top',
-                align: 'left'
+                align: 'left',
+                width: +tooltipModel.get(['textStyle', 'width']) || null,

Review comment:
       `height` should also be specified.

##########
File path: src/component/tooltip/TooltipRichContent.ts
##########
@@ -106,7 +106,10 @@ class TooltipRichContent {
                 fill: tooltipModel.get(['textStyle', 'color']),
                 padding: getPaddingFromTooltipModel(tooltipModel, 'richText'),
                 verticalAlign: 'top',
-                align: 'left'
+                align: 'left',
+                width: +tooltipModel.get(['textStyle', 'width']) || null,
+                overflow: tooltipModel.get(['textStyle', 'overflow']),
+                ellipsis: tooltipModel.get(['textStyle', 'ellipsis'])

Review comment:
       `lineOverflow` needs to be added.

##########
File path: src/util/types.ts
##########
@@ -1345,6 +1345,8 @@ export interface CommonTooltipOption<FormatterParams> {
 
         // Available when renderMode is html
         decoration?: string
+        overflow?: 'none' | 'truncate' | 'break' | 'breakAll'
+        ellipsis?: string

Review comment:
       The type definitions for `overflow` and `ellipsis` here are 
inappropriate and seems redundant. We can pick the `overflow` property from 
`LabelOption`. As for the `ellipsis` and `lineOverflow`, they can also be 
picked from the `TextStyleProps` in zrender. I think they are just missing in 
`LabelOption`. We should add them.
   
   ```ts
   export interface LabelOption extends TextCommonOption {
       overflow?: TextStyleProps['overflow']
       ellipsis?: TextStyleProps['ellipsis']
       lineOverflow?: TextStyleProps['lineOverflow']
   }
   ```
   
   Then add support for `ellipsis` after 
https://github.com/apache/echarts/blob/master/src/label/labelStyle.ts#L416-L419
   ```ts
   const ellipsis = textStyleModel.get('ellipsis');
   if (ellipsis) {
       textStyle.ellipsis = ellipsis;
   }
   const lineOverflow = textStyleModel.get('lineOverflow');
   if (lineOverflow) {
       textStyle.lineOverflow = lineOverflow;
   }
   ```
   
   But there is a TODO 
   
https://github.com/ecomfe/zrender/blob/master/src/graphic/helper/parseText.ts#L206-L213
   
   So `lineOverflow: truncate` won't be truncated by `ellipsis` characters. We 
can fix it later.




----------------------------------------------------------------
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.

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



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

Reply via email to