Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
glacier-home
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NemoMobile
glacier-home
Commits
443b798b
Commit
443b798b
authored
Nov 21, 2014
by
Filip Matijević
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[rotation] apply rotation to LockScreen to always keep it in native orientation
parent
5238406a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
11 deletions
+44
-11
GlacierRotation.qml
src/qml/GlacierRotation.qml
+24
-1
MainScreen.qml
src/qml/MainScreen.qml
+2
-4
compositor.qml
src/qml/compositor.qml
+18
-6
No files found.
src/qml/GlacierRotation.qml
View file @
443b798b
...
...
@@ -35,10 +35,24 @@ import org.nemomobile.lipstick 0.1
Item
{
property
int
_nativeRotation
:
Screen
.
angleBetween
(
nativeOrientation
,
Screen
.
primaryOrientation
)
property
bool
_nativeIsPortrait
:
((
_nativeRotation
===
0
)
||
(
_nativeRotation
===
180
))
property
Item
rotationParent
property
variant
unrotatedItems
:
[]
function
rotationDiff
(
a
,
b
)
{
var
r
=
_nativeRotation
-
rotationParent
.
rotation
if
(
r
<
360
)
r
+=
360
return
r
}
function
rotateRotationParent
(
o
)
{
rotateObject
(
rotationParent
,
o
)
for
(
var
i
=
0
;
i
<
unrotatedItems
.
length
;
i
++
)
{
rotateObjectToAngle
(
unrotatedItems
[
i
],
rotationDiff
(
_nativeRotation
,
rotationParent
.
rotation
))
}
}
function
rotateObject
(
obj
,
o
)
{
...
...
@@ -50,7 +64,16 @@ Item {
function
rotateObjectToAngle
(
obj
,
r
)
{
obj
.
width
=
Screen
.
width
;
obj
.
height
=
Screen
.
height
;
obj
.
x
=
0
;
obj
.
y
=
0
obj
.
rotation
=
r
var
res
=
obj
.
mapToItem
(
rotationParent
.
parent
,
0
,
0
,
obj
.
width
,
obj
.
height
)
var
res
=
obj
.
mapToItem
((
obj
===
rotationParent
)
?
rotationParent
.
parent
:
rotationParent
,
0
,
0
,
obj
.
width
,
obj
.
height
)
if
(
obj
!==
rotationParent
)
{
if
(
_nativeIsPortrait
)
{
var
i
=
res
.
x
res
.
x
=
res
.
y
res
.
y
=
i
}
var
res2
=
rotationParent
.
mapToItem
(
rotationParent
.
parent
,
0
,
0
,
res
.
width
,
res
.
height
)
res
.
width
=
res2
.
width
;
res
.
height
=
res2
.
height
}
obj
.
x
=
res
.
x
;
obj
.
y
=
res
.
y
;
obj
.
width
=
res
.
width
;
obj
.
height
=
res
.
height
}
}
src/qml/MainScreen.qml
View file @
443b798b
...
...
@@ -73,6 +73,7 @@ Page {
GlacierRotation
{
id
:
glacierRotation
rotationParent
:
desktop
.
parent
unrotatedItems
:
[
lockScreen
]
}
orientation
:
Lipstick
.
compositor
.
screenOrientation
...
...
@@ -94,11 +95,8 @@ Page {
Connections
{
target
:
LipstickSettings
onLockscreenVisibleChanged
:
{
if
(
lockscreenVisible
())
{
glacierRotation
.
rotateRotationParent
(
nativeOrientation
)
}
else
{
if
(
!
lockscreenVisible
())
glacierRotation
.
rotateRotationParent
(
desktop
.
orientation
)
}
}
}
...
...
src/qml/compositor.qml
View file @
443b798b
...
...
@@ -131,6 +131,8 @@ Compositor {
property
real
swipeThreshold
:
0.15
property
real
lockThreshold
:
0.25
property
int
lockscreenX
property
int
lockscreenY
onGestureStarted
:
{
swipeAnimation
.
stop
()
...
...
@@ -139,6 +141,8 @@ Compositor {
if
(
root
.
appActive
)
{
state
=
"
swipe
"
}
else
if
(
root
.
homeActive
)
{
lockscreenX
=
Desktop
.
instance
.
lockscreen
.
x
lockscreenY
=
Desktop
.
instance
.
lockscreen
.
y
state
=
"
lock
"
}
}
...
...
@@ -199,14 +203,22 @@ Compositor {
}
PropertyChanges
{
target
:
Desktop
.
instance
.
lockscreen
x
:
gestureArea
.
horizontal
?
(
Desktop
.
instance
.
lockscreenVisible
()?(
gestureArea
.
value
)
:
x
:
gestureArea
.
lockscreenX
+
((
gestureArea
.
horizontal
)
?
(
Desktop
.
instance
.
lockscreenVisible
()?(
gestureArea
.
value
)
:
(
gestureArea
.
gesture
==
"
right
"
?
-
Desktop
.
instance
.
lockscreen
.
width
+
Math
.
abs
(
gestureArea
.
value
)
:
Desktop
.
instance
.
lockscreen
.
width
+
gestureArea
.
value
)
)
:
0
y
:
gestureArea
.
horizontal
?
0
:
(
Desktop
.
instance
.
lockscreenVisible
()?(
gestureArea
.
value
):
((
Desktop
.
instance
.
lockscreen
.
width
===
topmostWindow
.
width
)
?
-
Desktop
.
instance
.
lockscreen
.
width
:
-
Desktop
.
instance
.
lockscreen
.
height
)
+
Math
.
abs
(
gestureArea
.
value
)
:
((
Desktop
.
instance
.
lockscreen
.
width
===
topmostWindow
.
width
)
?
Desktop
.
instance
.
lockscreen
.
width
:
Desktop
.
instance
.
lockscreen
.
height
)
+
gestureArea
.
value
)
)
:
0
)
y
:
gestureArea
.
lockscreenY
+
((
gestureArea
.
horizontal
)
?
0
:
(
Desktop
.
instance
.
lockscreenVisible
()?(
gestureArea
.
value
)
:
(
gestureArea
.
gesture
==
"
down
"
?
-
Desktop
.
instance
.
lockscreen
.
height
+
Math
.
abs
(
gestureArea
.
value
)
:
Desktop
.
instance
.
lockscreen
.
height
+
gestureArea
.
value
)
)
((
Desktop
.
instance
.
lockscreen
.
width
===
topmostWindow
.
width
)
?
-
Desktop
.
instance
.
lockscreen
.
height
:
-
Desktop
.
instance
.
lockscreen
.
width
)
+
Math
.
abs
(
gestureArea
.
value
)
:
((
Desktop
.
instance
.
lockscreen
.
width
===
topmostWindow
.
width
)
?
Desktop
.
instance
.
lockscreen
.
height
:
Desktop
.
instance
.
lockscreen
.
width
)
+
gestureArea
.
value
)
)
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment