Skip to content

Commit

Permalink
Start renaming current layers to collections
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Sep 7, 2024
1 parent 8b94827 commit c563e72
Show file tree
Hide file tree
Showing 27 changed files with 514 additions and 266 deletions.
12 changes: 7 additions & 5 deletions api/lib/src/converter/xopp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ String _exportColor(int value) {
}

(NoteData, PadElement?) getElement(
NoteData data, XmlElement element, String layerName) {
NoteData data, XmlElement element, String collectionName) {
PadElement? get() {
switch (element.qualifiedName) {
case 'stroke':
Expand All @@ -48,7 +48,7 @@ String _exportColor(int value) {
.split(' ')
.map((e) => double.parse(e))
.toList()),
layer: layerName,
collection: collectionName,
);
case 'text':
return TextElement(
Expand All @@ -66,7 +66,7 @@ String _exportColor(int value) {
)),
position: Point(double.parse(element.getAttribute('x')!),
double.parse(element.getAttribute('y')!)),
layer: layerName,
collection: collectionName,
);
case 'image':
final imageData = UriData.parse(element.innerText);
Expand All @@ -79,7 +79,7 @@ String _exportColor(int value) {
return ImageElement(
source: Uri.file(path, windows: false).toString(),
position: Point(left, top),
layer: layerName,
collection: collectionName,
height: bottom - top,
width: right - left,
);
Expand Down Expand Up @@ -134,7 +134,9 @@ NoteData xoppMigrator(Uint8List data) {
_ => null,
};
(note, _) = note.addPage(DocumentPage(
content: elements,
layers: [
DocumentLayer(content: elements),
],
backgrounds: [
if (background != null) background,
],
Expand Down
14 changes: 7 additions & 7 deletions api/lib/src/models/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ sealed class PadElement with _$PadElement {
@Implements<PathElement>()
factory PadElement.pen({
@Default(0) double rotation,
@Default('') String layer,
@Default('') String collection,
@IdJsonConverter() String? id,
double? zoom,
@Default([]) List<PathPoint> points,
Expand All @@ -93,7 +93,7 @@ sealed class PadElement with _$PadElement {
@With<LabelElement>()
factory PadElement.text({
@Default(0) double rotation,
@Default('') String layer,
@Default('') String collection,
@IdJsonConverter() String? id,
@DoublePointJsonConverter()
@Default(Point(0.0, 0.0))
Expand All @@ -109,7 +109,7 @@ sealed class PadElement with _$PadElement {
@With<LabelElement>()
factory PadElement.markdown({
@Default(0) double rotation,
@Default('') String layer,
@Default('') String collection,
@IdJsonConverter() String? id,
@DoublePointJsonConverter()
@Default(Point(0.0, 0.0))
Expand All @@ -126,7 +126,7 @@ sealed class PadElement with _$PadElement {
@Implements<SourcedElement>()
factory PadElement.image({
@Default(0) double rotation,
@Default('') String layer,
@Default('') String collection,
@IdJsonConverter() String? id,
@DoublePointJsonConverter()
@Default(Point(0.0, 0.0))
Expand All @@ -142,7 +142,7 @@ sealed class PadElement with _$PadElement {
@Implements<SourcedElement>()
factory PadElement.svg({
@Default(0) double rotation,
@Default('') String layer,
@Default('') String collection,
@IdJsonConverter() String? id,
@DoublePointJsonConverter()
@Default(Point(0.0, 0.0))
Expand All @@ -157,7 +157,7 @@ sealed class PadElement with _$PadElement {

factory PadElement.shape({
@Default(0) double rotation,
@Default('') String layer,
@Default('') String collection,
@IdJsonConverter() String? id,
@DoublePointJsonConverter()
@Default(Point(0.0, 0.0))
Expand All @@ -171,7 +171,7 @@ sealed class PadElement with _$PadElement {

factory PadElement.texture({
@Default(0) double rotation,
@Default('') String layer,
@Default('') String collection,
@IdJsonConverter() String? id,
@Default(SurfaceTexture.pattern()) SurfaceTexture texture,
@DoublePointJsonConverter()
Expand Down
Loading

0 comments on commit c563e72

Please sign in to comment.