add a local only readme

This commit is contained in:
2025-09-07 03:38:02 +00:00
parent 88fb705c7c
commit 47aa9a234d
3 changed files with 139 additions and 31 deletions
+17 -7
View File
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; // HardwareKeyboard, LogicalKeyboardKey
@@ -46,13 +47,22 @@ class _LazyCanvasState extends State<LazyCanvas> with TickerProviderStateMixin<L
return Listener(
behavior: HitTestBehavior.translucent, // ensure scroll signals are captured even on empty space
onPointerSignal: (event) {
if (event is PointerScrollEvent) {
final pressed = HardwareKeyboard.instance.logicalKeysPressed;
if (pressed.contains(LogicalKeyboardKey.controlLeft) || pressed.contains(LogicalKeyboardKey.controlRight)) {
// Typical mouse wheel up gives negative dy on many platforms; invert if needed
final delta = (-event.scrollDelta.dy) * 0.0015; // sensitivity
if (delta != 0) {
widget.controller.updateScalebyDelta(delta, focalPoint: event.localPosition);
// on web these are pointer scale events
if (kIsWeb) {
if (event is PointerScaleEvent) {
final delta = (event.scale - 1) * 0.25; // sensitivity
widget.controller.updateScalebyDelta(delta, focalPoint: event.localPosition);
}
} else {
// other desktop mouse wheel is scroll event
if (event is PointerScrollEvent) {
final pressed = HardwareKeyboard.instance.logicalKeysPressed;
if (pressed.contains(LogicalKeyboardKey.controlLeft) || pressed.contains(LogicalKeyboardKey.controlRight)) {
// Typical mouse wheel up gives negative dy on many platforms; invert if needed
final delta = (-event.scrollDelta.dy) * 0.0015; // sensitivity
if (delta != 0) {
widget.controller.updateScalebyDelta(delta, focalPoint: event.localPosition);
}
}
}
}