Improved character sheet printing

This commit is contained in:
ThaumRystra
2024-10-13 15:58:08 +02:00
parent efc52b4f68
commit f37149f466
6 changed files with 19 additions and 44 deletions

View File

@@ -33,7 +33,6 @@ export default {
.column-layout>*, .column-layout>*,
.column-layout>span>div { .column-layout>span>div {
display: inline-block;
break-inside: avoid; break-inside: avoid;
page-break-inside: avoid; page-break-inside: avoid;
margin-bottom: 8px; margin-bottom: 8px;

View File

@@ -109,7 +109,7 @@ export default {
name: 'characterSheet', name: 'characterSheet',
params: { id: this.creatureId}, params: { id: this.creatureId},
}); });
return new URL(props?.href, document.baseURI).href return new URL(props?.href, 'https://dicecloud.com').href
}, },
level() { level() {
return this.variables?.level?.value; return this.variables?.level?.value;
@@ -139,7 +139,6 @@ export default {
].sort((a, b) => a.order - b.order); ].sort((a, b) => a.order - b.order);
}, },
}, },
// @ts-ignore reactiveProvide isn't defined on vue
reactiveProvide: { reactiveProvide: {
name: 'context', name: 'context',
include: ['creatureId', 'editPermission'], include: ['creatureId', 'editPermission'],
@@ -278,7 +277,8 @@ export default {
} }
.character-sheet-printed .column-layout>div { .character-sheet-printed .column-layout>div {
position:relative; position: relative;
display: inline-block;
margin-top: 4px; margin-top: 4px;
margin-bottom: 4px; margin-bottom: 4px;
} }
@@ -383,6 +383,7 @@ export default {
} }
body { body {
margin: 0; margin: 0;
padding: 2mm;
} }
.character-sheet-printed .page { .character-sheet-printed .page {
width: 100%; width: 100%;

View File

@@ -102,7 +102,6 @@ export default {
organize: false, organize: false,
} }
}, },
// @ts-ignore Meteor isn't defined on vue
meteor: { meteor: {
containers() { containers() {
return CreatureProperties.find({ return CreatureProperties.find({
@@ -128,7 +127,7 @@ export default {
containersWithoutAncestorContainers() { containersWithoutAncestorContainers() {
return CreatureProperties.find({ return CreatureProperties.find({
...getFilter.descendantsOfRoot(this.creatureId), ...getFilter.descendantsOfRoot(this.creatureId),
$not: getFilter.descendantsOfAll(this.containers), $nor: [getFilter.descendantsOfAll(this.containers)],
type: 'container', type: 'container',
removed: { $ne: true }, removed: { $ne: true },
inactive: { $ne: true }, inactive: { $ne: true },
@@ -151,7 +150,7 @@ export default {
carriedItems() { carriedItems() {
return CreatureProperties.find({ return CreatureProperties.find({
...getFilter.descendantsOfRoot(this.creatureId), ...getFilter.descendantsOfRoot(this.creatureId),
$not: getFilter.descendantsOfAll(this.containers), $nor: [getFilter.descendantsOfAll(this.containers)],
type: 'item', type: 'item',
equipped: { $ne: true }, equipped: { $ne: true },
removed: { $ne: true }, removed: { $ne: true },

View File

@@ -61,7 +61,6 @@ export default {
organize: false, organize: false,
} }
}, },
// @ts-ignore-error Meteor not defined on vue
meteor: { meteor: {
spellLists() { spellLists() {
return CreatureProperties.find({ return CreatureProperties.find({
@@ -76,7 +75,7 @@ export default {
spellsWithoutList() { spellsWithoutList() {
return CreatureProperties.find({ return CreatureProperties.find({
...getFilter.descendantsOfRoot(this.creatureId), ...getFilter.descendantsOfRoot(this.creatureId),
$not: getFilter.descendantsOfAll(this.spellLists), $nor: [getFilter.descendantsOfAll(this.spellLists)],
type: 'spell', type: 'spell',
removed: { $ne: true }, removed: { $ne: true },
deactivatedByAncestor: { $ne: true }, deactivatedByAncestor: { $ne: true },
@@ -91,7 +90,7 @@ export default {
spellListsWithoutAncestorSpellLists() { spellListsWithoutAncestorSpellLists() {
return CreatureProperties.find({ return CreatureProperties.find({
...getFilter.descendantsOfRoot(this.creatureId), ...getFilter.descendantsOfRoot(this.creatureId),
$not: getFilter.descendantsOfAll(this.spellLists), $nor: [getFilter.descendantsOfAll(this.spellLists)],
type: 'spellList', type: 'spellList',
removed: { $ne: true }, removed: { $ne: true },
inactive: { $ne: true }, inactive: { $ne: true },

View File

@@ -1,7 +1,7 @@
<template lang="html"> <template lang="html">
<div class="stats"> <div class="stats">
<div <div
class="d-flex wrap justify-space-between px-2 pt-3 pb-1" class="d-flex wrap justify-space-between px-2 pt-3 pb-2"
style="page-break-after: avoid" style="page-break-after: avoid"
> >
<div <div

View File

@@ -4,11 +4,6 @@
:class="cardClasses" :class="cardClasses"
> >
<div class="d-flex align-center mb-2"> <div class="d-flex align-center mb-2">
<div class="roll-bonus">
<template v-if="!onHitDamage && rollBonus">
{{ rollBonus }}
</template>
</div>
<div class="action-title text-center flex-grow-1"> <div class="action-title text-center flex-grow-1">
{{ model.name || propertyName }} {{ model.name || propertyName }}
</div> </div>
@@ -51,28 +46,21 @@
<markdown-text :markdown="model.summary.value || model.summary.text" /> <markdown-text :markdown="model.summary.value || model.summary.text" />
</template> </template>
<div <div
v-if="onHitDamage" v-if="rollBonus"
class="roll-bonus"
> >
<span class="damage"> <span class="to-hit ml-2">
{{ rollBonus }} {{ rollBonus }}
</span> </span>
<span> <span>
to hit to hit
</span> </span>
</div> </div>
<div v-if="onHitDamage">
<span class="damage">
{{ onHitDamage.damage }}
</span>
<span>
{{ onHitDamage.suffix }}
</span>
</div>
<tree-node-list <tree-node-list
v-else-if="children && children.length" v-if="children && children.length"
start-expanded start-expanded
show-external-details
:children="children" :children="children"
:root="{id: model._id, collection: 'creatureProperties'}"
@selected="e => $emit('sub-click', e)" @selected="e => $emit('sub-click', e)"
/> />
</div> </div>
@@ -151,21 +139,6 @@ export default {
'long': 'Long Action' 'long': 'Long Action'
}[this.model.actionType] || this.model.actionType }[this.model.actionType] || this.model.actionType
}, },
onHitDamage() {
/**
* Only match a property who has exactly one to-hit child with one damage under that
*/
if (this.children?.length !== 1) return;
if (this.children[0]?.node?.type !== 'branch') return;
if (this.children[0].children?.length !== 1) return;
if (this.children[0].children[0]?.node?.type !== 'damage') return;
if (this.children[0].children[0].children?.length !== 0) return;
const damage = this.children[0].children[0]?.node;
return {
damage: damage.value,
suffix: damage.damageType + (damage.damageType !== 'healing' ? ' damage ' : '')
};
},
}, },
meteor: { meteor: {
children() { children() {
@@ -205,6 +178,10 @@ export default {
transform 0.075s ease; transform 0.075s ease;
} }
.roll-bonus { .roll-bonus {
color: rgba(0, 0, 0, 0.87);
}
.to-hit {
color: rgba(0, 0, 0, 0.54);
font-size: 18pt; font-size: 18pt;
flex-basis: 24px; flex-basis: 24px;
} }