opt-cc/static/src/app/pub/decoration-overview/decoration-panel/decoration-panel.component.ts

39 lines
932 B
TypeScript

import {Component, EventEmitter, Input, Output} from '@angular/core';
import {Decoration} from '../../../models/model-interfaces';
import {Fraction} from '../../../utils/fraction.enum';
@Component({
selector: 'cc-decoration-panel',
templateUrl: './decoration-panel.component.html',
styleUrls: ['./decoration-panel.component.scss']
})
export class DecorationPanelComponent {
@Input() decoration: Decoration;
@Output() select = new EventEmitter();
readonly fraction = Fraction;
getColor(fractionKey) {
switch (fractionKey) {
case 'ARF':
return this.fraction.COLOR_ARF;
case 'SWORD':
return this.fraction.COLOR_SWORD;
case 'BLUFOR':
return this.fraction.COLOR_BLUFOR;
case 'OPFOR':
return this.fraction.COLOR_OPFOR;
default:
return this.fraction.COLOR_NEUTRAL;
}
}
selectDecoration() {
this.select.emit(this.decoration);
}
}