Commit c49c874b authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

make sure to reset positions array on split count changed

parent 2bf4bcb6
......@@ -12,15 +12,13 @@ Control {
property real handleWidth: 5
property real handleHeight: 5
property var _majorPositions: {
let positions = [];
for (let i = 0; i < majorCount; ++i) {
positions.push(i / majorCount);
}
return positions;
}
property var _minorPositions: {
let count = Math.max(...minorCounts);
property var _majorPositions: _makeDefaultPositionsArray(majorCount)
property var _minorPositions: _makeDefaultPositionsArray(Math.max(...minorCounts))
property alias model: contentRepeater.model
property Component delegate
function _makeDefaultPositionsArray(count) {
let positions = [];
for (let i = 0; i < count; ++i) {
positions.push(i / count);
......@@ -28,8 +26,19 @@ Control {
return positions;
}
property alias model: contentRepeater.model
property Component delegate
Component.onCompleted: {
// break binding
_majorPositions = _majorPositions;
_minorPositions = _minorPositions;
}
onMajorCountChanged: {
_majorPositions = _makeDefaultPositionsArray(majorCount);
}
onMinorCountsChanged: {
_minorPositions = _makeDefaultPositionsArray(Math.max(...minorCounts));
}
contentItem: Item {
Item {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment