Opened 3 years ago

Closed 20 months ago

#16725 closed bug (fixed)

WebPositive: Wrong status bar size while showing loading bar

Reported by: nephele Owned by: pulkomandy
Priority: normal Milestone: R1/beta4
Component: Applications/WebPositive Version: R1/beta2
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

The status bar size will resize itself to be a bit too small to hold the text it renders when it starts drawing the loading bar.

Please see lower area of attached screenshots. This likely only happens with higher than normal font sizes.

Attachments (2)

Loading-bar.png (21.3 KB ) - added by nephele 3 years ago.
Status bar with loading bar
no-loading-bar.png (39.5 KB ) - added by nephele 3 years ago.
Status bar without loading bar

Download all attachments as: .zip

Change History (7)

by nephele, 3 years ago

Attachment: Loading-bar.png added

Status bar with loading bar

by nephele, 3 years ago

Attachment: no-loading-bar.png added

Status bar without loading bar

comment:1 by nephele, 2 years ago

Here is what i came up with:

--- a/src/apps/webpositive/BrowserWindow.cpp
+++ b/src/apps/webpositive/BrowserWindow.cpp
@@ -547,7 +547,7 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
        fLoadingProgressBar = new BStatusBar("progress");
        fLoadingProgressBar->SetMaxValue(100);
        fLoadingProgressBar->Hide();
-       fLoadingProgressBar->SetBarHeight(12);
+       fLoadingProgressBar->SetBarHeight(font.Size() + 7.0f);
 
        const float kInsetSpacing = 3;
        const float kElementSpacing = 5;

The +7.0F seems a bit random, in my font size this looks correct (22 set as plain size), but with a different font size it fails again. Is there a way to figure out what the correct size has to be?

comment:2 by pulkomandy, 2 years ago

You have to compute it from the font ascents and descents from the font metrics (there is a GetMetrics function or something like that), not the Size (which is not in pixels, but in typographic points and not really usable directly).

Add a few pixels (kInsetSpacing?) at the top and bottom so that there is some empty pixels above and below the text.

Last edited 2 years ago by pulkomandy (previous) (diff)

comment:3 by nephele, 2 years ago

Ah, that should have been obvious, not the first time I dealt with that.

There is no GetMetrics function directly, sadly. maybe there should be one to avoid writing so much code to get the pixelsize.

Full patch: https://git.gryphno.de/nephele/haiku/commit/e562123b409e5cb990f3791b24c0b3471a3b3a49

comment:5 by nephele, 20 months ago

Milestone: UnscheduledR1/beta4
Resolution: fixed
Status: newclosed

fixed in hrev55746 (quite some time ago, forgot to close this :)

Note: See TracTickets for help on using tickets.