@@ -1680,6 +1680,8 @@ define('zrender/Handler',['require','./core/env','./core/event','./core/util','.
16801680 for ( var i = list . length - 1 ; i >= 0 ; i -- ) {
16811681 if ( ! list [ i ] . silent
16821682 && list [ i ] !== exclude
1683+ // getDisplayList may include ignored item in VML mode
1684+ && ! list [ i ] . ignore
16831685 && isHover ( list [ i ] , x , y ) ) {
16841686 return list [ i ] ;
16851687 }
@@ -1739,7 +1741,7 @@ define('zrender/Handler',['require','./core/env','./core/event','./core/util','.
17391741 }
17401742
17411743 function eventNameFix ( name ) {
1742- return ( name === 'mousewheel' && env . firefox ) ? 'DOMMouseScroll' : name ;
1744+ return ( name === 'mousewheel' && env . browser . firefox ) ? 'DOMMouseScroll' : name ;
17431745 }
17441746
17451747 util . mixin ( Handler , Eventful ) ;
@@ -5058,13 +5060,16 @@ define('zrender/Storage',['require','./core/util','./container/Group'],function
50585060
50595061 /**
50605062 * 返回所有图形的绘制队列
5061- * @param {boolean } [update=false] 是否在返回前更新该数组
5063+ * @param {boolean } [update=false] 是否在返回前更新该数组
5064+ * @param {boolean } [includeIgnore=false] 是否包含 ignore 的数组, 在 update 为 true 的时候有效
5065+ *
50625066 * 详见{@link module:zrender/graphic/Displayable.prototype.updateDisplayList}
50635067 * @return {Array.<module:zrender/graphic/Displayable> }
50645068 */
5065- getDisplayList : function ( update ) {
5069+ getDisplayList : function ( update , includeIgnore ) {
5070+ includeIgnore = includeIgnore || false ;
50665071 if ( update ) {
5067- this . updateDisplayList ( ) ;
5072+ this . updateDisplayList ( includeIgnore ) ;
50685073 }
50695074 return this . _displayList ;
50705075 } ,
@@ -5073,14 +5078,14 @@ define('zrender/Storage',['require','./core/util','./container/Group'],function
50735078 * 更新图形的绘制队列。
50745079 * 每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,
50755080 * 最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列
5081+ * @param {boolean } [includeIgnore=false] 是否包含 ignore 的数组
50765082 */
5077- updateDisplayList : function ( ) {
5083+ updateDisplayList : function ( includeIgnore ) {
50785084 this . _displayListLen = 0 ;
50795085 var roots = this . _roots ;
50805086 var displayList = this . _displayList ;
50815087 for ( var i = 0 , len = roots . length ; i < len ; i ++ ) {
5082- var root = roots [ i ] ;
5083- this . _updateAndAddDisplayable ( root ) ;
5088+ this . _updateAndAddDisplayable ( roots [ i ] , null , includeIgnore ) ;
50845089 }
50855090 displayList . length = this . _displayListLen ;
50865091
@@ -5091,9 +5096,9 @@ define('zrender/Storage',['require','./core/util','./container/Group'],function
50915096 displayList . sort ( shapeCompareFunc ) ;
50925097 } ,
50935098
5094- _updateAndAddDisplayable : function ( el , clipPaths ) {
5099+ _updateAndAddDisplayable : function ( el , clipPaths , includeIgnore ) {
50955100
5096- if ( el . ignore ) {
5101+ if ( el . ignore && ! includeIgnore ) {
50975102 return ;
50985103 }
50995104
@@ -5129,7 +5134,7 @@ define('zrender/Storage',['require','./core/util','./container/Group'],function
51295134 // FIXME __dirtyPath ?
51305135 child . __dirty = el . __dirty || child . __dirty ;
51315136
5132- this . _updateAndAddDisplayable ( child , clipPaths ) ;
5137+ this . _updateAndAddDisplayable ( child , clipPaths , includeIgnore ) ;
51335138 }
51345139
51355140 // Mark group clean here
@@ -5793,6 +5798,11 @@ define('zrender/graphic/Style',['require'],function (require) {
57935798 */
57945799 textAlign : null ,
57955800
5801+ /**
5802+ * @type {string }
5803+ */
5804+ textVerticalAlign : null ,
5805+
57965806 /**
57975807 * @type {number }
57985808 */
@@ -6209,6 +6219,7 @@ define('zrender/graphic/mixin/RectText',['require','../../contain/text','../../c
62096219 var align = style . textAlign ;
62106220 var font = style . textFont || style . font ;
62116221 var baseline = style . textBaseline ;
6222+ var verticalAlign = style . textVerticalAlign ;
62126223
62136224 textRect = textRect || textContain . getBoundingRect ( text , font , align , baseline ) ;
62146225
@@ -6243,7 +6254,22 @@ define('zrender/graphic/mixin/RectText',['require','../../contain/text','../../c
62436254 }
62446255
62456256 ctx . textAlign = align ;
6246- ctx . textBaseline = baseline ;
6257+ if ( verticalAlign ) {
6258+ switch ( verticalAlign ) {
6259+ case 'middle' :
6260+ y -= textRect . height / 2 ;
6261+ break ;
6262+ case 'bottom' :
6263+ y -= textRect . height ;
6264+ break ;
6265+ // 'top'
6266+ }
6267+ // Ignore baseline
6268+ ctx . textBaseline = 'top' ;
6269+ }
6270+ else {
6271+ ctx . textBaseline = baseline ;
6272+ }
62476273
62486274 var textFill = style . textFill ;
62496275 var textStroke = style . textStroke ;
@@ -8087,8 +8113,26 @@ define('zrender/graphic/Text',['require','./Displayable','../core/util','../cont
80878113
80888114 ctx . font = style . textFont || style . font ;
80898115 ctx . textAlign = style . textAlign ;
8090- ctx . textBaseline = style . textBaseline ;
80918116
8117+ if ( style . textVerticalAlign ) {
8118+ var rect = textContain . getBoundingRect (
8119+ text , ctx . font , style . textAlign , 'top'
8120+ ) ;
8121+ // Ignore textBaseline
8122+ ctx . textBaseline = 'top' ;
8123+ switch ( style . textVerticalAlign ) {
8124+ case 'middle' :
8125+ y -= rect . height / 2 ;
8126+ break ;
8127+ case 'bottom' :
8128+ y -= rect . height ;
8129+ break ;
8130+ // 'top'
8131+ }
8132+ }
8133+ else {
8134+ ctx . textBaseline = style . textBaseline ;
8135+ }
80928136 var lineHeight = textContain . measureText ( '国' , ctx . font ) . width ;
80938137
80948138 var textLines = text . split ( '\n' ) ;
@@ -8106,7 +8150,7 @@ define('zrender/graphic/Text',['require','./Displayable','../core/util','../cont
81068150 if ( ! this . _rect ) {
81078151 var style = this . style ;
81088152 var rect = textContain . getBoundingRect (
8109- style . text + '' , style . textFont , style . textAlign , style . textBaseline
8153+ style . text + '' , style . textFont || style . font , style . textAlign , style . textBaseline
81108154 ) ;
81118155 rect . x += style . x || 0 ;
81128156 rect . y += style . y || 0 ;
@@ -10766,6 +10810,7 @@ define('zrender/graphic/shape/Ring',['require','../Path'],function (require) {
1076610810 var x = shape . cx ;
1076710811 var y = shape . cy ;
1076810812 var PI2 = Math . PI * 2 ;
10813+ ctx . moveTo ( x + shape . r , y ) ;
1076910814 ctx . arc ( x , y , shape . r , 0 , PI2 , false ) ;
1077010815 ctx . moveTo ( x + shape . r0 , y ) ;
1077110816 ctx . arc ( x , y , shape . r0 , 0 , PI2 , true ) ;
@@ -12348,6 +12393,7 @@ if (!require('../core/env').canvasSupported) {
1234812393 var font = fontStyle . style + ' ' + fontStyle . variant + ' ' + fontStyle . weight + ' '
1234912394 + fontStyle . size + 'px "' + fontStyle . family + '"' ;
1235012395 var baseline = style . textBaseline ;
12396+ var verticalAlign = style . textVerticalAlign ;
1235112397
1235212398 textRect = textRect || textContain . getBoundingRect ( text , font , align , baseline ) ;
1235312399
@@ -12387,14 +12433,26 @@ if (!require('../core/env').canvasSupported) {
1238712433 x = rect . x ;
1238812434 y = rect . y ;
1238912435 }
12436+ if ( verticalAlign ) {
12437+ switch ( verticalAlign ) {
12438+ case 'middle' :
12439+ y -= textRect . height / 2 ;
12440+ break ;
12441+ case 'bottom' :
12442+ y -= textRect . height ;
12443+ break ;
12444+ // 'top'
12445+ }
12446+ // Ignore baseline
12447+ baseline = 'top' ;
12448+ }
1239012449
1239112450 var fontSize = fontStyle . size ;
1239212451 // 1.75 is an arbitrary number, as there is no info about the text baseline
12393- var lineCount = ( text + '' ) . split ( '\n' ) . length ; // not precise.
1239412452 switch ( baseline ) {
1239512453 case 'hanging' :
1239612454 case 'top' :
12397- y += ( fontSize / 1.75 ) * lineCount ;
12455+ y += fontSize / 1.75 ;
1239812456 break ;
1239912457 case 'middle' :
1240012458 break ;
@@ -12629,7 +12687,7 @@ define('zrender/vml/Painter',['require','../core/log','./core'],function (requir
1262912687 */
1263012688 refresh : function ( ) {
1263112689
12632- var list = this . storage . getDisplayList ( true ) ;
12690+ var list = this . storage . getDisplayList ( true , true ) ;
1263312691
1263412692 this . _paintList ( list ) ;
1263512693 } ,
@@ -12638,10 +12696,23 @@ define('zrender/vml/Painter',['require','../core/log','./core'],function (requir
1263812696 var vmlRoot = this . _vmlRoot ;
1263912697 for ( var i = 0 ; i < list . length ; i ++ ) {
1264012698 var el = list [ i ] ;
12641- if ( el . __dirty && ! el . invisible ) {
12642- el . beforeBrush && el . beforeBrush ( ) ;
12643- el . brush ( vmlRoot ) ;
12644- el . afterBrush && el . afterBrush ( ) ;
12699+ if ( el . invisible || el . ignore ) {
12700+ if ( ! el . __alreadyNotVisible ) {
12701+ el . onRemoveFromStorage ( vmlRoot ) ;
12702+ }
12703+ // Set as already invisible
12704+ el . __alreadyNotVisible = true ;
12705+ }
12706+ else {
12707+ if ( el . __alreadyNotVisible ) {
12708+ el . onAddToStorage ( vmlRoot ) ;
12709+ }
12710+ el . __alreadyNotVisible = false ;
12711+ if ( el . __dirty ) {
12712+ el . beforeBrush && el . beforeBrush ( ) ;
12713+ el . brush ( vmlRoot ) ;
12714+ el . afterBrush && el . afterBrush ( ) ;
12715+ }
1264512716 }
1264612717 el . __dirty = false ;
1264712718 }
0 commit comments