bitcoin-core / gui-qml

Bitcoin GUI (experimental QML-based fork)
MIT License
106 stars 40 forks source link

Set minimum block clock size to 200px width #382

Closed GBKS closed 6 months ago

GBKS commented 7 months ago

Issues, reports or feature requests related to the GUI should be opened directly on the GUI repo

Report

On my Android phone, the clock is too small. Minimum size should be 200px width. It is ~131px wide.

image

D33r-Gee commented 6 months ago

Hi @GBKS , what android device are you using?

GBKS commented 6 months ago

It's a Galaxy A32 5G.

D33r-Gee commented 6 months ago

It's a Galaxy A32 5G.

Great I will test with a virtual device...

Also to make sure I'm able to reproduce it, which build are you using? Latest on main branch?

GBKS commented 6 months ago

The math that defines the width is located here.

Math.min((root.parentWidth * dial.scale), (root.parentHeight * dial.scale))

The Galaxy A32 has a logical resolution of 360x800. The dial scale is either 1/2 or 1/3. parentWidth is set here as the parent.width - 40. So that puts the width at (360-40)/2 = 160 or (360-40)/3 = ~107. Not exactly the ~131 I roughly measured in my screenshot above, but both values are below the 200 minimum that we want. So maybe we change the line above to this?

Math.max(200, Math.min((root.parentWidth * dial.scale), (root.parentHeight * dial.scale)))

But that misses the scenario where the clock is shown in a widget. So you really don't want to go smaller than the screen width minus some padding. So maybe something like this?

Math.max(Math.min(200, root.parentWidth - 30), Math.min((root.parentWidth * dial.scale), (root.parentHeight * dial.scale)))

I am probably missing something, since my math above doesn't totally add up with my screenshot measurement.

Thanks for looking into this. I believe I am on the latest main branch.

D33r-Gee commented 6 months ago

@GBKS, thanks for your comment above, made my life very easy :)

build and tested with the change you suggested:

Math.max(Math.min(200, root.parentWidth - 30), Math.min((root.parentWidth * dial.scale), (root.parentHeight * dial.scale)))

Results below:

Before change (this a screenshot of a Galaxy A32 5G virtual device):

Screenshot_1703024712

this is after the change: Screenshot_1703024560

I'll go ahead a start a PR, unless there's more to consider?

D33r-Gee commented 6 months ago

@GBKS just opened the PR with your fix https://github.com/bitcoin-core/gui-qml/pull/385