Index: sources/gui/qml/components/RangeMarker.qml =================================================================== diff -u -r7caa737179a8c31825ae6445f593ac7ff5f95080 -r0022c3993c47e74c2d17c7f07f78fa1751a034f6 --- sources/gui/qml/components/RangeMarker.qml (.../RangeMarker.qml) (revision 7caa737179a8c31825ae6445f593ac7ff5f95080) +++ sources/gui/qml/components/RangeMarker.qml (.../RangeMarker.qml) (revision 0022c3993c47e74c2d17c7f07f78fa1751a034f6) @@ -47,8 +47,8 @@ visible : false width : _root.width * 3 - height : _root.width * 3 - radius : _root.width * 3 + height : width + radius : width color : _root.color anchors { top : _root.top @@ -69,18 +69,37 @@ Text { id: _textValue font { pixelSize : Fonts.fontPixelRangeMarker - bold : true + weight : Font.Bold } anchors { - right : parent.left + right : valueOnTop ? parent.left : undefined top : valueOnTop ? undefined : parent.top bottom : valueOnTop ? _handle.top : undefined bottomMargin: valueOnTop ? 5 : 0 rightMargin : valueOnTop ? -12 : 5 topMargin : valueOnTop ? 0 : -5 + horizontalCenter: valueOnTop ? _handle.horizontalCenter : undefined + horizontalCenterOffset: { + if (valueOnTop) { + if (_root.parent !== undefined) { + let xDelta = (_root.width-implicitWidth)/2 + // left boundary + if (_root.x + xDelta < 0) { + return -(_root.x + xDelta) + } + // right boundary + let rightOverflow = _root.x + _root.width - xDelta + if (rightOverflow > _root.parent.width) { + return -(rightOverflow - _root.parent.width) + } + } + } + return 0 + } } + horizontalAlignment: valueOnTop ? Text.AlignHCenter : Text.AlignLeft color : _root.color text : value.toFixed(decimal) + " " + unitText }