Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Isha
Free fall tower
Commits
b466502b
Commit
b466502b
authored
Sep 18, 2014
by
Ganesh Katrapati
Browse files
Objects Mass increase and Scaling
parent
8b2a70e9
Changes
4
Hide whitespace changes
Inline
Side-by-side
qml/freefalltower/golf-ball.jpg
View replaced file @
8b2a70e9
View file @
b466502b
45.3 KB
|
W:
|
H:
43.2 KB
|
W:
|
H:
2-up
Swipe
Onion skin
qml/freefalltower/layers.qml
0 → 100644
View file @
b466502b
import
QtQuick
2.0
ListModel
{
id
:
layer_list
ListElement
{
layer_number
:
10
}
ListElement
{
layer_number
:
9
}
ListElement
{
layer_number
:
8
}
ListElement
{
layer_number
:
7
}
ListElement
{
layer_number
:
6
}
ListElement
{
layer_number
:
5
}
ListElement
{
layer_number
:
4
}
ListElement
{
layer_number
:
3
}
ListElement
{
layer_number
:
2
}
ListElement
{
layer_number
:
1
}
}
qml/freefalltower/main.qml
View file @
b466502b
import
QtQuick
2.0
Rectangle
{
width
:
5
00
height
:
50
0
width
:
6
00
height
:
74
0
Text
{
id
:
status_text
...
...
@@ -112,11 +112,11 @@ Rectangle {
Drag.source
:
object_image
Drag.active
:
dragArea
.
drag
.
active
property
string
objectName
:
name
property
real
objectMass
:
mass
property
real
objectWidth
:
width
property
real
objectHeight
:
height
property
real
dropThisMuch
:
0
signal
scale
(
var
changed_mass
)
MouseArea
{
id
:
dragArea
...
...
@@ -138,10 +138,27 @@ Rectangle {
onObjectMassChanged
:
{
mass
=
objectMass
}
onActiveFocusChanged
:
{
console
.
log
(
"
Hello
"
)
}
states
:
[
State
{
name
:
"
drop
"
PropertyChanges
{
target
:
object_image
;
y
:
y
+
dropThisMuch
}
}
]
transitions
:
Transition
{
NumberAnimation
{
duration
:
600
;
properties
:
"
x,y
"
;
easing.type
:
Easing
.
InOutQuad
}
}
}
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
Text
{
...
...
@@ -156,6 +173,100 @@ Rectangle {
cellWidth
:
70
}
ListView
{
id
:
layers_list
x
:
241
y
:
109
width
:
166
height
:
448
interactive
:
false
property
real
total_height
:
100
model
:
Qt
.
createComponent
(
"
layers.qml
"
).
createObject
(
null
);
delegate
:
Item
{
x
:
5
height
:
(
layers_list
.
height
/
layers_list
.
count
)
Row
{
id
:
row1
Rectangle
{
width
:
100
height
:
5
color
:
"
black
"
property
string
layerNumber
:
layer_number
property
string
numberOfLayers
:
layers_list
.
count
DropArea
{
width
:
parent
.
width
height
:
40
clip
:
true
y
:
-
40
Rectangle
{
x
:
0
y
:
0
anchors.fill
:
parent
border.color
:
"
red
"
opacity
:
0.5
visible
:
parent
.
containsDrag
}
onDropped
:
{
status_text
.
text
=
qsTr
(
"
You have moved a
"
+
drag
.
source
.
objectName
+
"
On to floor :
"
+
layer_number
)
var
temp
=
simulate_button
.
currentItem
temp
[
Object
.
keys
(
temp
).
length
]
=
drag
.
source
simulate_button
.
currentItem
=
temp
simulate_button
.
currentLayer
=
layer_number
}
}
Text
{
x
:
-
60
text
:
(
layer_number
*
(
layers_list
.
total_height
/
layers_list
.
count
)).
toFixed
(
1
)
+
"
cm
"
}
}
}
}
}
Rectangle
{
id
:
simulate_button
x
:
483
y
:
68
property
variant
currentItem
:
[]
property
int
currentLayer
width
:
85
height
:
25
border.width
:
5
border.color
:
"
red
"
radius
:
10
Text
{
color
:
"
#000000
"
anchors.centerIn
:
parent
font.bold
:
true
text
:
"
Simulate !
"
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
console
.
log
(
Object
.
keys
(
simulate_button
.
currentItem
))
for
(
var
i
in
simulate_button
.
currentItem
)
{
if
(
simulate_button
.
currentItem
[
i
]
!=
null
){
var
height_per_layer
=
layers_list
.
height
/
layers_list
.
count
//simulate_button.currentItem[i].y += (simulate_button.currentLayer) * height_per_layer
simulate_button
.
currentItem
[
i
].
state
=
""
simulate_button
.
currentItem
[
i
].
dropThisMuch
=
(
simulate_button
.
currentLayer
)
*
height_per_layer
simulate_button
.
currentItem
[
i
].
state
=
"
drop
"
simulate_button
.
currentItem
[
i
].
dropThisMuch
=
0
}
}
simulate_button
.
currentItem
=
[]
}
}
}
}
}
qml/freefalltower/objects.qml
View file @
b466502b
...
...
@@ -7,7 +7,7 @@ ListModel {
name
:
"
Golf Ball
"
image
:
"
golf-ball.jpg
"
mass
:
100
init_width
:
5
0
init_width
:
4
0
init_height
:
40
...
...
Write
Preview
Supports
Markdown
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