diff --git a/packages/layers/src/core/BaseLayer.ts b/packages/layers/src/core/BaseLayer.ts index 14feb807d5..866e558a73 100644 --- a/packages/layers/src/core/BaseLayer.ts +++ b/packages/layers/src/core/BaseLayer.ts @@ -664,6 +664,7 @@ export default class BaseLayer return this; } public scale(field: string | number | IScaleOptions, cfg?: IScale) { + const preOption = { ...this.scaleOptions }; if (isObject(field)) { this.scaleOptions = { ...this.scaleOptions, @@ -672,7 +673,7 @@ export default class BaseLayer } else { this.scaleOptions[field] = cfg; } - if (this.styleAttributeService) { + if (this.styleAttributeService && !isEqual(preOption, this.scaleOptions)) { const scaleOptions = isObject(field) ? field : { [field]: cfg }; this.styleAttributeService.updateScaleAttribute(scaleOptions); }