2014-08-06 05:05:31 +08:00
|
|
|
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?
|
2014-08-06 05:13:51 +08:00
|
|
|
Template.slide.createWhiteboardPaper (wpm)->
|
2014-08-12 02:41:03 +08:00
|
|
|
Template.slide.displaySlide wpm
|
2014-08-06 05:05:31 +08:00
|
|
|
|
|
|
|
Template.slide.helpers
|
|
|
|
createWhiteboardPaper: (callback) ->
|
2014-08-12 02:41:03 +08:00
|
|
|
Template.slide.whiteboardPaperModel = new WhiteboardPaperModel('whiteboard-paper')
|
|
|
|
callback(Template.slide.whiteboardPaperModel)
|
2014-08-06 05:05:31 +08:00
|
|
|
|
2014-08-12 02:41:03 +08:00
|
|
|
displaySlide: (wpm) ->
|
2014-08-11 23:56:46 +08:00
|
|
|
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)
|
|
|
|
|
2014-08-12 04:54:16 +08:00
|
|
|
updatePointerLocation: (pointer) ->
|
|
|
|
console.log "X=#{pointer.x}__Y=#{pointer.y}"
|
|
|
|
|
2014-08-11 23:56:46 +08:00
|
|
|
#### SHAPE ####
|
2014-08-12 02:41:03 +08:00
|
|
|
Template.shape.rendered = ->
|
2014-08-12 02:46:10 +08:00
|
|
|
# @data is the shape object coming from the {{#each}} in the html file
|
|
|
|
shapeInfo = @data.shape?.shape
|
|
|
|
shapeType = shapeInfo?.type
|
2014-08-12 02:41:03 +08:00
|
|
|
|
|
|
|
for num in [0..3] # the coordinates must be in the range 0 to 1
|
2014-08-12 02:46:10 +08:00
|
|
|
shapeInfo.points[num] = shapeInfo.points[num] / 100
|
2014-08-12 02:41:03 +08:00
|
|
|
|
|
|
|
wpm = Template.slide.whiteboardPaperModel
|
2014-08-12 02:46:10 +08:00
|
|
|
wpm.makeShape(shapeType, shapeInfo)
|
|
|
|
wpm.updateShape(shapeType, shapeInfo)
|
2014-08-12 04:54:16 +08:00
|
|
|
|
|
|
|
|