forked from reqable/re-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MouseTrackerAnnotationTextSpan for hovering support
- Loading branch information
1 parent
dad40ef
commit d915467
Showing
8 changed files
with
117 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
part of re_editor; | ||
|
||
@immutable | ||
class _MouseTrackerAnnotationTextSpan extends TextSpan { | ||
|
||
final int id; | ||
final MouseTrackerAnnotationTextSpan span; | ||
final List<Rect> rects; | ||
|
||
const _MouseTrackerAnnotationTextSpan({ | ||
required this.id, | ||
required this.rects, | ||
required this.span, | ||
}); | ||
|
||
@override | ||
PointerEnterEventListener? get onEnter => (event) { | ||
span.onEnterWithRect(event, id, rects); | ||
}; | ||
|
||
@override | ||
PointerExitEventListener? get onExit => (event) { | ||
span.onExitWithRect(event, id, rects); | ||
}; | ||
|
||
@override | ||
int get hashCode => span.hashCode; | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
if (identical(this, other)) { | ||
return true; | ||
} | ||
return other is _MouseTrackerAnnotationTextSpan && span == other.span && | ||
id == other.id; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
part of re_editor; | ||
|
||
typedef PointerEnterEventWithRectListener = void Function(PointerEnterEvent event, int id, List<Rect> rects); | ||
|
||
typedef PointerExitEventWithRectListener = void Function(PointerExitEvent event, int id, List<Rect> rects); | ||
|
||
@immutable | ||
class MouseTrackerAnnotationTextSpan extends TextSpan { | ||
|
||
final PointerEnterEventWithRectListener onEnterWithRect; | ||
final PointerExitEventWithRectListener onExitWithRect; | ||
|
||
const MouseTrackerAnnotationTextSpan({ | ||
super.text, | ||
super.children, | ||
super.style, | ||
super.recognizer, | ||
super.mouseCursor, | ||
super.semanticsLabel, | ||
super.locale, | ||
super.spellOut, | ||
required this.onEnterWithRect, | ||
required this.onExitWithRect, | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters