Skip to content

Commit 9e663ad

Browse files
committed
(graphics) Calculate offset in a moder controlable way
1 parent 07ad087 commit 9e663ad

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

agrf/graphics/sprites/map.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ def __init__(self, a, f, name, xofs=0, yofs=0):
1111
if not isinstance(a, tuple):
1212
a = (a,)
1313
super().__init__(
14-
a[0].w, a[0].h, zoom=a[0].zoom, xofs=a[0].xofs + xofs, yofs=a[0].yofs + yofs, bpp=a[0].bpp, crop=a[0].crop
14+
a[0].w, a[0].h, zoom=a[0].zoom, xofs=a[0].xofs, yofs=a[0].yofs, bpp=a[0].bpp, crop=a[0].crop
1515
)
1616
self.a = a
1717
self.f = f
1818
self._fname = name
19+
self._relative_xofs = xofs
20+
self._relative_yofs = yofs
1921

2022
def get_fingerprint(self):
2123
return {"a": [x.get_fingerprint() for x in self.a], "name": self._fname}
@@ -28,4 +30,7 @@ def get_data_layers(self, context):
2830
fa = self.f([LayeredImage.from_sprite(x).copy() for x in self.a])
2931
timer.count_composing()
3032

33+
self.xofs = fa.xofs + self._relative_xofs
34+
self.yofs = fa.yofs + self._relative_yofs
35+
3136
return fa.w, fa.h, fa.rgb, fa.alpha, fa.mask

0 commit comments

Comments
 (0)