rinigus / pure-maps

Maps and navigation
https://rinigus.github.io/pure-maps/
GNU General Public License v3.0
252 stars 43 forks source link

"Info" and "delete" (marker) buttons are squezed and hard to hit with touch. #640

Closed Talkless closed 3 months ago

Talkless commented 1 year ago

Screenshot on Ubuntu Touch (Volla Phone X, had same issue on smaller BQ Aquaris E5): puremaps_buttons

Screenshot was made while pressing "Info" button. We can see that it's area is small, button's width is squeezed and rather hard to hit with your finger. Same with marker button.

Same situation in landscape mode.

jonnius commented 1 year ago

I can confirm this issue. It can even be reproduced in desktop mode with clickable desktop.

jonnius commented 1 year ago

@rinigus, what is the reason for those icons not to have an iconWidth set?

rinigus commented 1 year ago

Really weird. I wonder I don't see it in other platforms... Was it always like this on UT?

jonnius commented 1 year ago

I think it started to be like this when UT switched from Qt 5.9 to 5.12.

rinigus commented 1 year ago

Re iconWidth: it is not set to let it scale proportionally. Do you still have this issue at UT?

jonnius commented 1 year ago

Yes, we still have the issue. Do you think it is a bug in the Ubuntu/Lomiri UI Toolkit?

rinigus commented 1 year ago

It boils down to Icon implementation in UT. Corresponding type used by Pure Maps is https://github.com/rinigus/pure-maps/blob/master/qml/platform.uuitk/IconPL.qml . It is expected that the width would be calculated on the basis of height if not specified. That approach works for Kirigami, Silica, and older UT. Probably it is a bug in UT Icon.

rinigus commented 1 year ago

Has anyone looked into it from UT side? Any bugs in Icon code? We have, in principle, square icons. I can try to set them both equal if not set otherwise...

jonnius commented 1 year ago

I looked into it. This function should be responsible. I couldn't spot an issue there and also didn't yet debug.

rinigus commented 1 year ago

This section is a bit weird, if I read it correctly. I would have used something like:

if (requestSize.width() > 0 && requestSize.height()==0) {
        ratio = qreal(requestSize.width())/s.width();
}
...

Right now, if requstSize.height is zero, but requestSize.width() > s.width() is true, we don't get any scaling. For UT, we use the following icons: https://github.com/rinigus/pure-maps/blob/master/qml/platform.uuitk/StylerPL.qml#L60

jonnius commented 1 year ago

I think force_scale should be true thanks to the svg format. Therefore we should end up scaling the image. But even if we would not scale it, it should keep its ratio and not get distorted, shouldn't it?

rinigus commented 1 year ago

No, Info and Delete are Ubuntu Touch provided icons from its theme. So, they could be something else...

jonnius commented 1 year ago

They are svg, too.

jonnius commented 1 year ago

If I remove * factor from this line, the icons show correctly. The factor logic does not seem to work as intended and I have a hard time understanding it in the first place.

When I print the values, this is what I get:

w: -32, req: 364, item.width: 0
w: 591, req: 364, item.width: 623

Looks like on first calculation item.width is still zero, causing the factor to be 1/4.

jonnius commented 1 year ago

I have added if (item.width == 0) return 1.0; to the factor calculation. This seems to fix it. But if I resize the window to be very narrow once, they get squeezed again. If I return to a broad width, they stay squeezed.

Screencast from 2023-03-11 21-52-22.webm

jonnius commented 1 year ago

I created a bug report upstream and opened a PR with the workaround mentioned above (see the video).

jonnius commented 1 year ago

Just as a side note: In the video above you can see that the other icons don't get squeezed horizontally. But they get squeezed vertically when the app width is small, making the whole factor logic meaningless. Is this the case for other platforms, too?

rinigus commented 1 year ago

Thank you very much for looking into it. No, on Kirigami it works as it should. Note that you can probably install Pure Maps through Flatpak on Linux PC and see it for yourself. I have icons reduced in size as needed.

But the fix ensuring that there is no zero division, if I understand it correctly, should be there. Will look into PR in a sec

jonnius commented 1 year ago

It is not a zero division, but just the incorrect initial assumption of not enough space due to width 0. In a sequence of events and bugs this leads to the squeezed icons.

jonnius commented 3 months ago

Fixed with the 3.3.0 release.

Talkless commented 3 months ago

Yep, works as expected. Thanks!