diff --git a/src/app/app.icons.ts b/src/app/app.icons.ts index 9d8cf07..62f97c7 100644 --- a/src/app/app.icons.ts +++ b/src/app/app.icons.ts @@ -2,6 +2,7 @@ import { heroArrowDownOnSquare, heroArrowPathRoundedSquare, heroArrowsRightLeft, + heroArrowTopRightOnSquare, heroDocumentDuplicate, heroDocumentText, heroFaceFrown, @@ -24,4 +25,5 @@ export const appIcons = { heroFaceFrown, heroFaceSmile, heroArrowPathRoundedSquare, + heroArrowTopRightOnSquare, }; diff --git a/src/app/shared/components/input-sprite/input-sprite.component.html b/src/app/shared/components/input-sprite/input-sprite.component.html index 5792e15..c8cfe2f 100644 --- a/src/app/shared/components/input-sprite/input-sprite.component.html +++ b/src/app/shared/components/input-sprite/input-sprite.component.html @@ -1,12 +1,37 @@
- + -
+
+ Sprite - Sprite +
+ + + + \ No newline at end of file diff --git a/src/app/shared/components/input-sprite/input-sprite.component.ts b/src/app/shared/components/input-sprite/input-sprite.component.ts index 9c0fa3b..51904bf 100644 --- a/src/app/shared/components/input-sprite/input-sprite.component.ts +++ b/src/app/shared/components/input-sprite/input-sprite.component.ts @@ -1,4 +1,12 @@ -import { Component, computed, input, model } from '@angular/core'; +import { + Component, + computed, + ElementRef, + input, + model, + signal, + viewChild, +} from '@angular/core'; @Component({ selector: 'app-input-sprite', @@ -9,4 +17,29 @@ export class InputSpriteComponent { public sprite = model.required(); public type = input<'creatures' | 'items'>('items'); public step = computed(() => (this.type() === 'creatures' ? 5 : 1)); + + public pickerSprite = signal(0); + + public iconPicker = viewChild>('iconPicker'); + + public readonly maxSpriteCount = { + items: 1057, + creatures: 1875, + }; + + public iconArray = computed(() => + Array(this.maxSpriteCount[this.type()]) + .fill(0) + .map((_, i) => i) + .filter((i) => i % this.step() === 0) + ); + + changeIcon() { + this.pickerSprite.set(this.sprite()); + this.iconPicker()?.nativeElement.showModal(); + } + + confirmNewIcon(newIcon: number) { + this.sprite.set(newIcon); + } }