@@ -42,24 +42,25 @@ static inline float sp_EaseFunc(float t, float d)
4242
4343ScrollPane::ScrollPane (GComponent* owner)
4444 : _vtScrollBar(nullptr ),
45- _hzScrollBar(nullptr ),
46- _header(nullptr ),
47- _footer(nullptr ),
48- _pageController(nullptr ),
49- _needRefresh(false ),
50- _refreshBarAxis(0 ),
51- _aniFlag(0 ),
52- _loop(0 ),
53- _headerLockedSize(0 ),
54- _footerLockedSize(0 ),
55- _vScrollNone(false ),
56- _hScrollNone(false ),
57- _tweening(0 ),
58- _xPos(0 ),
59- _yPos(0 ),
60- _floating(false ),
61- _mouseWheelEnabled(true ),
62- _hover(false )
45+ _hzScrollBar(nullptr ),
46+ _header(nullptr ),
47+ _footer(nullptr ),
48+ _pageController(nullptr ),
49+ _needRefresh(false ),
50+ _refreshBarAxis(0 ),
51+ _aniFlag(0 ),
52+ _loop(0 ),
53+ _headerLockedSize(0 ),
54+ _footerLockedSize(0 ),
55+ _vScrollNone(false ),
56+ _hScrollNone(false ),
57+ _tweening(0 ),
58+ _xPos(0 ),
59+ _yPos(0 ),
60+ _floating(false ),
61+ _dontClipMargin(false ),
62+ _mouseWheelEnabled(true ),
63+ _hover(false )
6364{
6465 _owner = owner;
6566
@@ -134,6 +135,7 @@ void ScrollPane::setup(ByteBuffer* buffer)
134135 _inertiaDisabled = (flags & 256 ) != 0 ;
135136 _maskContainer->setClippingEnabled ((flags & 512 ) == 0 );
136137 _floating = (flags & 1024 ) != 0 ;
138+ _dontClipMargin = (flags & 2048 ) != 0 ;
137139
138140 if (scrollBarDisplay == ScrollBarDisplayType::DEFAULT)
139141 {
@@ -758,6 +760,13 @@ void ScrollPane::handleSizeChanged()
758760 maskRect.size .width += _vtScrollBar->getWidth ();
759761 if (_hScrollNone && _hzScrollBar != nullptr )
760762 maskRect.size .height += _hzScrollBar->getHeight ();
763+ if (_dontClipMargin)
764+ {
765+ maskRect.origin .x -= _owner->_margin .left ;
766+ maskRect.size .width += _owner->_margin .left + _owner->_margin .right ;
767+ maskRect.origin .y -= _owner->_margin .top ;
768+ maskRect.size .height += _owner->_margin .top + _owner->_margin .bottom ;
769+ }
761770 _maskContainer->setClippingRegion (maskRect);
762771
763772 if (_vtScrollBar)
@@ -787,10 +796,10 @@ void ScrollPane::handleSizeChanged()
787796 max += _footerLockedSize;
788797 if (_refreshBarAxis == 0 )
789798 _container->setPosition2 (clampf (_container->getPositionX (), -max, _headerLockedSize),
790- clampf (_container->getPositionY2 (), -_overlapSize.height , 0 ));
799+ clampf (_container->getPositionY2 (), -_overlapSize.height , 0 ));
791800 else
792801 _container->setPosition2 (clampf (_container->getPositionX (), -_overlapSize.width , 0 ),
793- clampf (_container->getPositionY2 (), -max, _headerLockedSize));
802+ clampf (_container->getPositionY2 (), -max, _headerLockedSize));
794803
795804 if (_header != nullptr )
796805 {
@@ -977,9 +986,9 @@ void ScrollPane::updateScrollBarVisible2(GScrollBar* bar)
977986 {
978987 if (bar->isVisible ())
979988 GTween::to (1 , 0 , 0 .5f )
980- ->setDelay (0 .5f )
981- ->onComplete1 (CC_CALLBACK_1 (ScrollPane::onBarTweenComplete, this ))
982- ->setTarget (bar, TweenPropType::Alpha);
989+ ->setDelay (0 .5f )
990+ ->onComplete1 (CC_CALLBACK_1 (ScrollPane::onBarTweenComplete, this ))
991+ ->setTarget (bar, TweenPropType::Alpha);
983992 }
984993 else
985994 {
@@ -1221,7 +1230,7 @@ float ScrollPane::updateTargetAndDuration(float pos, int axis)
12211230 {
12221231 if (v2 > 1000 )
12231232 ratio = pow ((v2 - 1000 ) / 1000 , 2 );
1224- }
1233+ }
12251234#endif
12261235
12271236 if (ratio != 0 )
@@ -1237,7 +1246,7 @@ float ScrollPane::updateTargetAndDuration(float pos, int axis)
12371246 float change = (int )(v * duration * 0 .4f );
12381247 pos += change;
12391248 }
1240- }
1249+ }
12411250
12421251 if (duration < TWEEN_TIME_DEFAULT)
12431252 duration = TWEEN_TIME_DEFAULT;
0 commit comments