Phazorknight / Cogito

Immersive Sim Template Project for GODOT 4
MIT License
799 stars 90 forks source link

Readables not able to scroll with mouse - mousing over inventory spaces causes text to scroll #221

Closed DaveA2021 closed 2 months ago

DaveA2021 commented 2 months ago

Cogito and Godot Engine Version: beta 202406.02 Godot 4.2.2

Description: When interacting with readables that have scrolling enabled, the player is unable to scroll the text with the mouse wheel or by clicking the visible scroll bar. mousing over squares inside the inventory GUI causes the text to scroll whether the readable is visible on the screen or not

Reproduction steps:

  1. Open Readable that has Scrolling enabled
  2. attempt to scroll text
  3. text does not scroll
  4. open inventory and readable at the same time
  5. mouse over inventory boxes
  6. text begins to scroll

Expected behavior: The expected behavior is to be able to move the scroll bar with the mouse wheel or by clicking on the visible bar.

Screenshots:

Follow Focus Script :- image_2024-07-09_222234293

Readable Script:- image

Inventory Slot Script:-

image

Phazorknight commented 2 months ago

Hey, so I was not able to reproduces this bug fully.

I've added a few more paragraphs to the first demo readable (note_welcome) and I can scroll with the mouse and the scrollbar as expected.

https://github.com/Phazorknight/Cogito/assets/70389309/7d7e4722-fb3d-4fb3-8690-c93eddabd0b0

Have you by chance changed the ReadableComponent setup? If so, could you show your node setup?

The behavior with the readable scrolling when the player highlights inventory slot is caused by the follow_focus_center script. This script basically "auto-scrolls" the ScrollContainer relative to whatever Control node is in focus, even if those nodes are the Inventory slots. It's not really a major issue.

If you want the player to be unable to have the Inventory and a Readable open at the same time, make sure to turn Ignore Open GUI off in the InteractionComponent section of your ReadableComponent.

As a side note: I've noticed that you couldn't scroll the readables with a game pad. I've just pushed a small update that fixes this, enabling the player to scroll readables with the right thumbstick.

DaveA2021 commented 2 months ago

Thanks for your response! I have not changed the set up as far as I know (unless I did something by accident) but here is the book in question:-

image

image

I also noticed that if I add paragraphs to another readable I have, I also cannot scroll.

Edit: Just confirming - I can use the scroll in the COGITO_3_Lobby scene after your update but still can't scroll in my scene - readables seem to be set up the same.

Phazorknight commented 2 months ago

Hm... would you mind sharing the node setup of your scene?

For anything UI related, node order inside the hierarchy matters, so I suspect that somehow another node might be "on top" of your readable, blocking the input.

As a quick test, you could try putting your readable object into one of the demo scenes as well and see if that changes the behavior.

DaveA2021 commented 2 months ago

Ok I feel silly now :D I moved the player node to the top of the hierarchy in my scene and the scrolling now works!

Thank you for the help :D

Phazorknight commented 2 months ago

Don't feel silly! I've run into this problem more times than I can count. Glad you were able to solve it!