Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-26031

Single pixel scrolls can cause firstIndexInView to be incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Adobe Flex SDK Previous
    • None
    • Spark: Layout
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Language Found: English

    Description

      Steps to reproduce:
      1. Compile and run this application:

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark" width="700">

      <fx:Script>
      <![CDATA[
      private function showInView1():void

      { output.text += hLayout.firstIndexInView + ' expecting 0; ' output.text += hLayout.lastIndexInView + ' expecting 10; ' }

      private function showInView2():void

      { output.text += hLayout.firstIndexInView + ' expecting 1; ' output.text += hLayout.lastIndexInView + ' expecting 10; ' }

      ]]
      >
      </fx:Script>

      <s:controlBarContent>
      <s:Button label="set hsp to 23" click="group1.horizontalScrollPosition = 23" />
      <s:Button label="assert in view" click="showInView1()" />
      <s:Button label="set hsp to 24" click="group1.horizontalScrollPosition = 24" />
      <s:Button label="assert in view" click="showInView2()" />
      </s:controlBarContent>

      <s:Label id="output" />

      <s:DataGroup id="group1" width="300" height="100" y="50" clipAndEnableScrolling="true">
      <s:itemRenderer>
      <fx:Component>
      <s:ItemRenderer width="24" height="100">
      <s:states>
      <s:State name="normal"/>
      <s:State name="hovered"/>
      <s:State name="selected"/>
      </s:states>
      <s:Rect top="0" left="0" right="0" bottom="0">
      <s:fill>
      <s:SolidColor color="0xA8C6EE" color.hovered="0xCEDBEF" color.selected="0xCCCCCC" />
      </s:fill>
      </s:Rect>
      <s:Label id="lbl" text="

      {data.myItemIndex}

      " top="1" left="1" />
      </s:ItemRenderer>
      </fx:Component>
      </s:itemRenderer>
      <s:layout>
      <s:HorizontalLayout id="hLayout" useVirtualLayout="true" />
      </s:layout>
      <s:dataProvider>
      <s:ArrayList>
      <fx:Object myItemIndex="0" />
      <fx:Object myItemIndex="1" />
      <fx:Object myItemIndex="2" />
      <fx:Object myItemIndex="3" />
      <fx:Object myItemIndex="4" />
      <fx:Object myItemIndex="5" />
      <fx:Object myItemIndex="6" />
      <fx:Object myItemIndex="7" />
      <fx:Object myItemIndex="8" />
      <fx:Object myItemIndex="9" />
      <fx:Object myItemIndex="10" />
      <fx:Object myItemIndex="11" />
      </s:ArrayList>
      </s:dataProvider>
      </s:DataGroup>

      </s:Application>

      2. Click "set hsp to 23"
      3. Click "assert in view"
      4. Click "set hsp to 24"
      5. Click "assert in view"

      Actual Results:

      0 expecting 0; 10 expecting 10; 0 expecting 1; 10 expecting 10

      Expected Results:

      0 expecting 0; 10 expecting 10; 1 expecting 1; 10 expecting 10

      Workaround (if any):

      Attachments

        Activity

          People

            adobejira Adobe JIRA
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: