MAPG-235 noMove, noZoom, noPan restrictions implemented

This commit is contained in:
Balázs Vigh 2021-05-19 21:16:59 +02:00
parent 77ff175794
commit 3b98570f6d
6 changed files with 44 additions and 7 deletions

View File

@ -15,6 +15,17 @@
right: 0; right: 0;
background-color: #000000; background-color: #000000;
opacity: 0.5; opacity: 0.5;
z-index: 4;
}
#panningBlockerCover {
display: none;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
opacity: 0;
z-index: 3; z-index: 3;
} }
@ -22,7 +33,7 @@
position: absolute; position: absolute;
bottom: 30px; bottom: 30px;
right: 20px; right: 20px;
z-index: 2; z-index: 3;
} }
#guess.result { #guess.result {

View File

@ -77,6 +77,7 @@ div.mapItem>div.buttonContainer {
#restrictions { #restrictions {
margin-top: 1em; margin-top: 1em;
margin-bottom: 1em;
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
} }

View File

@ -301,11 +301,21 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
Game.transitToResultMap(); Game.transitToResultMap();
Game.showSummary(); Game.showSummary();
//document.getElementById('continueButton').style.display = 'none';
} else { } else {
if (this.response.restrictions) {
Game.panorama.setOptions({
clickToGo: !this.response.restrictions.noMove,
linksControl: !this.response.restrictions.noMove,
scrollwheel: !this.response.restrictions.noZoom
});
if (this.response.restrictions.noPan) {
document.getElementById('panningBlockerCover').style.display = 'block';
}
}
Game.panoId = this.response.place.panoId; Game.panoId = this.response.place.panoId;
Game.pov = this.response.place.pov; Game.pov = this.response.place.pov;
@ -442,6 +452,13 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
// needs to be set visible after the show guess map hid it in mobile view // needs to be set visible after the show guess map hid it in mobile view
document.getElementById("navigation").style.visibility = 'visible'; document.getElementById("navigation").style.visibility = 'visible';
Game.panorama.setOptions({
clickToGo: true,
linksControl: true,
scrollwheel: true
});
document.getElementById('panningBlockerCover').style.display = null;
Game.initialize(); Game.initialize();
}, },

View File

@ -194,6 +194,13 @@ class GameFlowController
} }
} }
} }
$response['restrictions'] = [
'timeLimit' => $challenge->getTimeLimit(),
'noMove' => $challenge->getNoMove(),
'noPan' => $challenge->getNoPan(),
'noZoom' => $challenge->getNoZoom()
];
} }
return $response; return $response;

View File

@ -25,6 +25,7 @@
<p id="countdownTime" class="mono bold"></p> <p id="countdownTime" class="mono bold"></p>
</div> </div>
<div id="panoCover"></div> <div id="panoCover"></div>
<div id="panningBlockerCover"></div>
<div id="panorama"></div> <div id="panorama"></div>
<div id="showGuessButtonContainer"> <div id="showGuessButtonContainer">
<button id="showGuessButton" class="fullWidth">Show guess map</button> <button id="showGuessButton" class="fullWidth">Show guess map</button>

View File

@ -65,14 +65,14 @@ TODO: condition!
<input type="checkbox" id="noMove" name="noMove" value="noMove" /> <input type="checkbox" id="noMove" name="noMove" value="noMove" />
<label for="noMove">No movement allowed</label> <label for="noMove">No movement allowed</label>
</div> </div>
<div>
<input type="checkbox" id="noPan" name="noPan" value="noPan" />
<label for="noPan">No camera rotation allowed</label>
</div>
<div> <div>
<input type="checkbox" id="noZoom" name="noZoom" value="noZoom" /> <input type="checkbox" id="noZoom" name="noZoom" value="noZoom" />
<label for="noMove">No zoom allowed</label> <label for="noMove">No zoom allowed</label>
</div> </div>
<div>
<input type="checkbox" id="noPan" name="noPan" value="noPan" />
<label for="noPan">No camera change allowed</label>
</div>
<input type="hidden" name="mapId" id="challengeMapId" /> <input type="hidden" name="mapId" id="challengeMapId" />
</div> </div>
<button id="createNewChallengeButton" type="submit" class="button fullWidth green" href="" title="Create new challenge">Create new challenge</button> <button id="createNewChallengeButton" type="submit" class="button fullWidth green" href="" title="Create new challenge">Create new challenge</button>