Merge pull request #1102 from avandecreme/sketch_canvas_size

Fix sketch canvas not resizing properly. Fix #973
This commit is contained in:
Ian Gilman 2017-01-16 11:04:07 -08:00 committed by GitHub
commit 855bfbe168

View File

@ -328,7 +328,11 @@ $.Drawer.prototype = {
// the viewport get rotated later on, we will need to resize it. // the viewport get rotated later on, we will need to resize it.
if (this.viewport.getRotation() === 0) { if (this.viewport.getRotation() === 0) {
var self = this; var self = this;
this.viewer.addOnceHandler('rotate', function resizeSketchCanvas() { this.viewer.addHandler('rotate', function resizeSketchCanvas() {
if (self.viewport.getRotation() === 0) {
return;
}
self.viewer.removeHandler('rotate', resizeSketchCanvas);
var sketchCanvasSize = self._calculateSketchCanvasSize(); var sketchCanvasSize = self._calculateSketchCanvasSize();
self.sketchCanvas.width = sketchCanvasSize.x; self.sketchCanvas.width = sketchCanvasSize.x;
self.sketchCanvas.height = sketchCanvasSize.y; self.sketchCanvas.height = sketchCanvasSize.y;