Coder Social home page Coder Social logo

User interface hover. about geonbit.ui HOT 6 CLOSED

ronenness avatar ronenness commented on May 27, 2024
User interface hover.

from geonbit.ui.

Comments (6)

Catvert avatar Catvert commented on May 27, 2024 1

Thank you for your help ! Yes you're right, I implemented a root entity for each scene and the TargetEntity was always true because it was pointing to that root entity. Your solutions solved my issue ! Thanks for everything ! :)

from geonbit.ui.

RonenNess avatar RonenNess commented on May 27, 2024

Hi @Catvert, glad you like the lib!

If you have the most up-to-date version you should have a UserInterface.TargetEntity getter, which either points on the current entity the mouse points on, or null. Checking if its not null is equivalent to checking if mouse is hover (any) entity.

Here's the related line: https://github.com/RonenNess/GeonBit.UI/blob/master/GeonBit.UI/GeonBit.UI/UserInterface.cs#L143

I'm closing this ticket, but if you need further assistant with this subject or I misunderstood you feel free to reopen it :)

Thanks!

from geonbit.ui.

Catvert avatar Catvert commented on May 27, 2024

Thank you for your reply, I have tried to use UserInterface.TargetEntity, with this code in the update method : Debug.WriteLine(UserInterface.TargetEntity != null && UserInterface.TargetEntity.IsMouseOver); but it return always true even if my mouse is not hover an entity, just hover the window. Thank you for your help and sorry for my english, Arno.

from geonbit.ui.

RonenNess avatar RonenNess commented on May 27, 2024

You don't need the && UserInterface.TargetEntity.IsMouseOver part, if its the target entity mouse hover should be true.

Anyway I suspect you have an invisible panel or something covering the entire screen. Could you please check what type of entity you're getting under 'TargetEntity' and whats its size?

Thanks :)

from geonbit.ui.

Catvert avatar Catvert commented on May 27, 2024

Yes, it was an invisible entity, but now i'm stuck, i don't know how can i remove all entities when the game switch the scene. By the way, I can't access to UserInterface.Root, the getter is private. Thank you for your help ! :)

from geonbit.ui.

RonenNess avatar RonenNess commented on May 27, 2024

Cool glad to see this was indeed the problem :)

From what I understand, you implemented different scene UIs by creating a root panel per scene (a skinless panel), that you add/remove when scene loads/unload, and the problem was that its always the TargetEntity when mouse is not on any other entity. Am I right? If so, that's the way to go, there's no need to change that.

Assuming I understood correctly and that's how you do it, there are several ways to solve your problem:

  1. You can set ClickThrough = true in your scene root panel. This will make the panel itself ignore events, but its children will still work.
  2. Instead of testing if UserInterface.TargetEntity == null you can check if UserInterface.TargetEntity == scenePanel (where 'scenePanel' is your scene root panel).
  3. Or, similar to above if you have lots of scenes and want to cover them all in one if, you can use the Identifier or AttachedData to mark them as scene roots, and do something like: UserInterface.TargetEntity != null && UserInterface.TargetEntity.Identifier == "scene_root".

With that said, the reason UserInterface.Root is private is because the built-in root panel behave slightly different than regular panels, and by hiding it I wanted to signal the user that he should not mess with it because it will behave unexpectedly. However, I do agree there's a need for a Clear() function and I'll add it shortly to dev branch.

Let me know if the suggestions above worked for you and the issue is resolved. If not, we'll think of something else :)

from geonbit.ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.