Skip to content

Commit

Permalink
Drag and drop
Browse files Browse the repository at this point in the history
  • Loading branch information
ben committed Aug 27, 2024
1 parent 6cc9ef1 commit ee55793
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 21 additions & 1 deletion src/module/vue/components/foe-browser/foe-browser-row.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
[$style.article]: true,
[$style.variant]: foe.isVariant
}"
draggable="true"
:data-uuid="foe.uuid"
@dragstart="dragStart"
@dragend="dragEnd"
>
<header :class="$style.header">
<button
Expand Down Expand Up @@ -52,9 +56,25 @@ import FontIcon from 'component:icon/font-icon.vue'
import CollapseTransition from 'component:transition/collapse-transition.vue'
import FoeBrowserContent from 'component:foe-browser/foe-browser-content.vue'
defineProps<{ foe: DisplayFoe }>()
const props = defineProps<{ foe: DisplayFoe }>()
const expanded = ref(false)
function dragStart(ev) {
ev.dataTransfer.setData(
'text/plain',
JSON.stringify({
type: 'FoeBrowserData',
uuid: props.foe.uuid
})
)
CONFIG.IRONSWORN.emitter.emit('dragStart', 'progress')
}
function dragEnd() {
CONFIG.IRONSWORN.emitter.emit('dragEnd', 'progress')
}
</script>

<style lang="scss" module>
Expand Down
2 changes: 1 addition & 1 deletion src/module/vue/vueactorsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export abstract class VueActorSheet extends VueAppMixin(ActorSheet) {
protected async _onDrop(event: DragEvent) {
const data = (TextEditor as any).getDragEventData(event)

if (data.type === 'AssetBrowserData') {
if (['AssetBrowserData', 'FoeBrowserData'].includes(data.type)) {
const document = (await fromUuid(data.uuid)) as
| StoredDocument<IronswornItem>
| undefined
Expand Down

0 comments on commit ee55793

Please sign in to comment.