How about another snapping option – snap to grid/cells?

How about another snapping option – snap to grid/cells?

I’d use it for a sidebar, I know I can use stop points, but when I 8 rows and multiple pages, then it is a lot of work, not to mention when I add apps to the sidebar. I know that I can just disable snap to pages to almost get the effect that I want, but it don’t like cutoff icons at the edge of the panel.

It seems like it shouldn’t be too difficult and I’m sure that other uses will be thought of too!

]]>
« (Previous Post)
(Next Post) »

24 Commentsto How about another snapping option – snap to grid/cells?

  1. Anonymous says:

    < ![CDATA[

    Are you using LL or LLX? I may try to script something for you…

    ]]>

  2. Anonymous says:

    < ![CDATA[

    I’m using LLX of course 😀


    If you don’t mind…I’ve got zero scripting abilities myself…so far


    Would really appreciate it!

    ]]>

  3. Anonymous says:

    < ![CDATA[

    I’ll try and post something tomorrow, it’s 2am now…

    ]]>

  4. Anonymous says:

    < ![CDATA[

    sidebar without script.


    you can use folder.


    1) add folder to desktop.


    2) long tap on folder and select folder settings/Current folder window/ and set: horizontal alignment (left), animation: open (Slides to right), animation: close (Slides to left). You can or can not set width or higt (or automaticall).


    3) Now you set some gesture for open folder and select this folder.


    4) if you can hide folder from desktop, you can set lightning settins/general/honor pinned items in edit mode (no) and in desktop set this folder positon/pin. And now in edit layout move this folder to not visible home screen.


    That is all…

    ]]>

  5. Anonymous says:

    < ![CDATA[

    (untested)



    Var c=LL.getEvent().getContainer();


    c.setPosition(Math.round(c.getPositionX()/c.getCellWidth())*c.getCellWidth(),Math.round(c.getPositionY/c.getCellHeight)*c.getCellHeight);



    Set this to poaitionchanged event of your container.

    ]]>

  6. Anonymous says:

    < ![CDATA[

    Oh oh! Don’t use it sth seems to be broken. This will turn your container in an ugly state. Pierre Hébert I think this is a bug. Could you try it out?

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Lukas Morawietz Thanks for this ! ! Guess we’ll just have to wait and see what Pierre has to say =D



    Danbar Danbar I don’t want to use a folder, I want it to be on the desktop, so I used a panel. It doesn’t have to be accessible everywhere, then I would have used a folder. The problem would still remain – I don’t like scrolling through pages, I wouldlike to be able to scroll down a little (a row, two rows, half a page, …), but then the items might be cutoff by the panels (or a folders) edges.


    Thanks for trying though, always good to see that people in this community want to help any way they can.

    ]]>

  8. Anonymous says:

    < ![CDATA[

    Best solution IMHO is to put stop points and set snap Taavo Allik

    ]]>

  9. Anonymous says:

    < ![CDATA[

    Bogdan Tautu I already tried that, but it gets real messy wuite quickly. Created a new panel (old one was somehow too resource heavy) – at the moment I have 2 pages, 8 rows per page and that makes 16 rows meaning I would have to place 17 stop points. Each and everyone has to be manually set up, because there’s no way to copy a stop points settings. And when I decide to add items to that panel, then I would have to create more stop points, change a few around….


    I already tried it! Not fun!


    Unfortunately something in my old panel ate ~40MB of reasource from LLX so I got frequent crashes….Now that I’ve made a new one, I really don’t feel like messing with so many stop points again.


    If it can be done with a script – great! If not, perhaps Pierre will consider this. If not then I’ll just have to live with the possibility of cutoff icons in that list.


    (Actually now that I thiink about this option, then I would prefer it in the app drawer as well  – I could freely scroll through the drawer without the page stopping mid-icon)

    ]]>

  10. Anonymous says:

    < ![CDATA[

    There is another tricky solution, but not sure how will it behave.


    Just add two stop points, one at the right cell, the other at the left cell. In both set the action to run a script, that will move both stop points one cell right/left respectively.


    I can’t test now, if someone want to.

    ]]>

  11. Anonymous says:

    < ![CDATA[

    TrianguloY wouldn’t that stop the scrolling? I thibk it will force you to scroll each row as a page.



    This is the script I thought of when I first saw your post. It’s not working well if you scroll too slow or if you keep your finger on the screen after you scroll.



    function update(tb)


    {


    var time = new Date();


    time = time.getTime();


    if (!tb || tb.time+33 > time)


    {


    return;


    }


    tb.time = 0;


    var d = LL.getContainerById(tb.dId);


    d.setPosition(tb.pX, tb.pY, 1, false);


    }



    var d = LL.getEvent().getContainer();


    var time = new Date();


    time = time.getTime();


    if (!self.tb)


    {


    self.tb = {};


    self.tb.time = time;


    self.tb.dId = d.getId();


    }



    if ( self.tb.time == 0 )


    {


    self.tb = null;


    return;


    }



    var h = d.getCellHeight();


    var w = d.getCellWidth();



    self.tb.pX=Math.round(d.getPositionX() / w) * w;



    self.tb.pY=Math.round(d.getPositionY() / h) * h;



    self.tb.time = time;


    self.tb.timer = setTimeout(function(){update(self.tb)}, 33);



    Set this script on the “Position change” event of the container.

    ]]>

  12. Anonymous says:

    < ![CDATA[

    Bogdan Tautu Is that http:// supposed to be there? Seems quite weird…



    And of course thanks for helping! =D



    I get an error with this script: line 10: can’t find method….

    ]]>

  13. Anonymous says:

    < ![CDATA[

    Taavo Allik don’t know how to remove the link.


    Fixed the line 10 error. I was testing on a desktop not inside a panel.


    Edit: try now, had a copy-paste error.

    ]]>

  14. Anonymous says:

    < ![CDATA[

    It works now….occasionally it’s visually quite jumpy, but it works ! ! =D


    If anyone else tries this then don’t forget to disable snap to pages 🙂


    Thanks Bogdan!!

    ]]>

  15. Anonymous says:

    < ![CDATA[

    It’s jumpy because if I use the default animation of setPosition it will become unresponsive.

    ]]>

  16. Anonymous says:

    < ![CDATA[

    Hmm…sounds weird (a bug?)..


    Just to clarify – it’s a good as it gets? Unless Pierre fixes something…of course


    Thanks for taking the time and helping me!

    ]]>

  17. Anonymous says:

    < ![CDATA[

    Maybe TrianguloY’s idea works better, but I’m waiting for him to implement it.


    Taavo Allik can you post a link to a video or picture of your layout? I don’t quite get what you need it for.

    ]]>

  18. Anonymous says:

    < ![CDATA[

    Bogdan Tautu Me? Oh, sorry. I thought that wasn’t what you want, you said…doesn’t matter.


    Taavo Allik do you want to stop in every cell or just scroll and when you stop go to the nearest one?



    (I also realized that stop points without drag stop don’t execute when you pass them…maybe we could ask Pierre Hébert to implement it? )

    ]]>

  19. Anonymous says:

    < ![CDATA[

    https://youtu.be/oUohI6zTcsM
    That’s the video, it’s a bit choppy because I used a free screen recorder that only allows up to 8fps.


    Bogdan’s solution works as I wanted, but it’s a bit jumpy and doesn’t always snap to the grid/cells.


    When I stop then to the nearest. (I like how I can scroll when snap to pages is disabled, but the cutoff icons aren’t a welcomed sight)


    The effect can be achieved when stop points are put between every cell and set to only snap….I hope now everyone can understand =D

    ]]>

  20. Anonymous says:

    < ![CDATA[

    It’s a little bit more complex that snap to pages because this is more than snapping but also requires to stop scrolling.


    Changing the container position in a position change event is unsafe, because it may conflict with the ongoing internal move.


    Maybe something that could be done is to disable scrolling and use swipe events to trigger a position change with an offset equals to the cell width/height ?

    ]]>

  21. Anonymous says:

    < ![CDATA[

    Then I would have to swipe for every row that I want to move up/down ?


    That would ruin the idea kinda..



    Not sure what I wanted to say…forgot and can’t remember.


    Too bad, if it’s more complex, but at least it’s not impossible ;D



    If stop points (without stop scrolling checked) can achieve that effect, then would snap to grid really have to stop scrolling?



    Just saying – if it’s to complex/pointless to implement, then I can live without any snapping out with Bogdan’s script (or manually adding lots of stop points when I get bored).


    // That reminds me – how about the ability to copy stop point preferences?


    Still – it would make interaction with the app drawer and app panels (like mine) visually a lot…for the lack of a better word…prettier =D

    ]]>

  22. Anonymous says:

    < ![CDATA[

    Pierre Hébert is there any chance you will implement different events for touch on and off? Or implement LL.getTouchPoints() or smth similar?

    ]]>

  23. Anonymous says:

    < ![CDATA[

    Ok, try this:





    var cont=LL.getEvent().getContainer();


    var up=cont.getItemByLabel(“SPup”);


    var down=cont.getItemByLabel(“SPdown”);



    var siz = cont.getCellHeight();



    var posy = cont.getPositionY();


    if(posycont.getBoundingBox().getBottom()-cont.getHeight()-cont.getCellHeight())return;



    var pos = Math.floor((posy+1)/siz);





    up.setCell(up.getCell().getLeft(),pos,up.getCell().getRight(),pos+1);



    down.setCell(down.getCell().getLeft(),pos+1,down.getCell().getRight(),pos+2);




    Set it to run on screen change.


    You need to place only two stop points, with snapping and desktop wide only.


    The top will be ‘direction top to bottom’ match top edge. Label it “SPup”


    The bottom will be ‘direction bottom to top’ match top edge. Label it “SPdown”



    It only works up/down…do you also need right left?

    ]]>

  24. Anonymous says:

    < ![CDATA[

    I only need up/down. Shouldn’t the stop point at the bottom match the bottom edge instead of top?


    By screen change did you man position change?


    Will give it a go!


    Thanks, TrianguloY



    Tested it: works a lot smoother than Bogdan’s script. Realized that the bottom one needs to match the top edge as well! 🙂


    Occasionally the scrolling stops mid-cell, perhaps once per 10-15 scrolls. Happens more often when I manage to get the panel to scroll freely for a bit (keeps moving after removing my finger), less when draging.


    Also there’s some “lag” at the beginning of the scrolling usually.



    Thanks again!!



    I guess this case is closed – doubtful it will get implemented and the result is pretty good already!


    Thanks everybody!

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *