fix: Surface pen pressure, zoom glitches, sticky notes, selection UX
All checks were successful
CI / Windows build (push) Successful in 8m19s
All checks were successful
CI / Windows build (push) Successful in 8m19s
Wire Win32 pressure into Dart, tighten pinch guards, use geometric shape strokes, expand the ink palette, and replace scratch-link split view with an on-page sticky that shares the sidecar repo. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -89,13 +89,7 @@ class _SplitViewState extends State<SplitViewScreen> {
|
||||
static const double _penWidthFraction = 0.006;
|
||||
static const double _highlighterWidthFraction = 0.02;
|
||||
|
||||
static const List<Color> _palette = [
|
||||
Colors.black,
|
||||
Colors.red,
|
||||
Colors.blue,
|
||||
Colors.green,
|
||||
Colors.orange,
|
||||
];
|
||||
static const List<Color> _palette = kInkPalette;
|
||||
|
||||
// -- Auto-save debounce --
|
||||
Timer? _saveTimer;
|
||||
@@ -119,12 +113,14 @@ class _SplitViewState extends State<SplitViewScreen> {
|
||||
@override
|
||||
void dispose() {
|
||||
_saveTimer?.cancel();
|
||||
_saveImmediate();
|
||||
final repo = _repo;
|
||||
if (repo != null) {
|
||||
repo.flush(); // fire-and-forget; atomic write finishes off the tree
|
||||
repo.dispose();
|
||||
// Schedule a final flush; retain-counted repo may still be held by the
|
||||
// PDF editor, so dispose only drops our retain.
|
||||
if (_dirty) {
|
||||
unawaited(_saveImmediate());
|
||||
} else {
|
||||
unawaited(_repo?.flush() ?? Future<void>.value());
|
||||
}
|
||||
_repo?.dispose();
|
||||
// PdfViewerController (pdfrx) has no dispose(); it detaches with the viewer.
|
||||
_scratchTransform.dispose();
|
||||
super.dispose();
|
||||
@@ -166,9 +162,9 @@ class _SplitViewState extends State<SplitViewScreen> {
|
||||
|
||||
Future<void> _saveImmediate() async {
|
||||
if (!_dirty) return;
|
||||
_dirty = false;
|
||||
final repo = _repo;
|
||||
if (repo == null) return;
|
||||
// Keep dirty until schedule succeeds so a race during load can't swallow ink.
|
||||
repo.scheduleScratchpadSave(
|
||||
widget.scratchLinkId,
|
||||
SidecarScratchpad(
|
||||
@@ -177,6 +173,7 @@ class _SplitViewState extends State<SplitViewScreen> {
|
||||
strokes: List<InkStroke>.of(_strokes),
|
||||
),
|
||||
);
|
||||
_dirty = false;
|
||||
await repo.flush();
|
||||
}
|
||||
|
||||
@@ -295,9 +292,9 @@ class _SplitViewState extends State<SplitViewScreen> {
|
||||
title: const Text('Scratch link', style: TextStyle(fontSize: 16)),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
onPressed: () {
|
||||
_saveImmediate();
|
||||
Navigator.of(context).pop();
|
||||
onPressed: () async {
|
||||
await _saveImmediate();
|
||||
if (context.mounted) Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
|
||||
Reference in New Issue
Block a user