fixes the fullscreen zoom bug

This commit is contained in:
Jeena 2014-07-12 17:44:57 +02:00
parent 1a6d8effad
commit a5c1c05bb4
2 changed files with 16 additions and 24 deletions

View file

@ -248,8 +248,8 @@ function (Parent, DomController, PIXI, ColorRangeReplaceFilter, Settings, Nc, Ex
if(isFullScreen) { if(isFullScreen) {
this.renderer.resize(window.innerWidth, window.innerHeight); this.renderer.resize(window.innerWidth, window.innerHeight);
this.currentZoom = window.innerWidth / Settings.STAGE_WIDTH; this.currentZoom = window.innerWidth / 600;
console.log(); console.log(this.currentZoom);
} else { } else {
this.renderer.resize(600, 400); this.renderer.resize(600, 400);
this.currentZoom = 1; this.currentZoom = 1;
@ -269,17 +269,6 @@ function (Parent, DomController, PIXI, ColorRangeReplaceFilter, Settings, Nc, Ex
grayFilter.gray = 0.85; grayFilter.gray = 0.85;
this.infoFilters = [blurFilter, grayFilter]; this.infoFilters = [blurFilter, grayFilter];
/*
var colorFilter = new ColorMatrixFilter()
colorFilter.matrix = [
1,1,0,0,
0,1,0,0,
0,0,1,0,
0,0,0,1
];
this.infoFilters = [colorFilter];
*/
this.infoText = new PIXI.Text("", {font: "normal 20px monospace", fill: "red", align: "center"}); this.infoText = new PIXI.Text("", {font: "normal 20px monospace", fill: "red", align: "center"});
this.infoBox = new PIXI.Graphics(); this.infoBox = new PIXI.Graphics();
this.infoBox.alpha = 0.7; this.infoBox.alpha = 0.7;
@ -310,7 +299,7 @@ function (Parent, DomController, PIXI, ColorRangeReplaceFilter, Settings, Nc, Ex
this.infoBox.position.x = this.infoText.position.x + borderWidth/2 - padding * 2; this.infoBox.position.x = this.infoText.position.x + borderWidth/2 - padding * 2;
this.infoBox.position.y = this.infoText.position.y + borderWidth/2 - padding; this.infoBox.position.y = this.infoText.position.y + borderWidth/2 - padding;
this.infoContainer.visible = false; this.infoContainer.visible = true;
this.container.filters = this.infoFilters; this.container.filters = this.infoFilters;
this.infoFilters.forEach(function(filter) { filter.dirty = true; }); this.infoFilters.forEach(function(filter) { filter.dirty = true; });
} else { } else {

View file

@ -1,8 +1,9 @@
define([ define([
"Lib/Utilities/ColorConverter" "Lib/Utilities/ColorConverter",
"Lib/Utilities/Exception"
], ],
function (ColorConverter) { function (ColorConverter, Exception) {
var instance = null var instance = null
@ -28,8 +29,8 @@ function (ColorConverter) {
$("#refresh").onclick = refresh; $("#refresh").onclick = refresh;
refresh(); refresh();
populateMaps(); populateMaps();
var channelDestructionTimeout = null; this.channelDestructionTimeout = null;
var refreshInterval = setInterval(refresh, 5000); this.refreshInterval = setInterval(refresh, 5000);
$("#createbutton").onclick = function() { $("#createbutton").onclick = function() {
show('#createform'); show('#createform');
@ -55,7 +56,9 @@ function (ColorConverter) {
$("#primarycolor").style.backgroundColor = "#" + this.colorConverter.getColorByName(e.target.value).toString(16); $("#primarycolor").style.backgroundColor = "#" + this.colorConverter.getColorByName(e.target.value).toString(16);
}; };
Menu.prototype.onRun = function(channelName, nickname) {} Menu.prototype.onRun = function(channelName, nickname) {
throw new Exception("Menu onRun has to be overwritten");
}
window.onhashchange = function() { window.onhashchange = function() {
if(window.location.hash) { if(window.location.hash) {
@ -250,7 +253,7 @@ function (ColorConverter) {
function startTimer(seconds) { function startTimer(seconds) {
var now = new Date(); var now = new Date();
var end = new Date(now.getTime() + seconds * 1000); var end = new Date(now.getTime() + seconds * 1000);
channelDestructionTimeout = setInterval(function() { instance.channelDestructionTimeout = setInterval(function() {
now = new Date(); now = new Date();
var diff = new Date(end.getTime() - now.getTime()); var diff = new Date(end.getTime() - now.getTime());
if(diff.getTime() < 0) { if(diff.getTime() < 0) {
@ -346,12 +349,12 @@ function (ColorConverter) {
$("#game").style.display = "block"; $("#game").style.display = "block";
instance.onRun(channelName, nickname); // Dumm und dümmer instance.onRun(channelName, nickname); // Dumm und dümmer
if(refreshInterval) { if(instance.refreshInterval) {
clearInterval(refreshInterval); clearInterval(instance.refreshInterval);
} }
if(channelDestructionTimeout) { if(instance.channelDestructionTimeout) {
clearInterval(channelDestructionTimeout); clearInterval(instance.channelDestructionTimeout);
} }
} }