bigbluebutton-Github/labs/meteor-client/client/views/whiteboard/slide.coffee
2014-08-12 16:18:29 +00:00

46 lines
1.6 KiB
CoffeeScript
Executable File

Template.slide.rendered = ->
currentPresentation = Meteor.Presentations.findOne({"presentation.current": true})
presentationId = currentPresentation?.presentation?.id
currentSlide = Meteor.Slides.findOne({"presentationId": presentationId, "slide.current": true})
if currentSlide?.slide?.png_uri?
Template.slide.createWhiteboardPaper (wpm)->
Template.slide.displaySlide wpm
Template.slide.helpers
createWhiteboardPaper: (callback) ->
Template.slide.whiteboardPaperModel = new WhiteboardPaperModel('whiteboard-paper')
callback(Template.slide.whiteboardPaperModel)
displaySlide: (wpm) ->
currentPresentation = Meteor.Presentations.findOne({"presentation.current": true})
presentationId = currentPresentation?.presentation?.id
currentSlide = Meteor.Slides.findOne({"presentationId": presentationId, "slide.current": true})
wpm.create()
wpm._displayPage(currentSlide?.slide?.png_uri)
updatePointerLocation: (pointer) ->
console.log "X=#{pointer.x}__Y=#{pointer.y}"
wpm = Template.slide.whiteboardPaperModel
wpm?.moveCursor(pointer.x, pointer.y)
#### SHAPE ####
Template.shape.rendered = ->
# @data is the shape object coming from the {{#each}} in the html file
shapeInfo = @data.shape?.shape
shapeType = shapeInfo?.type
for num in [0..3] # the coordinates must be in the range 0 to 1
shapeInfo.points[num] = shapeInfo.points[num] / 100
wpm = Template.slide.whiteboardPaperModel
wpm.makeShape(shapeType, shapeInfo)
wpm.updateShape(shapeType, shapeInfo)
### POINTER ###
# Template.pointer.rendered = ->
# alert getInSession "presentationPointer"