plainheart commented on a change in pull request #14214:
URL: https://github.com/apache/echarts/pull/14214#discussion_r571339080
##########
File path: src/component/tooltip/TooltipHTMLContent.ts
##########
@@ -358,6 +358,34 @@ class TooltipHTMLContent {
+ `border-color: ${nearPointColor};`
+ (tooltipModel.get('extraCssText') || '');
+ const userWidth = tooltipModel.get(['textStyle', 'width']);
+ if (userWidth != null) {
+ el.style.cssText += `;width:${userWidth}px;`;
+ // `text-overflow_string` has very humble compatibility
+ // shttps://caniuse.com/mdn-css_properties_text-overflow_string
+ const ellipsis = tooltipModel.get(['textStyle', 'ellipsis']);
+ const userOverflow = tooltipModel.get(['textStyle', 'overflow']);
+ switch (userOverflow) {
+ case 'truncate':
+ el.style.cssText += ';overflow:hidden;'
+ + `text-overflow:${ellipsis != null ?
`\'${ellipsis}\'` : 'ellipsis'};`
+ + 'white-space:nowrap;';
+ break;
+
+ case 'break':
+ el.style.cssText +=
';word-break:break-word;white-space:normal;';
+ break;
+
+ case 'breakAll':
+ el.style.cssText +=
';word-break:break-all;white-space:normal;';
+ break;
+
+ default:
+ el.style.cssText += '';
+ break;
+ }
+ }
Review comment:
I can understand it. The reason for the proposal is just for reducing
the minimized code size by merging some conditions. Sure, except for that, we
can also make the switch simpler.
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]