Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/lib/src/models/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ sealed class PadElement with _$PadElement {
bool isStroke() => switch (this) {
PenElement _ => true,
ShapeElement _ => true,
PolygonElement _ => true,
_ => false,
};
}
26 changes: 26 additions & 0 deletions api/lib/src/models/tool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,29 @@ enum BarcodeType {
const BarcodeType({this.width = 300, this.height = 300});
}

enum HitElementMode {
none,
full,
touchEdges,
touchAnywhere;

static List<HitElementMode> eraserValues() {
return [
HitElementMode.none,
HitElementMode.touchEdges,
HitElementMode.touchAnywhere,
];
}

static List<HitElementMode> selectorValues() {
return [
HitElementMode.full,
HitElementMode.touchEdges,
HitElementMode.touchAnywhere,
];
}
}

@Freezed(equal: false)
sealed class Tool with _$Tool {
Tool._();
Expand All @@ -49,6 +72,7 @@ sealed class Tool with _$Tool {
@Default('') String displayIcon,
@IdJsonConverter() String? id,
@Default(SelectMode.rectangle) SelectMode mode,
@Default(HitElementMode.touchAnywhere) HitElementMode hitElementMode,
}) = SelectTool;

factory Tool.hand({
Expand Down Expand Up @@ -104,6 +128,7 @@ sealed class Tool with _$Tool {
@Default('') String displayIcon,
@IdJsonConverter() String? id,
@Default(5) double strokeWidth,
@Default(HitElementMode.touchAnywhere) HitElementMode hitElementMode,
@Default(false) bool eraseElements,
}) = EraserTool;

Expand All @@ -112,6 +137,7 @@ sealed class Tool with _$Tool {
@Default('') String displayIcon,
@IdJsonConverter() String? id,
@Default(5) double strokeWidth,
@Default(HitElementMode.touchAnywhere) HitElementMode hitElementMode,
@Default(false) bool eraseElements,
}) = PathEraserTool;

Expand Down
36 changes: 21 additions & 15 deletions api/lib/src/models/tool.freezed.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions api/lib/src/models/tool.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions api/lib/src/models/utilities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@ part 'utilities.g.dart';
@JsonSerializable()
final class UtilitiesState with _$UtilitiesState {
@override
final bool lockCollection,
lockLayer,
lockZoom,
lockHorizontal,
lockVertical,
fullSelection;
final bool lockCollection, lockLayer, lockZoom, lockHorizontal, lockVertical;

const UtilitiesState({
this.lockCollection = false,
this.lockLayer = false,
this.lockZoom = false,
this.lockHorizontal = false,
this.lockVertical = false,
this.fullSelection = false,
});

factory UtilitiesState.fromJson(Map<String, dynamic> json) =>
Expand Down
13 changes: 6 additions & 7 deletions api/lib/src/models/utilities.freezed.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/lib/src/models/utilities.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading