[BUG] - Deleting items in the scrollable window causes scrollbar to reset to top (#1025)

Fixes #977

Co-authored-by: Joaquin Pereyra <joaquinpereyra98@users.noreply.github.com>
This commit is contained in:
joaquinpereyra98 2025-08-19 22:07:35 -03:00 committed by GitHub
parent 774b6dbdcc
commit af250d7a61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 122 additions and 40 deletions

View file

@ -25,11 +25,22 @@ export default class AdversarySheet extends DHBaseActorSheet {
};
static PARTS = {
sidebar: { template: 'systems/daggerheart/templates/sheets/actors/adversary/sidebar.hbs' },
sidebar: {
template: 'systems/daggerheart/templates/sheets/actors/adversary/sidebar.hbs',
scrollable: ['.shortcut-items-section']
},
header: { template: 'systems/daggerheart/templates/sheets/actors/adversary/header.hbs' },
features: { template: 'systems/daggerheart/templates/sheets/actors/adversary/features.hbs' },
notes: { template: 'systems/daggerheart/templates/sheets/actors/adversary/notes.hbs' },
effects: { template: 'systems/daggerheart/templates/sheets/actors/adversary/effects.hbs' }
features: {
template: 'systems/daggerheart/templates/sheets/actors/adversary/features.hbs',
scrollable: ['.feature-section']
},
notes: {
template: 'systems/daggerheart/templates/sheets/actors/adversary/notes.hbs'
},
effects: {
template: 'systems/daggerheart/templates/sheets/actors/adversary/effects.hbs',
scrollable: ['.effects-sections']
}
};
/** @inheritdoc */

View file

@ -78,6 +78,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
static PARTS = {
sidebar: {
id: 'sidebar',
scrollable: ['.shortcut-items-section'],
template: 'systems/daggerheart/templates/sheets/actors/character/sidebar.hbs'
},
header: {
@ -86,22 +87,27 @@ export default class CharacterSheet extends DHBaseActorSheet {
},
features: {
id: 'features',
scrollable: ['.features-sections'],
template: 'systems/daggerheart/templates/sheets/actors/character/features.hbs'
},
loadout: {
id: 'loadout',
scrollable: ['.items-section'],
template: 'systems/daggerheart/templates/sheets/actors/character/loadout.hbs'
},
inventory: {
id: 'inventory',
scrollable: ['.items-section'],
template: 'systems/daggerheart/templates/sheets/actors/character/inventory.hbs'
},
biography: {
id: 'biography',
scrollable: ['.items-section'],
template: 'systems/daggerheart/templates/sheets/actors/character/biography.hbs'
},
effects: {
id: 'effects',
scrollable: ['.effects-sections'],
template: 'systems/daggerheart/templates/sheets/actors/character/effects.hbs'
}
};

View file

@ -15,7 +15,10 @@ export default class DhCompanionSheet extends DHBaseActorSheet {
static PARTS = {
header: { template: 'systems/daggerheart/templates/sheets/actors/companion/header.hbs' },
details: { template: 'systems/daggerheart/templates/sheets/actors/companion/details.hbs' },
effects: { template: 'systems/daggerheart/templates/sheets/actors/companion/effects.hbs' }
effects: {
template: 'systems/daggerheart/templates/sheets/actors/companion/effects.hbs',
scrollable: ['.effects-sections']
}
};
/* -------------------------------------------- */

View file

@ -27,9 +27,13 @@ export default class DhpEnvironment extends DHBaseActorSheet {
/**@override */
static PARTS = {
header: { template: 'systems/daggerheart/templates/sheets/actors/environment/header.hbs' },
features: { template: 'systems/daggerheart/templates/sheets/actors/environment/features.hbs' },
features: {
template: 'systems/daggerheart/templates/sheets/actors/environment/features.hbs',
scrollable: ['feature-section']
},
potentialAdversaries: {
template: 'systems/daggerheart/templates/sheets/actors/environment/potentialAdversaries.hbs'
template: 'systems/daggerheart/templates/sheets/actors/environment/potentialAdversaries.hbs',
scrollable: ['items-sections']
},
notes: { template: 'systems/daggerheart/templates/sheets/actors/environment/notes.hbs' }
};

View file

@ -0,0 +1,17 @@
@import '../../../utils/colors.less';
.application.sheet.daggerheart.actor.dh-style.adversary {
.tab.effects {
.effects-sections {
display: flex;
flex-direction: column;
gap: 10px;
overflow-y: auto;
mask-image: linear-gradient(0deg, transparent 0%, black 5%);
padding-bottom: 20px;
scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
}
}
}

View file

@ -0,0 +1,17 @@
@import '../../../utils/colors.less';
.application.sheet.daggerheart.actor.dh-style.companion {
.tab.effects {
.effects-sections {
display: flex;
flex-direction: column;
gap: 10px;
overflow-y: auto;
mask-image: linear-gradient(0deg, transparent 0%, black 5%);
padding-bottom: 20px;
scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
}
}
}

View file

@ -0,0 +1,17 @@
@import '../../../utils/colors.less';
.application.sheet.daggerheart.actor.dh-style.environment {
.tab.potentialAdversaries {
.items-section {
display: flex;
flex-direction: column;
gap: 10px;
overflow-y: auto;
mask-image: linear-gradient(0deg, transparent 0%, black 5%);
padding-bottom: 20px;
scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
}
}
}

View file

@ -4,6 +4,7 @@
@import './actors/adversary/header.less';
@import './actors/adversary/sheet.less';
@import './actors/adversary/sidebar.less';
@import './actors/adversary/effects.less';
@import './actors/character/biography.less';
@import './actors/character/effects.less';
@ -17,9 +18,11 @@
@import './actors/companion/details.less';
@import './actors/companion/header.less';
@import './actors/companion/sheet.less';
@import './actors/companion/effects.less';
@import './actors/environment/actions.less';
@import './actors/environment/header.less';
@import './actors/environment/potentialAdversaries.less';
@import './actors/environment/sheet.less';
@import './items/beastform.less';

View file

@ -1,20 +1,22 @@
<section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}'
data-group='{{tabs.effects.group}}'>
{{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.activeEffects'
type='effect'
isGlassy=true
collection=effects.actives
canCreate=true
hideResources=true
}}
<div class="effects-sections">
{{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.activeEffects'
type='effect'
isGlassy=true
collection=effects.actives
canCreate=true
hideResources=true
}}
{{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.inactiveEffects'
type='effect'
isGlassy=true
collection=effects.inactives
canCreate=true
hideResources=true
}}
{{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.inactiveEffects'
type='effect'
isGlassy=true
collection=effects.inactives
canCreate=true
hideResources=true
}}
</div>
</section>

View file

@ -1,20 +1,22 @@
<section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}'
data-group='{{tabs.effects.group}}'>
{{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.activeEffects'
type='effect'
isGlassy=true
collection=effects.actives
canCreate=true
hideResources=true
}}
<div class="effects-sections">
{{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.activeEffects'
type='effect'
isGlassy=true
collection=effects.actives
canCreate=true
hideResources=true
}}
{{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.inactiveEffects'
type='effect'
isGlassy=true
collection=effects.inactives
canCreate=true
hideResources=true
}}
{{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.inactiveEffects'
type='effect'
isGlassy=true
collection=effects.inactives
canCreate=true
hideResources=true
}}
</div>
</section>

View file

@ -3,7 +3,7 @@
data-tab='{{tabs.potentialAdversaries.id}}'
data-group='{{tabs.potentialAdversaries.group}}'
>
<div class="action-section">
<div class="items-section">
{{#each document.system.potentialAdversaries as |category categoryId|}}
{{> 'daggerheart.inventory-items'
title=category.label