From 0f74e6ae4f9467ba367d866b89288d6778a302da Mon Sep 17 00:00:00 2001 From: U~man Date: Sun, 28 Jun 2020 20:11:06 +0200 Subject: [PATCH] ENH: sheet overflows solved --- src/module/actor/character-sheet.js | 24 ++++++++++++++++ src/module/actor/monster-sheet.js | 28 +++++++++++++++++++ src/scss/actor-base.scss | 3 ++ src/scss/core.scss | 4 +++ .../partials/character-attributes-tab.html | 4 +-- .../partials/character-inventory-tab.html | 2 +- .../actors/partials/character-spells-tab.html | 2 +- .../partials/monster-attributes-tab.html | 4 +-- 8 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/module/actor/character-sheet.js b/src/module/actor/character-sheet.js index 38aefb6..dbbb461 100644 --- a/src/module/actor/character-sheet.js +++ b/src/module/actor/character-sheet.js @@ -33,6 +33,20 @@ export class OseActorSheetCharacter extends ActorSheet { /* -------------------------------------------- */ + // Override to set resizable initial size + async _renderInner(...args) { + const html = await super._renderInner(...args); + this.form = html[0]; + + // Resize resizable classes + let resizable = html.find('.resizable'); + resizable.each((_, el) => { + let heightDelta = this.position.height - (this.options.height); + el.style.height = `${heightDelta + parseInt(el.dataset.baseSize)}px`; + }); + return html; + } + /** * Prepare data for rendering the Actor sheet * The prepared data object contains both the actor data as well as additional sheet options @@ -141,4 +155,14 @@ export class OseActorSheetCharacter extends ActorSheet { // Handle default listeners last so system listeners are triggered first super.activateListeners(html); } + + async _onResize(event) { + super._onResize(event); + let html = $(event.path); + let resizable = html.find('.resizable'); + resizable.each((_, el) => { + let heightDelta = this.position.height - (this.options.height); + el.style.height = `${heightDelta + parseInt(el.dataset.baseSize)}px`; + }); + } } diff --git a/src/module/actor/monster-sheet.js b/src/module/actor/monster-sheet.js index 09b7dff..6b29973 100644 --- a/src/module/actor/monster-sheet.js +++ b/src/module/actor/monster-sheet.js @@ -33,6 +33,24 @@ export class OseActorSheetMonster extends ActorSheet { /* -------------------------------------------- */ + // Override to set resizable initial size + async _renderInner(...args) { + const html = await super._renderInner(...args); + console.log(html); + this.form = html[0]; + + // Resize resizable classes + let resizable = html.find('.resizable'); + if (resizable.length == 0) { + return; + } + resizable.each((_, el) => { + let heightDelta = this.position.height - (this.options.height); + el.style.height = `${heightDelta + parseInt(el.dataset.baseSize)}px`; + }); + return html; + } + /** * Prepare data for rendering the Actor sheet * The prepared data object contains both the actor data as well as additional sheet options @@ -134,4 +152,14 @@ export class OseActorSheetMonster extends ActorSheet { // Handle default listeners last so system listeners are triggered first super.activateListeners(html); } + + async _onResize(event) { + super._onResize(event); + let html = $(event.path); + let resizable = html.find('.resizable'); + resizable.each((_, el) => { + let heightDelta = this.position.height - (this.options.height); + el.style.height = `${heightDelta + parseInt(el.dataset.baseSize)}px`; + }); + } } diff --git a/src/scss/actor-base.scss b/src/scss/actor-base.scss index c37d75a..4ee7e6d 100644 --- a/src/scss/actor-base.scss +++ b/src/scss/actor-base.scss @@ -135,10 +135,13 @@ .item { .item-image { flex: 0 0 24px; + height: 24px; background-size: cover; } .item-name { line-height: 24px; + height: 24px; + overflow: hidden; h4 { text-indent: 4px; margin: 0; diff --git a/src/scss/core.scss b/src/scss/core.scss index 15e1f92..d90a3f0 100644 --- a/src/scss/core.scss +++ b/src/scss/core.scss @@ -33,4 +33,8 @@ a:hover { text-shadow: none; } + + .resizable { + overflow: auto; + } } diff --git a/src/templates/actors/partials/character-attributes-tab.html b/src/templates/actors/partials/character-attributes-tab.html index 335da04..c87817d 100644 --- a/src/templates/actors/partials/character-attributes-tab.html +++ b/src/templates/actors/partials/character-attributes-tab.html @@ -76,7 +76,7 @@ {{!-- Skills and abilities --}} -
+

{{localize 'OSE.panel.abilities'}}

@@ -85,7 +85,7 @@ {{/if}}
-
    +
      {{#each abilities as |item|}}
    • diff --git a/src/templates/actors/partials/character-inventory-tab.html b/src/templates/actors/partials/character-inventory-tab.html index 61e03b7..b370525 100644 --- a/src/templates/actors/partials/character-inventory-tab.html +++ b/src/templates/actors/partials/character-inventory-tab.html @@ -1,4 +1,4 @@ -
      +
      {{#each inventory as |item|}}
    • diff --git a/src/templates/actors/partials/character-spells-tab.html b/src/templates/actors/partials/character-spells-tab.html index a87ae53..c18b4dd 100644 --- a/src/templates/actors/partials/character-spells-tab.html +++ b/src/templates/actors/partials/character-spells-tab.html @@ -63,7 +63,7 @@ {{/if}}
    • -
      +
      {{#each spells as |item|}}
    • diff --git a/src/templates/actors/partials/monster-attributes-tab.html b/src/templates/actors/partials/monster-attributes-tab.html index afaef42..3cdd12e 100644 --- a/src/templates/actors/partials/monster-attributes-tab.html +++ b/src/templates/actors/partials/monster-attributes-tab.html @@ -49,7 +49,7 @@ {{/if}}
    • -
        +
          {{#each abilities as |item|}}
        • @@ -84,7 +84,7 @@ {{/if}}
      -
        +
          {{#each inventory as |item|}}