File tree 4 files changed +14
-13
lines changed 4 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ Vue.use(VueThreejs)
54
54
- [ ] global-control
55
55
- [ ] Physical engine
56
56
- [x] movement(a/v/pos/ra/rv/rot)/mass(m/F)
57
- - [ ] gravity(G/r)/collision
57
+ - [x] gravity(G/r)/collision/oimo
58
+ - [ ] circular-motion/centripetal-force
58
59
- [ ] Unit test
59
60
- [x] karma/mocha/phantom
60
61
- [ ] avoriaz/ava
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export default {
12
12
let e = new CustomEvent (name, {
13
13
detail,
14
14
bubbles: true ,
15
+ cancelable: true ,
15
16
... options
16
17
})
17
18
return this .$el .dispatchEvent (e)
Original file line number Diff line number Diff line change @@ -17,9 +17,13 @@ export default {
17
17
18
18
let body = this .world .add (opts)
19
19
body .connectMesh (this .curObj )
20
-
21
20
this .body = body
22
- this .dispatchEvent (' vm-oimo-body' , this )
21
+
22
+ // If you want to wait until the entire view has been rendered
23
+ // https://vuejs.org/v2/api/#mounted
24
+ this .$nextTick (() => {
25
+ this .dispatchEvent (' vm-oimo-body' , body)
26
+ })
23
27
},
24
28
25
29
beforeDestroy () {
Original file line number Diff line number Diff line change 1
1
<template >
2
- <div @vm-oimo-body =" handleBodyVm " >
2
+ <div @vm-oimo-body =" handleBody " >
3
3
<slot ></slot >
4
4
</div >
5
5
</template >
@@ -10,7 +10,7 @@ export default {
10
10
inject: [' spaceVms' ],
11
11
12
12
data () {
13
- return { bodyVm : null }
13
+ return { body : null }
14
14
},
15
15
16
16
mounted () {
@@ -22,15 +22,10 @@ export default {
22
22
if (index > - 1 ) this .spaceVms .splice (index, 1 )
23
23
},
24
24
25
- computed: {
26
- body () {
27
- return this .bodyVm && this .bodyVm .body
28
- }
29
- },
30
-
31
25
methods: {
32
- handleBodyVm (e ) {
33
- this .bodyVm = e .detail
26
+ handleBody (e ) {
27
+ e .stopPropagation ()
28
+ this .body = e .detail
34
29
}
35
30
}
36
31
}
You can’t perform that action at this time.
0 commit comments