File tree Expand file tree Collapse file tree 3 files changed +53
-2
lines changed Expand file tree Collapse file tree 3 files changed +53
-2
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,10 @@ define(function(require) {
154
154
+ finalTextStyle . fontSize + 'px '
155
155
+ finalTextStyle . fontFamily ;
156
156
}
157
+
158
+ function resize ( ) {
159
+ self . refresh && self . refresh ( ) ;
160
+ }
157
161
158
162
/**
159
163
* 清除图形数据,实例仍可用
@@ -182,6 +186,7 @@ define(function(require) {
182
186
self . getFont = getFont ;
183
187
self . clear = clear ;
184
188
self . dispose = dispose ;
189
+ self . resize = resize ;
185
190
}
186
191
187
192
return Base ;
Original file line number Diff line number Diff line change @@ -975,8 +975,39 @@ define(function (require) {
975
975
_buildShape ( ) ;
976
976
}
977
977
}
978
+
979
+ /**
980
+ * 避免dataZoom带来两次refresh,不设refresh接口,resize重复一下buildshape逻辑
981
+ */
982
+ function resize ( ) {
983
+ self . clear ( ) ;
984
+
985
+ // 自己show 或者 toolbox启用且dataZoom有效
986
+ if ( option . dataZoom . show
987
+ || (
988
+ self . deepQuery ( [ option ] , 'toolbox.show' )
989
+ && self . deepQuery ( [ option ] , 'toolbox.feature.dataZoom' )
990
+ )
991
+ ) {
992
+ _location = _getLocation ( ) ;
993
+ _zoom = _getZoom ( ) ;
994
+ }
995
+
996
+ if ( option . dataZoom . show ) {
997
+ _buildBackground ( ) ;
998
+ _buildDataBackground ( ) ;
999
+ _buildFiller ( ) ;
1000
+ _bulidHandle ( ) ;
1001
+
1002
+ for ( var i = 0 , l = self . shapeList . length ; i < l ; i ++ ) {
1003
+ self . shapeList [ i ] . id = zr . newShapeId ( self . type ) ;
1004
+ zr . addShape ( self . shapeList [ i ] ) ;
1005
+ }
1006
+ }
1007
+ }
978
1008
979
1009
self . init = init ;
1010
+ self . resize = resize ;
980
1011
self . syncBackupData = syncBackupData ;
981
1012
self . absoluteZoom = absoluteZoom ;
982
1013
self . rectZoom = rectZoom ;
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ define(function (require) {
31
31
var _y ;
32
32
var _width ;
33
33
var _height ;
34
+ var _zrWidth ;
35
+ var _zrHeight ;
34
36
35
37
/**
36
38
* 构造函数默认执行的初始化方法,也用于创建实例后动态修改
@@ -47,16 +49,18 @@ define(function (require) {
47
49
_y = gridOption . y ;
48
50
var x2 = gridOption . x2 ;
49
51
var y2 = gridOption . y2 ;
52
+ _zrWidth = zr . getWidth ( ) ;
53
+ _zrHeight = zr . getHeight ( ) ;
50
54
51
55
if ( typeof gridOption . width == 'undefined' ) {
52
- _width = zr . getWidth ( ) - _x - x2 ;
56
+ _width = _zrWidth - _x - x2 ;
53
57
}
54
58
else {
55
59
_width = gridOption . width ;
56
60
}
57
61
58
62
if ( typeof gridOption . height == 'undefined' ) {
59
- _height = zr . getHeight ( ) - _y - y2 ;
63
+ _height = _zrHeight - _y - y2 ;
60
64
}
61
65
else {
62
66
_height = gridOption . height ;
@@ -114,6 +118,16 @@ define(function (require) {
114
118
height : _height
115
119
} ;
116
120
}
121
+
122
+ function refresh ( newOption ) {
123
+ if ( _zrWidth != zr . getWidth ( )
124
+ || _zrHeight != zr . getHeight ( )
125
+ || newOption
126
+ ) {
127
+ self . clear ( ) ;
128
+ init ( newOption || option ) ;
129
+ }
130
+ }
117
131
118
132
self . init = init ;
119
133
self . getX = getX ;
@@ -123,6 +137,7 @@ define(function (require) {
123
137
self . getXend = getXend ;
124
138
self . getYend = getYend ;
125
139
self . getArea = getArea ;
140
+ self . refresh = refresh ;
126
141
127
142
init ( option ) ;
128
143
}
You can’t perform that action at this time.
0 commit comments