Skip to content

Commit bdfabcf

Browse files
committed
Add a QOL improvement so that single-button images can quickly be filled, without dragging a region
1 parent ddd999e commit bdfabcf

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

Data/RegionBrush.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ public EmulatedKey SelectedEmulatedKey
3434
OnPropertyChanged(nameof(SelectedEmulatedKey));
3535
}
3636
}
37+
38+
/// <summary>
39+
/// Whether to fill the entire image with the region
40+
/// </summary>
41+
private bool _fill_region;
42+
public bool FillRegion
43+
{
44+
get { return _fill_region; }
45+
set
46+
{
47+
_fill_region = value;
48+
OnPropertyChanged(nameof(FillRegion));
49+
}
50+
}
3751
#endregion
3852
}
3953
}

MainWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
</Style>
9292
</ComboBox.Style>
9393
</ComboBox>
94+
<CheckBox Margin="5 0 5 0" Content="Fill texture?" IsChecked="{Binding SelectedRegionBrush.FillRegion}" VerticalAlignment="Center" />
9495
</StackPanel>
9596
<controls:PanZoom x:Name="PanZoom" Grid.Row="1"></controls:PanZoom>
9697
</Grid>

ViewModels/PanZoomViewModel.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,21 @@ public void StartCreatingRegion(Point p)
8989
}
9090
}
9191

92-
_currently_creating_region = new Data.RectRegion() { ScaleFactor = InputPack.EditingTexture.ScaleFactor, X = p.X, Y = p.Y, Height = 1, Width = 1, Device = InputPack.SelectedRegionBrush.SelectedEmulatedDevice, Key = InputPack.SelectedRegionBrush.SelectedEmulatedKey };
92+
if (InputPack.SelectedRegionBrush.FillRegion)
93+
{
94+
_currently_creating_region = new Data.RectRegion() { ScaleFactor = InputPack.EditingTexture.ScaleFactor, X = 0, Y = 0, Height = InputPack.EditingTexture.ImageHeight, Width = InputPack.EditingTexture.ImageWidth, Device = InputPack.SelectedRegionBrush.SelectedEmulatedDevice, Key = InputPack.SelectedRegionBrush.SelectedEmulatedKey };
95+
}
96+
else
97+
{
98+
_currently_creating_region = new Data.RectRegion() { ScaleFactor = InputPack.EditingTexture.ScaleFactor, X = p.X, Y = p.Y, Height = 1, Width = 1, Device = InputPack.SelectedRegionBrush.SelectedEmulatedDevice, Key = InputPack.SelectedRegionBrush.SelectedEmulatedKey };
99+
}
93100
InputPack.EditingTexture.Regions.Add(_currently_creating_region);
101+
102+
if (InputPack.SelectedRegionBrush.FillRegion)
103+
{
104+
// No need to continue, operation is finished
105+
_currently_creating_region = null;
106+
}
94107
}
95108

96109
/// <summary>

0 commit comments

Comments
 (0)