Commit 97e81ff1 authored by Ronan Abhamon's avatar Ronan Abhamon

TMP

parent f9bebf12
...@@ -8,21 +8,28 @@ Item { ...@@ -8,21 +8,28 @@ Item {
property alias childA: contentA.data property alias childA: contentA.data
property alias childB: contentB.data property alias childB: contentB.data
onWidthChanged: { property bool useDynamicLimits: true
console.log('RESIZE', width, handleLimitRight)
if (contentB.width < handleLimitRight) {
console.log('lala', width, handleLimitRight, width - handle.width - handleLimitRight)
contentA.width = width - handle.width - handleLimitRight
} else if (contentA.width < handleLimitLeft) {
console.log('zaza', width, handleLimitLeft)
function updateContentA () {
// width(A) < minimum width(A)
if (contentA.width < handleLimitLeft) {
contentA.width = handleLimitLeft contentA.width = handleLimitLeft
} else if (contentA.width >= width - handleLimitRight - 20) { }
console.log('FUCK', contentA.width , width - handleLimitRight - 20)
contentA.width - handle.width - handleLimitRight // width(B) < minimum width(B)
else if (width - contentA.width - handle.width < handleLimitRight) {
contentA.width = width - handle.width - handleLimitRight
} }
} }
onHandleLimitLeftChanged: updateContentA()
onHandleLimitRightChanged: updateContentA()
onWidthChanged: !useDynamicLimits && updateContentA()
Component.onCompleted: {
contentA.width = handleLimitLeft
}
Rectangle { Rectangle {
id: contentA id: contentA
...@@ -49,11 +56,16 @@ Item { ...@@ -49,11 +56,16 @@ Item {
var offset = mouseX - _mouseStart var offset = mouseX - _mouseStart
// width(B) < minimum width(B)
if (container.width - offset - contentA.width - width < handleLimitRight) { if (container.width - offset - contentA.width - width < handleLimitRight) {
contentA.width = container.width - width - handleLimitRight contentA.width = container.width - width - handleLimitRight
} else if (contentA.width + offset < handleLimitLeft) { }
// width(A) < minimum width(A)
else if (contentA.width + offset < handleLimitLeft) {
contentA.width = handleLimitLeft contentA.width = handleLimitLeft
} else { }
// Resize A/B.
else {
contentA.width = contentA.width + offset contentA.width = contentA.width + offset
} }
} }
......
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