diff --git a/static/coffee/page.coffee b/static/coffee/page.coffee index a182b29..fd5aade 100644 --- a/static/coffee/page.coffee +++ b/static/coffee/page.coffee @@ -11,6 +11,7 @@ class Page height = viewport.height canvas.width = width canvas.height = height + @canvas = canvas else if params.width? and params.height? width = params.width height = params.height @@ -26,6 +27,7 @@ class Page params.page.render canvasContext: canvas.getContext '2d' viewport: viewport + .then @updatePagePreview @readOnly = false if params.readOnly? @readOnly = params.readOnly @@ -47,11 +49,25 @@ class Page for ann in anns @addAnnotation ann.text, ann.id, ann, ann.state + updatePagePreview: => + if @previewCtx? + @previewCtx.drawImage(@canvas, 0, 0) + addAnnotation: (text, id, geom, state) -> ann = new Annotation @$textLayerDiv, @docid, @i, text, id, geom, state, @readOnly $row = $('