Fix scale update diff (#1576)

* feat: scale update

* docs: scale/filter document

* docs: this image is missing a text alternative

* fix: add scale options diff

* fix: lint error
This commit is contained in:
@thinkinggis 2023-01-16 16:57:51 +08:00 committed by GitHub
parent cefe7a71ed
commit 56b22369ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -664,6 +664,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
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<ChildLayerStyleOptions = {}>
} 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);
}