Menu items off Scroll view still clickable

  • fechox
    Likes 0

    Problem Description

    Hi there,

    I’ve come across an interesting issue, I have created a menu with 30 menu items and the following alignment: alignItemsInColumns(3,3,3,3,3,3,3,3,3,3).

    I also created a scroll view (vertical) and added the menu with the 30 items to it, I set contentsize to (615,775) and setInnerContainerSize(cc.size(700,1500)).

    It all works fine with the exception of something, I can click on the menu items that are not visible in the content size.

    Here’s my code:

     

    The scroll view:

     

                  var scrollVMenu = new ccui.ScrollView();

                  scrollVMenu.setDirection(ccui.ScrollView.DIR_VERTICAL);

                  scrollVMenu.setTouchEnabled(true);

                  scrollVMenu.setBounceEnabled(true);

                  scrollVMenu.setAnchorPoint(0.5,0.5);

                  scrollVMenu.setPosition(scrWidth/2,scrHeight/2);

                  scrollVMenu.setContentSize(615,775);           

                  scrollVMenu.setInnerContainerSize(cc.size(700,1500));

                  this.addChild(scrollVMenu);

     

    The menu:

                  var menuLevel = new cc.Menu(arrMenuItems);

                  menuLevel.setAnchorPoint(0.0,1.0);

                  menuLevel.setPosition(cc.p(scrollVMenu/2,100));

                  menuLevel.setPosition(cc.p(300,880));

                  menuLevel.alignItemsInColumns(3,3,3,3,3,3,3,3,3,3);

                  scrollVMenu.addChild(menuLevel);

               

    any ideas?

     

  • Sonar Systems admin
    Likes 0

    Set clipping to false.


    This reply has been verified.
  • fechox
    Likes 0

    Thanks for your reply.

    Unfortunately setting clipping to false didn’t work, if clipping is set to false the menuitems that are not visible become visible overflowing beyond the borders of the scrollview’s visible area.

  • Sonar Systems admin
    Likes 0

    Could you show us a screenshot of the screen please.


    This reply has been verified.
  • fechox
    Likes 0

    This is how it looks, the areas signalled by the red arrows are still clickable when the buttons are off the scroll’s visible area:

     


  • Sonar Systems admin
    Likes 0

    I cant see the image, could you send a link to it please.


    This reply has been verified.
  • fechox
    Likes 0

    This is what it looks like: https://drive.google.com/file/d/0ByF2MyhrYuZVUzZDcDhTM1ZtS1U/view  (the areas up and down off the visible content are still clickable, so if a menu item is hidden in there you can click it)

    this is hwat it looks like with clipping set to false: https://drive.google.com/file/d/0ByF2MyhrYuZVeXh0QzctTGtCaWM/view

     

     

  • Sonar Systems admin
    Likes 0

    Coudl you show us a video of this problem to help us better understand the issue.


    This reply has been verified.
  • fechox
    Likes 0

    Don’t worry about it, I fixed it by capturing the ccordinates of the clicked menu item, if it’s within the scrollview’s visible area the click is accepted, otherwise it’s refused.


  • Sonar Systems admin
    Likes 0

    Great to hear you have this resolved, feel free to ask any other questions.

  • fechox
    Likes 0

    Thanks anyway!

  • Sonar Systems admin
    Likes 0

    Your welcome :D

Login to reply