Browse Source

added fullscreen option to Plan menu

lookup-tables
Stephan Richter 5 years ago
parent
commit
aa88d84536
  1. 2
      pom.xml
  2. 15
      resources/js/plan.js
  3. 2
      src/main/java/de/srsoftware/web4rail/Plan.java

2
pom.xml

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

15
resources/js/plan.js

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

2
src/main/java/de/srsoftware/web4rail/Plan.java

@ -117,6 +117,7 @@ public class Plan extends BaseClass{
private static final String X = "x"; private static final String X = "x";
private static final String Y = "y"; private static final String Y = "y";
private static final HashMap<OutputStreamWriter,Integer> clients = new HashMap<OutputStreamWriter, Integer>(); 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 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 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_SAVE).clazz(REALM_PLAN).content(t("Save")).addTo(actions);
new Div(ACTION_ANALYZE).clazz(REALM_PLAN).content(t("Analyze")).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(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); return actions.addTo(actionMenu);
} }

Loading…
Cancel
Save