* feat: 调整类型定义

* style: lint style
This commit is contained in:
YiQianYao 2022-03-23 19:37:57 +08:00 committed by GitHub
parent 2b914b30d5
commit ea286a7dfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 22 deletions

View File

@ -1,4 +1,4 @@
import { IModelUniform } from '@antv/l7-core';
import { ILayerConfig, IModelUniform } from '@antv/l7-core';
import BaseModel from '../../core/BaseModel';
import {
CanvasUpdateType,
@ -17,7 +17,9 @@ export default class CanvaModel extends BaseModel {
zIndex = 10,
update = CanvasUpdateType.ALWAYS,
animateOption = { enable: false, duration: 20 },
} = this.layer.getLayerConfig() as ICanvasLayerStyleOptions;
} = this.layer.getLayerConfig() as Partial<
ICanvasLayerStyleOptions & ILayerConfig
>;
if (+this.canvas.style.zIndex === zIndex) {
this.canvas.style.zIndex = zIndex + '';
}

View File

@ -1,12 +1,7 @@
import { IAnimateOption, IMapService } from '@antv/l7-core';
import { generateColorRamp, getMask, IColorRamp } from '@antv/l7-utils';
import { styleColor, styleOffset, styleSingle } from '../core/BaseModel';
import {
anchorType,
getGlyphQuads,
IGlyphQuad,
shapeText,
} from '../utils/symbol-layout';
import { IMapService } from '@antv/l7-core';
import { IColorRamp } from '@antv/l7-utils';
import { styleOffset, styleSingle } from '../core/BaseModel';
import { anchorType } from '../utils/symbol-layout';
export enum lineStyleType {
'solid' = 0.0,
'dash' = 1.0,
@ -75,7 +70,6 @@ export interface IPointLayerStyleOptions {
rotation?: number; // angle
speed?: number;
animateOption: IAnimateOption;
}
export interface IPolygonLayerStyleOptions {
@ -137,7 +131,6 @@ export interface ICanvasLayerStyleOptions {
zIndex: number;
update: CanvasUpdateType | string;
drawingOnCanvas: (option: IDrawingOnCanvas) => void;
animateOption: IAnimateOption;
}
export interface IHeatMapLayerStyleOptions {

View File

@ -1,4 +1,10 @@
import { AttributeType, gl, IEncodeFeature, IModel } from '@antv/l7-core';
import {
AttributeType,
gl,
IEncodeFeature,
ILayerConfig,
IModel,
} from '@antv/l7-core';
import { rgb2arr } from '@antv/l7-utils';
import { isNumber } from 'lodash';
import BaseModel from '../../core/BaseModel';
@ -33,7 +39,9 @@ export default class ExtrudeModel extends BaseModel {
},
lightEnable = true,
} = this.layer.getLayerConfig() as IPointLayerStyleOptions;
} = this.layer.getLayerConfig() as Partial<
ILayerConfig & IPointLayerStyleOptions
>;
if (
this.dataTextureTest &&
this.dataTextureNeedUpdate({
@ -134,7 +142,7 @@ export default class ExtrudeModel extends BaseModel {
const {
depth = true,
animateOption: { repeat = 1 },
} = this.layer.getLayerConfig() as IPointLayerStyleOptions;
} = this.layer.getLayerConfig() as ILayerConfig;
this.raiserepeat = repeat;
return [
this.layer.buildLayerModel({

View File

@ -5,6 +5,7 @@ import {
IAttribute,
IElements,
IEncodeFeature,
ILayerConfig,
IModel,
IModelUniform,
} from '@antv/l7-core';
@ -104,7 +105,7 @@ export default class FillModel extends BaseModel {
public getAnimateUniforms(): IModelUniform {
const {
animateOption = { enable: false },
} = this.layer.getLayerConfig() as IPointLayerStyleOptions;
} = this.layer.getLayerConfig() as ILayerConfig;
return {
u_aimate: this.animateOption2Array(animateOption),
u_time: this.layer.getLayerAnimateTime(),
@ -188,7 +189,9 @@ export default class FillModel extends BaseModel {
mask = false,
maskInside = true,
animateOption = { enable: false },
} = this.layer.getLayerConfig() as IPointLayerStyleOptions;
} = this.layer.getLayerConfig() as Partial<
ILayerConfig & IPointLayerStyleOptions
>;
const { frag, vert, type } = this.getShaders(animateOption);
// TODO: 判断当前的点图层的模型是普通地图模式还是地球模式
@ -214,7 +217,7 @@ export default class FillModel extends BaseModel {
* @returns
*/
public getShaders(
animateOption: IAnimateOption,
animateOption: Partial<IAnimateOption>,
): { frag: string; vert: string; type: string } {
if (animateOption.enable) {
switch (animateOption.type) {
@ -245,7 +248,7 @@ export default class FillModel extends BaseModel {
}
// overwrite baseModel func
protected animateOption2Array(option: IAnimateOption): number[] {
protected animateOption2Array(option: Partial<IAnimateOption>): number[] {
return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];
}
protected registerBuiltinAttributes() {

View File

@ -5,6 +5,7 @@ import {
IAttribute,
IElements,
IEncodeFeature,
ILayerConfig,
IModel,
IModelUniform,
} from '@antv/l7-core';
@ -96,7 +97,7 @@ export default class RadarModel extends BaseModel {
public getAnimateUniforms(): IModelUniform {
const {
animateOption = { enable: false },
} = this.layer.getLayerConfig() as IPointLayerStyleOptions;
} = this.layer.getLayerConfig() as ILayerConfig;
return {
u_aimate: this.animateOption2Array(animateOption),
u_time: this.layer.getLayerAnimateTime(),
@ -212,7 +213,7 @@ export default class RadarModel extends BaseModel {
}
// overwrite baseModel func
protected animateOption2Array(option: IAnimateOption): number[] {
protected animateOption2Array(option: Partial<IAnimateOption>): number[] {
return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];
}
protected registerBuiltinAttributes() {