mirror of https://github.com/axmolengine/axmol.git
Sync extension fairygui
This commit is contained in:
parent
fb7343ad5d
commit
192a59f39e
|
@ -15,17 +15,17 @@ USING_NS_CC;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
GComponent::GComponent() : _container(nullptr),
|
GComponent::GComponent() : _container(nullptr),
|
||||||
_scrollPane(nullptr),
|
_scrollPane(nullptr),
|
||||||
_childrenRenderOrder(ChildrenRenderOrder::ASCENT),
|
_childrenRenderOrder(ChildrenRenderOrder::ASCENT),
|
||||||
_apexIndex(0),
|
_apexIndex(0),
|
||||||
_boundsChanged(false),
|
_boundsChanged(false),
|
||||||
_trackBounds(false),
|
_trackBounds(false),
|
||||||
_opaque(false),
|
_opaque(false),
|
||||||
_sortingChildCount(0),
|
_sortingChildCount(0),
|
||||||
_applyingController(nullptr),
|
_applyingController(nullptr),
|
||||||
_buildingDisplayList(false),
|
_buildingDisplayList(false),
|
||||||
_maskOwner(nullptr),
|
_maskOwner(nullptr),
|
||||||
_hitArea(nullptr)
|
_hitArea(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,8 +445,8 @@ void GComponent::applyController(GController* c)
|
||||||
{
|
{
|
||||||
_applyingController = c;
|
_applyingController = c;
|
||||||
|
|
||||||
for (const auto& child : _children)
|
for (ssize_t i = 0; i < _children.size(); i++)
|
||||||
child->handleControllerChanged(c);
|
_children.at(i)->handleControllerChanged(c);
|
||||||
|
|
||||||
_applyingController = nullptr;
|
_applyingController = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -452,7 +452,7 @@ void GGroup::setup_beforeAdd(ByteBuffer* buffer, int beginPos)
|
||||||
{
|
{
|
||||||
_excludeInvisibles = buffer->readBool();
|
_excludeInvisibles = buffer->readBool();
|
||||||
_autoSizeDisabled = buffer->readBool();
|
_autoSizeDisabled = buffer->readBool();
|
||||||
_mainChildIndex = buffer->readShort();
|
_mainGridIndex = buffer->readShort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,25 +42,25 @@ static inline float sp_EaseFunc(float t, float d)
|
||||||
|
|
||||||
ScrollPane::ScrollPane(GComponent* owner)
|
ScrollPane::ScrollPane(GComponent* owner)
|
||||||
: _vtScrollBar(nullptr),
|
: _vtScrollBar(nullptr),
|
||||||
_hzScrollBar(nullptr),
|
_hzScrollBar(nullptr),
|
||||||
_header(nullptr),
|
_header(nullptr),
|
||||||
_footer(nullptr),
|
_footer(nullptr),
|
||||||
_pageController(nullptr),
|
_pageController(nullptr),
|
||||||
_needRefresh(false),
|
_needRefresh(false),
|
||||||
_refreshBarAxis(0),
|
_refreshBarAxis(0),
|
||||||
_aniFlag(0),
|
_aniFlag(0),
|
||||||
_loop(0),
|
_loop(0),
|
||||||
_headerLockedSize(0),
|
_headerLockedSize(0),
|
||||||
_footerLockedSize(0),
|
_footerLockedSize(0),
|
||||||
_vScrollNone(false),
|
_vScrollNone(false),
|
||||||
_hScrollNone(false),
|
_hScrollNone(false),
|
||||||
_tweening(0),
|
_tweening(0),
|
||||||
_xPos(0),
|
_xPos(0),
|
||||||
_yPos(0),
|
_yPos(0),
|
||||||
_floating(false),
|
_floating(false),
|
||||||
_dontClipMargin(false),
|
_dontClipMargin(false),
|
||||||
_mouseWheelEnabled(true),
|
_mouseWheelEnabled(true),
|
||||||
_hover(false)
|
_hover(false)
|
||||||
{
|
{
|
||||||
_owner = owner;
|
_owner = owner;
|
||||||
|
|
||||||
|
@ -84,6 +84,10 @@ ScrollPane::ScrollPane(GComponent* owner)
|
||||||
_owner->addEventListener(UIEventType::TouchBegin, CC_CALLBACK_1(ScrollPane::onTouchBegin, this));
|
_owner->addEventListener(UIEventType::TouchBegin, CC_CALLBACK_1(ScrollPane::onTouchBegin, this));
|
||||||
_owner->addEventListener(UIEventType::TouchMove, CC_CALLBACK_1(ScrollPane::onTouchMove, this));
|
_owner->addEventListener(UIEventType::TouchMove, CC_CALLBACK_1(ScrollPane::onTouchMove, this));
|
||||||
_owner->addEventListener(UIEventType::TouchEnd, CC_CALLBACK_1(ScrollPane::onTouchEnd, this));
|
_owner->addEventListener(UIEventType::TouchEnd, CC_CALLBACK_1(ScrollPane::onTouchEnd, this));
|
||||||
|
_owner->addEventListener(UIEventType::Exit, [this](EventContext*) {
|
||||||
|
if (_draggingPane == this)
|
||||||
|
_draggingPane = nullptr;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollPane::~ScrollPane()
|
ScrollPane::~ScrollPane()
|
||||||
|
@ -99,6 +103,9 @@ ScrollPane::~ScrollPane()
|
||||||
_header->release();
|
_header->release();
|
||||||
if (_footer)
|
if (_footer)
|
||||||
_footer->release();
|
_footer->release();
|
||||||
|
|
||||||
|
if (_draggingPane == this)
|
||||||
|
_draggingPane = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollPane::setup(ByteBuffer* buffer)
|
void ScrollPane::setup(ByteBuffer* buffer)
|
||||||
|
@ -796,10 +803,10 @@ void ScrollPane::handleSizeChanged()
|
||||||
max += _footerLockedSize;
|
max += _footerLockedSize;
|
||||||
if (_refreshBarAxis == 0)
|
if (_refreshBarAxis == 0)
|
||||||
_container->setPosition2(clampf(_container->getPositionX(), -max, _headerLockedSize),
|
_container->setPosition2(clampf(_container->getPositionX(), -max, _headerLockedSize),
|
||||||
clampf(_container->getPositionY2(), -_overlapSize.height, 0));
|
clampf(_container->getPositionY2(), -_overlapSize.height, 0));
|
||||||
else
|
else
|
||||||
_container->setPosition2(clampf(_container->getPositionX(), -_overlapSize.width, 0),
|
_container->setPosition2(clampf(_container->getPositionX(), -_overlapSize.width, 0),
|
||||||
clampf(_container->getPositionY2(), -max, _headerLockedSize));
|
clampf(_container->getPositionY2(), -max, _headerLockedSize));
|
||||||
|
|
||||||
if (_header != nullptr)
|
if (_header != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -986,9 +993,9 @@ void ScrollPane::updateScrollBarVisible2(GScrollBar* bar)
|
||||||
{
|
{
|
||||||
if (bar->isVisible())
|
if (bar->isVisible())
|
||||||
GTween::to(1, 0, 0.5f)
|
GTween::to(1, 0, 0.5f)
|
||||||
->setDelay(0.5f)
|
->setDelay(0.5f)
|
||||||
->onComplete1(CC_CALLBACK_1(ScrollPane::onBarTweenComplete, this))
|
->onComplete1(CC_CALLBACK_1(ScrollPane::onBarTweenComplete, this))
|
||||||
->setTarget(bar, TweenPropType::Alpha);
|
->setTarget(bar, TweenPropType::Alpha);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1230,7 +1237,7 @@ float ScrollPane::updateTargetAndDuration(float pos, int axis)
|
||||||
{
|
{
|
||||||
if (v2 > 1000)
|
if (v2 > 1000)
|
||||||
ratio = pow((v2 - 1000) / 1000, 2);
|
ratio = pow((v2 - 1000) / 1000, 2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ratio != 0)
|
if (ratio != 0)
|
||||||
|
@ -1246,7 +1253,7 @@ float ScrollPane::updateTargetAndDuration(float pos, int axis)
|
||||||
float change = (int)(v * duration * 0.4f);
|
float change = (int)(v * duration * 0.4f);
|
||||||
pos += change;
|
pos += change;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duration < TWEEN_TIME_DEFAULT)
|
if (duration < TWEEN_TIME_DEFAULT)
|
||||||
duration = TWEEN_TIME_DEFAULT;
|
duration = TWEEN_TIME_DEFAULT;
|
||||||
|
|
Loading…
Reference in New Issue