Fix issue #38: Implement tokens on maps
All checks were successful
Test / test (push) Successful in 2s
All checks were successful
Test / test (push) Successful in 2s
This commit is contained in:
@@ -8,6 +8,7 @@ import { emitter } from '~/services/Emitter';
|
||||
import Server from '~/services/Server';
|
||||
import { ClearWindow, CreateWindow, GetFirstWindowId } from '~/services/Windows';
|
||||
import { HideContextMenu, ShowContextMenu } from '~/services/ContextMenu';
|
||||
import { ACTOR_DRAG_TYPE } from '~/services/MapTokens';
|
||||
import NestedNoteList from './NestedNoteList.vue';
|
||||
|
||||
const { Campaign } = useCampaignService();
|
||||
@@ -44,6 +45,14 @@ async function handleSidebarDrop(event) {
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// An actor row is dragged out of the sidebar onto a map, where it stands as a token. The map viewer
|
||||
// reads that type back on its drop (see MapViewerPane.vue); a note drag carries 'text/plain'
|
||||
// instead, so the two never land where the other belongs.
|
||||
function startActorDrag(event, actor) {
|
||||
event.dataTransfer.setData(ACTOR_DRAG_TYPE, String(actor._id));
|
||||
event.dataTransfer.effectAllowed = 'copyMove';
|
||||
}
|
||||
|
||||
function toggleExpandedFolder(folderId) {
|
||||
const arr = expandedFolderIds.value;
|
||||
const idx = arr.indexOf(folderId);
|
||||
@@ -488,7 +497,7 @@ onBeforeUnmount(() => {
|
||||
<div v-if="loadingEntries" class="sidebar-state">{{ t('campaigns.states.loading') }}</div>
|
||||
<div v-else-if="entriesError" class="sidebar-state error">{{ entriesError }}</div>
|
||||
<div v-else-if="actors.length === 0" class="sidebar-state">{{ t('campaigns.states.empty-actors') }}</div>
|
||||
<div v-for="actor in actors" :key="actor._id" class="entity-entry" role="button" tabindex="0" @click="openCharacterSheet(actor)" @keydown.enter="openCharacterSheet(actor)" @keydown.space.prevent="openCharacterSheet(actor)" @contextmenu.prevent="showEntryMenu(actor, 'actor')">
|
||||
<div v-for="actor in actors" :key="actor._id" class="entity-entry" role="button" tabindex="0" draggable="true" :title="t('campaigns.map.tokens.drag')" @click="openCharacterSheet(actor)" @keydown.enter="openCharacterSheet(actor)" @keydown.space.prevent="openCharacterSheet(actor)" @dragstart="startActorDrag($event, actor)" @contextmenu.prevent="showEntryMenu(actor, 'actor')">
|
||||
<span class="entity-entry-name">{{ actor.name }}</span>
|
||||
<span class="entity-entry-meta">{{ entrySummary(actor) }}</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user