2015-02-25 05:29:32 +08:00
|
|
|
# redraw the whiteboard to adapt to the resized window
|
2015-03-31 07:03:41 +08:00
|
|
|
@redrawWhiteboard = (callback) ->
|
2015-01-07 01:42:37 +08:00
|
|
|
adjustedDimensions = scaleSlide(getInSession('slideOriginalWidth'), getInSession('slideOriginalHeight'))
|
|
|
|
wpm = whiteboardPaperModel
|
|
|
|
wpm.clearShapes()
|
|
|
|
wpm.clearCursor()
|
|
|
|
manuallyDisplayShapes()
|
|
|
|
wpm.scale(adjustedDimensions.width, adjustedDimensions.height)
|
|
|
|
wpm.createCursor()
|
2015-03-31 07:03:41 +08:00
|
|
|
if callback
|
|
|
|
callback()
|
2015-03-28 08:59:56 +08:00
|
|
|
|
|
|
|
Template.whiteboard.events
|
2015-05-07 03:45:51 +08:00
|
|
|
"click .previousSlide":(event) ->
|
|
|
|
BBB.goToPreviousPage()
|
|
|
|
|
|
|
|
"click .nextSlide":(event) ->
|
|
|
|
BBB.goToNextPage()
|
|
|
|
|
2015-03-28 08:59:56 +08:00
|
|
|
"click .fullscreenWhiteboardButton": (event, template) ->
|
|
|
|
elem = document.getElementById("whiteboard")
|
|
|
|
if elem.requestFullscreen
|
|
|
|
elem.requestFullscreen()
|
|
|
|
else if elem.msRequestFullscreen
|
|
|
|
elem.msRequestFullscreen()
|
|
|
|
else if elem.mozRequestFullScreen
|
|
|
|
elem.mozRequestFullScreen()
|
|
|
|
else if elem.webkitRequestFullscreen
|
|
|
|
elem.webkitRequestFullscreen()
|
2015-03-31 07:03:41 +08:00
|
|
|
$('#whiteboard-paper').addClass('invisible')
|
2015-03-28 08:59:56 +08:00
|
|
|
$('#chat').addClass('invisible')
|
|
|
|
$('#users').addClass('invisible')
|
|
|
|
$('#footer').addClass('invisible')
|
|
|
|
$('#navbar').addClass('invisible')
|
2015-03-31 07:03:41 +08:00
|
|
|
$('#main').css('padding-top', '0px')
|
2015-03-28 08:59:56 +08:00
|
|
|
$('html').css('height', '100%')
|
|
|
|
$('html').css('width', '100%')
|
|
|
|
$('html').css('overflow', 'hidden')
|
|
|
|
$('body').css('height', '100%')
|
|
|
|
$('body').css('width', '100%')
|
|
|
|
$('body').css('overflow', 'hidden')
|
2015-03-31 07:03:41 +08:00
|
|
|
setTimeout () ->
|
|
|
|
redrawWhiteboard () ->
|
|
|
|
$('#whiteboard-paper').removeClass('invisible')
|
|
|
|
$('#whiteboard-paper').addClass('vertically-centered')
|
|
|
|
, 100
|
2015-03-28 08:59:56 +08:00
|
|
|
|
|
|
|
# Listens for the fullscreen state change (user leaves fullscreen mode)
|
|
|
|
|
|
|
|
# Chrome
|
|
|
|
$('#whiteboard').bind 'webkitfullscreenchange', (e) ->
|
|
|
|
if document.webkitFullscreenElement is null
|
|
|
|
$('#whiteboard').unbind('webkitfullscreenchange')
|
2015-03-31 07:03:41 +08:00
|
|
|
$('#whiteboard-paper').removeClass('vertically-centered')
|
2015-03-28 08:59:56 +08:00
|
|
|
$('#chat').removeClass('invisible')
|
|
|
|
$('#users').removeClass('invisible')
|
|
|
|
$('#footer').removeClass('invisible')
|
|
|
|
$('#navbar').removeClass('invisible')
|
|
|
|
$('html').css('height', '')
|
|
|
|
$('html').css('width', '')
|
|
|
|
$('html').css('overflow', '')
|
|
|
|
$('body').css('height', '')
|
|
|
|
$('body').css('width', '')
|
|
|
|
$('body').css('overflow', '')
|
2015-03-31 07:03:41 +08:00
|
|
|
$('#main').css('padding-top', '')
|
2015-03-28 08:59:56 +08:00
|
|
|
redrawWhiteboard()
|
|
|
|
# Firefox
|
|
|
|
$(document).bind 'mozfullscreenchange', (e) -> # target is always the document in Firefox
|
|
|
|
if document.mozFullScreenElement is null
|
|
|
|
$(document).unbind('mozfullscreenchange')
|
2015-03-31 07:03:41 +08:00
|
|
|
$('#whiteboard-paper').removeClass('vertically-centered')
|
2015-03-28 08:59:56 +08:00
|
|
|
$('#chat').removeClass('invisible')
|
|
|
|
$('#users').removeClass('invisible')
|
|
|
|
$('#footer').removeClass('invisible')
|
|
|
|
$('#navbar').removeClass('invisible')
|
|
|
|
$('html').css('height', '')
|
|
|
|
$('html').css('width', '')
|
|
|
|
$('html').css('overflow', '')
|
|
|
|
$('body').css('height', '')
|
|
|
|
$('body').css('width', '')
|
|
|
|
$('body').css('overflow', '')
|
2015-03-31 07:03:41 +08:00
|
|
|
$('#main').css('padding-top', '')
|
2015-03-28 08:59:56 +08:00
|
|
|
redrawWhiteboard()
|