Skip to content

Commit fd751a1

Browse files
sersishen荊芥
and
荊芥
authored
fix: 提供customMappingField能力,只对color生效 (#3850)
Co-authored-by: 荊芥 <[email protected]>
1 parent e2aa10c commit fd751a1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/adaptor/geometries/base.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export type Geometry = {
4646
readonly rawFields?: RawFields;
4747
/** 图形映射规则 */
4848
readonly mapping?: MappingOptions;
49+
/** 自定义映射字段 */
50+
readonly customMappingField?: string;
4951
/** label 映射通道,因为历史原因导致实现略有区别 */
5052
readonly label?: Label;
5153
/** 不同状态的样式 */
@@ -156,6 +158,7 @@ export function geometry<O extends GeometryOptions>(params: Params<O>): Params<O
156158
label,
157159
state,
158160
customInfo,
161+
customMappingField,
159162
} = options;
160163

161164
// 如果没有 mapping 信息,那么直接返回
@@ -179,7 +182,7 @@ export function geometry<O extends GeometryOptions>(params: Params<O>): Params<O
179182
colorField ? geometry.color(colorField, color) : geometry.color(color);
180183
} else if (isFunction(color)) {
181184
const { mappingFields, tileMappingField } = getMappingField(options, 'color');
182-
geometry.color(tileMappingField, getMappingFunction(mappingFields, color));
185+
geometry.color(customMappingField || tileMappingField, getMappingFunction(mappingFields, color));
183186
} else {
184187
colorField && geometry.color(colorField, color);
185188
}

0 commit comments

Comments
 (0)