mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
refa: danmaku & feat: scroll fixed velocity (#1791)
This commit is contained in:
committed by
GitHub
parent
0a40d11133
commit
49b7ea14c3
@@ -1200,17 +1200,21 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
final ctr = plPlayerController.danmakuController;
|
||||
if (ctr != null) {
|
||||
final pos = details.localPosition;
|
||||
final item = ctr.findSingleDanmaku(pos);
|
||||
if (item == null) {
|
||||
final res = ctr.findSingleDanmaku(pos);
|
||||
if (res != null) {
|
||||
final (dy, item) = res;
|
||||
if (item != _suspendedDm) {
|
||||
_suspendedDm?.suspend = false;
|
||||
if (item.content.extra == null) {
|
||||
_dmOffset.value = null;
|
||||
return;
|
||||
}
|
||||
_suspendedDm = item..suspend = true;
|
||||
this.dy = dy;
|
||||
}
|
||||
} else {
|
||||
_suspendedDm?.suspend = false;
|
||||
_dmOffset.value = null;
|
||||
} else if (item != _suspendedDm) {
|
||||
_suspendedDm?.suspend = false;
|
||||
if (item.content.extra == null) {
|
||||
_dmOffset.value = null;
|
||||
return;
|
||||
}
|
||||
_suspendedDm = item..suspend = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2269,6 +2273,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
static const _actionItemHeight = 35.0 - _triangleHeight;
|
||||
|
||||
DanmakuItem<DanmakuExtra>? _suspendedDm;
|
||||
double dy = 0;
|
||||
late final Rxn<Offset> _dmOffset = Rxn<Offset>();
|
||||
|
||||
void _removeDmAction() {
|
||||
@@ -2327,9 +2332,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
|
||||
final overlayWidth = _actionItemWidth * (seekOffset == null ? 3 : 4);
|
||||
|
||||
final dy = item.content.type == DanmakuItemType.bottom
|
||||
? maxHeight - item.yPosition - item.height
|
||||
: item.yPosition;
|
||||
final top = dy + item.height + _triangleHeight + 2;
|
||||
|
||||
final realLeft = dx + overlayWidth / 2;
|
||||
|
||||
Reference in New Issue
Block a user