2019-07-21 08:08:58 +10:00
|
|
|
// Copyright 2019 miruka
|
|
|
|
// This file is part of harmonyqml, licensed under LGPLv3.
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
|
|
|
|
|
|
|
Item {
|
|
|
|
property Item flickTarget: Item {}
|
|
|
|
|
|
|
|
function smartVerticalFlick(baseVelocity, fastMultiply=3) {
|
2019-07-21 08:28:00 +10:00
|
|
|
if (! flickTarget.interactive) { return }
|
2019-07-21 08:08:58 +10:00
|
|
|
|
2019-07-21 08:28:00 +10:00
|
|
|
baseVelocity = -baseVelocity
|
|
|
|
let vel = -flickTarget.verticalVelocity
|
|
|
|
let fast = (baseVelocity < 0 && vel < baseVelocity / 2) ||
|
|
|
|
(baseVelocity > 0 && vel > baseVelocity / 2)
|
2019-07-21 08:08:58 +10:00
|
|
|
|
|
|
|
flickTarget.flick(0, baseVelocity * (fast ? fastMultiply : 1))
|
|
|
|
}
|
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
sequences: ["Alt+Up", "Alt+K"]
|
|
|
|
onActivated: smartVerticalFlick(-335)
|
|
|
|
}
|
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
sequences: ["Alt+Down", "Alt+J"]
|
|
|
|
onActivated: smartVerticalFlick(335)
|
|
|
|
}
|
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
sequence: "Alt+Shift+D"
|
|
|
|
onActivated: if (window.debug) { py.call("APP.pdb") }
|
|
|
|
}
|
|
|
|
}
|