fix: layer style storkeColor->stroke

This commit is contained in:
thinkinggis 2019-12-26 00:16:33 +08:00
parent ae1e0fafaa
commit 40851dabb9
10 changed files with 19 additions and 23 deletions

View File

@ -73,7 +73,8 @@ module.exports = [
'isFunction',
'cloneDeep',
'isString',
'isNumber'
'isNumber',
'merge'
]
}
}),

View File

@ -14,7 +14,7 @@ export interface ICircleVertex {
color: number[];
radius: number;
opacity: number;
strokeColor: number[];
stroke: number[];
strokeWidth: number;
strokeOpacity: number;
}
@ -68,7 +68,7 @@ export function packCircleVertex(
tileY,
shape,
opacity, // packed buffer1
strokeColor,
stroke,
strokeWidth,
strokeOpacity, // packed buffer2
} = props;
@ -81,8 +81,8 @@ export function packCircleVertex(
packUint8ToFloat(color[2], color[3]),
];
const packedStrokeColor: [number, number] = [
packUint8ToFloat(strokeColor[0], strokeColor[1]),
packUint8ToFloat(strokeColor[2], strokeColor[3]),
packUint8ToFloat(stroke[0], stroke[1]),
packUint8ToFloat(stroke[2], stroke[3]),
];
[

View File

@ -55,7 +55,7 @@ let layerIdCounter = 0;
export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
implements ILayer {
public id: string = `${layerIdCounter++}`;
public name: string;
public name: string = `${layerIdCounter++}`;
public type: string;
public visible: boolean = true;
public zIndex: number = 0;

View File

@ -1,4 +1,4 @@
export const enum lineStyleType {
export enum lineStyleType {
'solid' = 0.0,
'dash' = 1.0,
}
@ -9,8 +9,3 @@ export interface ILineLayerStyleOptions {
dashArray?: [number, number];
segmentNumber: number;
}
export const lineStyleObj: { [key: string]: number } = {
solid: 0.0,
dash: 1.0,
};

View File

@ -21,12 +21,12 @@ export default class ConfigSchemaValidationPlugin implements ILayerPlugin {
public apply(layer: ILayer) {
layer.hooks.init.tap('ConfigSchemaValidationPlugin', () => {
this.configService.registerLayerConfigSchemaValidator(
layer.name,
layer.name as string,
layer.getConfigSchemaForValidation(),
);
const { valid, errorText } = this.configService.validateLayerConfig(
layer.name,
layer.name as string,
layer.getLayerConfig(),
);

View File

@ -4,7 +4,7 @@ import PointModels, { PointType } from './models/index';
interface IPointLayerStyleOptions {
opacity: number;
strokeWidth: number;
strokeColor: string;
stroke: string;
}
export default class PointLayer extends BaseLayer<IPointLayerStyleOptions> {
public type: string = 'PointLayer';

View File

@ -15,19 +15,19 @@ import pointFillVert from '../shaders/fill_vert.glsl';
interface IPointLayerStyleOptions {
opacity: number;
strokeWidth: number;
strokeColor: string;
stroke: string;
}
export default class FillModel extends BaseModel {
public getUninforms(): IModelUniform {
const {
opacity = 1,
strokeColor = 'rgb(0,0,0,0)',
stroke = 'rgb(0,0,0,0)',
strokeWidth = 1,
} = this.layer.getLayerConfig() as IPointLayerStyleOptions;
return {
u_opacity: opacity,
u_stroke_width: strokeWidth,
u_stroke_color: rgb2arr(strokeColor),
u_stroke_color: rgb2arr(stroke),
};
}

View File

@ -16,7 +16,7 @@ import normalVert from '../shaders/normal_vert.glsl';
interface IPointLayerStyleOptions {
opacity: number;
strokeWidth: number;
strokeColor: string;
stroke: string;
}
export function PointTriangulation(feature: IEncodeFeature) {
const coordinates = feature.coordinates as number[];
@ -36,13 +36,13 @@ export default class NormalModel extends BaseModel {
public getUninforms(): IModelUniform {
const {
opacity = 1,
strokeColor = 'rgb(0,0,0,0)',
stroke = 'rgb(0,0,0,0)',
strokeWidth = 1,
} = this.layer.getLayerConfig() as IPointLayerStyleOptions;
return {
u_opacity: opacity,
u_stroke_width: strokeWidth,
u_stroke_color: rgb2arr(strokeColor),
u_stroke_color: rgb2arr(stroke),
};
}
public buildModels(): IModel[] {

View File

@ -34,7 +34,7 @@ void main() {
float antialiasblur = 1.0 / (a_Size + u_stroke_width);
// construct point coords
v_data = vec4(extrude, antialiasblur, );
v_data = vec4(extrude, antialiasblur,shape_type);
setPickingColor(a_PickingColor);
}

View File

@ -48,7 +48,7 @@ export default class DataUpdate extends React.Component {
.active(false)
.color('#2F54EB')
.style({
strokeColor: '#fff',
stroke: '#fff',
strokeWidth: 2,
opacity: 1,
});