jsfehler / renpy-mouse-tooltip

A Tooltip whose x/y position follows the mouse's.
MIT License
4 stars 1 forks source link

Layering issue #3

Open LuYifeng112 opened 4 years ago

LuYifeng112 commented 4 years ago

The text tends to get rendered to the lowest layer which means that in most cases with screens it can't be seen. How can the layer be specified so that it can be visible at the top of the other displayables? I tried to add this tooltip to my viewport national map. I have a bg map, which covers the tooltips.

jsfehler commented 4 years ago

I need a working, minimal example of a screen that replicates the issue you're encountering.

LuYifeng112 commented 4 years ago

`screen tooltip_test: add mtt zorder 20 add "Provincecolors.jpg"

vbox:
    textbutton "One.":
        action Return(1)
        #was originally> hovered mtt.Action(Text("The loneliest number."))
        hovered [SetField(mtt, 'redraw', True), mtt.Action(Text("The loneliest number."))]
        unhovered SetField(mtt, 'redraw', False)

    textbutton "Two.":
        action Return(2)
        #was originally> hovered mtt.Action(Text("Is what it takes."))
        hovered [SetField(mtt, 'redraw', True), mtt.Action(Text("Is what it takes."))]
        unhovered SetField(mtt, 'redraw', False)

    textbutton "Three.":
        action Return(3)
        #was originally> hovered mtt.Action(Text("A crowd."))
        hovered [SetField(mtt, 'redraw', True), mtt.Action(Text("A crowd.", size=20))]
        unhovered SetField(mtt, 'redraw', False)

    textbutton "Hearts.":
        action Return(3)
        #was originally> hovered mtt.Action(Image("icons8-heart-outline-48.png"))
        hovered [SetField(mtt, 'redraw', True), mtt.Action(Image("icons8-heart-outline-48.png"))]
        unhovered SetField(mtt, 'redraw', False)`

Provincecolors

If you use this screen with your mouse tooltip module you'll see that the tooltip is not visible because it gets covered by the picture. I think that a tooltip displays information so it must be on the top layer of anything. That's just my opinion but here is a working screen of the problem. Thank you!

jsfehler commented 4 years ago

Your issue is due to declaring your background after the MouseTooltip. You'd see the same issue with a regular Tooltip. Displayables are drawn in order, so you want to move the MouseTooltip declaration to be after your background.

LuYifeng112 commented 4 years ago

That worked with the test screen but not on my screen. This is my screen image

I tried to put add mtt last but it still won't come up. Any idea on that?