提交 bf4298d2 编写于 作者: L lang

toolbox hover text position fix

上级 6ea42515
......@@ -13,7 +13,7 @@ define(function (require) {
var angleAxisOptList = option.angleAxis;
var radarSeries = filter(option.series, function (seriesOpt) {
return seriesOpt.type === 'radar';
});
}) || [];
if (polarOptList && radarSeries.length) {
if (!isArray(polarOptList)) {
polarOptList = [polarOptList];
......
......@@ -49,7 +49,7 @@ define(function (require) {
iconStyle: {
normal: {
borderColor: '#000',
borderColor: '#666',
color: 'none'
},
emphasis: {
......
......@@ -132,11 +132,14 @@ define(function (require) {
graphic.setHoverStyle(path);
if (toolboxModel.get('showTitle')) {
path.__title = titles[iconName];
path.on('mouseover', function () {
path.setStyle({
textPosition: 'bottom',
text: titles[iconName],
textFill: hoverStyle.fill || hoverStyle.stroke || '#000'
textPosition: hoverStyle.textPosition,
textFill: hoverStyle.fill || hoverStyle.stroke || '#000',
textAlign: hoverStyle.textAlign,
textBaseline: hoverStyle.textBaseline
});
})
.on('mouseout', function () {
......@@ -163,11 +166,12 @@ define(function (require) {
// Adjust icon title positions to avoid them out of screen
group.eachChild(function (icon) {
var titleText = icon.__title;
var hoverStyle = icon.hoverStyle;
// May be background element
if (hoverStyle && hoverStyle.text) {
if (hoverStyle && titleText) {
var rect = textContain.getBoundingRect(
hoverStyle.text, hoverStyle.font
titleText, hoverStyle.font
);
var offsetX = icon.position[0] + group.position[0];
var offsetY = icon.position[1] + group.position[1] + itemSize;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册