Skip to content

Commit

Permalink
chore: 给复合图层显隐方法类型补充
Browse files Browse the repository at this point in the history
  • Loading branch information
lvisei committed Oct 25, 2022
1 parent a5760be commit 000dabb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/composite-layers/src/core/composite-layer.ts
@@ -1,4 +1,4 @@
import { uniqueId } from '@antv/util';
import { isUndefined, uniqueId } from '@antv/util';
import EventEmitter from '@antv/event-emitter';
import { ILegend, Source } from '@antv/l7';
import { deepMergeLayerOptions, isSourceChanged } from '../utils';
Expand Down Expand Up @@ -288,7 +288,7 @@ export abstract class CompositeLayer<O extends CompositeLayerOptions> extends Ev
* 图层是否可见
*/
public isVisible() {
return this.layer.inited ? this.layer.isVisible() : this.options.visible;
return this.layer.inited ? this.layer.isVisible() : isUndefined(this.options.visible) ? true : this.options.visible;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/composite-layers/src/core/core-layer.ts
Expand Up @@ -351,7 +351,7 @@ export abstract class CoreLayer<O extends CoreLayerOptions> extends EventEmitter
* 图层是否可见
*/
public isVisible() {
return this.layer.inited ? this.layer.isVisible() : this.options.visible || false;
return this.layer.inited ? this.layer.isVisible() : isUndefined(this.options.visible) ? true : this.options.visible;
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/composite-layers/src/types/interface.ts
Expand Up @@ -91,6 +91,7 @@ export interface ICompositeLayer {
show(): void;
hide(): void;
toggleVisible(): void;
isVisible(): boolean;

setIndex(zIndex: number): void;
setMinZoom(minZoom: number): void;
Expand Down

0 comments on commit 000dabb

Please sign in to comment.