diff --git a/qml/Keyboard.qml b/qml/Keyboard.qml index 9498bddf..980cce7b 100644 --- a/qml/Keyboard.qml +++ b/qml/Keyboard.qml @@ -89,104 +89,69 @@ Item { opacity: Keyboard.opacity - MouseArea { - id: swipeArea - - property int jumpBackThreshold: Device.gu(10) + Page { + id: keyboardSurface + objectName: "keyboardSurface" anchors.fill: parent - drag.target: keyboardSurface - drag.axis: Drag.YAxis; - drag.minimumY: 0 - drag.maximumY: parent.height - //fix for lp:1277186 - //only filter children when wordRibbon visible - drag.filterChildren: wordRibbon.visible - // Avoid conflict with extended key swipe selection and cursor swipe mode - enabled: !canvas.extendedKeysShown && !fullScreenItem.cursorSwipe - - onReleased: { - if (keyboardSurface.y > jumpBackThreshold) { - MaliitGeometry.shown = false; - } else { - bounceBackAnimation.from = keyboardSurface.y - bounceBackAnimation.start(); - } - } + WordRibbon { + id: wordRibbon + objectName: "wordRibbon" - Page { - id: keyboardSurface - objectName: "keyboardSurface" + // Hide thte word ribbon when in emoji or cursor mode + visible: !fullScreenItem.cursorSwipe && canvas.wordribbon_visible && keypad.state !== "EMOJI" - x:0 - y:0 - width: parent.width - height: canvas.height + anchors.bottom: keyboardComp.top + width: parent.width; - onXChanged: fullScreenItem.reportKeyboardVisibleRect(); - onYChanged: fullScreenItem.reportKeyboardVisibleRect(); - onWidthChanged: fullScreenItem.reportKeyboardVisibleRect(); + // Use a size proportional to the height of keyboard keys + height: visible ? keypad.keyHeight * 0.5 : 0 onHeightChanged: fullScreenItem.reportKeyboardVisibleRect(); - - WordRibbon { - id: wordRibbon - objectName: "wordRibbon" - - // Hide thte word ribbon when in emoji or cursor mode - visible: !fullScreenItem.cursorSwipe && canvas.wordribbon_visible && keypad.state !== "EMOJI" - - anchors.bottom: keyboardComp.top - width: parent.width; - - // Use a size proportional to the height of keyboard keys - height: visible ? keypad.keyHeight * 0.5 : 0 - onHeightChanged: fullScreenItem.reportKeyboardVisibleRect(); - } + } - ActionsToolbar { - id: toolbar - objectName: "actionsToolbar" + ActionsToolbar { + id: toolbar + objectName: "actionsToolbar" - visible: fullScreenItem.cursorSwipe - height: Device.wordRibbonHeight - } + visible: fullScreenItem.cursorSwipe + height: Device.wordRibbonHeight + } - Rectangle { - width: parent.width - height: 1 - color: "#888888" - anchors.bottom: wordRibbon.visible ? wordRibbon.top : keyboardComp.top - } + Rectangle { + width: parent.width + height: 1 + color: "#888888" + anchors.bottom: wordRibbon.visible ? wordRibbon.top : keyboardComp.top + } - Item { - id: keyboardComp - objectName: "keyboardComp" + Item { + id: keyboardComp + objectName: "keyboardComp" - visible: !fullScreenItem.cursorSwipe - height: parent.height - width: parent.width - anchors.bottom: parent.bottom + visible: !fullScreenItem.cursorSwipe + height: parent.height + width: parent.width + anchors.bottom: parent.bottom - onHeightChanged: fullScreenItem.reportKeyboardVisibleRect(); + onHeightChanged: fullScreenItem.reportKeyboardVisibleRect(); - KeyboardContainer { - id: keypad + KeyboardContainer { + id: keypad - anchors.fill: parent - anchors.topMargin: wordRibbon.visible ? 0 : Device.top_margin - anchors.bottomMargin: Device.bottom_margin - } + anchors.fill: parent + anchors.topMargin: wordRibbon.visible ? 0 : Device.top_margin + anchors.bottomMargin: Device.bottom_margin + } - LanguageMenu { - id: languageMenu - objectName: "languageMenu" - anchors.centerIn: parent - height: contentHeight > keypad.height ? keypad.height : contentHeight - width: Device.gu(30); - } - } // keyboardComp - } + LanguageMenu { + id: languageMenu + objectName: "languageMenu" + anchors.centerIn: parent + height: contentHeight > keypad.height ? keypad.height : contentHeight + width: Device.gu(30); + } + } // keyboardComp } PropertyAnimation { @@ -283,7 +248,7 @@ Item { topMargin: toolbar.height } - enabled: cursorSwipe + enabled: fullScreenItem.cursorSwipe // An invisible text field to be able to get selection colors from // thte qqc2 style in use, for selection mode diff --git a/qml/keys/CharKey.qml b/qml/keys/CharKey.qml index c7e30a38..8c5a15a6 100644 --- a/qml/keys/CharKey.qml +++ b/qml/keys/CharKey.qml @@ -383,12 +383,4 @@ Item { keyMouseArea.evaluateSelectorSwipe(); } } - - Connections { - target: swipeArea.drag - function onActiveChanged() { - if (swipeArea.drag.active) - keyMouseArea.cancelPress(); - } - } } diff --git a/qml/keys/PressArea.qml b/qml/keys/PressArea.qml index 46f7104f..876bc81f 100644 --- a/qml/keys/PressArea.qml +++ b/qml/keys/PressArea.qml @@ -69,28 +69,6 @@ MultiPointTouchArea { swipedOut = true; cancelPress(); } - - // Dirty hack, see onReleased below - if (point.y > panel.height) { - // Touch point released past height of keyboard. - return; - } - - var distance = point.y - lastY; - // If changing direction wait until movement passes 1 gu - // to avoid jitter - if ((lastYChange * distance > 0 || Math.abs(distance) > Device.gu(1)) && !held) { - keyboardSurface.y += distance; - lastY = point.y; - lastYChange = distance; - } - // Hide if we get close to the bottom of the screen. - // This works around issues with devices with touch buttons - // below the screen preventing release events when swiped - // over - if(point.sceneY > fullScreenItem.height - Device.gu(4) && point.y > startY + Device.gu(8) && !held) { - Keyboard.hide(); - } } else { lastY = point.y; } @@ -139,23 +117,6 @@ MultiPointTouchArea { } onReleased: { - // Don't evaluate if the release point is above the start point - // or further away from its start than the height of the whole keyboard. - // This works around touches sometimes being recognized as ending below - // the bottom of the screen. - if (point.y > panel.height) { - console.warn("Touch point released past height of keyboard. Ignoring."); - } else if (!(point.y <= startY)) { - // Handles swiping away the keyboard - // Hide if the end point is more than 8 grid units from the start - if (!held && point.y > startY + Device.gu(8)) { - Keyboard.hide(); - } else { - bounceBackAnimation.from = keyboardSurface.y; - bounceBackAnimation.start(); - } - } - pressed = false; held = false; holdTimer.stop();