pure-maps icon indicating copy to clipboard operation
pure-maps copied to clipboard

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

Open Talkless opened this issue 3 years ago • 19 comments

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.

Talkless avatar Oct 31 '22 10:10 Talkless

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

jonnius avatar Oct 31 '22 12:10 jonnius

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

jonnius avatar Oct 31 '22 12:10 jonnius

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

rinigus avatar Oct 31 '22 17:10 rinigus

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

jonnius avatar Oct 31 '22 20:10 jonnius

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

rinigus avatar Jan 21 '23 13:01 rinigus

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

jonnius avatar Jan 21 '23 14:01 jonnius

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 avatar Jan 21 '23 14:01 rinigus

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...

rinigus avatar Feb 27 '23 20:02 rinigus

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

jonnius avatar Feb 28 '23 08:02 jonnius

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

rinigus avatar Feb 28 '23 16:02 rinigus

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?

jonnius avatar Mar 04 '23 19:03 jonnius

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

rinigus avatar Mar 05 '23 10:03 rinigus

They are svg, too.

jonnius avatar Mar 11 '23 19:03 jonnius

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 avatar Mar 11 '23 20:03 jonnius

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 avatar Mar 11 '23 20:03 jonnius

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

jonnius avatar Mar 12 '23 17:03 jonnius

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?

jonnius avatar Mar 12 '23 17:03 jonnius

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

rinigus avatar Mar 12 '23 17:03 rinigus

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 avatar Mar 12 '23 19:03 jonnius

Fixed with the 3.3.0 release.

jonnius avatar Jun 04 '24 21:06 jonnius

Yep, works as expected. Thanks!

Talkless avatar Jun 05 '24 18:06 Talkless