Proper handling of slide dimensions (natural size).

This commit is contained in:
Maxim Khlobystov 2014-09-09 09:30:02 -07:00
parent 5ef2913da4
commit 22ac4c6598

View File

@ -824,5 +824,12 @@ class @WhiteboardPaperModel
console.log "imageWidth: #{imageWidth}"
console.log "imageHeight: #{imageHeight}"
# @addImageToPaper(data, imageWidth, imageHeight) # TODO the dimensions should be modified
@addImageToPaper(data, imageWidth, imageHeight)
pic = new Image()
_this = this
pic.onload = ->
if this.width <= this.height # natural dimensions
# square => boardHeight is the shortest side
_this.addImageToPaper(data, boardHeight * this.width / this.height, boardHeight)
else
_this.addImageToPaper(data, boardWidth, boardWidth * this.height / this.width)
pic.src = data