Ajout de drag'n drop là ou c'est possible ; ajout de l'import des ennemis depuis foundryVTT
This commit is contained in:
@@ -43,7 +43,9 @@
|
||||
<label>{{ 'sceneEdit.battlemapLabel' | translate }}</label>
|
||||
<small class="field-hint">{{ 'sceneEdit.battlemapHint' | translate }}</small>
|
||||
|
||||
<div class="battlemap-slot">
|
||||
<div class="battlemap-slot"
|
||||
appFileDrop [dropDisabled]="battlemapUploadingMedia"
|
||||
(filesDropped)="onBattlemapMediaDropped($event)">
|
||||
<span class="battlemap-slot-label">{{ 'sceneEdit.battlemapMedia' | translate }}</span>
|
||||
@if (battlemapMediaFileId) {
|
||||
<span class="battlemap-file">{{ battlemapMediaName || ('sceneEdit.battlemapAttached' | translate) }}</span>
|
||||
@@ -58,7 +60,9 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="battlemap-slot">
|
||||
<div class="battlemap-slot"
|
||||
appFileDrop [dropDisabled]="battlemapUploadingData"
|
||||
(filesDropped)="onBattlemapDataDropped($event)">
|
||||
<span class="battlemap-slot-label">{{ 'sceneEdit.battlemapData' | translate }}</span>
|
||||
@if (battlemapDataFileId) {
|
||||
<span class="battlemap-file">{{ battlemapDataName || ('sceneEdit.battlemapAttached' | translate) }}</span>
|
||||
|
||||
@@ -8,7 +8,15 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.5rem 0;
|
||||
padding: 0.5rem 0.5rem;
|
||||
border: 1px dashed transparent;
|
||||
border-radius: 6px;
|
||||
transition: border-color 0.15s, background 0.15s;
|
||||
|
||||
&.drag-over {
|
||||
border-color: #6c63ff;
|
||||
background: #1f1f3a;
|
||||
}
|
||||
|
||||
.battlemap-slot-label {
|
||||
min-width: 160px;
|
||||
|
||||
@@ -26,6 +26,7 @@ import { AiChatDrawerComponent } from '../../../shared/ai-chat-drawer/ai-chat-dr
|
||||
import { ImageGalleryComponent } from '../../../shared/image-gallery/image-gallery.component';
|
||||
import { IconPickerComponent } from '../../../shared/icon-picker/icon-picker.component';
|
||||
import { RoomsEditorComponent } from '../../../shared/rooms-editor/rooms-editor.component';
|
||||
import { FileDropDirective } from '../../../shared/file-drop.directive';
|
||||
import { CAMPAIGN_ICON_OPTIONS } from '../../campaign-icons';
|
||||
import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dialog.service';
|
||||
|
||||
@@ -35,7 +36,7 @@ import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dia
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-scene-edit',
|
||||
imports: [ReactiveFormsModule, LucideAngularModule, ExpandableSectionComponent, LoreLinkPickerComponent, EnemyLinkPickerComponent, AiChatDrawerComponent, ImageGalleryComponent, IconPickerComponent, RoomsEditorComponent, TranslatePipe],
|
||||
imports: [ReactiveFormsModule, LucideAngularModule, ExpandableSectionComponent, LoreLinkPickerComponent, EnemyLinkPickerComponent, AiChatDrawerComponent, ImageGalleryComponent, IconPickerComponent, RoomsEditorComponent, FileDropDirective, TranslatePipe],
|
||||
templateUrl: './scene-edit.component.html',
|
||||
styleUrls: ['./scene-edit.component.scss']
|
||||
})
|
||||
@@ -282,7 +283,15 @@ export class SceneEditComponent implements OnInit, OnDestroy {
|
||||
onBattlemapMediaSelected(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
if (!file) return;
|
||||
if (file) this.uploadBattlemapMedia(file);
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
onBattlemapMediaDropped(files: File[]): void {
|
||||
if (files[0]) this.uploadBattlemapMedia(files[0]);
|
||||
}
|
||||
|
||||
private uploadBattlemapMedia(file: File): void {
|
||||
this.battlemapUploadingMedia = true;
|
||||
this.storedFileService.upload(file).subscribe({
|
||||
next: f => {
|
||||
@@ -292,13 +301,20 @@ export class SceneEditComponent implements OnInit, OnDestroy {
|
||||
},
|
||||
error: () => { this.battlemapUploadingMedia = false; }
|
||||
});
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
onBattlemapDataSelected(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
if (!file) return;
|
||||
if (file) this.uploadBattlemapData(file);
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
onBattlemapDataDropped(files: File[]): void {
|
||||
if (files[0]) this.uploadBattlemapData(files[0]);
|
||||
}
|
||||
|
||||
private uploadBattlemapData(file: File): void {
|
||||
this.battlemapUploadingData = true;
|
||||
this.storedFileService.upload(file).subscribe({
|
||||
next: f => {
|
||||
@@ -308,7 +324,6 @@ export class SceneEditComponent implements OnInit, OnDestroy {
|
||||
},
|
||||
error: () => { this.battlemapUploadingData = false; }
|
||||
});
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
removeBattlemapMedia(): void {
|
||||
|
||||
Reference in New Issue
Block a user