mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-08-07 15:25:31 +00:00
Account for scrolled view when assigning and unassigning scripts.
This commit is contained in:
@@ -117,15 +117,15 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void assignScript(Script script, double x, double y) {
|
public void assignScript(Script script, double x, double y) {
|
||||||
int xx = (int) (x / tileWidth);
|
int xx = (int) (x / tileWidth) + posX;
|
||||||
int yy = (int) (y / tileHeight);
|
int yy = (int) (y / tileHeight) + posY;
|
||||||
getCurrentMap().putLocationScript(xx, yy, script);
|
getCurrentMap().putLocationScript(xx, yy, script);
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unassignScripts(double x, double y) {
|
public void unassignScripts(double x, double y) {
|
||||||
int xx = (int) (x / tileWidth);
|
int xx = (int) (x / tileWidth) + posX;
|
||||||
int yy = (int) (y / tileHeight);
|
int yy = (int) (y / tileHeight) + posY;
|
||||||
getCurrentMap().removeLocationScripts(xx, yy);
|
getCurrentMap().removeLocationScripts(xx, yy);
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user