|
1 | 1 | /*
|
2 | 2 | * Patience Deck is a collection of patience games.
|
3 |
| - * Copyright (C) 2020-2022 Tomi Leppänen |
| 3 | + * Copyright (C) 2020-2023 Tomi Leppänen |
4 | 4 | *
|
5 | 5 | * This program is free software: you can redistribute it and/or modify
|
6 | 6 | * it under the terms of the GNU General Public License as published by
|
@@ -167,13 +167,7 @@ Page {
|
167 | 167 | backgroundColor: settings.backgroundColor
|
168 | 168 | highlightColor: Theme.rgba(Theme.highlightColor, Theme.opacityLow)
|
169 | 169 |
|
170 |
| - transform: Scale { |
171 |
| - id: magnifyTransform |
172 |
| - origin { |
173 |
| - x: Math.floor(magnifyArea.mouseX) |
174 |
| - y: Math.floor(magnifyArea.mouseY) |
175 |
| - } |
176 |
| - } |
| 170 | + transform: Scale { id: magnifyTransform } |
177 | 171 | doubleResolution: magnifyArea.pressed || animateShrink.running || animateGrow.running
|
178 | 172 |
|
179 | 173 | layer.enabled: pullDownMenu.active
|
@@ -214,8 +208,33 @@ Page {
|
214 | 208 | }
|
215 | 209 | enabled: toolbar.magnify
|
216 | 210 | preventStealing: true
|
217 |
| - onPressed: animateGrow.running = true |
218 |
| - onReleased: animateShrink.running = true |
| 211 | + onPressed: { |
| 212 | + clickTimer.running = true |
| 213 | + if (magnifyTransform.xScale < 2) { |
| 214 | + animateGrow.running = true |
| 215 | + } |
| 216 | + } |
| 217 | + onReleased: if (magnifyTransform.xScale === 2 || !clickTimer.running) animateShrink.running = true |
| 218 | + onEnabledChanged: if (!enabled) animateShrink.running = true |
| 219 | + |
| 220 | + Timer { |
| 221 | + id: clickTimer |
| 222 | + interval: 100 |
| 223 | + } |
| 224 | + |
| 225 | + Binding { |
| 226 | + target: magnifyTransform |
| 227 | + property: "origin.x" |
| 228 | + value: Math.floor(magnifyArea.mouseX) |
| 229 | + when: magnifyArea.pressed && (magnifyTransform.xScale === 1 || !clickTimer.running) |
| 230 | + } |
| 231 | + |
| 232 | + Binding { |
| 233 | + target: magnifyTransform |
| 234 | + property: "origin.y" |
| 235 | + value: Math.floor(magnifyArea.mouseY) |
| 236 | + when: magnifyArea.pressed && (magnifyTransform.xScale === 1 || !clickTimer.running) |
| 237 | + } |
219 | 238 | }
|
220 | 239 | }
|
221 | 240 |
|
|
0 commit comments