[editor only] Correct tile coordinates that might be changed due to float precision
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+8
-1
@@ -143,6 +143,8 @@ public class DrawTileTool implements Tool {
|
||||
gridHeight = tiledPlugin.dataToSave.getParameterVO().gridHeight;
|
||||
}
|
||||
|
||||
private final Vector2 temp = new Vector2();
|
||||
|
||||
private void drawImage(float x, float y) {
|
||||
if (tiledPlugin.getSelectedTileName().equals("")) return;
|
||||
|
||||
@@ -158,13 +160,18 @@ public class DrawTileTool implements Tool {
|
||||
}
|
||||
|
||||
IFactory itemFactory = tiledPlugin.getAPI().getItemFactory();
|
||||
if (itemFactory.createSimpleImage(tiledPlugin.getSelectedTileName(), new Vector2(newX, newY))) {
|
||||
temp.set(newX, newY);
|
||||
if (itemFactory.createSimpleImage(tiledPlugin.getSelectedTileName(), temp)) {
|
||||
Entity imageEntity = itemFactory.getCreatedEntity();
|
||||
MainItemComponent mainItemComponent = ComponentRetriever.get(imageEntity, MainItemComponent.class);
|
||||
mainItemComponent.tags.add(TiledPlugin.TILE_TAG);
|
||||
|
||||
mainItemComponent.setCustomVars(TiledPlugin.ROW, Integer.toString(row));
|
||||
mainItemComponent.setCustomVars(TiledPlugin.COLUMN, Integer.toString(column));
|
||||
|
||||
TransformComponent transformComponent = ComponentRetriever.get(imageEntity, TransformComponent.class);
|
||||
transformComponent.x = newX;
|
||||
transformComponent.y = newY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user