Skip to content
Snippets Groups Projects
Commit 194de0ec authored by Manuel Herrmann's avatar Manuel Herrmann
Browse files

use opacity instead of display:none - bbox wont work on svgs if so; onload...

use opacity instead of display:none - bbox wont work on svgs if so; onload fix; spawn not found message
parent fe9ea871
No related branches found
No related tags found
No related merge requests found
......@@ -71,18 +71,19 @@ class Game1SignupMethod extends SignupMethod {
var FAPI = new FAPI();
var game = new Game({
startMap: \'map_landing.svg\',
startMap: \'map_landing\',
showEventLayers: false,
pathFindingGridSize: 5,
usePathFinding: true,
size: [800, 600]
});
game.run();
// this following stuff is to prevent the page from scrolling, when the user
// actually just wants to scroll inside the logs.
// it removes the main scrollbar and adds a padding of its size to replace the space
window.onload = function() {
$(function() {
game.run();
var scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
var x = document.getElementsByClassName("sidebar-log");
for (var i = 0; i < x.length; i++) {
......@@ -95,7 +96,7 @@ class Game1SignupMethod extends SignupMethod {
document.body.style.paddingRight = scrollbarWidth+"px";
}, false);
}
};
});
</script>';
}
......
......@@ -26,6 +26,7 @@ function Char(svg, options) {
Char.prototype.findSpawn = function() {
// [1320, svgFlipY(svg[0][0], 500)]
var spawn = this.svg.select("#player_spawn");
if (!spawn[0][0]) console.error("Could not find spawn");
var bbox = spawn[0][0].getBBox();
return Vec.add(getTranslation(this.svg[0][0], spawn[0][0]), [bbox.x, bbox.y]);
};
......
......@@ -58,13 +58,15 @@ Game.prototype.loadMap = function(map) {
// -------------------------------------
// init event related stuff
var displayEvents = Game.config.showEventLayers ? 'block' : 'none';
var displayEvents = Game.config.showEventLayers ? 1 : 0;
svg.selectAll('g').filter(function() {
return (
this.getAttribute('inkscape:groupmode') == 'layer'
&& Game.eventLayers.indexOf(this.getAttribute('inkscape:label')) >= 0
);
}).style('display', displayEvents);
})
.style('display', 'block')
.style('opacity', displayEvents);
Game.eventHandler = new EventHandler(svg);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment