Skip to content

Commit 9ec0c82

Browse files
committed
Updated Avalonia Nugets to try to solve a bug in Mac versions
Fixed Paste data from GDU/Chars to Sprite
1 parent 2076a7a commit 9ec0c82

2 files changed

Lines changed: 19 additions & 45 deletions

File tree

ZXBStudio/DocumentEditors/ZXGraphics/SpriteEditor.axaml

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,7 @@
99
Focusable="True"
1010
Background="#ff202020"
1111
x:Class="ZXBasicStudio.DocumentEditors.ZXGraphics.SpriteEditor">
12-
<UserControl.Styles>
13-
<Style Selector="Button.toolbar_r90">
14-
<Setter Property="Background" Value="#fff0f0f0" />
15-
<Setter Property="Width" Value="32" />
16-
<Setter Property="Height" Value="32" />
17-
<Setter Property="Padding" Value="4" />
18-
<Setter Property="CornerRadius" Value="4" />
19-
<Setter Property="RenderTransform">
20-
<Setter.Value>
21-
<RotateTransform Angle="90"/>
22-
</Setter.Value>
23-
</Setter>
24-
</Style>
25-
<Style Selector="Button.toolbar_r270">
26-
<Setter Property="Background" Value="#fff0f0f0" />
27-
<Setter Property="Width" Value="32" />
28-
<Setter Property="Height" Value="32" />
29-
<Setter Property="Padding" Value="4" />
30-
<Setter Property="CornerRadius" Value="4" />
31-
<Setter Property="RenderTransform">
32-
<Setter.Value>
33-
<RotateTransform Angle="270"/>
34-
</Setter.Value>
35-
</Setter>
36-
</Style>
37-
<Style Selector="Button.toolbar_hMirror">
38-
<Setter Property="Background" Value="#fff0f0f0" />
39-
<Setter Property="Width" Value="32" />
40-
<Setter Property="Height" Value="32" />
41-
<Setter Property="Padding" Value="4" />
42-
<Setter Property="CornerRadius" Value="4" />
43-
<Setter Property="RenderTransform">
44-
<Setter.Value>
45-
<ScaleTransform ScaleX="-1"/>
46-
</Setter.Value>
47-
</Setter>
48-
</Style>
49-
</UserControl.Styles>
50-
12+
5113
<Grid Name="grdMain" RowDefinitions="*,Auto">
5214
<Grid Name="grdEditor" Grid.RowSpan="2" ColumnDefinitions="180,4,*,4,200" Margin="0,8,0,0">
5315

ZXBStudio/DocumentEditors/ZXGraphics/SpritePatternEditor.axaml.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Linq;
1111
using System.Xml.Schema;
1212
using ZXBasicStudio.Common;
13+
using ZXBasicStudio.DocumentEditors.ZXGraphics.log;
1314
using ZXBasicStudio.DocumentEditors.ZXGraphics.neg;
1415
using ZXBasicStudio.Extensions;
1516

@@ -363,8 +364,14 @@ public async void Paste()
363364

364365
if (cbPatterns.Length == 1)
365366
{
366-
SpriteData.Patterns[SpriteData.CurrentFrame].Data = cbPatterns[0].Data;
367-
SpriteData.Patterns[SpriteData.CurrentFrame].RawData = cbPatterns[0].RawData;
367+
if (cbPatterns[0].RawData == null)
368+
{
369+
SpriteData.Patterns[SpriteData.CurrentFrame].RawData = ServiceLayer.PointData2RawData(cbPatterns[0].Data, 8, 8);
370+
}
371+
else
372+
{
373+
SpriteData.Patterns[SpriteData.CurrentFrame].RawData = cbPatterns[0].RawData;
374+
}
368375
}
369376
else
370377
{
@@ -377,19 +384,24 @@ public async void Paste()
377384
// Paste from PointData
378385
int ox = 0;
379386
int oy = 0;
387+
int dir = 0;
380388
for (int n = 0; n < cbPatterns.Length; n++)
381389
{
390+
//int d1 = (n / SpriteData.Width);
391+
//int d2 = (d1 * SpriteData.Width) - n;
382392
for (int py = 0; py < 8; py++)
383393
{
384394
for (int px = 0; px < 8; px++)
385395
{
386396
var po = cbPatterns[n].Data.FirstOrDefault(d => d.X == px && d.Y == py);
387397
if (po != null)
388398
{
389-
var pd = pat2.Data.FirstOrDefault(d => d.X == px + ox && d.Y == py + oy);
390-
if (pd != null)
399+
dir = ((oy+py) * SpriteData.Width) + (ox+px);
400+
401+
if (dir < pattern.RawData.Length)
391402
{
392-
pd.ColorIndex = po.ColorIndex;
403+
SpriteData.Patterns[SpriteData.CurrentFrame].RawData[dir] = po.ColorIndex;
404+
//pattern.RawData[dir] = po.ColorIndex;
393405
}
394406
}
395407
}
@@ -401,7 +413,7 @@ public async void Paste()
401413
oy += 8;
402414
}
403415
}
404-
SpriteData.Patterns[SpriteData.CurrentFrame].Data = pat2.Data;
416+
//SpriteData.Patterns[SpriteData.CurrentFrame].Data = pat2.Data;
405417
}
406418
else
407419
{

0 commit comments

Comments
 (0)