chore(Tracer): Simplify by using Timer instead of Animation
This commit is contained in:
parent
fe0b0ee795
commit
c61fd6057b
|
@ -1,6 +1,6 @@
|
||||||
import QtQuick 2.14
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.14
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.14
|
import QtQuick.Layouts 1.15
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
@ -10,31 +10,29 @@ Rectangle {
|
||||||
color: 'transparent'
|
color: 'transparent'
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: internal
|
id: d
|
||||||
|
|
||||||
property Item originalParent
|
property Item originalParent
|
||||||
property int counter: 0
|
}
|
||||||
|
|
||||||
PropertyAnimation on counter {
|
Timer {
|
||||||
id: positionUpdater
|
id: positionUpdateTimer
|
||||||
|
|
||||||
running: false
|
interval: 500
|
||||||
from: 0
|
repeat: true
|
||||||
to: 1000
|
triggeredOnStart: true
|
||||||
duration: 1000
|
|
||||||
loops: Animation.Infinite
|
|
||||||
}
|
|
||||||
|
|
||||||
onCounterChanged: {
|
onTriggered: {
|
||||||
const overlay = originalParent.Overlay.overlay
|
const overlay = d.originalParent.Overlay.overlay
|
||||||
|
|
||||||
if (!overlay)
|
if (!overlay)
|
||||||
return
|
return
|
||||||
|
|
||||||
root.parent = overlay
|
root.parent = overlay
|
||||||
root.visible = originalParent.visible
|
root.visible = d.originalParent.visible
|
||||||
const rect = originalParent.mapToItem(
|
const rect = d.originalParent.mapToItem(overlay, 0, 0,
|
||||||
overlay, 0, 0, originalParent.width, originalParent.height)
|
d.originalParent.width,
|
||||||
|
d.originalParent.height)
|
||||||
root.x = rect.x
|
root.x = rect.x
|
||||||
root.y = rect.y
|
root.y = rect.y
|
||||||
root.width = rect.width
|
root.width = rect.width
|
||||||
|
@ -51,8 +49,8 @@ Rectangle {
|
||||||
|| parent instanceof Row
|
|| parent instanceof Row
|
||||||
|| parent instanceof Grid
|
|| parent instanceof Grid
|
||||||
|| parent instanceof Flow) {
|
|| parent instanceof Flow) {
|
||||||
internal.originalParent = parent
|
d.originalParent = parent
|
||||||
positionUpdater.running = true
|
positionUpdateTimer.running = true
|
||||||
} else {
|
} else {
|
||||||
if (!anchors.fill)
|
if (!anchors.fill)
|
||||||
anchors.fill = parent
|
anchors.fill = parent
|
||||||
|
|
Loading…
Reference in New Issue