fix: restore PDF pen capture and overhaul sticky/pens/pages
All checks were successful
CI / Windows build (push) Successful in 9m55s

Reinstall PenCaptureBinding so stylus ink hits again; keep finger Listener translucent under pinch; page-anchor sticky with drag/resize; OneNote pen slots (brush+width+color); blank-note multi-page; default side button to hold-select-text.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-07 02:38:58 +08:00
parent ad9b1b46db
commit 307161f465
16 changed files with 1279 additions and 487 deletions

View File

@@ -2,11 +2,8 @@
//
// A PDF-anchored scratch link: a sticky-note "tab" placed at a normalized
// position (nx, ny in [0,1]) on a specific page of a document. Tapping the
// anchor opens a split view whose right pane is an infinite freehand scratchpad
// that BELONGS TO THIS ANCHOR (keyed by [id]).
//
// Plain immutable value class (no freezed codegen) so it compiles without a
// build_runner step. Equality is by value so anchors can be diffed in lists.
// anchor opens an on-page sticky card that BELONGS TO THIS ANCHOR (keyed by
// [id]). Optional [nw]/[nh] size the expanded card as fractions of the page.
import 'package:flutter/foundation.dart';
@@ -18,6 +15,8 @@ class ScratchLink {
required this.pageIndex,
required this.nx,
required this.ny,
this.nw = 0.42,
this.nh = 0.36,
});
/// Stable anchor id (uuid). Doubles as the scratchpad storage key so each
@@ -30,18 +29,26 @@ class ScratchLink {
/// 0-based page the anchor sits on.
final int pageIndex;
/// Normalized horizontal position on the page, in [0, 1].
/// Normalized horizontal position on the page, in [0, 1] (top-left of card).
final double nx;
/// Normalized vertical position on the page, in [0, 1].
/// Normalized vertical position on the page, in [0, 1] (top-left of card).
final double ny;
/// Expanded card width as a fraction of page width (clamped on write).
final double nw;
/// Expanded card height as a fraction of page height.
final double nh;
ScratchLink copyWith({
String? id,
String? documentId,
int? pageIndex,
double? nx,
double? ny,
double? nw,
double? nh,
}) =>
ScratchLink(
id: id ?? this.id,
@@ -49,6 +56,8 @@ class ScratchLink {
pageIndex: pageIndex ?? this.pageIndex,
nx: nx ?? this.nx,
ny: ny ?? this.ny,
nw: nw ?? this.nw,
nh: nh ?? this.nh,
);
Map<String, dynamic> toJson() => {
@@ -57,6 +66,8 @@ class ScratchLink {
'pageIndex': pageIndex,
'nx': nx,
'ny': ny,
'nw': nw,
'nh': nh,
};
factory ScratchLink.fromJson(Map<String, dynamic> json) => ScratchLink(
@@ -65,6 +76,8 @@ class ScratchLink {
pageIndex: (json['pageIndex'] as num).toInt(),
nx: (json['nx'] as num).toDouble(),
ny: (json['ny'] as num).toDouble(),
nw: (json['nw'] as num?)?.toDouble() ?? 0.42,
nh: (json['nh'] as num?)?.toDouble() ?? 0.36,
);
@override
@@ -76,13 +89,15 @@ class ScratchLink {
documentId == other.documentId &&
pageIndex == other.pageIndex &&
nx == other.nx &&
ny == other.ny;
ny == other.ny &&
nw == other.nw &&
nh == other.nh;
@override
int get hashCode => Object.hash(id, documentId, pageIndex, nx, ny);
int get hashCode => Object.hash(id, documentId, pageIndex, nx, ny, nw, nh);
@override
String toString() =>
'ScratchLink(id: $id, documentId: $documentId, pageIndex: $pageIndex, '
'nx: $nx, ny: $ny)';
'nx: $nx, ny: $ny, nw: $nw, nh: $nh)';
}