Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
OpenSpace
Commits
4a8e4a35
Commit
4a8e4a35
authored
2 years ago
by
Ylva Selling
Browse files
Options
Download
Email Patches
Plain Diff
Create timer that allows the browser to reload before changing the border radius
parent
2dd981ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/skybrowser/include/screenspaceskybrowser.h
+2
-0
modules/skybrowser/include/screenspaceskybrowser.h
modules/skybrowser/src/screenspaceskybrowser.cpp
+7
-2
modules/skybrowser/src/screenspaceskybrowser.cpp
with
9 additions
and
2 deletions
+9
-2
modules/skybrowser/include/screenspaceskybrowser.h
+
2
-
0
View file @
4a8e4a35
...
...
@@ -37,6 +37,7 @@ namespace openspace {
class
ScreenSpaceSkyBrowser
:
public
ScreenSpaceRenderable
,
public
WwtCommunicator
{
public:
static
constexpr
int
RadiusTimeOut
=
25
;
explicit
ScreenSpaceSkyBrowser
(
const
ghoul
::
Dictionary
&
dictionary
);
~
ScreenSpaceSkyBrowser
()
override
;
...
...
@@ -80,6 +81,7 @@ private:
bool
_ratioIsDirty
=
false
;
bool
_radiusIsDirty
=
false
;
bool
_isInitialized
=
false
;
int
_borderRadiusTimer
=
-
1
;
float
_ratio
=
1.
f
;
};
...
...
This diff is collapsed.
Click to expand it.
modules/skybrowser/src/screenspaceskybrowser.cpp
+
7
-
2
View file @
4a8e4a35
...
...
@@ -129,6 +129,7 @@ ScreenSpaceSkyBrowser::ScreenSpaceSkyBrowser(const ghoul::Dictionary& dictionary
_scale
.
onChange
([
this
]()
{
updateTextureResolution
();
_borderRadiusTimer
=
0
;
});
_useRadiusAzimuthElevation
.
onChange
(
...
...
@@ -325,11 +326,15 @@ void ScreenSpaceSkyBrowser::update() {
if
(
_shouldReload
)
{
_isInitialized
=
false
;
}
if
(
_radiusIsDirty
&&
_isInitialized
)
{
// After the texture has been updated, wait a little bit before updating the border
// radius so the browser has time to update its size
if
(
_radiusIsDirty
&&
_isInitialized
&&
_borderRadiusTimer
==
RadiusTimeOut
)
{
setBorderRadius
(
_borderRadius
);
_radiusIsDirty
=
false
;
_borderRadiusTimer
=
-
1
;
}
_borderRadiusTimer
++
;
ScreenSpaceRenderable
::
update
();
WwtCommunicator
::
update
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment