You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2019/10/22 07:00:07 UTC
[incubator-echarts] 01/01: fix(toolbox): avoid text overflow when
mouseon #10951
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a commit to branch fix-10951
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit cb4c8aa6eae1d650254b9d6f350458eadc47ad96
Author: Ovilia <zw...@gmail.com>
AuthorDate: Tue Oct 22 14:59:25 2019 +0800
fix(toolbox): avoid text overflow when mouseon #10951
---
src/component/toolbox/ToolboxView.js | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/component/toolbox/ToolboxView.js b/src/component/toolbox/ToolboxView.js
index 35c3fc3..58095e0 100644
--- a/src/component/toolbox/ToolboxView.js
+++ b/src/component/toolbox/ToolboxView.js
@@ -157,6 +157,15 @@ export default echarts.extendComponentView({
path.setStyle(iconStyleModel.getItemStyle());
path.hoverStyle = iconStyleEmphasisModel.getItemStyle();
+ // Text position calculation
+ path.setStyle({
+ text: titles[iconName],
+ textAlign: iconStyleEmphasisModel.get('textAlign'),
+ textBorderRadius: iconStyleEmphasisModel.get('textBorderRadius'),
+ textPadding: iconStyleEmphasisModel.get('textPadding'),
+ textFill: null
+ });
+
var tooltipModel = toolboxModel.getModel('tooltip');
if (tooltipModel && tooltipModel.get('show')) {
path.attr('tooltip', zrUtil.extend({
@@ -182,15 +191,14 @@ export default echarts.extendComponentView({
path.on('mouseover', function () {
// Should not reuse above hoverStyle, which might be modified.
var hoverStyle = iconStyleEmphasisModel.getItemStyle();
+ var defaultTextPosition = toolboxModel.get('orient') === 'vertical'
+ ? (toolboxModel.get('right') == null ? 'right' : 'left')
+ : (toolboxModel.get('bottom') == null ? 'bottom' : 'top');
path.setStyle({
- text: titles[iconName],
- textPosition: iconStyleEmphasisModel.get('textPosition') || 'bottom',
textFill: iconStyleEmphasisModel.get('textFill')
|| hoverStyle.fill || hoverStyle.stroke || '#000',
- textAlign: iconStyleEmphasisModel.get('textAlign') || 'center',
textBackgroundColor: iconStyleEmphasisModel.get('textBackgroundColor'),
- textBorderRadius: iconStyleEmphasisModel.get('textBorderRadius'),
- textPadding: iconStyleEmphasisModel.get('textPadding')
+ textPosition: iconStyleEmphasisModel.get('textPosition') || defaultTextPosition
});
})
.on('mouseout', function () {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org