@@ -652,6 +652,50 @@ define('zrender/core/util',['require'],function(require) {
652
652
return obj [ primitiveKey ] ;
653
653
}
654
654
655
+ /**
656
+ * @constructor
657
+ */
658
+ function HashMap ( obj ) {
659
+ obj && extend ( this , obj ) ;
660
+ }
661
+
662
+ // Add prefix to avoid conflict with Object.prototype.
663
+ var HASH_MAP_PREFIX = '_ec_' ;
664
+ var HASH_MAP_PREFIX_LENGTH = 4 ;
665
+
666
+ HashMap . prototype = {
667
+ constructor : HashMap ,
668
+ // Do not provide `has` method to avoid defining what is `has`.
669
+ // (We usually treat `null` and `undefined` as the same, different
670
+ // from ES6 Map).
671
+ get : function ( key ) {
672
+ return this [ HASH_MAP_PREFIX + key ] ;
673
+ } ,
674
+ set : function ( key , value ) {
675
+ this [ HASH_MAP_PREFIX + key ] = value ;
676
+ // Comparing with invocation chaining, `return value` is more commonly
677
+ // used in this case: `var someVal = map.set('a', genVal());`
678
+ return value ;
679
+ } ,
680
+ // Although util.each can be performed on this hashMap directly, user
681
+ // should not use the exposed keys, who are prefixed.
682
+ each : function ( cb , context ) {
683
+ context !== void 0 && ( cb = bind ( cb , context ) ) ;
684
+ for ( var prefixedKey in this ) {
685
+ this . hasOwnProperty ( prefixedKey )
686
+ && cb ( this [ prefixedKey ] , prefixedKey . slice ( HASH_MAP_PREFIX_LENGTH ) ) ;
687
+ }
688
+ } ,
689
+ // Do not use this method if performance sensitive.
690
+ removeKey : function ( key ) {
691
+ delete this [ key ] ;
692
+ }
693
+ } ;
694
+
695
+ function createHashMap ( ) {
696
+ return new HashMap ( ) ;
697
+ }
698
+
655
699
var util = {
656
700
inherits : inherits ,
657
701
mixin : mixin ,
@@ -682,6 +726,7 @@ define('zrender/core/util',['require'],function(require) {
682
726
retrieve : retrieve ,
683
727
assert : assert ,
684
728
setAsPrimitive : setAsPrimitive ,
729
+ createHashMap : createHashMap ,
685
730
noop : function ( ) { }
686
731
} ;
687
732
return util ;
@@ -7597,7 +7642,7 @@ define('zrender/contain/text',['require','../core/util','../core/BoundingRect'],
7597
7642
break ;
7598
7643
case 'insideTop' :
7599
7644
x += width / 2 ;
7600
- y += distance ;
7645
+ y += distance + lineHeight ;
7601
7646
textAlign = 'center' ;
7602
7647
break ;
7603
7648
case 'insideBottom' :
@@ -7607,12 +7652,12 @@ define('zrender/contain/text',['require','../core/util','../core/BoundingRect'],
7607
7652
break ;
7608
7653
case 'insideTopLeft' :
7609
7654
x += distance ;
7610
- y += distance ;
7655
+ y += distance + lineHeight ;
7611
7656
textAlign = 'left' ;
7612
7657
break ;
7613
7658
case 'insideTopRight' :
7614
7659
x += width - distance ;
7615
- y += distance ;
7660
+ y += distance + lineHeight ;
7616
7661
textAlign = 'right' ;
7617
7662
break ;
7618
7663
case 'insideBottomLeft' :
@@ -9441,7 +9486,7 @@ define('zrender/zrender',['require','./core/guid','./core/env','./core/util','./
9441
9486
/**
9442
9487
* @type {string }
9443
9488
*/
9444
- zrender . version = '3.4.3 ' ;
9489
+ zrender . version = '3.4.4 ' ;
9445
9490
9446
9491
/**
9447
9492
* Initializing a zrender instance
0 commit comments