Implemented slide zooming and panning (horizontally and vertically).
This commit is contained in:
parent
22ac4c6598
commit
c37c5c6601
@ -362,6 +362,21 @@ class @WhiteboardPaperModel
|
||||
# Updated a shape `shape` with the data in `data`.
|
||||
# TODO: check if the objects exist before calling update, if they don't they should be created
|
||||
updateShape: (shape, data) ->
|
||||
console.log "FUNCTION updateShape"
|
||||
###currentPresentation = Meteor.Presentations.findOne({"presentation.current": true})
|
||||
presentationId = currentPresentation?.presentation?.id
|
||||
slidesCursor = Meteor.Slides.find({"presentationId": presentationId, "slide.current": true})
|
||||
console.log "slidesCursor:"
|
||||
console.log slidesCursor
|
||||
|
||||
slidesCursor.observe
|
||||
added: (document) ->
|
||||
console.log "ADDED:"
|
||||
console.log document.slide.width_ratio
|
||||
changed: (newDocument, oldDocument) ->
|
||||
console.log "CHANGED:"
|
||||
console.log newDocument.slide.width_ratio###
|
||||
|
||||
switch shape
|
||||
when "line"
|
||||
@currentLine.update(data)
|
||||
@ -823,6 +838,17 @@ class @WhiteboardPaperModel
|
||||
# console.log "boardHeight: #{boardHeight}"
|
||||
console.log "imageWidth: #{imageWidth}"
|
||||
console.log "imageHeight: #{imageHeight}"
|
||||
|
||||
currentSlideCursor = Meteor.Slides.find({"presentationId": presentationId, "slide.current": true})
|
||||
_raphaelObj = @raphaelObj
|
||||
|
||||
currentSlideCursor.observe # watching the current slide changes
|
||||
changed: (newDoc, oldDoc) ->
|
||||
newX = - newDoc.slide.x_offset * 2 * boardWidth / 100
|
||||
newY = - newDoc.slide.y_offset * 2 * boardHeight / 100
|
||||
newWidth = boardWidth * newDoc.slide.width_ratio / 100
|
||||
newHeight = boardHeight * newDoc.slide.height_ratio / 100
|
||||
_raphaelObj.setViewBox(newX, newY, newWidth, newHeight) # zooms and pans
|
||||
|
||||
pic = new Image()
|
||||
_this = this
|
||||
|
@ -319,7 +319,10 @@ class Meteor.RedisPubSub
|
||||
widthRatio = message.payload?.page?.width_ratio
|
||||
xOffset = message.payload?.page?.x_offset
|
||||
yOffset = message.payload?.page?.y_offset
|
||||
console.log "__#{slideId}___#{heightRatio}___#{widthRatio}___#{xOffset}__#{yOffset}__"
|
||||
presentationId = slideId.split("/")[0]
|
||||
Meteor.Slides.update({presentationId: presentationId, "slide.current": true},
|
||||
{$set: {"slide.height_ratio": heightRatio, "slide.width_ratio": widthRatio, "slide.x_offset": xOffset, "slide.y_offset": yOffset}})
|
||||
console.log "__#{presentationId}___#{slideId}___#{heightRatio}___#{widthRatio}___#{xOffset}__#{yOffset}__"
|
||||
|
||||
if message.header?.name is "user_raised_hand_message"
|
||||
userId = message.payload?.userid
|
||||
|
Loading…
Reference in New Issue
Block a user