File tree Expand file tree Collapse file tree 3 files changed +482
-428
lines changed Expand file tree Collapse file tree 3 files changed +482
-428
lines changed Original file line number Diff line number Diff line change @@ -302,6 +302,14 @@ class MapDraw {
302
302
? mapOrGeoModel . getRegionModel ( regionName )
303
303
: ( data ? data . getItemModel ( dataIdx ) as Model < MapDataItemOption > : null ) ;
304
304
305
+ // allow specified itemStyle in GeoJSON data
306
+ const regionItemStyle = region . properties && region . properties . itemStyle ;
307
+ if ( regionItemStyle ) {
308
+ const regionModelOption = regionModel . option ;
309
+ const modelItemStyle = regionModelOption . itemStyle || ( regionModelOption . itemStyle = { } ) ;
310
+ modelItemStyle && zrUtil . defaults ( modelItemStyle , regionItemStyle ) ;
311
+ }
312
+
305
313
regionsInfoByName . set ( regionName , { dataIdx, regionModel } ) ;
306
314
}
307
315
Original file line number Diff line number Diff line change @@ -23,8 +23,9 @@ import * as vec2 from 'zrender/src/core/vector';
23
23
import * as polygonContain from 'zrender/src/contain/polygon' ;
24
24
import { GeoJSON , GeoProjection , GeoSVGGraphicRoot } from './geoTypes' ;
25
25
import * as matrix from 'zrender/src/core/matrix' ;
26
- import Element from 'zrender/src/Element' ;
26
+ import type Element from 'zrender/src/Element' ;
27
27
import { each } from 'zrender/src/core/util' ;
28
+ import type { GeoItemStyleOption } from './GeoModel' ;
28
29
29
30
const TMP_TRANSFORM = [ ] as number [ ] ;
30
31
@@ -135,7 +136,9 @@ export class GeoJSONRegion extends Region {
135
136
readonly geometries : ( GeoJSONPolygonGeometry | GeoJSONLineStringGeometry ) [ ] ;
136
137
137
138
// Injected outside.
138
- properties : GeoJSON [ 'features' ] [ 0 ] [ 'properties' ] ;
139
+ properties : GeoJSON [ 'features' ] [ 0 ] [ 'properties' ] & {
140
+ itemStyle ?: GeoItemStyleOption
141
+ } ;
139
142
140
143
constructor (
141
144
name : string ,
You can’t perform that action at this time.
0 commit comments