mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Merge pull request #1551 from yuzujr/fix/NScrollText
fix issue#1371:ActiveWindow text/title length limited to previous active window
This commit is contained in:
@@ -40,9 +40,16 @@ Item {
|
||||
property real scrollCycleDuration: Math.max(4000, root.text.length * 120)
|
||||
property real resettingDuration: 300
|
||||
|
||||
readonly property real contentWidth: {
|
||||
if (!titleText.item)
|
||||
return 0;
|
||||
const implicit = titleText.item.implicitWidth;
|
||||
return implicit > 0 ? implicit : titleText.item.width;
|
||||
}
|
||||
readonly property real measuredWidth: scrollContainer.width
|
||||
|
||||
clip: true
|
||||
implicitWidth: alwaysMaxWidth ? maxWidth : Math.min(maxWidth, contentWidth)
|
||||
implicitHeight: titleText.height
|
||||
|
||||
enum ScrollState {
|
||||
@@ -63,13 +70,10 @@ Item {
|
||||
resetState();
|
||||
}
|
||||
onMaxWidthChanged: resetState()
|
||||
onContentWidthChanged: root.updateState()
|
||||
onForcedHoverChanged: updateState()
|
||||
|
||||
function resetState() {
|
||||
root.implicitWidth = Math.min(root.maxWidth, titleText.width);
|
||||
if (alwaysMaxWidth) {
|
||||
root.implicitWidth = root.maxWidth;
|
||||
}
|
||||
root.state = NScrollText.ScrollState.None;
|
||||
scrollContainer.x = 0;
|
||||
scrollTimer.restart();
|
||||
@@ -101,7 +105,7 @@ Item {
|
||||
}
|
||||
|
||||
function updateState() {
|
||||
if (titleText.width <= root.maxWidth || scrollMode === NScrollText.ScrollMode.Never) {
|
||||
if (contentWidth <= root.maxWidth || scrollMode === NScrollText.ScrollMode.Never) {
|
||||
state = NScrollText.ScrollState.None;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user