Browse Source

UI: Refactoring ColorProcessor fromSettings function

pull/10557/head
Vladyslav_Prykhodko 2 years ago
parent
commit
5ca5ce92f5
  1. 17
      ui-ngx/src/app/shared/models/widget-settings.models.ts

17
ui-ngx/src/app/shared/models/widget-settings.models.ts

@ -361,19 +361,10 @@ export interface ColorProcessorSettings {
export abstract class ColorProcessor {
static fromSettings(color: ColorSettings, ctx?: WidgetContext): ColorProcessor {
const settings = color || constantColor(null);
switch (settings.type) {
case ColorType.constant:
return new ConstantColorProcessor(settings);
case ColorType.range:
return new RangeColorProcessor(settings, ctx);
case ColorType.function:
return new FunctionColorProcessor(settings);
case ColorType.gradient:
return new GradientColorProcessor(settings, ctx);
default:
return new ConstantColorProcessor(settings);
}
return ColorProcessor.fromColorProcessingSettings({
settings: color,
ctx
});
}
static fromColorProcessingSettings(setting: ColorProcessorSettings): ColorProcessor {

Loading…
Cancel
Save