mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Dragging features from one adversary to another (#788)
This commit is contained in:
parent
5359455050
commit
f81d0d250f
4 changed files with 33 additions and 6 deletions
|
|
@ -1899,6 +1899,7 @@
|
|||
"difficulty": "Difficulty",
|
||||
"downtime": "Downtime",
|
||||
"dropActorsHere": "Drop Actors here",
|
||||
"dropFeaturesHere": "Drop Features here",
|
||||
"duality": "Duality",
|
||||
"dualityRoll": "Duality Roll",
|
||||
"enabled": "Enabled",
|
||||
|
|
|
|||
|
|
@ -98,11 +98,17 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
|
|||
|
||||
async _onDrop(event) {
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
if (data.fromInternal) return;
|
||||
|
||||
|
||||
const item = await fromUuid(data.uuid);
|
||||
if (item.type === 'feature') {
|
||||
await this.actor.createEmbeddedDocuments('Item', [item]);
|
||||
if (item?.type === 'feature') {
|
||||
if (data.fromInternal && item.parent?.uuid === this.actor.uuid) {
|
||||
return;
|
||||
}
|
||||
|
||||
const itemData = item.toObject();
|
||||
delete itemData._id;
|
||||
|
||||
await this.actor.createEmbeddedDocuments('Item', [itemData]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,14 @@
|
|||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.feature-list {
|
||||
.feature-list,
|
||||
.features-dragger {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
font-family: @font-body;
|
||||
}
|
||||
|
||||
.feature-list {
|
||||
flex-direction: column;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<legend>{{localize tabs.features.label}}</legend>
|
||||
<ul class="feature-list">
|
||||
{{#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="">
|
||||
<div class="label">
|
||||
<span>{{feature.name}}</span>
|
||||
|
|
@ -22,5 +22,8 @@
|
|||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
<div class="features-dragger">
|
||||
{{localize "DAGGERHEART.GENERAL.dropFeaturesHere"}}
|
||||
</div>
|
||||
</fieldset>
|
||||
</section>
|
||||
Loading…
Add table
Add a link
Reference in a new issue