Skip to content

Commit

Permalink
The position of a newly loaded effect is now set to the position of t…
Browse files Browse the repository at this point in the history
…he old one. Resolves #6.
  • Loading branch information
raeleus committed Feb 18, 2024
1 parent 5016731 commit 8d2de2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog
### Version 1.0.6
* Resolved issue with Angle still affecting the emitter despite being deactivated. Thanks ludek17052.
* The position of a newly loaded effect is now set to the position of the old one. Thanks ChinQingl.
### Version 1.0.5
* Fix export file dialog defaulting to an incorrect path
* Fixed image name error when loading old particle effects with whole paths listed in the particle file
Expand Down
7 changes: 6 additions & 1 deletion core/src/main/java/com/ray3k/gdxparticleeditor/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public static boolean loadParticle(FileHandle fileHandle, ObjectMap<String, File
try {
if (fileHandle.type() != FileType.Internal) {
newParticleEffect.loadEmitters(fileHandle);
newParticleEffect.setPosition(0, 0);

if (imageFileMap == null) newParticleEffect.loadEmitterImages(fileHandle.parent());
else {
Expand Down Expand Up @@ -173,6 +172,12 @@ public static boolean loadParticle(FileHandle fileHandle, ObjectMap<String, File
return false;
}

//Set position of the new effect to the position of the current one
if (activeEmitters.size > 0) {
var emitter = activeEmitters.orderedKeys().get(0);
newParticleEffect.setPosition(emitter.getX(), emitter.getY());
}

disposeParticleEffect();
sprites.clear();
fileHandles.clear();
Expand Down

0 comments on commit 8d2de2d

Please sign in to comment.