mirror of https://gitee.com/antv-l7/antv-l7
feat: 调整线图层纹理监听控制逻辑
This commit is contained in:
parent
8a8a0ab71b
commit
baaced6f63
|
@ -31,6 +31,7 @@ const lineStyleObj: { [key: string]: number } = {
|
|||
dash: 1.0,
|
||||
};
|
||||
export default class LineModel extends BaseModel {
|
||||
private textureListenService: undefined | any;
|
||||
protected texture: ITexture2D = this.createTexture2D({
|
||||
data: [0,0,0,0],
|
||||
mag: gl.NEAREST,
|
||||
|
@ -163,8 +164,10 @@ export default class LineModel extends BaseModel {
|
|||
public async initModels():Promise<IModel[]>{
|
||||
this.updateTexture();
|
||||
// Tip: keep updateTexture listen only once
|
||||
this.iconService.off('imageUpdate', this.updateTexture);
|
||||
this.iconService.on('imageUpdate', this.updateTexture);
|
||||
if(!this.textureListenService) {
|
||||
this.textureListenService = this.iconService.on('imageUpdate', this.updateTexture);
|
||||
}
|
||||
|
||||
return await this.buildModels();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue