Skip to content

Commit 8fb8943

Browse files
committed
update image offsets with a new folder is loaded
1 parent e1dbcd8 commit 8fb8943

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Gui/ViewModels/SubObjectTypes/ImageTableViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void LoadSprite(string filename, SpriteOffset? offset = null)
309309
}
310310
else
311311
{
312-
UpdateImage(img, index);
312+
UpdateImage(img, index, offset);
313313
}
314314
}
315315

@@ -367,7 +367,7 @@ public async Task ReplaceImage()
367367
this.RaisePropertyChanged(nameof(SelectedG1Element));
368368
}
369369

370-
void UpdateImage(Image<Rgba32> img, int index)
370+
void UpdateImage(Image<Rgba32> img, int index, SpriteOffset? offset = null)
371371
{
372372
if (index == -1)
373373
{
@@ -381,8 +381,8 @@ void UpdateImage(Image<Rgba32> img, int index)
381381
Height = (int16_t)img.Height,
382382
Flags = currG1.Flags,
383383
ImageData = PaletteMap.ConvertRgba32ImageToG1Data(img, currG1.Flags),
384-
XOffset = currG1.XOffset,
385-
YOffset = currG1.YOffset
384+
XOffset = offset?.X ?? currG1.XOffset,
385+
YOffset = offset?.Y ?? currG1.YOffset,
386386
};
387387
G1Provider.G1Elements[index] = currG1;
388388
Images[index] = img;

0 commit comments

Comments
 (0)