Pinning objects working

This commit is contained in:
Luis Fernando Molina committed 2019-05-13 17:16:57 +02:00
1 parent ef06f7bc8b
commit 21c22bf4a5
4 files changed
+88 -35

No files matched your search

+14 -1
View File
@@ -19,6 +19,8 @@ function newFloatingObject () {
rawMass: 0, // This is the mass value without zoom.
rawRadius: 0, // This is the radius of this floating object without zoom.
targetRadius: 0, // This is the target radius of the floating object with zoom applied. It should be animated until reaching this value.
isPinned: undefined,
pinToggle: pinToggle,
physics: physics,
initializeMass: initializeMass,
initializeRadius: initializeRadius,
@@ -95,6 +97,15 @@ function newFloatingObject () {
}
}
function pinToggle () {
if (thisObject.isPinned !== true) {
thisObject.isPinned = true
thisObject.positionLocked = true
} else {
thisObject.isPinned = false
}
}
function physics () {
thisObjectPhysics()
thisObject.payload.uiObject.physics()
@@ -171,7 +182,9 @@ function newFloatingObject () {
thisObject.payload.uiObject.container.eventHandler.raiseEvent('onNotFocus')
thisObject.positionLocked = false
if (thisObject.isPinned !== true) {
thisObject.positionLocked = false
}
thisObject.isOnFocus = false
}
}