diff options
| -rw-r--r-- | launcher/components/Emoji.qml | 12 | ||||
| -rw-r--r-- | launcher/components/Spell.qml | 10 |
2 files changed, 10 insertions, 12 deletions
diff --git a/launcher/components/Emoji.qml b/launcher/components/Emoji.qml index d4bc54f..d1343e6 100644 --- a/launcher/components/Emoji.qml +++ b/launcher/components/Emoji.qml @@ -13,10 +13,6 @@ IComponent { property var emojis: active ? Emoji.query(input) : [] property int selectedIndex: -1 - property int cols: Math.max(1, Math.floor(innerLoader.width / Math.max(1, Math.round(Launcher.widgetFontSize * 4)))) - property int cellWidth: Math.floor(innerLoader.width / cols) - property int cellHeight: Math.ceil(Launcher.widgetFontSize * 2) + Launcher.innerMargin * 2 - name: "Emoji" prefix: name.toLowerCase() + " " @@ -76,11 +72,13 @@ IComponent { selectedIndex++; } up: function () { + const cols = loader.view ? Math.max(1, Math.floor(loader.view.width / loader.view.cellWidth)) : 1; if (selectedIndex - cols < 0) return true; selectedIndex -= cols; } down: function () { + const cols = loader.view ? Math.max(1, Math.floor(loader.view.width / loader.view.cellWidth)) : 1; if (selectedIndex + cols >= emojis.length) return true; selectedIndex += cols; @@ -121,14 +119,14 @@ IComponent { flow: GridView.FlowLeftToRight snapMode: GridView.NoSnap - cellWidth: root.cellWidth - cellHeight: root.cellHeight + cellWidth: Math.min(width / Math.max(1, Math.floor(width / (Launcher.widgetFontSize * 5))), width / 3) + cellHeight: Launcher.widgetFontSize * 2.2 + Launcher.innerMargin * 2 delegate: Item { required property var modelData required property int index width: grid.cellWidth - height: chipContent.implicitHeight + Launcher.innerMargin * 2 + height: grid.cellHeight scale: index === selectedIndex ? 1.03 : 0.97 IRect { diff --git a/launcher/components/Spell.qml b/launcher/components/Spell.qml index 2072057..d4f505b 100644 --- a/launcher/components/Spell.qml +++ b/launcher/components/Spell.qml @@ -94,14 +94,14 @@ IComponent { } up: function () { - const cols = Math.max(1, Math.floor(innerLoader.width / Math.max(1, Math.round(Launcher.widgetFontSize * 6)))); + const cols = loader.view ? Math.max(1, Math.floor(loader.view.width / loader.view.cellWidth)) : 1; if (selectedIndex - cols < 0) return true; selectedIndex -= cols; } down: function () { - const cols = Math.max(1, Math.floor(innerLoader.width / Math.max(1, Math.round(Launcher.widgetFontSize * 6)))); + const cols = loader.view ? Math.max(1, Math.floor(loader.view.width / loader.view.cellWidth)) : 1; if (selectedIndex + cols >= aspell.length) return true; selectedIndex += cols; @@ -144,15 +144,15 @@ IComponent { flow: GridView.FlowLeftToRight snapMode: GridView.NoSnap - cellWidth: Math.floor(width / Math.max(1, Math.floor(width / Math.max(1, Math.round(Launcher.widgetFontSize * 6))))) - cellHeight: Math.ceil(Launcher.widgetFontSize * 1.6) + Launcher.innerMargin * 2 + cellWidth: Math.min(width / Math.max(1, Math.floor(width / (Launcher.widgetFontSize * 4))), width / 2) + cellHeight: Launcher.widgetFontSize * 1.4 + Launcher.innerMargin * 2 delegate: Item { required property var modelData required property int index width: grid.cellWidth - height: chipContent.implicitHeight + Launcher.innerMargin * 2 + height: grid.cellHeight scale: index === selectedIndex ? 1.03 : 0.97 IRect { |
