1
0
Fork 0

Fix button.

This commit is contained in:
namedkitten 2020-05-03 17:09:52 +01:00
parent 78b6497b0a
commit 77ba915623
2 changed files with 14 additions and 14 deletions

View file

@ -22,19 +22,19 @@ Control {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
sourceSize.height: Math.floor(root.parent.height / (appearance.themeName == "Niconico" ? 1.8 : 1.25)) sourceSize.height: Math.floor(root.parent.height / (appearance.themeName == "Niconico" ? 1.8 : 1.25))
sourceSize.width: Math.floor(root.parent.height / (appearance.themeName == "Niconico" ? 1.8 : 1.25)) sourceSize.width: Math.floor(root.parent.height / (appearance.themeName == "Niconico" ? 1.8 : 1.25))
ColorOverlay { }
id: colorOverlay ColorOverlay {
anchors.fill: parent id: colorOverlay
source: parent anchors.fill: buttonImage
color: getAppearanceValueForTheme(appearance.themeName, "buttonColor") source: buttonImage
cached: false color: getAppearanceValueForTheme(appearance.themeName, "buttonColor")
Binding on color { cached: true
when: root.hovered Binding on color {
value: root.hovered ? getAppearanceValueForTheme( when: root.hovered
appearance.themeName, value: root.hovered ? getAppearanceValueForTheme(
"buttonHoverColor") : getAppearanceValueForTheme( appearance.themeName,
appearance.themeName, "buttonColor") "buttonHoverColor") : getAppearanceValueForTheme(
} appearance.themeName, "buttonColor")
} }
} }

View file

@ -391,7 +391,7 @@ Window {
} }
} }
onReleased: { onReleased: {
var isLongEnough = Math.hypot(xStart, mouse.x) > mainWindow.width * 0.3 var isLongEnough = Math.sqrt(xStart*xStart, mouse.x*mouse.x) > mainWindow.width * 0.3
if (velocity > 2 && isLongEnough) { if (velocity > 2 && isLongEnough) {
appearance.scaleFactor += 0.2 appearance.scaleFactor += 0.2
} else if (velocity < -2 && isLongEnough) { } else if (velocity < -2 && isLongEnough) {