Some checks failed
CI / Windows build (push) Has been cancelled
Closes TODO(brush-persist). EditorStroke now serializes its brush as the stable BrushKind name; sidecars written before this field, and any unknown name, load as fountainPen (back-compat). PenStroke<->EditorStroke carry brush both ways, so a ballpoint/highlighter/pencil stroke keeps its opacity/blend after a document is closed and reopened. Note: InkStroke (the note/scratchpad world-coord format) has no brush field, so notes derive brush from the tool — highlighter is preserved, ballpoint/pencil collapse to fountainPen on reload (TODO: extend InkStroke). PDF documents persist brush fully. analyze clean, 379 tests green.
89 lines
2.9 KiB
Dart
89 lines
2.9 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'stroke_model.dart';
|
|
|
|
// **************************************************************************
|
|
// JsonSerializableGenerator
|
|
// **************************************************************************
|
|
|
|
_$EditorPointImpl _$$EditorPointImplFromJson(Map<String, dynamic> json) =>
|
|
_$EditorPointImpl(
|
|
x: (json['x'] as num).toDouble(),
|
|
y: (json['y'] as num).toDouble(),
|
|
pressure: (json['pressure'] as num?)?.toDouble(),
|
|
tilt: (json['tilt'] as num?)?.toDouble(),
|
|
timestamp: (json['timestamp'] as num?)?.toInt(),
|
|
pointerDeviceKind: $enumDecodeNullable(
|
|
_$InputDeviceKindEnumMap,
|
|
json['pointerDeviceKind'],
|
|
),
|
|
);
|
|
|
|
Map<String, dynamic> _$$EditorPointImplToJson(_$EditorPointImpl instance) =>
|
|
<String, dynamic>{
|
|
'x': instance.x,
|
|
'y': instance.y,
|
|
'pressure': instance.pressure,
|
|
'tilt': instance.tilt,
|
|
'timestamp': instance.timestamp,
|
|
'pointerDeviceKind': _$InputDeviceKindEnumMap[instance.pointerDeviceKind],
|
|
};
|
|
|
|
const _$InputDeviceKindEnumMap = {
|
|
InputDeviceKind.touch: 'touch',
|
|
InputDeviceKind.mouse: 'mouse',
|
|
InputDeviceKind.stylus: 'stylus',
|
|
InputDeviceKind.invertedStylus: 'invertedStylus',
|
|
InputDeviceKind.trackpad: 'trackpad',
|
|
InputDeviceKind.unknown: 'unknown',
|
|
};
|
|
|
|
_$EditorStrokeImpl _$$EditorStrokeImplFromJson(Map<String, dynamic> json) =>
|
|
_$EditorStrokeImpl(
|
|
id: json['id'] as String,
|
|
points: (json['points'] as List<dynamic>)
|
|
.map((e) => EditorPoint.fromJson(e as Map<String, dynamic>))
|
|
.toList(),
|
|
tool:
|
|
$enumDecodeNullable(_$EditorToolEnumMap, json['tool']) ??
|
|
EditorTool.pen,
|
|
color: (json['color'] as num?)?.toInt() ?? 0xFF000000,
|
|
width: (json['width'] as num?)?.toDouble() ?? 0.003,
|
|
filled: json['filled'] as bool? ?? false,
|
|
textContent: json['textContent'] as String?,
|
|
fontSize: (json['fontSize'] as num?)?.toDouble() ?? 14.0,
|
|
brush:
|
|
$enumDecodeNullable(
|
|
_$BrushKindEnumMap,
|
|
json['brush'],
|
|
unknownValue: BrushKind.fountainPen,
|
|
) ??
|
|
BrushKind.fountainPen,
|
|
);
|
|
|
|
Map<String, dynamic> _$$EditorStrokeImplToJson(_$EditorStrokeImpl instance) =>
|
|
<String, dynamic>{
|
|
'id': instance.id,
|
|
'points': instance.points,
|
|
'tool': _$EditorToolEnumMap[instance.tool]!,
|
|
'color': instance.color,
|
|
'width': instance.width,
|
|
'filled': instance.filled,
|
|
'textContent': instance.textContent,
|
|
'fontSize': instance.fontSize,
|
|
'brush': _$BrushKindEnumMap[instance.brush]!,
|
|
};
|
|
|
|
const _$EditorToolEnumMap = {
|
|
EditorTool.pen: 'pen',
|
|
EditorTool.highlighter: 'highlighter',
|
|
EditorTool.eraser: 'eraser',
|
|
};
|
|
|
|
const _$BrushKindEnumMap = {
|
|
BrushKind.fountainPen: 'fountainPen',
|
|
BrushKind.ballpoint: 'ballpoint',
|
|
BrushKind.highlighter: 'highlighter',
|
|
BrushKind.pencil: 'pencil',
|
|
};
|