working on clearing all shapes from a slide

This commit is contained in:
Anton Georgiev 2014-08-12 20:05:34 +00:00
parent 9d5000e636
commit 07138bda00
2 changed files with 23 additions and 2 deletions

View File

@ -21,5 +21,18 @@ Meteor.methods
color: shapeObject.shape.color color: shapeObject.shape.color
id = Meteor.Shapes.insert(entry) id = Meteor.Shapes.insert(entry)
console.log "added shape id =[#{id}]:#{shapeObject.id} in #{meetingId}" numShapesOnSlide = Meteor.Shapes.find({meetingId: meetingId, whiteboardId: whiteboardId}).fetch().length
console.log "added shape id =[#{id}]:#{shapeObject.id} in #{meetingId} || now there are #{numShapesOnSlide} shapes on the slide"
removeAllShapesFromSlide: (meetingId, whiteboardId) ->
console.log "removeAllShapesFromSlide__" + whiteboardId
if meetingId? and whiteboardId? and Meteor.Shapes.find({meetingId: meetingId, whiteboardId: whiteboardId})?
shapesOnSlide = Meteor.Shapes.find({meetingId: meetingId, whiteboardId: whiteboardId}).fetch()
console.log "number of shapes:" + shapesOnSlide.length
for s in shapesOnSlide
console.log "shape=" + s.shape.id
id = Meteor.Shapes.findOne({meetingId: meetingId, whiteboardId: whiteboardId, "shape.id": s.shape.id})
if id?
Meteor.Shapes.remove(id._id)
console.log "----removed shape[" + s.shape.id + "] from " + whiteboardId
console.log "remaining shapes on the slide:" + Meteor.Shapes.find({meetingId: meetingId, whiteboardId: whiteboardId}).fetch().length

View File

@ -228,7 +228,15 @@ class Meteor.RedisPubSub
y = message.payload?.y_percent y = message.payload?.y_percent
Meteor.Presentations.update({"presentation.current": true, meetingId: meetingId},{$set: {"pointer.x": x, "pointer.y": y}}) Meteor.Presentations.update({"presentation.current": true, meetingId: meetingId},{$set: {"pointer.x": x, "pointer.y": y}})
console.log "presentation_cursor_updated_message #{x}_#{y}"
if message.header?.name is "whiteboard_cleared_message"
whiteboardId = message.payload?.whiteboard_id
# shapesOnSlide = Meteor.Shapes.find({whiteboardId:whiteboardId, meetingId: meetingId}).fetch()
# console.log "shapesOnSlide:" + shapesOnSlide.size()
Meteor.call("removeAllShapesFromSlide", meetingId, whiteboardId)
if message.header?.name in ["meeting_ended_message", "meeting_destroyed_event", if message.header?.name in ["meeting_ended_message", "meeting_destroyed_event",
"end_and_kick_all_message", "disconnect_all_users_message"] "end_and_kick_all_message", "disconnect_all_users_message"]