mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Dragging features from one adversary to another
This commit is contained in:
parent
300719c116
commit
b3bb7867ab
4 changed files with 33 additions and 6 deletions
|
|
@ -1898,6 +1898,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",
|
||||||
|
|
|
||||||
|
|
@ -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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue