ScrollView - Adding new items changes scroll width

I´m making a game where the player has to set bombs. Everytime when a bomb is set. The scrollable area gets wider and i can scroll out of the gameplay area. It does not stop at the boarder where it should stop. 

Working with 1920*1080

Can someone help me? 

 -- Create a scrollView local group2 = widget.newScrollView { scrollWidth = 1920, scrollHeight = 1080, width = 1950, height = 1080, hideBackground = true, isBounceEnabled = false, horizontalScrollingDisabled = false, verticalScrollingDisabled = false, listener = scrollListener, }

When you insert objects into your scrollview, the width/height settings automatically update. 

https://docs.coronalabs.com/daily/api/library/widget/newScrollView.html#scrollwidth-scrollheight-optional

I believe you should be able to set them back to your preferred values, but I haven’t tested that. Let me know if I misunderstood your question.

i don´t understand why they update and why the area gets wider. o.O 

where is the logic? can´t see it? 

the bomb i am placing is so small and at the beginning of the gameplay area

First off, I don’t know how you’re using your scrollView, so I can’t comment too far on it. I don’t know how useful they would be in a game situation, since they have a fair amount of gotchas when it comes to touch logic. 

Regardless, as the docs suggest, adding items to a scrollview increases their width and/or height. Are you saying that you don’t see where you can reset your width? Or you don’t see the item that you inserted into the scrollview?

now the code is like this: 

 local group2 = widget.newScrollView { width = 3000, height = 1080, hideBackground = true, isBounceEnabled = false, horizontalScrollingDisabled = false, verticalScrollingDisabled = false, listener = scrollListener, }

and in the bomb function :

group2:setScrollHeight( 1080 ) group2:setScrollWidth( 3000)

now the view is limited and don´t gain width, but the size of the viewable area before the bomb function has not the same size after the bomb function ^^

sometimes it is a little bit buggy but it seems to nearly work. will check the code and work on it.

is there another way to make the gameplay area over viewable? like in angry birds? so he can see the level before he starts? 

In order to make your entire level scrollable, you could ditch the scrollView and add a touch listener that allows the player to pan around the level. Using a “moved” event listener would be the first step. This is a super-old forum post, but the logic is still sound:

https://forums.coronalabs.com/topic/35265-drag-object-within-bounds/

When you insert objects into your scrollview, the width/height settings automatically update. 

https://docs.coronalabs.com/daily/api/library/widget/newScrollView.html#scrollwidth-scrollheight-optional

I believe you should be able to set them back to your preferred values, but I haven’t tested that. Let me know if I misunderstood your question.

i don´t understand why they update and why the area gets wider. o.O 

where is the logic? can´t see it? 

the bomb i am placing is so small and at the beginning of the gameplay area

First off, I don’t know how you’re using your scrollView, so I can’t comment too far on it. I don’t know how useful they would be in a game situation, since they have a fair amount of gotchas when it comes to touch logic. 

Regardless, as the docs suggest, adding items to a scrollview increases their width and/or height. Are you saying that you don’t see where you can reset your width? Or you don’t see the item that you inserted into the scrollview?

now the code is like this: 

 local group2 = widget.newScrollView { width = 3000, height = 1080, hideBackground = true, isBounceEnabled = false, horizontalScrollingDisabled = false, verticalScrollingDisabled = false, listener = scrollListener, }

and in the bomb function :

group2:setScrollHeight( 1080 ) group2:setScrollWidth( 3000)

now the view is limited and don´t gain width, but the size of the viewable area before the bomb function has not the same size after the bomb function ^^

sometimes it is a little bit buggy but it seems to nearly work. will check the code and work on it.

is there another way to make the gameplay area over viewable? like in angry birds? so he can see the level before he starts? 

In order to make your entire level scrollable, you could ditch the scrollView and add a touch listener that allows the player to pan around the level. Using a “moved” event listener would be the first step. This is a super-old forum post, but the logic is still sound:

https://forums.coronalabs.com/topic/35265-drag-object-within-bounds/