@@ -23,7 +23,7 @@ import * as graphic from '../../util/graphic';
23
23
import { createSymbol } from '../../util/symbol' ;
24
24
import * as layout from '../../util/layout' ;
25
25
import * as helper from './helper' ;
26
- import PiecewiseModel from './PiecewiseModel' ;
26
+ import PiecewiseModel , { PiecewiseVisualMapOption } from './PiecewiseModel' ;
27
27
import { TextAlign } from 'zrender/src/core/types' ;
28
28
import { VisualMappingOption } from '../../visual/VisualMapping' ;
29
29
import { createTextStyle } from '../../label/labelStyle' ;
@@ -43,6 +43,7 @@ class PiecewiseVisualMapView extends VisualMapView {
43
43
44
44
const visualMapModel = this . visualMapModel ;
45
45
const textGap = visualMapModel . get ( 'textGap' ) ;
46
+ const selectMode = visualMapModel . get ( 'selectedMode' ) ;
46
47
const textStyleModel = visualMapModel . textStyleModel ;
47
48
const textFont = textStyleModel . getFont ( ) ;
48
49
const textFill = textStyleModel . getTextColor ( ) ;
@@ -68,13 +69,12 @@ class PiecewiseVisualMapView extends VisualMapView {
68
69
const representValue = visualMapModel . getRepresentValue ( piece ) as number ;
69
70
70
71
this . _createItemSymbol (
71
- itemGroup , representValue , [ 0 , 0 , itemSize [ 0 ] , itemSize [ 1 ] ]
72
+ itemGroup , representValue , [ 0 , 0 , itemSize [ 0 ] , itemSize [ 1 ] ] , selectMode
72
73
) ;
73
74
74
75
if ( showLabel ) {
75
76
const visualState = this . visualMapModel . getValueState ( representValue ) ;
76
-
77
- itemGroup . add ( new graphic . Text ( {
77
+ const itemText = new graphic . Text ( {
78
78
style : {
79
79
x : itemAlign === 'right' ? - textGap : itemSize [ 0 ] + textGap ,
80
80
y : itemSize [ 1 ] / 2 ,
@@ -83,9 +83,11 @@ class PiecewiseVisualMapView extends VisualMapView {
83
83
align : itemAlign as TextAlign ,
84
84
font : textFont ,
85
85
fill : textFill ,
86
- opacity : visualState === 'outOfRange' ? 0.5 : 1
86
+ opacity : visualState === 'outOfRange' ? 0.5 : 1 ,
87
87
}
88
- } ) ) ;
88
+ } ) ;
89
+ itemText . silent = ! selectMode ;
90
+ itemGroup . add ( itemText ) ;
89
91
}
90
92
91
93
thisGroup . add ( itemGroup ) ;
@@ -199,15 +201,18 @@ class PiecewiseVisualMapView extends VisualMapView {
199
201
private _createItemSymbol (
200
202
group : graphic . Group ,
201
203
representValue : number ,
202
- shapeParam : number [ ]
204
+ shapeParam : number [ ] ,
205
+ selectMode : PiecewiseVisualMapOption [ 'selectedMode' ] ,
203
206
) {
204
- group . add ( createSymbol (
207
+ const itemSymbol = createSymbol (
205
208
// symbol will be string
206
209
this . getControllerVisual ( representValue , 'symbol' ) as string ,
207
210
shapeParam [ 0 ] , shapeParam [ 1 ] , shapeParam [ 2 ] , shapeParam [ 3 ] ,
208
211
// color will be string
209
212
this . getControllerVisual ( representValue , 'color' ) as string
210
- ) ) ;
213
+ ) ;
214
+ itemSymbol . silent = ! selectMode ;
215
+ group . add ( itemSymbol ) ;
211
216
}
212
217
213
218
private _onItemClick (
@@ -241,4 +246,4 @@ class PiecewiseVisualMapView extends VisualMapView {
241
246
}
242
247
}
243
248
244
- export default PiecewiseVisualMapView ;
249
+ export default PiecewiseVisualMapView ;
0 commit comments