Make EditAccount keyboard-flickable, fix function

This commit is contained in:
miruka 2019-07-20 18:28:00 -04:00
parent 41eea44fff
commit 414082d258
3 changed files with 14 additions and 16 deletions

View File

@ -9,6 +9,7 @@ import "../../utils.js" as Utils
HPage {
id: editAccount
Component.onCompleted: shortcuts.flickTarget = flickable
property int avatarPreferredSize: 256

View File

@ -7,15 +7,12 @@ Item {
property Item flickTarget: Item {}
function smartVerticalFlick(baseVelocity, fastMultiply=3) {
let vel = flickTarget.verticalVelocity
if (! flickTarget.interactive) { return }
if (flickTarget.verticalLayoutDirection == ListView.BottomToTop) {
baseVelocity = -baseVelocity
vel = -vel
}
let fast = (baseVelocity < 0 && vel < baseVelocity / 2) ||
(baseVelocity > 0 && vel > baseVelocity / 2)
baseVelocity = -baseVelocity
let vel = -flickTarget.verticalVelocity
let fast = (baseVelocity < 0 && vel < baseVelocity / 2) ||
(baseVelocity > 0 && vel > baseVelocity / 2)
flickTarget.flick(0, baseVelocity * (fast ? fastMultiply : 1))
}

View File

@ -74,19 +74,19 @@ Item {
id: initialRoomTimer
interval: 4000
repeat: false
onTriggered: pageStack.showRoom(
"@test_mary:matrix.org",
"Rooms",
// onTriggered: pageStack.showRoom(
// "@test_mary:matrix.org",
// "Rooms",
// "!TSXGsbBbdwsdylIOJZ:matrix.org" // st
// "!VDSsFIzQnXARSCVNxS:matrix.org" // hs
"!XhxUcnVhVhUHkBZEIL:matrix.org" // nc
// "!XhxUcnVhVhUHkBZEIL:matrix.org" // nc
// "Invites",
// "!xjqvLOGhMVutPXpAqi:matrix.org"
)
// onTriggered: pageStack.showPage(
// "EditAccount/EditAccount",
// {"userId": "@test_mary:matrix.org"}
// )
onTriggered: pageStack.showPage(
"EditAccount/EditAccount",
{"userId": "@test_mary:matrix.org"}
)
}
onCurrentItemChanged: if (currentItem) {