Skip to content

Commit

Permalink
fix some jshint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
englercj committed Dec 13, 2014
1 parent 2d7a09b commit 1edd0d5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
34 changes: 15 additions & 19 deletions src/tiled/TilemapParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,24 +194,12 @@ var TilemapParser = {

poly = obj.getElementsByTagName('polygon');
if (poly.length) {
object.polygon = poly[0].attributes.getNamedItem('points').value.split(' ').map(function (pt) {
var points = pt.split(',');
return {
x: parseInt(points[0], 10),
y: parseInt(points[1], 10)
};
});
object.polygon = poly[0].attributes.getNamedItem('points').value.split(' ').map(csvToXY);
}

poly = obj.getElementsByTagName('polyline');
if (poly.length) {
object.polyline = poly[0].attributes.getNamedItem('points').value.split(' ').map(function (pt) {
var points = pt.split(',');
return {
x: parseInt(points[0], 10),
y: parseInt(points[1], 10)
};
});
object.polyline = poly[0].attributes.getNamedItem('points').value.split(' ').map(csvToXY);
}

poly = obj.getElementsByTagName('ellipse');
Expand Down Expand Up @@ -246,11 +234,11 @@ var TilemapParser = {
properties: {}
};

var props = ilyr.getElementsByTagName('properties');
if(props.length) {
props = props[0].getElementsByTagName('property');
for(var pr = 0; pr < props.length; ++pr) {
imglayer.properties[props[pr].attributes.getNamedItem('name').value] = props[pr].attributes.getNamedItem('value').value;
var iprops = ilyr.getElementsByTagName('properties');
if(iprops.length) {
iprops = iprops[0].getElementsByTagName('property');
for(var ip = 0; ip < iprops.length; ++ip) {
imglayer.properties[iprops[ip].attributes.getNamedItem('name').value] = iprops[ip].attributes.getNamedItem('value').value;
}
}

Expand Down Expand Up @@ -403,3 +391,11 @@ var TilemapParser = {
};

module.exports = TilemapParser;

function csvToXY(pt) {
var points = pt.split(',');
return {
x: parseInt(points[0], 10),
y: parseInt(points[1], 10)
};
}
10 changes: 8 additions & 2 deletions src/tiled/Tileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ function Tileset(game, key, settings) {
ttx = PIXI.TextureCache[ttxkey];

if (!ttx) {
console.warn('Tileset "' + settings.name + '" unable to find texture cached by key "' + ttxkey + '", using blank texture.');
console.warn(
'Tileset "' + settings.name + '" unable to find texture cached by key "' +
ttxkey + '", using blank texture.'
);
ttx = new PIXI.Texture(new PIXI.BaseTexture());
}

Expand All @@ -62,7 +65,10 @@ function Tileset(game, key, settings) {

// if no main texture, and we didn't find any image tiles then warn about blank tileset
if (!tx && !tileTextures) {
console.warn('Tileset "' + settings.name + '" unable to find texture cached by key "' + txkey + '", using blank texture.');
console.warn(
'Tileset "' + settings.name + '" unable to find texture cached by key "' +
txkey + '", using blank texture.'
);
}

PIXI.Texture.call(this, tx || new PIXI.BaseTexture());
Expand Down

0 comments on commit 1edd0d5

Please sign in to comment.