Opened 4 years ago
Closed 2 years 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)
Change History (7)
by , 4 years ago
Attachment: | Loading-bar.png added |
---|
comment:1 by , 3 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 , 3 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.
comment:3 by , 3 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 , 2 years ago
Milestone: | Unscheduled → R1/beta4 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
fixed in hrev55746 (quite some time ago, forgot to close this :)
Status bar with loading bar