You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/12/03 23:50:53 UTC

[royale-asjs] branch develop updated: fix selection and highlights in virtual lists. Should fix #606

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 499a16c  fix selection and highlights in virtual lists.  Should fix #606
499a16c is described below

commit 499a16cd3b19579f165168733f1a5f1debddc569
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Dec 3 15:50:34 2019 -0800

    fix selection and highlights in virtual lists.  Should fix #606
---
 .../org/apache/royale/html/beads/VirtualListView.as | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VirtualListView.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VirtualListView.as
index b37f3e3..b09a77b 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VirtualListView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VirtualListView.as
@@ -24,15 +24,15 @@ package org.apache.royale.html.beads
 	import org.apache.royale.core.IBeadLayout;
 	import org.apache.royale.core.IBeadModel;
 	import org.apache.royale.core.IBeadView;
-	import org.apache.royale.core.ISelectableItemRenderer;
 	import org.apache.royale.core.IItemRenderer;
 	import org.apache.royale.core.IItemRendererParent;
 	import org.apache.royale.core.IParent;
-    import org.apache.royale.core.IParentIUIBase;
+	import org.apache.royale.core.IParentIUIBase;
 	import org.apache.royale.core.IRollOverModel;
+	import org.apache.royale.core.ISelectableItemRenderer;
 	import org.apache.royale.core.ISelectionModel;
 	import org.apache.royale.core.IStrand;
-    import org.apache.royale.core.IUIBase;
+	import org.apache.royale.core.IUIBase;
 	import org.apache.royale.core.Strand;
 	import org.apache.royale.core.UIBase;
 	import org.apache.royale.core.ValuesManager;
@@ -75,6 +75,21 @@ package org.apache.royale.html.beads
 			super.handleInitComplete(event);
 		}
 
+        override public function getItemRendererForIndex(index:int):IItemRenderer
+        {
+            if (contentView.numElements == 0)
+                return null;
+            
+            var firstIndex:int = (contentView.getElementAt(1) as ISelectableItemRenderer).index;
+            
+            if (index < firstIndex) 
+                return null;
+            if (index > (firstIndex + contentView.numElements))
+                return null;
+            
+            return contentView.getElementAt(index - firstIndex + 1) as IItemRenderer;            
+        }
+        
 		/**
 		 * @private
 		 * @royaleignorecoercion org.apache.royale.core.ISelectableItemRenderer