Skip to content

Commit

Permalink
[fix] 补充isPaintKey判断
Browse files Browse the repository at this point in the history
review by huzhipeng
  • Loading branch information
MyShallowTime committed Oct 12, 2023
1 parent c607483 commit 5640c5b
Show file tree
Hide file tree
Showing 2 changed files with 247 additions and 29 deletions.
139 changes: 124 additions & 15 deletions src/mapboxgl/overlay/symbol/SymbolUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,38 +174,147 @@ export function validateSymbol(symbol) {
return validateStyleKey(s.paint || {}) && validateStyleKey(s.layout || {});
});
}

// 来源于 mapboxgl.AnyPaint
export const isPaintKey = (key) => {
return [
'icon-color',
'icon-opacity',
'icon-translate',
// BackgroundPaint
'background-color',
'background-color-transition',
'background-pattern',
'background-pattern-transition',
'background-opacity',
'background-opacity-transition',
// FillPaint
'fill-antialias',
'fill-opacity',
'fill-opacity-transition',
'fill-color',
'fill-color-transition',
'fill-outline-color',
'fill-outline-color-transition',
'fill-translate',
'fill-translate-transition',
'fill-translate-anchor',
'fill-pattern',
'fill-pattern-transition',
// FillExtrusionPaint
'fill-extrusion-opacity',
'fill-extrusion-opacity-transition',
'fill-extrusion-color',
'fill-extrusion-color-transition',
'fill-extrusion-translate',
'fill-extrusion-translate-transition',
'fill-extrusion-translate-anchor',
'fill-extrusion-pattern',
'fill-extrusion-pattern-transition',
'fill-extrusion-height',
'fill-extrusion-height-transition',
'fill-extrusion-base',
'fill-extrusion-base-transition',
'fill-extrusion-vertical-gradient',
// LinePaint
'line-opacity',
'line-blur',
'line-translate',
'line-opacity-transition',
'line-color',
'line-color-transition',
'line-translate',
'line-translate-transition',
'line-translate-anchor',
'line-width',
'line-width-transition',
'line-gap-width',
'line-gap-width-transition',
'line-offset',
'line-offset-transition',
'line-blur',
'line-blur-transition',
'line-dasharray',
'line-dasharray-transition',
'line-pattern',
'fill-color',
'fill-opacity',
'fill-pattern',
'fill-outline-color',
'line-pattern-transition',
'line-gradient',
// SymbolPaint
'icon-opacity',
'icon-opacity-transition',
'icon-color',
'icon-color-transition',
'icon-halo-color',
'icon-halo-color-transition',
'icon-halo-width',
'icon-halo-width-transition',
'icon-halo-blur',
'icon-halo-blur-transition',
'icon-translate',
'icon-translate-transition',
'icon-translate-anchor',
'text-opacity',
'text-opacity-transition',
'text-color',
'text-halo-blur',
'text-color-transition',
'text-halo-color',
'text-halo-color-transition',
'text-halo-width',
'text-opacity',
'text-halo-width-transition',
'text-halo-blur',
'text-halo-blur-transition',
'text-translate',
'text-translate-transition',
'text-translate-anchor',
'circle-blur',
// RasterPaint
'raster-opacity',
'raster-opacity-transition',
'raster-hue-rotate',
'raster-hue-rotate-transition',
'raster-brightness-min',
'raster-brightness-min-transition',
'raster-brightness-max',
'raster-brightness-max-transition',
'raster-saturation',
'raster-saturation-transition',
'raster-contrast',
'raster-contrast-transition',
'raster-fade-duration',
'raster-resampling',
'circle-sort-key',
// CirclePaint
'circle-radius',
'circle-radius-transition',
'circle-color',
'circle-color-transition',
'circle-blur',
'circle-blur-transition',
'circle-opacity',
'circle-opacity-transition',
'circle-translate',
'circle-radius',
'circle-translate-transition',
'circle-translate-anchor',
'circle-pitch-scale',
'circle-pitch-alignment',
'circle-stroke-width',
'circle-stroke-width-transition',
'circle-stroke-color',
'circle-stroke-color-transition',
'circle-stroke-opacity',
'circle-stroke-width'
'circle-stroke-opacity-transition',
// HeatmapPaint
'heatmap-radius',
'heatmap-radius-transition',
'heatmap-weight',
'heatmap-intensity',
'heatmap-intensity-transition',
'heatmap-color',
'heatmap-opacity',
'heatmap-opacity-transition',
// HillshadePaint
'hillshade-illumination-direction',
'hillshade-illumination-anchor',
'hillshade-exaggeration',
'hillshade-exaggeration-transition',
'hillshade-shadow-color',
'hillshade-shadow-color-transition',
'hillshade-highlight-color',
'hillshade-highlight-color-transition',
'hillshade-accent-color',
'hillshade-accent-color-transition'
].includes(key);
}
137 changes: 123 additions & 14 deletions src/maplibregl/overlay/symbol/SymbolUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,35 +177,144 @@ export function validateSymbol(symbol) {

export const isPaintKey = (key) => {
return [
'icon-color',
'icon-opacity',
'icon-translate',
// BackgroundPaint
'background-color',
'background-color-transition',
'background-pattern',
'background-pattern-transition',
'background-opacity',
'background-opacity-transition',
// FillPaint
'fill-antialias',
'fill-opacity',
'fill-opacity-transition',
'fill-color',
'fill-color-transition',
'fill-outline-color',
'fill-outline-color-transition',
'fill-translate',
'fill-translate-transition',
'fill-translate-anchor',
'fill-pattern',
'fill-pattern-transition',
// FillExtrusionPaint
'fill-extrusion-opacity',
'fill-extrusion-opacity-transition',
'fill-extrusion-color',
'fill-extrusion-color-transition',
'fill-extrusion-translate',
'fill-extrusion-translate-transition',
'fill-extrusion-translate-anchor',
'fill-extrusion-pattern',
'fill-extrusion-pattern-transition',
'fill-extrusion-height',
'fill-extrusion-height-transition',
'fill-extrusion-base',
'fill-extrusion-base-transition',
'fill-extrusion-vertical-gradient',
// LinePaint
'line-opacity',
'line-blur',
'line-translate',
'line-opacity-transition',
'line-color',
'line-color-transition',
'line-translate',
'line-translate-transition',
'line-translate-anchor',
'line-width',
'line-width-transition',
'line-gap-width',
'line-gap-width-transition',
'line-offset',
'line-offset-transition',
'line-blur',
'line-blur-transition',
'line-dasharray',
'line-dasharray-transition',
'line-pattern',
'fill-color',
'fill-opacity',
'fill-pattern',
'fill-outline-color',
'line-pattern-transition',
'line-gradient',
// SymbolPaint
'icon-opacity',
'icon-opacity-transition',
'icon-color',
'icon-color-transition',
'icon-halo-color',
'icon-halo-color-transition',
'icon-halo-width',
'icon-halo-width-transition',
'icon-halo-blur',
'icon-halo-blur-transition',
'icon-translate',
'icon-translate-transition',
'icon-translate-anchor',
'text-opacity',
'text-opacity-transition',
'text-color',
'text-halo-blur',
'text-color-transition',
'text-halo-color',
'text-halo-color-transition',
'text-halo-width',
'text-opacity',
'text-halo-width-transition',
'text-halo-blur',
'text-halo-blur-transition',
'text-translate',
'text-translate-transition',
'text-translate-anchor',
'circle-blur',
// RasterPaint
'raster-opacity',
'raster-opacity-transition',
'raster-hue-rotate',
'raster-hue-rotate-transition',
'raster-brightness-min',
'raster-brightness-min-transition',
'raster-brightness-max',
'raster-brightness-max-transition',
'raster-saturation',
'raster-saturation-transition',
'raster-contrast',
'raster-contrast-transition',
'raster-fade-duration',
'raster-resampling',
'circle-sort-key',
// CirclePaint
'circle-radius',
'circle-radius-transition',
'circle-color',
'circle-color-transition',
'circle-blur',
'circle-blur-transition',
'circle-opacity',
'circle-opacity-transition',
'circle-translate',
'circle-radius',
'circle-translate-transition',
'circle-translate-anchor',
'circle-pitch-scale',
'circle-pitch-alignment',
'circle-stroke-width',
'circle-stroke-width-transition',
'circle-stroke-color',
'circle-stroke-color-transition',
'circle-stroke-opacity',
'circle-stroke-width'
'circle-stroke-opacity-transition',
// HeatmapPaint
'heatmap-radius',
'heatmap-radius-transition',
'heatmap-weight',
'heatmap-intensity',
'heatmap-intensity-transition',
'heatmap-color',
'heatmap-opacity',
'heatmap-opacity-transition',
// HillshadePaint
'hillshade-illumination-direction',
'hillshade-illumination-anchor',
'hillshade-exaggeration',
'hillshade-exaggeration-transition',
'hillshade-shadow-color',
'hillshade-shadow-color-transition',
'hillshade-highlight-color',
'hillshade-highlight-color-transition',
'hillshade-accent-color',
'hillshade-accent-color-transition'
].includes(key);
}

0 comments on commit 5640c5b

Please sign in to comment.