Skip to content

Commit a92cf23

Browse files
committed
Merge pull request #326 from Vennik/enhancement/overlay-hide
Add function for overlay hide.
2 parents 24aa345 + dbf61f8 commit a92cf23

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

geex-core/src/main/java/nl/tudelft/context/controller/MainController.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,22 @@ public final void setBaseView(final ViewController viewController) {
136136

137137
}
138138

139+
/**
140+
* Hide overlay.
141+
*
142+
* @return If overlay was shown.
143+
*/
144+
public boolean hideOverlay() {
145+
146+
boolean visible = overlay.isVisible();
147+
if (visible) {
148+
menuController.getToggleOverlay().fire();
149+
}
150+
151+
return visible;
152+
153+
}
154+
139155
/**
140156
* Set a new main view and push it on the view stack.
141157
*
@@ -144,9 +160,7 @@ public final void setBaseView(final ViewController viewController) {
144160
*/
145161
public void setView(final ViewController on, final ViewController viewController) {
146162

147-
if (overlay.isVisible()) {
148-
menuController.getToggleOverlay().fire();
149-
}
163+
hideOverlay();
150164

151165
if (shift || viewList.indexOf(on) == -1) {
152166

@@ -181,11 +195,7 @@ private Stream<ViewController> getVisibleStream() {
181195
*/
182196
public final void previousView() {
183197

184-
if (overlay.isVisible()) {
185-
186-
menuController.getToggleOverlay().fire();
187-
188-
} else {
198+
if (!hideOverlay()) {
189199

190200
getVisibleStream()
191201
.skip(1)
@@ -205,6 +215,8 @@ public final void previousView() {
205215
*/
206216
public void toView(final ViewController viewController) {
207217

218+
hideOverlay();
219+
208220
int index = viewList.indexOf(viewController) + 1;
209221
viewList.stream()
210222
.skip(index)

0 commit comments

Comments
 (0)