From 2f4005083452d61ddaf7542b195927b1d0d6227f Mon Sep 17 00:00:00 2001 From: RblSb Date: Tue, 12 May 2020 05:53:12 +0300 Subject: Fix setNext item button --- src/VideoList.hx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/VideoList.hx') diff --git a/src/VideoList.hx b/src/VideoList.hx index e2d88d5..0799cfa 100644 --- a/src/VideoList.hx +++ b/src/VideoList.hx @@ -39,10 +39,12 @@ abstract VideoList(Array) from Array to Array { else this.insert(itemPos + 1, item); } - public function setNextItem(pos:Int, itemPos:Int):Void { + public function setNextItem(pos:Int, itemPos:Int):Int { final next = this[pos]; this.remove(next); + if (pos < itemPos) itemPos--; this.insert(itemPos + 1, next); + return itemPos; } public function toggleItemType(pos:Int):Void { -- cgit v1.2.3