diff --git a/src/util/symbol.js b/src/util/symbol.js index 0df28c2eb1f8442178d479faa1f0630ec566a62a..7d0c8e0f62db864259125e03507c07c44ac3bebf 100644 --- a/src/util/symbol.js +++ b/src/util/symbol.js @@ -22,6 +22,7 @@ import * as zrUtil from 'zrender/src/core/util'; import * as graphic from './graphic'; import BoundingRect from 'zrender/src/core/BoundingRect'; +import {interpretTextPosition} from 'zrender/src/contain/text'; /** * Triangle shape @@ -269,21 +270,19 @@ var SymbolClz = graphic.extendShape({ height: 0 }, - beforeBrush: function () { - var style = this.style; + interpretTextPosition(out, style, rect) { + var res = interpretTextPosition(out, style, rect); var shape = this.shape; - // FIXME - if (shape.symbolType === 'pin' && style.textPosition === 'inside') { - style.textPosition = ['50%', '40%']; - style.textAlign = 'center'; - style.textVerticalAlign = 'middle'; + if (shape && shape.symbolType === 'pin' && style.textPosition === 'inside') { + res.y = rect.y + rect.height * 0.4; } + return res; }, buildPath: function (ctx, shape, inBundle) { var symbolType = shape.symbolType; - var proxySymbol = symbolBuildProxies[symbolType]; - if (shape.symbolType !== 'none') { + if (symbolType !== 'none') { + var proxySymbol = symbolBuildProxies[symbolType]; if (!proxySymbol) { // Default rect symbolType = 'rect'; diff --git a/test/hoverStyle.html b/test/hoverStyle.html index 807aa405b88cbe23d1f203b130d92ed4709ad382..366e94c18c49bffd0517d14ad12365717bd80eed 100644 --- a/test/hoverStyle.html +++ b/test/hoverStyle.html @@ -54,6 +54,7 @@ under the License.
+
@@ -151,6 +152,57 @@ under the License. + + + + + +