mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-27 09:55:34 -05:00
force all nodes of a Layout be ignoreAnchorPointForPosition
This commit is contained in:
parent
bb60da8cb2
commit
c42b5ddbc2
1 changed files with 11 additions and 8 deletions
|
@ -252,8 +252,12 @@ float AxisLayout::nextGap(AxisLayoutOptions const* now, AxisLayoutOptions const*
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AxisLayout::shouldAutoScale(AxisLayoutOptions const* opts) const {
|
bool AxisLayout::shouldAutoScale(AxisLayoutOptions const* opts) const {
|
||||||
if (!opts) return m_autoScale;
|
if (opts) {
|
||||||
return opts->getAutoScale().value_or(m_autoScale);
|
return opts->getAutoScale().value_or(m_autoScale);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return m_autoScale;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float AxisLayout::minScaleForPrio(CCArray* nodes, int prio) const {
|
float AxisLayout::minScaleForPrio(CCArray* nodes, int prio) const {
|
||||||
|
@ -382,9 +386,7 @@ AxisLayout::Row* AxisLayout::fitInRow(
|
||||||
// calculate row scale, squish, and prio
|
// calculate row scale, squish, and prio
|
||||||
int tries = 1000;
|
int tries = 1000;
|
||||||
while (axisLength > available.axisLength) {
|
while (axisLength > available.axisLength) {
|
||||||
if (this->canTryScalingDown(
|
if (this->canTryScalingDown(res, prio, scale, scale - .002f, minMaxPrios)) {
|
||||||
res, prio, scale, scale - .002f, minMaxPrios
|
|
||||||
)) {
|
|
||||||
scale -= .002f;
|
scale -= .002f;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -547,9 +549,7 @@ void AxisLayout::tryFitLayout(
|
||||||
totalRowCrossLength > available.crossLength &&
|
totalRowCrossLength > available.crossLength &&
|
||||||
depth < RECURSION_DEPTH_LIMIT
|
depth < RECURSION_DEPTH_LIMIT
|
||||||
) {
|
) {
|
||||||
if (this->canTryScalingDown(
|
if (this->canTryScalingDown(nodes, prio, scale, crossScaleDownFactor, minMaxPrios)) {
|
||||||
nodes, prio, scale, crossScaleDownFactor, minMaxPrios
|
|
||||||
)) {
|
|
||||||
rows->release();
|
rows->release();
|
||||||
return this->tryFitLayout(
|
return this->tryFitLayout(
|
||||||
on, nodes,
|
on, nodes,
|
||||||
|
@ -755,6 +755,9 @@ void AxisLayout::apply(CCNode* on) {
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto node : CCArrayExt<CCNode*>(nodes)) {
|
for (auto node : CCArrayExt<CCNode*>(nodes)) {
|
||||||
|
// Require all nodes not to have this stupid option enabled because it
|
||||||
|
// screws up all position calculations
|
||||||
|
node->ignoreAnchorPointForPosition(false);
|
||||||
int prio = 0;
|
int prio = 0;
|
||||||
auto opts = axisOpts(node);
|
auto opts = axisOpts(node);
|
||||||
if (opts) {
|
if (opts) {
|
||||||
|
|
Loading…
Reference in a new issue