fix: PDF finger ink, chrome UX, OneNote pens, and pen physics
Some checks failed
CI / Windows build (push) Has been cancelled
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:
34
test/pen_physics_test.dart
Normal file
34
test/pen_physics_test.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
// Tests for tipVelocityWidthScale (physical tip model).
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:badnote/editor/engine/brush.dart';
|
||||
import 'package:badnote/editor/engine/pen_physics.dart';
|
||||
|
||||
void main() {
|
||||
group('tipVelocityWidthScale', () {
|
||||
test('idle speed leaves all brushes at 1.0', () {
|
||||
for (final k in BrushKind.values) {
|
||||
expect(tipVelocityWidthScale(k, 0.0), closeTo(1.0, 1e-9));
|
||||
}
|
||||
});
|
||||
|
||||
test('fountain thins more than ballpoint at the same speed', () {
|
||||
const speed = 2.0; // reference fast handwriting
|
||||
final fountain = tipVelocityWidthScale(BrushKind.fountainPen, speed);
|
||||
final ballpoint = tipVelocityWidthScale(BrushKind.ballpoint, speed);
|
||||
expect(fountain, closeTo(0.85, 1e-9));
|
||||
expect(ballpoint, closeTo(0.98, 1e-9));
|
||||
expect(fountain, lessThan(ballpoint));
|
||||
});
|
||||
|
||||
test('highlighter ignores velocity', () {
|
||||
expect(tipVelocityWidthScale(BrushKind.highlighter, 5.0), 1.0);
|
||||
});
|
||||
|
||||
test('NaN / negative speed treated as idle', () {
|
||||
expect(tipVelocityWidthScale(BrushKind.fountainPen, double.nan), 1.0);
|
||||
expect(tipVelocityWidthScale(BrushKind.fountainPen, -1.0), 1.0);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user