Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Possible bug + correction for SectionStack dropline position resolution

    Hello,

    I think I found some bug in the SectionStack code when dragging something onto it.

    When dragging something over a sectionstack with an opened section, not all droplines get displayed if you hover below an opened section.

    I included a slightly modified SectionsReorderSample.java from the showcase (Accordeon / Sections; Drag Reorder) with an additional canvas to drag around and some more sections below the HTML flow section. When hovering the canvas below the opened HTML flow, no drop lines shows up, they only reappear when you hover near the end of the sectionstack.

    I've peeked into the SectionStack.js of the underlying SmartClient, and I think I've found the culprit.
    in SectionStack.js, ~ line 503, in getStackDropPosition(), the size variable for the currently inspected member gets set after it is used to check if the member is near the drop position:
    Code:
                if (memberIsVisible || (member == section)) {
                    if (coord < (totalSize + (size/2))) {
                        // respect an explicit canDropBefore setting, which prevents dropping before a
                        // member
                        if (member.canDropBefore === false) return false;
                        return i;
                    }
                    
                    var size = this.memberSizes[visibleMemberCount];
                    totalSize += size + this.membersMargin + this.getMemberGap(member);
                    visibleMemberCount++;
                }
    When I move the size assignment up in front of its first usage, the effect goes away and the droplines behave as expected:
    Code:
                if (memberIsVisible || (member == section)) {
                    var size = this.memberSizes[visibleMemberCount];  // <- moved here
                    if (coord < (totalSize + (size/2))) {
                        // respect an explicit canDropBefore setting, which prevents dropping before a
                        // member
                        if (member.canDropBefore === false) return false;
                        return i;
                    }
                    
                    totalSize += size + this.membersMargin + this.getMemberGap(member);
                    visibleMemberCount++;
                }
    Greetings,
    Klaus

    Be sure your post includes:

    1. the *complete* SmartGWT or SmartClient version from the lower left-hand corner of the Developer Console (see FAQ for how to open Developer Console), for example, \"v8.2p_2012-04-18/PowerEdition Deployment\"
    v8.3p_2013-04-07/LGPL Development Only (built 2013-04-07)

    2. browser(s) and version(s) involved
    FF 19.0.2

    3. for a server-side problem, the *complete* logs generated during processing of the failing request (do *not* trim to just the error message)
    Nope, no server-side problem

    4. for any problem processing a server response, the actual response as shown in the RPC tab in the Developer Console
    Nope, no response problem

    5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)
    There are no stack traces

    6. sample code if applicable
    See attachment
    Attached Files
Working...
X