added fullscreen option to Plan menu

This commit is contained in:
Stephan Richter
2020-11-19 14:50:57 +01:00
parent 3cc0b109de
commit aa88d84536
3 changed files with 15 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.srsoftware</groupId>
<artifactId>web4rail</artifactId>
<version>1.0.6</version>
<version>1.0.7</version>
<name>Web4Rail</name>
<packaging>jar</packaging>
<description>Java Model Railway Control</description>

View File

@@ -185,8 +185,12 @@ function runAction(ev){
console.log("runAction: ",{action: clicked.id, realm:realm});
if (clicked.id == 'qrcode'){
window.open("https://api.qrserver.com/v1/create-qr-code/?data="+window.location.href,'_blank');
} else if (clicked.id == 'fullscreen'){
toggleFullscreen();
} else {
return request({action:ev.target.id,realm:realm}); // TODO: ask for name
}
return false;
} else return request({action:ev.target.id,realm:realm}); // TODO: ask for name
}
function selectDest(trainId){
@@ -235,6 +239,12 @@ function tileWindow(){
$('.swapbtn').text(vertical ? '⇩' : '⇨');
}
function toggleFullscreen(){
if (document.fullscreenElement == null){
document.documentElement.requestFullscreen();
} else document.exitFullscreen();
}
window.onload = function () {
var isDragging = false;
$('.menu > div').click(closeMenu);
@@ -246,5 +256,4 @@ window.onload = function () {
$(PLAN).click(planClick);
$(document).keyup(keypress);
(new EventSource("stream")).onmessage = stream;
$('#plan').click(function(){ document.documentElement.requestFullscreen(); });
}

View File

@@ -117,6 +117,7 @@ public class Plan extends BaseClass{
private static final String X = "x";
private static final String Y = "y";
private static final HashMap<OutputStreamWriter,Integer> clients = new HashMap<OutputStreamWriter, Integer>();
private static final String FULLSCREEN = "fullscreen";
public HashMap<String,Tile> tiles = new HashMap<String,Tile>(); // The list of tiles of this plan, i.e. the Track layout
private HashSet<Block> blocks = new HashSet<Block>(); // the list of tiles, that are blocks
@@ -564,6 +565,7 @@ public class Plan extends BaseClass{
new Div(ACTION_SAVE).clazz(REALM_PLAN).content(t("Save")).addTo(actions);
new Div(ACTION_ANALYZE).clazz(REALM_PLAN).content(t("Analyze")).addTo(actions);
new Div(ACTION_QR).clazz(REALM_PLAN).content(t("QR-Code")).addTo(actions);
new Div(FULLSCREEN).clazz(REALM_PLAN).content(t("Fullscreen")).addTo(actions);
return actions.addTo(actionMenu);
}