Add highlight on goToEvent
Add a temporary highlight when the goToEvent is triggered. This implementation also alows a temporary highlight of an item at anytime if the timeline container's isTemporaryHighlighted property is set to true. Closes network/neochat#34
This commit is contained in:
@@ -18,6 +18,17 @@ QQC2.ItemDelegate {
|
|||||||
|
|
||||||
property bool isEmote: false
|
property bool isEmote: false
|
||||||
property bool cardBackground: true
|
property bool cardBackground: true
|
||||||
|
property bool isHighlighted: model.isHighlighted || isTemporaryHighlighted
|
||||||
|
property bool isTemporaryHighlighted: false
|
||||||
|
|
||||||
|
onIsTemporaryHighlightedChanged: if (isTemporaryHighlighted) temporaryHighlightTimer.start()
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: temporaryHighlightTimer
|
||||||
|
|
||||||
|
interval: 1500
|
||||||
|
onTriggered: isTemporaryHighlighted = false
|
||||||
|
}
|
||||||
|
|
||||||
signal openContextMenu
|
signal openContextMenu
|
||||||
|
|
||||||
@@ -262,12 +273,13 @@ QQC2.ItemDelegate {
|
|||||||
|
|
||||||
background: Item {
|
background: Item {
|
||||||
Kirigami.ShadowedRectangle {
|
Kirigami.ShadowedRectangle {
|
||||||
|
id: bubbleBackground
|
||||||
visible: cardBackground && !Config.compactLayout
|
visible: cardBackground && !Config.compactLayout
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: {
|
color: {
|
||||||
if (model.author.isLocalUser) {
|
if (model.author.isLocalUser) {
|
||||||
return Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, 0.15)
|
return Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, 0.15)
|
||||||
} else if (model.isHighlighted) {
|
} else if (timelineContainer.isHighlighted) {
|
||||||
return Kirigami.Theme.positiveBackgroundColor
|
return Kirigami.Theme.positiveBackgroundColor
|
||||||
} else {
|
} else {
|
||||||
return Kirigami.Theme.backgroundColor
|
return Kirigami.Theme.backgroundColor
|
||||||
@@ -275,9 +287,13 @@ QQC2.ItemDelegate {
|
|||||||
}
|
}
|
||||||
radius: Kirigami.Units.smallSpacing
|
radius: Kirigami.Units.smallSpacing
|
||||||
shadow.size: Kirigami.Units.smallSpacing
|
shadow.size: Kirigami.Units.smallSpacing
|
||||||
shadow.color: !model.isHighlighted ? Qt.rgba(0.0, 0.0, 0.0, 0.10) : Qt.rgba(Kirigami.Theme.textColor.r, Kirigami.Theme.textColor.g, Kirigami.Theme.textColor.b, 0.10)
|
shadow.color: timelineContainer.isHighlighted ? Qt.rgba(0.0, 0.0, 0.0, 0.10) : Qt.rgba(Kirigami.Theme.textColor.r, Kirigami.Theme.textColor.g, Kirigami.Theme.textColor.b, 0.10)
|
||||||
border.color: Kirigami.ColorUtils.tintWithAlpha(color, Kirigami.Theme.textColor, 0.15)
|
border.color: Kirigami.ColorUtils.tintWithAlpha(color, Kirigami.Theme.textColor, 0.15)
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {target: bubbleBackground; duration: Kirigami.Units.veryLongDuration; easing.type: Easing.InOutCubic}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -430,7 +430,9 @@ Kirigami.ScrollablePage {
|
|||||||
headerPositioning: ListView.OverlayHeader
|
headerPositioning: ListView.OverlayHeader
|
||||||
|
|
||||||
function goToEvent(eventID) {
|
function goToEvent(eventID) {
|
||||||
messageListView.positionViewAtIndex(eventToIndex(eventID), ListView.Contain)
|
const index = eventToIndex(eventID)
|
||||||
|
messageListView.positionViewAtIndex(index, ListView.Center)
|
||||||
|
itemAtIndex(index).isTemporaryHighlighted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|||||||
Reference in New Issue
Block a user