resize when overshooting

This commit is contained in:
Marco Martin 2011-11-16 11:05:22 +01:00
parent f8ed323fab
commit cedf8f0075

View File

@ -48,10 +48,24 @@ PlasmaCore.FrameSvgItem {
imagePath:"widgets/scrollbar"
prefix: "slider"
property int length: internalLoader.isVertical? flickableItem.visibleArea.heightRatio * parent.height : flickableItem.visibleArea.widthRatio * parent.width
function length() {
if (internalLoader.isVertical) {
var overshoot = 0
if (flickableItem.atYBeginning || flickableItem.atYEnd) {
overshoot = Math.abs(flickableItem.visibleArea.yPosition * parent.height)
}
return (flickableItem.visibleArea.heightRatio * parent.height) - overshoot
} else {
var overshoot = 0
if (flickableItem.atXBeginning || flickableItem.atXEnd) {
overshoot = Math.abs(flickableItem.visibleArea.xPosition * parent.width)
}
return (flickableItem.visibleArea.widthRatio * parent.width) - overshoot
}
}
width: internalLoader.isVertical ? parent.width : length
height: internalLoader.isVertical ? length : parent.height
width: internalLoader.isVertical ? parent.width : length()
height: internalLoader.isVertical ? length() : parent.height
}
}