mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-25 06:05:52 +02:00
tslint changes
This commit is contained in:
@@ -7,67 +7,67 @@ const FILLS = ['Orange', 'DodgerBlue', 'LimeGreen', 'Orchid', 'crimson', 'Aquama
|
||||
const OUTLINES = ['Chocolate', 'SteelBlue', 'ForestGreen', 'DarkOrchid', 'darkred', 'DarkTurquoise'];
|
||||
|
||||
@Directive({
|
||||
selector: '[setOutlineHidden]',
|
||||
selector: '[setOutlineHidden]',
|
||||
})
|
||||
export class SetOutlineHidden {
|
||||
@Input() setOutlineHidden = false;
|
||||
@Input() setOutlineHidden = false;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'set-selection',
|
||||
templateUrl: 'set-selection.pug',
|
||||
styleUrls: ['set-selection.scss'],
|
||||
selector: 'set-selection',
|
||||
templateUrl: 'set-selection.pug',
|
||||
styleUrls: ['set-selection.scss'],
|
||||
})
|
||||
export class SetSelection implements OnChanges {
|
||||
readonly exampleFills = FILLS;
|
||||
readonly exampleOutlines = OUTLINES;
|
||||
@Input() label?: string;
|
||||
@Input() base?: string;
|
||||
@Input() set?: SpriteSet<string>;
|
||||
@Input() sets?: ColorExtraSets;
|
||||
@Input() sprites?: ColorExtraSet;
|
||||
@Input() circle?: string;
|
||||
@Input() outlineHidden = false;
|
||||
@Input() nonLockable = false;
|
||||
@Input() compact = false;
|
||||
@Input() onlyPatterns = false;
|
||||
@Input() darken = true;
|
||||
@Output() change = new EventEmitter<void>();
|
||||
constructor(@Optional() private hidden: SetOutlineHidden) {
|
||||
}
|
||||
get isOutlineHidden() {
|
||||
return this.hidden ? this.hidden.setOutlineHidden : this.outlineHidden;
|
||||
}
|
||||
get patternColors() {
|
||||
const set = this.getSet();
|
||||
const pat = this.set && set && set[this.set.pattern || 0];
|
||||
readonly exampleFills = FILLS;
|
||||
readonly exampleOutlines = OUTLINES;
|
||||
@Input() label?: string;
|
||||
@Input() base?: string;
|
||||
@Input() set?: SpriteSet<string>;
|
||||
@Input() sets?: ColorExtraSets;
|
||||
@Input() sprites?: ColorExtraSet;
|
||||
@Input() circle?: string;
|
||||
@Input() outlineHidden = false;
|
||||
@Input() nonLockable = false;
|
||||
@Input() compact = false;
|
||||
@Input() onlyPatterns = false;
|
||||
@Input() darken = true;
|
||||
@Output() change = new EventEmitter<void>();
|
||||
constructor(@Optional() private hidden: SetOutlineHidden) {
|
||||
}
|
||||
get isOutlineHidden() {
|
||||
return this.hidden ? this.hidden.setOutlineHidden : this.outlineHidden;
|
||||
}
|
||||
get patternColors() {
|
||||
const set = this.getSet();
|
||||
const pat = this.set && set && set[this.set.pattern || 0];
|
||||
|
||||
if (pat && !pat.colors) {
|
||||
return 0;
|
||||
} else if (pat) {
|
||||
return getColorCount(pat);
|
||||
} else {
|
||||
return this.nonLockable ? 1 : 0;
|
||||
}
|
||||
}
|
||||
get showColorPatterns(): boolean {
|
||||
const type = this.set && this.set.type || 0;
|
||||
const set = this.sets && this.sets[type];
|
||||
return !!set && set.length > 1;
|
||||
}
|
||||
ngOnChanges() {
|
||||
this.sprites = this.sets ? this.sets.map(s => s ? s[0] : undefined) : undefined;
|
||||
}
|
||||
onChange() {
|
||||
const set = this.getSet();
|
||||
if (pat && !pat.colors) {
|
||||
return 0;
|
||||
} else if (pat) {
|
||||
return getColorCount(pat);
|
||||
} else {
|
||||
return this.nonLockable ? 1 : 0;
|
||||
}
|
||||
}
|
||||
get showColorPatterns(): boolean {
|
||||
const type = this.set && this.set.type || 0;
|
||||
const set = this.sets && this.sets[type];
|
||||
return !!set && set.length > 1;
|
||||
}
|
||||
ngOnChanges() {
|
||||
this.sprites = this.sets ? this.sets.map(s => s ? s[0] : undefined) : undefined;
|
||||
}
|
||||
onChange() {
|
||||
const set = this.getSet();
|
||||
|
||||
if (this.set && set) {
|
||||
this.set.pattern = clamp(this.set.pattern || 0, 0, set.length - 1);
|
||||
}
|
||||
if (this.set && set) {
|
||||
this.set.pattern = clamp(this.set.pattern || 0, 0, set.length - 1);
|
||||
}
|
||||
|
||||
this.change.emit();
|
||||
}
|
||||
private getSet(): ColorExtraSet | undefined {
|
||||
return this.set && this.sets && this.sets[this.set.type || 0];
|
||||
}
|
||||
this.change.emit();
|
||||
}
|
||||
private getSet(): ColorExtraSet | undefined {
|
||||
return this.set && this.sets && this.sets[this.set.type || 0];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user