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) {
this.renderer.resize(window.innerWidth, window.innerHeight);
this.currentZoom = window.innerWidth / Settings.STAGE_WIDTH;
console.log();
this.currentZoom = window.innerWidth / 600;
console.log(this.currentZoom);
} else {
this.renderer.resize(600, 400);
this.currentZoom = 1;
@ -269,17 +269,6 @@ function (Parent, DomController, PIXI, ColorRangeReplaceFilter, Settings, Nc, Ex
grayFilter.gray = 0.85;
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.infoBox = new PIXI.Graphics();
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.y = this.infoText.position.y + borderWidth/2 - padding;
this.infoContainer.visible = false;
this.infoContainer.visible = true;
this.container.filters = this.infoFilters;
this.infoFilters.forEach(function(filter) { filter.dirty = true; });
} else {

View file

@ -1,8 +1,9 @@
define([
"Lib/Utilities/ColorConverter"
"Lib/Utilities/ColorConverter",
"Lib/Utilities/Exception"
],
function (ColorConverter) {
function (ColorConverter, Exception) {
var instance = null
@ -28,8 +29,8 @@ function (ColorConverter) {
$("#refresh").onclick = refresh;
refresh();
populateMaps();
var channelDestructionTimeout = null;
var refreshInterval = setInterval(refresh, 5000);
this.channelDestructionTimeout = null;
this.refreshInterval = setInterval(refresh, 5000);
$("#createbutton").onclick = function() {
show('#createform');
@ -55,7 +56,9 @@ function (ColorConverter) {
$("#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() {
if(window.location.hash) {
@ -250,7 +253,7 @@ function (ColorConverter) {
function startTimer(seconds) {
var now = new Date();
var end = new Date(now.getTime() + seconds * 1000);
channelDestructionTimeout = setInterval(function() {
instance.channelDestructionTimeout = setInterval(function() {
now = new Date();
var diff = new Date(end.getTime() - now.getTime());
if(diff.getTime() < 0) {
@ -346,12 +349,12 @@ function (ColorConverter) {
$("#game").style.display = "block";
instance.onRun(channelName, nickname); // Dumm und dümmer
if(refreshInterval) {
clearInterval(refreshInterval);
if(instance.refreshInterval) {
clearInterval(instance.refreshInterval);
}
if(channelDestructionTimeout) {
clearInterval(channelDestructionTimeout);
if(instance.channelDestructionTimeout) {
clearInterval(instance.channelDestructionTimeout);
}
}