Skip to content

Commit

Permalink
Removed snap to grid preference key
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Nov 18, 2023
1 parent 7a267cd commit a376db0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
4 changes: 1 addition & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ void main() async {
IPAddressMode.fromIndex(preferences.getInt(PrefKeys.ipAddressMode));

Globals.gridSize = preferences.getInt(PrefKeys.gridSize) ?? Globals.gridSize;
Globals.snapToGrid =
preferences.getBool(PrefKeys.snapToGrid) ?? Globals.snapToGrid;
Globals.showGrid = preferences.getBool(PrefKeys.showGrid) ?? Globals.showGrid;
Globals.cornerRadius =
preferences.getDouble(PrefKeys.cornerRadius) ?? Globals.cornerRadius;
Expand Down Expand Up @@ -143,7 +141,7 @@ class _ElasticState extends State<Elastic> {
version: widget.version,
onColorChanged: (color) => setState(() {
teamColor = color;
widget.preferences.setInt('team_color', color.value);
widget.preferences.setInt(PrefKeys.teamColor, color.value);
}),
),
);
Expand Down
2 changes: 0 additions & 2 deletions lib/services/globals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class Globals {
static int teamNumber = 353;
static int gridSize = 128;
static double cornerRadius = 15.0;
static bool snapToGrid = true;
static bool showGrid = false;

static const double defaultPeriod = 0.1;
Expand All @@ -28,6 +27,5 @@ class PrefKeys {
static String teamColor = 'team_color';
static String gridSize = 'grid_size';
static String cornerRadius = 'corner_radius';
static String snapToGrid = 'snap_to_grid';
static String showGrid = 'show_grid';
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,7 @@ class DraggableWidgetContainer extends StatelessWidget {
}

static double snapToGrid(double value) {
if (Globals.snapToGrid) {
return (value / Globals.gridSize).roundToDouble() * Globals.gridSize;
} else {
return value;
}
return (value / Globals.gridSize).roundToDouble() * Globals.gridSize;
}

void refresh() {
Expand Down

0 comments on commit a376db0

Please sign in to comment.