@@ -23,7 +23,7 @@ import * as graphic from '../../util/graphic';
2323import { createSymbol } from '../../util/symbol' ;
2424import * as layout from '../../util/layout' ;
2525import * as helper from './helper' ;
26- import PiecewiseModel from './PiecewiseModel' ;
26+ import PiecewiseModel , { PiecewiseVisualMapOption } from './PiecewiseModel' ;
2727import { TextAlign } from 'zrender/src/core/types' ;
2828import { VisualMappingOption } from '../../visual/VisualMapping' ;
2929import { createTextStyle } from '../../label/labelStyle' ;
@@ -43,6 +43,7 @@ class PiecewiseVisualMapView extends VisualMapView {
4343
4444 const visualMapModel = this . visualMapModel ;
4545 const textGap = visualMapModel . get ( 'textGap' ) ;
46+ const selectMode = visualMapModel . get ( 'selectedMode' ) ;
4647 const textStyleModel = visualMapModel . textStyleModel ;
4748 const textFont = textStyleModel . getFont ( ) ;
4849 const textFill = textStyleModel . getTextColor ( ) ;
@@ -68,13 +69,12 @@ class PiecewiseVisualMapView extends VisualMapView {
6869 const representValue = visualMapModel . getRepresentValue ( piece ) as number ;
6970
7071 this . _createItemSymbol (
71- itemGroup , representValue , [ 0 , 0 , itemSize [ 0 ] , itemSize [ 1 ] ]
72+ itemGroup , representValue , [ 0 , 0 , itemSize [ 0 ] , itemSize [ 1 ] ] , selectMode
7273 ) ;
7374
7475 if ( showLabel ) {
7576 const visualState = this . visualMapModel . getValueState ( representValue ) ;
76-
77- itemGroup . add ( new graphic . Text ( {
77+ const itemText = new graphic . Text ( {
7878 style : {
7979 x : itemAlign === 'right' ? - textGap : itemSize [ 0 ] + textGap ,
8080 y : itemSize [ 1 ] / 2 ,
@@ -83,9 +83,11 @@ class PiecewiseVisualMapView extends VisualMapView {
8383 align : itemAlign as TextAlign ,
8484 font : textFont ,
8585 fill : textFill ,
86- opacity : visualState === 'outOfRange' ? 0.5 : 1
86+ opacity : visualState === 'outOfRange' ? 0.5 : 1 ,
8787 }
88- } ) ) ;
88+ } ) ;
89+ itemText . silent = ! selectMode ;
90+ itemGroup . add ( itemText ) ;
8991 }
9092
9193 thisGroup . add ( itemGroup ) ;
@@ -199,15 +201,18 @@ class PiecewiseVisualMapView extends VisualMapView {
199201 private _createItemSymbol (
200202 group : graphic . Group ,
201203 representValue : number ,
202- shapeParam : number [ ]
204+ shapeParam : number [ ] ,
205+ selectMode : PiecewiseVisualMapOption [ 'selectedMode' ] ,
203206 ) {
204- group . add ( createSymbol (
207+ const itemSymbol = createSymbol (
205208 // symbol will be string
206209 this . getControllerVisual ( representValue , 'symbol' ) as string ,
207210 shapeParam [ 0 ] , shapeParam [ 1 ] , shapeParam [ 2 ] , shapeParam [ 3 ] ,
208211 // color will be string
209212 this . getControllerVisual ( representValue , 'color' ) as string
210- ) ) ;
213+ ) ;
214+ itemSymbol . silent = ! selectMode ;
215+ group . add ( itemSymbol ) ;
211216 }
212217
213218 private _onItemClick (
@@ -241,4 +246,4 @@ class PiecewiseVisualMapView extends VisualMapView {
241246 }
242247}
243248
244- export default PiecewiseVisualMapView ;
249+ export default PiecewiseVisualMapView ;
0 commit comments