fix: PDF finger ink, chrome UX, OneNote pens, and pen physics
Some checks failed
CI / Windows build (push) Has been cancelled

Wire finger drawing on PDF without breaking pinch; auto-hide page scrubber and fix bounce; share sticky tools with resize and per-page remember; side-button select; separate pen slots with colors; rnote pressure shapes plus tip-velocity width and lower stroke latency.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-06 16:01:01 +08:00
parent 85af037b7d
commit f31dd0fb52
17 changed files with 835 additions and 234 deletions

View File

@@ -470,12 +470,25 @@ class _PenNoteScreenState extends ConsumerState<PenNoteScreen> {
eraserRadius: _penConfig?.value.eraserRadius ?? kDefaultEraserRadius,
eraserWholeStroke: _penConfig?.value.eraserWholeStroke ?? false,
sideButtonAction:
_penConfig?.value.sideButton ?? PenButtonAction.eraser,
_penConfig?.value.sideButton ?? PenButtonAction.select,
eraserEndAction:
_penConfig?.value.eraserEnd ?? PenButtonAction.eraser,
allowFingerDrawing: _allowFingerDrawing,
onStrokeComplete: _commitStroke,
onEraseStroke: _eraseStroke,
onPenButtonAction: (action) {
if (action == PenButtonAction.select) {
setState(() => _tool = EditorToolKind.select);
} else if (action == PenButtonAction.undo) {
if (_undo.isNotEmpty) _performUndo();
} else if (action == PenButtonAction.toggleTool) {
setState(() {
_tool = _tool == EditorToolKind.eraser
? EditorToolKind.brush
: EditorToolKind.eraser;
});
}
},
// A white sheet with a soft shadow — the note "paper" — overlaid with
// the selected background template, painted in page-pixel space (so it
// scales with zoom) and BEHIND the ink layers.
@@ -510,19 +523,18 @@ class _PenNoteScreenState extends ConsumerState<PenNoteScreen> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
// Pen tool with brush picker (fountain / ballpoint / pencil), each
// brush showing its own remembered color.
BrushPickerButton(
selected: _penBrush,
active: _tool == EditorToolKind.brush,
tooltip: 'Brush',
labelFor: brushLabelEn,
colorFor: (b) => _brushColors[b] ?? Colors.black,
onSelected: (b) => setState(() {
_penBrush = b;
_tool = EditorToolKind.brush;
}),
),
// OneNote-style: each pen is its own slot with remembered color.
for (final b in kPenToolBrushes)
PenSlotButton(
kind: b,
selected: _tool == EditorToolKind.brush && _penBrush == b,
color: _brushColors[b] ?? Colors.black,
tooltip: brushLabelEn(b),
onPressed: () => setState(() {
_penBrush = b;
_tool = EditorToolKind.brush;
}),
),
ToolButton(
icon: Icons.brush_outlined,
selected: _tool == EditorToolKind.highlighter,