blob: 14abf1ab3906d58867984227c5c16177366480cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
import QtQuick 2.0
import "style.js" as Style
Item{
id:canvas
width:1
height:1
x: app.width/2+xOffset
y: app.height/2+yOffset
property real xOffset: 0
property real yOffset: 0
property real angle: 0
property real zoomInTarget: 5
property real scalingFactor: 5
property real rotationOriginX
property real rotationOriginY
function goHome()
{
worldMouseArea.panning = false
xOffset = 0; //(app.homeCenterX * app.homeScaleFactor);
yOffset = 0; //(-app.homeCenterY * app.homeScaleFactor);
rotationOriginX = 0;
rotationOriginY = 0;
angle = 0;
zoomInTarget = app.homeScaleFactor;
app.navigationState = 0 //home
app.forceActiveFocus()
zoomAnimation.restart();
}
function goTo(target, updateScalingFactor)
{
if (target)
{
worldMouseArea.panning = false
xOffset = -target.x;
yOffset = -target.y;
rotationOriginX = target.x;
rotationOriginY = target.y;
angle = 0
zoomInTarget = target.targetScale;
if (updateScalingFactor)
scalingFactor = zoomInTarget
app.navigationState = target.navState
}
}
function goNext() {
goTo(app.getNext(), false);
navigationAnimation.restartAnimation()
}
function goPrevious() {
goTo(app.getPrevious(), false);
navigationAnimation.restartAnimation()
}
function goBack()
{
if (app.useGroups && app.navigationState == 2) {
goTo(app.getCurrentGroup(), false)
zoomAnimation.restart()
}
else
canvas.goHome()
}
Behavior on xOffset {
id: xOffsetBehaviour
enabled: !worldMouseArea.panning
NumberAnimation{duration: Style.APP_ANIMATION_DELAY}
}
Behavior on yOffset {
id: yOffsetBehaviour
enabled: !worldMouseArea.panning
NumberAnimation{duration: Style.APP_ANIMATION_DELAY}
}
Behavior on rotationOriginX {
NumberAnimation{
duration: Style.APP_ANIMATION_DELAY
}
}
Behavior on rotationOriginY {
NumberAnimation{
duration: Style.APP_ANIMATION_DELAY
}
}
transform: [
Scale{
id: canvasScale
origin.x: canvas.rotationOriginX
origin.y: canvas.rotationOriginY
xScale: canvas.scalingFactor
yScale :canvas.scalingFactor
}
]
}
|