Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions spec/system/constructPresentationState.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,95 @@ out:
characterId: "bob"
content:
- text: "Second ADV line"
---
case: nvl-mode-maxLines-trims-oldest
in:
- - dialogue:
mode: "nvl"
gui:
resourceId: "nvl-layout"
characterId: "narrator"
content:
- text: "Line 1"
- dialogue:
mode: "nvl"
characterId: "alice"
content:
- text: "Line 2"
- dialogue:
mode: "nvl"
characterId: "bob"
content:
- text: "Line 3"
- dialogue:
mode: "nvl"
characterId: "narrator"
content:
- text: "Line 4"
- dialogue:
mode: "nvl"
maxLines: 4
characterId: "alice"
content:
- text: "Line 5"
out:
dialogue:
mode: "nvl"
gui:
resourceId: "nvl-layout"
characterId: "alice"
content:
- text: "Line 5"
lines:
- content:
- text: "Line 2"
characterId: "alice"
- content:
- text: "Line 3"
characterId: "bob"
- content:
- text: "Line 4"
characterId: "narrator"
- content:
- text: "Line 5"
characterId: "alice"
---
case: nvl-mode-maxLines-no-trim-under-limit
in:
- - dialogue:
mode: "nvl"
gui:
resourceId: "nvl-layout"
characterId: "narrator"
content:
- text: "Line 1"
- dialogue:
mode: "nvl"
maxLines: 4
characterId: "alice"
content:
- text: "Line 2"
- dialogue:
mode: "nvl"
maxLines: 4
characterId: "bob"
content:
- text: "Line 3"
out:
dialogue:
mode: "nvl"
gui:
resourceId: "nvl-layout"
characterId: "bob"
content:
- text: "Line 3"
lines:
- content:
- text: "Line 1"
characterId: "narrator"
- content:
- text: "Line 2"
characterId: "alice"
- content:
- text: "Line 3"
characterId: "bob"
10 changes: 10 additions & 0 deletions src/stores/constructPresentationState.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ export const dialogue = (state, presentation) => {
characterId: presentation.dialogue.characterId || null,
});
}

// Handle NVL maxLines trimming (scroll effect)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think issue with this one is that the height of each line might be variable. so using max number of lines does not take considereation of whether the container height is overflowing

if (
presentation.dialogue?.maxLines &&
state.dialogue?.lines?.length > presentation.dialogue.maxLines
) {
state.dialogue.lines = state.dialogue.lines.slice(
-presentation.dialogue.maxLines,
);
}
};

/**
Expand Down
52 changes: 51 additions & 1 deletion vt/specs/dialogue/nvl-mode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,58 @@ story:
content:
- text: "Second line on the new page."

# Back to ADV
# maxLines scroll effect
- id: "8"
actions:
dialogue:
mode: nvl
clearPage: true
content:
- text: "[maxLines test] Line 1 - This should scroll away."

- id: "9"
actions:
dialogue:
mode: nvl
characterId: alice
content:
- text: "[maxLines test] Line 2 - This should scroll away."

- id: "10"
actions:
dialogue:
mode: nvl
characterId: bob
content:
- text: "[maxLines test] Line 3 - Stays visible."

- id: "11"
actions:
dialogue:
mode: nvl
content:
- text: "[maxLines test] Line 4 - Stays visible."

- id: "12"
actions:
dialogue:
mode: nvl
maxLines: 4
characterId: alice
content:
- text: "[maxLines test] Line 5 - Line 1 should be gone now."

- id: "13"
actions:
dialogue:
mode: nvl
maxLines: 4
characterId: bob
content:
- text: "[maxLines test] Line 6 - Lines 1-2 should be gone."

# Back to ADV
- id: "14"
actions:
dialogue:
mode: adv
Expand Down