mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
fix pinch to zoom
This commit is contained in:
@@ -356,6 +356,7 @@ class _ContinuousModeState extends State<_ContinuousMode>
|
|||||||
var isCTRLPressed = false;
|
var isCTRLPressed = false;
|
||||||
static var _isMouseScrolling = false;
|
static var _isMouseScrolling = false;
|
||||||
var fingers = 0;
|
var fingers = 0;
|
||||||
|
bool disableScroll = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -426,7 +427,7 @@ class _ContinuousModeState extends State<_ContinuousMode>
|
|||||||
? Axis.vertical
|
? Axis.vertical
|
||||||
: Axis.horizontal,
|
: Axis.horizontal,
|
||||||
reverse: reader.mode == ReaderMode.continuousRightToLeft,
|
reverse: reader.mode == ReaderMode.continuousRightToLeft,
|
||||||
physics: isCTRLPressed || _isMouseScrolling
|
physics: isCTRLPressed || _isMouseScrolling || disableScroll
|
||||||
? const NeverScrollableScrollPhysics()
|
? const NeverScrollableScrollPhysics()
|
||||||
: const ClampingScrollPhysics(),
|
: const ClampingScrollPhysics(),
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
@@ -460,6 +461,11 @@ class _ContinuousModeState extends State<_ContinuousMode>
|
|||||||
widget = Listener(
|
widget = Listener(
|
||||||
onPointerDown: (event) {
|
onPointerDown: (event) {
|
||||||
fingers++;
|
fingers++;
|
||||||
|
if(fingers > 1 && !disableScroll) {
|
||||||
|
setState(() {
|
||||||
|
disableScroll = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
futurePosition = null;
|
futurePosition = null;
|
||||||
if (_isMouseScrolling) {
|
if (_isMouseScrolling) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -469,6 +475,11 @@ class _ContinuousModeState extends State<_ContinuousMode>
|
|||||||
},
|
},
|
||||||
onPointerUp: (event) {
|
onPointerUp: (event) {
|
||||||
fingers--;
|
fingers--;
|
||||||
|
if(fingers <= 1 && disableScroll) {
|
||||||
|
setState(() {
|
||||||
|
disableScroll = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onPointerPanZoomUpdate: (event) {
|
onPointerPanZoomUpdate: (event) {
|
||||||
if (event.scale == 1.0) {
|
if (event.scale == 1.0) {
|
||||||
|
Reference in New Issue
Block a user