From ae565cdaae0373db43fc772340072e8d6d4dc082 Mon Sep 17 00:00:00 2001 From: Zeke Chan Date: Mon, 6 Jan 2025 16:45:45 +0800 Subject: [PATCH] Revert "Fixed #6996. Updated calculation for widthInPixels and heightInPixels in MapData. Thanks @ptantiku" This reverts commit ab88e710098eb893cb3f38846a13194b956add92. --- src/tilemaps/parsers/tiled/ParseJSONTiled.js | 13 --------- src/tilemaps/parsers/tiled/ParseTileLayers.js | 28 ------------------- 2 files changed, 41 deletions(-) diff --git a/src/tilemaps/parsers/tiled/ParseJSONTiled.js b/src/tilemaps/parsers/tiled/ParseJSONTiled.js index a9342715b2..ce4a575665 100644 --- a/src/tilemaps/parsers/tiled/ParseJSONTiled.js +++ b/src/tilemaps/parsers/tiled/ParseJSONTiled.js @@ -57,19 +57,6 @@ var ParseJSONTiled = function (name, source, insertNull) mapData.hexSideLength = json.hexsidelength; mapData.staggerAxis = json.staggeraxis; mapData.staggerIndex = json.staggerindex; - - if (mapData.staggerAxis === 'y') - { - var triangleHeight = (mapData.tileHeight - mapData.hexSideLength) / 2; - mapData.widthInPixels = mapData.tileWidth * (mapData.width + 0.5); - mapData.heightInPixels = mapData.height * (mapData.hexSideLength + triangleHeight) + triangleHeight; - } - else - { - var triangleWidth = (mapData.tileWidth - mapData.hexSideLength) / 2; - mapData.widthInPixels = mapData.width * (mapData.hexSideLength + triangleWidth) + triangleWidth; - mapData.heightInPixels = mapData.tileHeight * (mapData.height + 0.5); - } } mapData.layers = ParseTileLayers(json, insertNull); diff --git a/src/tilemaps/parsers/tiled/ParseTileLayers.js b/src/tilemaps/parsers/tiled/ParseTileLayers.js index 6c3a8d0038..0b01c246a5 100644 --- a/src/tilemaps/parsers/tiled/ParseTileLayers.js +++ b/src/tilemaps/parsers/tiled/ParseTileLayers.js @@ -111,8 +111,6 @@ var ParseTileLayers = function (json, insertNull) var gidInfo; var tile; var blankTile; - var triangleHeight; - var triangleWidth; var output = []; var x = 0; @@ -142,19 +140,6 @@ var ParseTileLayers = function (json, insertNull) layerData.hexSideLength = json.hexsidelength; layerData.staggerAxis = json.staggeraxis; layerData.staggerIndex = json.staggerindex; - - if (layerData.staggerAxis === 'y') - { - triangleHeight = (layerData.tileHeight - layerData.hexSideLength) / 2; - layerData.widthInPixels = layerData.tileWidth * (layerData.width + 0.5); - layerData.heightInPixels = layerData.height * (layerData.hexSideLength + triangleHeight) + triangleHeight; - } - else - { - triangleWidth = (layerData.tileWidth - layerData.hexSideLength) / 2; - layerData.widthInPixels = layerData.width * (layerData.hexSideLength + triangleWidth) + triangleWidth; - layerData.heightInPixels = layerData.tileHeight * (layerData.height + 0.5); - } } for (var c = 0; c < curl.height; c++) @@ -236,19 +221,6 @@ var ParseTileLayers = function (json, insertNull) layerData.hexSideLength = json.hexsidelength; layerData.staggerAxis = json.staggeraxis; layerData.staggerIndex = json.staggerindex; - - if (layerData.staggerAxis === 'y') - { - triangleHeight = (layerData.tileHeight - layerData.hexSideLength) / 2; - layerData.widthInPixels = layerData.tileWidth * (layerData.width + 0.5); - layerData.heightInPixels = layerData.height * (layerData.hexSideLength + triangleHeight) + triangleHeight; - } - else - { - triangleWidth = (layerData.tileWidth - layerData.hexSideLength) / 2; - layerData.widthInPixels = layerData.width * (layerData.hexSideLength + triangleWidth) + triangleWidth; - layerData.heightInPixels = layerData.tileHeight * (layerData.height + 0.5); - } } var row = [];