sly icon indicating copy to clipboard operation
sly copied to clipboard

Activate item when dragging is running, not when released.

Open panych opened this issue 11 years ago • 2 comments

Thanks for your plugin, it's really good.

Problem: I used a 'forceCentered' mode and have found that Sly activate item only when dragging process is end (draggin.released). Question: Is there a way to activate items during dragging? Maybe you can run it in timeout to prevent performance issues.

Sly method where draggin.released is checked:

function slideTo(newPos, immediate, dontAlign) {
    // Align items
    if (itemNav && dragging.released && !dontAlign) {
        var tempRel = getRelatives(newPos);
        // some code

        if (centeredNav) {
            // some code
            if (forceCenteredNav && o.activateMiddle) {
                activate(tempRel.centerItem);
            }
        } 
        // some code
    }
    // some code
}

panych avatar Oct 11 '13 08:10 panych

Activating of items on dragging release and not on each move is done deliberately for performance reasons. Dragging is currently the most resource heavy thing in Sly, and I'm hesitant on adding more computation to it.

But maybe it could be optimized. It would require a redesign of activateMiddle functionality, and that won't be anytime soon.

I've realized that Sly is a bastard child, trying to solve 2 problems at the same time (basic scrollbar replacement & item based navigation), so I want to decouple it into 2 libraries. All new features and major rewrites will have to wait until than. So right now, I'm just fixing bugs and maintaining Sly.

darsain avatar Oct 14 '13 11:10 darsain

I think this issue can be closed.

In my particular case I've used move event to find out where items are placed right now and then do other staff based on it.

Thanks again for library. And you are right about the way to separate Sly to different libraries. I think that 'Item based', 'Non-item based' and 'Paralax' haven't much in common. Replacing them into carousel-slider and custom scroller would be good.

panych avatar Nov 22 '13 16:11 panych