Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
dart_pdf
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Aleksei
2024-01-24 12:21:39 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
David PHAM-VAN
2024-01-27 12:16:39 -0400
Commit
5aa2a42c2ac5883c7aa28127f3cc6be902f34cd1
5aa2a42c
1 parent
bc517b28
Update cursors on zoom mode
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
printing/lib/src/preview/custom.dart
printing/lib/src/preview/custom.dart
View file @
5aa2a42
...
...
@@ -245,7 +245,7 @@ class PdfPreviewCustomState extends State<PdfPreviewCustom>
preview
=
index
;
transformationController
.
value
.
setIdentity
();
if
(
kIsWeb
)
{
_
mouseCursor
=
SystemMouseCursors
.
grab
;
_
updateCursor
(
SystemMouseCursors
.
grab
)
;
}
});
_zoomChanged
();
...
...
@@ -285,32 +285,24 @@ class PdfPreviewCustomState extends State<PdfPreviewCustom>
Widget
_zoomPreview
()
{
final
zoomPreview
=
GestureDetector
(
onTapDown:
kIsWeb
?
(
_
)
{
setState
(()
{
_mouseCursor
=
SystemMouseCursors
.
grabbing
;
});
}
:
null
,
onTapUp:
kIsWeb
?
(
_
)
{
setState
(()
{
_mouseCursor
=
SystemMouseCursors
.
grab
;
});
}
:
null
,
onDoubleTap:
()
{
setState
(()
{
preview
=
null
;
if
(
kIsWeb
)
{
_
mouseCursor
=
MouseCursor
.
defer
;
_
updateCursor
(
MouseCursor
.
defer
)
;
}
});
_zoomChanged
();
},
onLongPressCancel:
kIsWeb
?
()
=>
_updateCursor
(
SystemMouseCursors
.
grab
)
:
null
,
onLongPressDown:
kIsWeb
?
(
_
)
=>
_updateCursor
(
SystemMouseCursors
.
grabbing
)
:
null
,
child:
InteractiveViewer
(
transformationController:
transformationController
,
maxScale:
5
,
onInteractionEnd:
kIsWeb
?
(
_
)
=>
_updateCursor
(
SystemMouseCursors
.
grab
)
:
null
,
child:
Center
(
child:
PdfPreviewPage
(
pageData:
pages
[
preview
!],
...
...
@@ -321,12 +313,23 @@ class PdfPreviewCustomState extends State<PdfPreviewCustom>
),
);
return
kIsWeb
?
MouseRegion
(
cursor:
_mouseCursor
,
child:
zoomPreview
)
?
MouseRegion
(
cursor:
_mouseCursor
,
child:
zoomPreview
,
)
:
zoomPreview
;
}
void
_zoomChanged
()
=>
widget
.
onZoomChanged
?.
call
(
preview
!=
null
);
void
_updateCursor
(
MouseCursor
mouseCursor
)
{
if
(
mouseCursor
!=
_mouseCursor
)
{
setState
(()
{
_mouseCursor
=
mouseCursor
;
});
}
}
@override
Widget
build
(
BuildContext
context
)
{
Widget
page
;
...
...
Please
register
or
login
to post a comment