Created
May 9, 2014 21:45
-
-
Save MariuszWisniewski/3a5092e1e12031b31090 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The function below is used for notification/subscription processing of the position of the note. | |
// When the position of the note is moved across one device, all other devices connected to Syncano will real-time sync to the same position. | |
updatePosition: function (element) { | |
var self = this; | |
var position = element.position(); | |
var xPos = Math.round(position.left); | |
var yPos = Math.round(position.top); | |
var noteId = self.findNote(element.attr('id')); | |
self.syncano.sendRequest({ | |
type: 'call', | |
method: 'data.update', | |
params: { | |
project_id: self.options.projectId, | |
collection_id: self.options.collectionId, | |
data_id: noteId, | |
xpos: xPos, | |
ypos: yPos, | |
sourcePlayer: self.syncano.uuid + '#' + self.token(), | |
update_method: 'merge', | |
} | |
}, function () { | |
console.log('Position Updated'); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment