mirror of
https://github.com/geode-sdk/geode.git
synced 2024-12-04 13:11:09 -05:00
do not break intended behavior while fixing #926
Some checks failed
Build Binaries / Build Windows (push) Has been cancelled
Build Binaries / Build macOS (push) Has been cancelled
Build Binaries / Build Android (64-bit) (push) Has been cancelled
Build Binaries / Build Android (32-bit) (push) Has been cancelled
Build Binaries / Publish (push) Has been cancelled
Some checks failed
Build Binaries / Build Windows (push) Has been cancelled
Build Binaries / Build macOS (push) Has been cancelled
Build Binaries / Build Android (64-bit) (push) Has been cancelled
Build Binaries / Build Android (32-bit) (push) Has been cancelled
Build Binaries / Publish (push) Has been cancelled
This commit is contained in:
parent
b8d29a8aa2
commit
4b5d112442
1 changed files with 9 additions and 12 deletions
|
@ -291,7 +291,7 @@ public:
|
||||||
return attemptRescale;
|
return attemptRescale;
|
||||||
}
|
}
|
||||||
|
|
||||||
float nextGap(AxisLayoutOptions const* now, AxisLayoutOptions const* next) const {
|
float nextGap(AxisLayoutOptions const* now, AxisLayoutOptions const* next, size_t ix) const {
|
||||||
std::optional<float> gap;
|
std::optional<float> gap;
|
||||||
if (now) {
|
if (now) {
|
||||||
gap = now->getNextGap();
|
gap = now->getNextGap();
|
||||||
|
@ -299,7 +299,7 @@ public:
|
||||||
if (next && (!gap || gap.value() < next->getPrevGap())) {
|
if (next && (!gap || gap.value() < next->getPrevGap())) {
|
||||||
gap = next->getPrevGap();
|
gap = next->getPrevGap();
|
||||||
}
|
}
|
||||||
return gap.value_or(m_gap);
|
return gap.value_or(ix ? m_gap : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Row* fitInRow(
|
Row* fitInRow(
|
||||||
|
@ -355,7 +355,7 @@ public:
|
||||||
res->addObject(node);
|
res->addObject(node);
|
||||||
}
|
}
|
||||||
if (ix) {
|
if (ix) {
|
||||||
auto gap = nextGap(prev, opts);
|
auto gap = nextGap(prev, opts, ix);
|
||||||
// if we've exhausted all priority scale options, scale gap too
|
// if we've exhausted all priority scale options, scale gap too
|
||||||
if (prio == minMaxPrios.first) {
|
if (prio == minMaxPrios.first) {
|
||||||
nextAxisScalableLength += gap * scale * squish;
|
nextAxisScalableLength += gap * scale * squish;
|
||||||
|
@ -690,10 +690,10 @@ public:
|
||||||
else {
|
else {
|
||||||
if (ix != 0) {
|
if (ix != 0) {
|
||||||
if (row->prio == minMaxPrios.first) {
|
if (row->prio == minMaxPrios.first) {
|
||||||
rowAxisPos += this->nextGap(prev, opts) * row->scale * row->squish;
|
rowAxisPos += this->nextGap(prev, opts, ix) * row->scale * row->squish;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rowAxisPos += this->nextGap(prev, opts) * row->squish;
|
rowAxisPos += this->nextGap(prev, opts, ix) * row->squish;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
axisPos = rowAxisPos + pos.axisLength * pos.axisAnchor;
|
axisPos = rowAxisPos + pos.axisLength * pos.axisAnchor;
|
||||||
|
@ -751,7 +751,7 @@ void AxisLayout::apply(CCNode* on) {
|
||||||
float totalLength = 0;
|
float totalLength = 0;
|
||||||
AxisLayoutOptions const* prev = nullptr;
|
AxisLayoutOptions const* prev = nullptr;
|
||||||
|
|
||||||
bool first = true;
|
size_t ix = 0;
|
||||||
for (auto node : CCArrayExt<CCNode*>(nodes)) {
|
for (auto node : CCArrayExt<CCNode*>(nodes)) {
|
||||||
// Require all nodes not to have this stupid option enabled because it
|
// Require all nodes not to have this stupid option enabled because it
|
||||||
// screws up all position calculations
|
// screws up all position calculations
|
||||||
|
@ -773,7 +773,7 @@ void AxisLayout::apply(CCNode* on) {
|
||||||
doAutoScale = true;
|
doAutoScale = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (first) {
|
if (ix == 0) {
|
||||||
minMaxPrio = { prio, prio };
|
minMaxPrio = { prio, prio };
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -785,13 +785,10 @@ void AxisLayout::apply(CCNode* on) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_impl->m_autoGrowAxisMinLength.has_value()) {
|
if (m_impl->m_autoGrowAxisMinLength.has_value()) {
|
||||||
totalLength += nodeAxis(node, m_impl->m_axis, 1.f).axisLength;
|
totalLength += nodeAxis(node, m_impl->m_axis, 1.f).axisLength + m_impl->nextGap(prev, opts, ix);
|
||||||
if (!first) {
|
|
||||||
totalLength += m_impl->nextGap(prev, opts);
|
|
||||||
}
|
|
||||||
prev = opts;
|
prev = opts;
|
||||||
}
|
}
|
||||||
first = false;
|
ix++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_impl->m_autoGrowAxisMinLength.has_value()) {
|
if (m_impl->m_autoGrowAxisMinLength.has_value()) {
|
||||||
|
|
Loading…
Reference in a new issue