Dragging features from one adversary to another (#788)

This commit is contained in:
Josh Q. 2025-08-10 14:18:01 -04:00 committed by GitHub
parent 5359455050
commit f81d0d250f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 6 deletions

View file

@ -1899,6 +1899,7 @@
"difficulty": "Difficulty", "difficulty": "Difficulty",
"downtime": "Downtime", "downtime": "Downtime",
"dropActorsHere": "Drop Actors here", "dropActorsHere": "Drop Actors here",
"dropFeaturesHere": "Drop Features here",
"duality": "Duality", "duality": "Duality",
"dualityRoll": "Duality Roll", "dualityRoll": "Duality Roll",
"enabled": "Enabled", "enabled": "Enabled",

View file

@ -98,11 +98,17 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
async _onDrop(event) { async _onDrop(event) {
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event); const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
if (data.fromInternal) return;
const item = await fromUuid(data.uuid); const item = await fromUuid(data.uuid);
if (item.type === 'feature') { if (item?.type === 'feature') {
await this.actor.createEmbeddedDocuments('Item', [item]); if (data.fromInternal && item.parent?.uuid === this.actor.uuid) {
return;
}
const itemData = item.toObject();
delete itemData._id;
await this.actor.createEmbeddedDocuments('Item', [itemData]);
} }
} }
} }

View file

@ -14,8 +14,14 @@
margin-bottom: 12px; margin-bottom: 12px;
} }
.feature-list { .feature-list,
.features-dragger {
display: flex; display: flex;
width: 100%;
font-family: @font-body;
}
.feature-list {
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
@ -45,5 +51,16 @@
} }
} }
} }
.features-dragger {
align-items: center;
justify-content: center;
box-sizing: border-box;
height: 40px;
margin-top: 10px;
border: 1px dashed light-dark(@dark-blue-50, @beige-50);
border-radius: 3px;
color: light-dark(@dark-blue-50, @beige-50);
}
} }
} }

View file

@ -10,7 +10,7 @@
<legend>{{localize tabs.features.label}}</legend> <legend>{{localize tabs.features.label}}</legend>
<ul class="feature-list"> <ul class="feature-list">
{{#each document.system.features as |feature|}} {{#each document.system.features as |feature|}}
<li class="feature-item" id="{{feature.id}}"> <li class="feature-item" id="{{feature.id}}" draggable="true">
<img src="{{feature.img}}" alt=""> <img src="{{feature.img}}" alt="">
<div class="label"> <div class="label">
<span>{{feature.name}}</span> <span>{{feature.name}}</span>
@ -22,5 +22,8 @@
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
<div class="features-dragger">
{{localize "DAGGERHEART.GENERAL.dropFeaturesHere"}}
</div>
</fieldset> </fieldset>
</section> </section>