From da91de78217dbb72d46eaff4e28e2d880346d82f Mon Sep 17 00:00:00 2001 From: Bence Laky Date: Thu, 12 Nov 2015 10:21:39 +0000 Subject: [PATCH] MDL-42571 assignfeedback_editpdf: Fixed second PDF view --- mod/assign/feedback/editpdf/version.php | 2 +- ...dle-assignfeedback_editpdf-editor-debug.js | 126 ++++++++++-------- ...oodle-assignfeedback_editpdf-editor-min.js | 16 +-- .../moodle-assignfeedback_editpdf-editor.js | 126 ++++++++++-------- .../editpdf/yui/src/editor/js/annotation.js | 4 +- .../yui/src/editor/js/annotationstamp.js | 4 +- .../editpdf/yui/src/editor/js/comment.js | 2 +- .../yui/src/editor/js/commentsearch.js | 4 +- .../editpdf/yui/src/editor/js/drawable.js | 2 +- .../editpdf/yui/src/editor/js/editor.js | 66 +++++---- .../editpdf/yui/src/editor/js/globals.js | 44 +++--- 11 files changed, 213 insertions(+), 183 deletions(-) diff --git a/mod/assign/feedback/editpdf/version.php b/mod/assign/feedback/editpdf/version.php index d9cc4ba3adc..42fd727ad59 100644 --- a/mod/assign/feedback/editpdf/version.php +++ b/mod/assign/feedback/editpdf/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2015051100; +$plugin->version = 2015111200; $plugin->requires = 2015050500; $plugin->component = 'assignfeedback_editpdf'; diff --git a/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js b/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js index 565dd2d0c65..50c827faed6 100644 --- a/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js +++ b/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js @@ -26,23 +26,23 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php', DIALOGUE : 'assignfeedback_editpdf_widget' }, SELECTOR = { - PREVIOUSBUTTON : '.' + CSS.DIALOGUE + ' .navigate-previous-button', - NEXTBUTTON : '.' + CSS.DIALOGUE + ' .navigate-next-button', - SEARCHCOMMENTSBUTTON : '.' + CSS.DIALOGUE + ' .searchcommentsbutton', + PREVIOUSBUTTON : '.navigate-previous-button', + NEXTBUTTON : ' .navigate-next-button', + SEARCHCOMMENTSBUTTON : '.searchcommentsbutton', SEARCHFILTER : '.assignfeedback_editpdf_commentsearch input', SEARCHCOMMENTSLIST : '.assignfeedback_editpdf_commentsearch ul', - PAGESELECT : '.' + CSS.DIALOGUE + ' .navigate-page-select', - LOADINGICON : '.' + CSS.DIALOGUE + ' .loading', - PROGRESSBARCONTAINER : '.' + CSS.DIALOGUE + ' .progress-info.progress-striped', - DRAWINGREGION : '.' + CSS.DIALOGUE + ' .drawingregion', - DRAWINGCANVAS : '.' + CSS.DIALOGUE + ' .drawingcanvas', - SAVE : '.' + CSS.DIALOGUE + ' .savebutton', - COMMENTCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .commentcolourbutton', - COMMENTMENU : ' .commentdrawable a', - ANNOTATIONCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .annotationcolourbutton', - DELETEANNOTATIONBUTTON : '.' + CSS.DIALOGUE + ' .deleteannotationbutton', + PAGESELECT : '.navigate-page-select', + LOADINGICON : '.loading', + PROGRESSBARCONTAINER : '.progress-info.progress-striped', + DRAWINGREGION : '.drawingregion', + DRAWINGCANVAS : '.drawingcanvas', + SAVE : '.savebutton', + COMMENTCOLOURBUTTON : '.commentcolourbutton', + COMMENTMENU : '.commentdrawable a', + ANNOTATIONCOLOURBUTTON : '.annotationcolourbutton', + DELETEANNOTATIONBUTTON : '.deleteannotationbutton', UNSAVEDCHANGESDIV : '.assignfeedback_editpdf_unsavedchanges', - STAMPSBUTTON : '.' + CSS.DIALOGUE + ' .currentstampbutton', + STAMPSBUTTON : '.currentstampbutton', DIALOGUE : '.' + CSS.DIALOGUE }, SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)', @@ -66,14 +66,14 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php', }, CLICKTIMEOUT = 300, TOOLSELECTOR = { - 'comment': '.' + CSS.DIALOGUE + ' .commentbutton', - 'pen': '.' + CSS.DIALOGUE + ' .penbutton', - 'line': '.' + CSS.DIALOGUE + ' .linebutton', - 'rectangle': '.' + CSS.DIALOGUE + ' .rectanglebutton', - 'oval': '.' + CSS.DIALOGUE + ' .ovalbutton', - 'stamp': '.' + CSS.DIALOGUE + ' .stampbutton', - 'select': '.' + CSS.DIALOGUE + ' .selectbutton', - 'highlight': '.' + CSS.DIALOGUE + ' .highlightbutton' + 'comment': '.commentbutton', + 'pen': '.penbutton', + 'line': '.linebutton', + 'rectangle': '.rectanglebutton', + 'oval': '.ovalbutton', + 'stamp': '.stampbutton', + 'select': '.selectbutton', + 'highlight': '.highlightbutton' }, STROKEWEIGHT = 4; // This file is part of Moodle - http://moodle.org/ @@ -498,7 +498,7 @@ var DRAWABLE = function(editor) { this.store_position = function(container, x, y) { var drawingregion, scrollx, scrolly; - drawingregion = Y.one(SELECTOR.DRAWINGREGION); + drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION); scrollx = parseInt(drawingregion.get('scrollLeft'), 10); scrolly = parseInt(drawingregion.get('scrollTop'), 10); container.setData('x', x + scrollx); @@ -680,8 +680,8 @@ Y.extend(ANNOTATION, Y.Base, { */ draw_highlight : function() { var bounds, - drawingregion = Y.one(SELECTOR.DRAWINGREGION), - offsetcanvas = Y.one(SELECTOR.DRAWINGCANVAS).getXY(), + drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION), + offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY(), shape; if (this.editor.currentannotation === this) { @@ -1553,7 +1553,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, { */ draw : function() { var drawable = new M.assignfeedback_editpdf.drawable(this.editor), - drawingregion = Y.one(SELECTOR.DRAWINGREGION), + drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION), node, position; @@ -1595,7 +1595,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, { draw_current_edit : function(edit) { var bounds = new M.assignfeedback_editpdf.rect(), drawable = new M.assignfeedback_editpdf.drawable(this.editor), - drawingregion = Y.one(SELECTOR.DRAWINGREGION), + drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION), node, position; @@ -2245,8 +2245,8 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, { commentslist, filtertext; - filternode = Y.one(SELECTOR.SEARCHFILTER); - commentslist = Y.one(SELECTOR.SEARCHCOMMENTSLIST); + filternode = this.get('editor').get_dialogue_element(SELECTOR.SEARCHFILTER); + commentslist = this.get('editor').get_dialogue_element(SELECTOR.SEARCHCOMMENTSLIST); filtertext = filternode.get('value'); @@ -2505,7 +2505,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) { this.draw = function(focus) { var drawable = new M.assignfeedback_editpdf.drawable(this.editor), node, - drawingregion = Y.one(SELECTOR.DRAWINGREGION), + drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION), container, menu, position, @@ -3272,7 +3272,7 @@ EDITOR.prototype = { var button, currenttoolnode, imgurl; // Initalise the colour buttons. - button = Y.one(SELECTOR.COMMENTCOLOURBUTTON); + button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON); imgurl = M.util.image_url('background_colour_' + this.currentedit.commentcolour, 'assignfeedback_editpdf'); button.one('img').setAttribute('src', imgurl); @@ -3283,15 +3283,15 @@ EDITOR.prototype = { button.one('img').setStyle('borderStyle', 'solid'); } - button = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON); + button = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON); imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdf'); button.one('img').setAttribute('src', imgurl); - currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]); + currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]); currenttoolnode.addClass('assignfeedback_editpdf_selectedbutton'); currenttoolnode.setAttribute('aria-pressed', 'true'); - button = Y.one(SELECTOR.STAMPSBUTTON); + button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON); button.one('img').setAttrs({'src': this.get_stamp_image_url(this.currentedit.stamp), 'height': '16', 'width': '16'}); @@ -3302,7 +3302,7 @@ EDITOR.prototype = { * @method get_canvas_bounds */ get_canvas_bounds : function() { - var canvas = Y.one(SELECTOR.DRAWINGCANVAS), + var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS), offsetcanvas = canvas.getXY(), offsetleft = offsetcanvas[0], offsettop = offsetcanvas[1], @@ -3361,12 +3361,12 @@ EDITOR.prototype = { // Add custom class for styling. this.dialogue.get('boundingBox').addClass(CSS.DIALOGUE); - this.loadingicon = Y.one(SELECTOR.LOADINGICON); + this.loadingicon = this.get_dialogue_element(SELECTOR.LOADINGICON); - drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS); + drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS); this.graphic = new Y.Graphic({render : SELECTOR.DRAWINGCANVAS}); - drawingregion = Y.one(SELECTOR.DRAWINGREGION); + drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); drawingregion.on('scroll', this.move_canvas, this); if (!this.get('readonly')) { @@ -3446,7 +3446,7 @@ EDITOR.prototype = { var pagetotal = this.get('pagetotal'); // Update the progress bar. - var progressbarcontainer = Y.one(SELECTOR.PROGRESSBARCONTAINER); + var progressbarcontainer = this.get_dialogue_element(SELECTOR.PROGRESSBARCONTAINER); var progressbar = progressbarcontainer.one('.bar'); if (progressbar) { // Calculate progress. @@ -3573,7 +3573,7 @@ EDITOR.prototype = { picker, filename; - searchcommentsbutton = Y.one(SELECTOR.SEARCHCOMMENTSBUTTON); + searchcommentsbutton = this.get_dialogue_element(SELECTOR.SEARCHCOMMENTSBUTTON); searchcommentsbutton.on('click', this.open_search_comments, this); searchcommentsbutton.on('key', this.open_search_comments, 'down:13', this); @@ -3582,7 +3582,7 @@ EDITOR.prototype = { } // Setup the tool buttons. Y.each(TOOLSELECTOR, function(selector, tool) { - toolnode = Y.one(selector); + toolnode = this.get_dialogue_element(selector); toolnode.on('click', this.handle_tool_button, this, tool); toolnode.on('key', this.handle_tool_button, 'down:13', this, tool); toolnode.setAttribute('aria-pressed', 'false'); @@ -3590,7 +3590,7 @@ EDITOR.prototype = { // Set the default tool. - commentcolourbutton = Y.one(SELECTOR.COMMENTCOLOURBUTTON); + commentcolourbutton = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON); picker = new M.assignfeedback_editpdf.colourpicker({ buttonNode: commentcolourbutton, colours: COMMENTCOLOUR, @@ -3606,7 +3606,7 @@ EDITOR.prototype = { context: this }); - annotationcolourbutton = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON); + annotationcolourbutton = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON); picker = new M.assignfeedback_editpdf.colourpicker({ buttonNode: annotationcolourbutton, iconprefix: 'colour_', @@ -3628,11 +3628,11 @@ EDITOR.prototype = { stampfiles = this.get('stampfiles'); if (stampfiles.length <= 0) { - Y.one(TOOLSELECTOR.stamp).ancestor().hide(); + this.get_dialogue_element(TOOLSELECTOR.stamp).ancestor().hide(); } else { filename = stampfiles[0].substr(stampfiles[0].lastIndexOf('/') + 1); this.currentedit.stamp = filename; - currentstampbutton = Y.one(SELECTOR.STAMPSBUTTON); + currentstampbutton = this.get_dialogue_element(SELECTOR.STAMPSBUTTON); picker = new M.assignfeedback_editpdf.stamppicker({ buttonNode: currentstampbutton, @@ -3665,7 +3665,7 @@ EDITOR.prototype = { e.preventDefault(); // Change style of the pressed button. - currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]); + currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]); currenttoolnode.removeClass('assignfeedback_editpdf_selectedbutton'); currenttoolnode.setAttribute('aria-pressed', 'false'); this.currentedit.tool = tool; @@ -3725,6 +3725,15 @@ EDITOR.prototype = { return drawable; }, + + /** + * Find an element within the dialogue. + * @protected + * @method get_dialogue_element + */ + get_dialogue_element : function(selector) { + return this.dialogue.get('boundingBox').one(selector); + }, /** * Redraw the active edit. @@ -3746,7 +3755,7 @@ EDITOR.prototype = { */ edit_start : function(e) { e.preventDefault(); - var canvas = Y.one(SELECTOR.DRAWINGCANVAS), + var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS), offset = canvas.getXY(), scrolltop = canvas.get('docScrollY'), scrollleft = canvas.get('docScrollX'), @@ -3817,7 +3826,7 @@ EDITOR.prototype = { edit_move : function(e) { e.preventDefault(); var bounds = this.get_canvas_bounds(), - canvas = Y.one(SELECTOR.DRAWINGCANVAS), + canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS), clientpoint = new M.assignfeedback_editpdf.point(e.clientX + canvas.get('docScrollX'), e.clientY + canvas.get('docScrollY')), point = this.get_canvas_coordinates(clientpoint); @@ -3914,7 +3923,7 @@ EDITOR.prototype = { if (drawregionheight < 100) { drawregionheight = 100; } - drawingregion = Y.one(SELECTOR.DRAWINGREGION); + drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); drawingregion.setStyle('maxHeight', drawregionheight +'px'); this.redraw(); return true; @@ -3974,7 +3983,8 @@ EDITOR.prototype = { if (jsondata.error) { return new M.core.ajaxException(jsondata); } - Y.one(SELECTOR.UNSAVEDCHANGESDIV).addClass('haschanges'); + Y.one('#' + this.get('linkid')).siblings(SELECTOR.UNSAVEDCHANGESDIV) + .item(0).addClass('haschanges'); } catch (e) { return new M.core.exception(e); } @@ -4038,13 +4048,13 @@ EDITOR.prototype = { * @method change_page */ change_page : function() { - var drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS), + var drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS), page, previousbutton, nextbutton; - previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON); - nextbutton = Y.one(SELECTOR.NEXTBUTTON); + previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON); + nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON); if (this.currentpage > 0) { previousbutton.removeAttribute('disabled'); @@ -4064,7 +4074,7 @@ EDITOR.prototype = { drawingcanvas.setStyle('height', page.height + 'px'); // Update page select. - Y.one(SELECTOR.PAGESELECT).set('value', this.currentpage); + this.get_dialogue_element(SELECTOR.PAGESELECT).set('value', this.currentpage); this.resize(); // Internally will call 'redraw', after checking the dialogue size. }, @@ -4082,7 +4092,7 @@ EDITOR.prototype = { previousbutton, nextbutton; - pageselect = Y.one(SELECTOR.PAGESELECT); + pageselect = this.get_dialogue_element(SELECTOR.PAGESELECT); var options = pageselect.all('option'); if (options.size() <= 1) { @@ -4099,8 +4109,8 @@ EDITOR.prototype = { this.change_page(); }, this); - previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON); - nextbutton = Y.one(SELECTOR.NEXTBUTTON); + previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON); + nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON); previousbutton.on('click', this.previous_page, this); previousbutton.on('key', this.previous_page, 'down:13', this); @@ -4144,7 +4154,7 @@ EDITOR.prototype = { move_canvas: function() { var drawingregion, x, y, i; - drawingregion = Y.one(SELECTOR.DRAWINGREGION); + drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); x = parseInt(drawingregion.get('scrollLeft'), 10); y = parseInt(drawingregion.get('scrollTop'), 10); diff --git a/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js b/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js index e5e4732e481..6848d480cd0 100644 --- a/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js +++ b/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js @@ -1,8 +1,8 @@ -YUI.add("moodle-assignfeedback_editpdf-editor",function(e,t){var n=M.cfg.wwwroot+"/mod/assign/feedback/editpdf/ajax.php",r=M.cfg.wwwroot+"/mod/assign/feedback/editpdf/ajax_progress.php",i={DIALOGUE:"assignfeedback_editpdf_widget"},s={PREVIOUSBUTTON:"."+i.DIALOGUE+" .navigate-previous-button",NEXTBUTTON:"."+i.DIALOGUE+" .navigate-next-button",SEARCHCOMMENTSBUTTON:"."+i.DIALOGUE+" .searchcommentsbutton",SEARCHFILTER:".assignfeedback_editpdf_commentsearch input",SEARCHCOMMENTSLIST:".assignfeedback_editpdf_commentsearch ul",PAGESELECT:"."+i.DIALOGUE+" .navigate-page-select",LOADINGICON:"."+i.DIALOGUE+" .loading",PROGRESSBARCONTAINER:"."+i.DIALOGUE+" .progress-info.progress-striped",DRAWINGREGION:"."+i.DIALOGUE+" .drawingregion",DRAWINGCANVAS:"."+i.DIALOGUE+" .drawingcanvas",SAVE:"."+i.DIALOGUE+" .savebutton",COMMENTCOLOURBUTTON:"."+i.DIALOGUE+" .commentcolourbutton",COMMENTMENU:" .commentdrawable a",ANNOTATIONCOLOURBUTTON:"."+i.DIALOGUE+" .annotationcolourbutton",DELETEANNOTATIONBUTTON:"."+i.DIALOGUE+" .deleteannotationbutton",UNSAVEDCHANGESDIV:".assignfeedback_editpdf_unsavedchanges",STAMPSBUTTON:"."+i.DIALOGUE+" .currentstampbutton",DIALOGUE:"."+i.DIALOGUE},o="rgba(200, 200, 255, 0.9)",u="rgba(200, 200, 255, 0.5)",a="rgb(51, 51, 51)",f={white:"rgb(255,255,255)",yellow:"rgb(255,236,174)",red:"rgb(249,181,179)",green:"rgb(214,234,178)",blue:"rgb(203,217,237)",clear:"rgba(255,255,255, 0)"},l={white:"rgb(255,255,255)",yellow:"rgb(255,207,53)",red:"rgb(239,69,64)",green:"rgb(152,202,62)",blue:"rgb(125,159,211)",black:"rgb(51,51,51)"},c=300,h={comment:"."+i.DIALOGUE+" .commentbutton",pen:"."+i.DIALOGUE+" .penbutton",line:"."+i.DIALOGUE+" .linebutton",rectangle:"."+i.DIALOGUE+" .rectanglebutton",oval:"."+i.DIALOGUE+" .ovalbutton",stamp:"."+i.DIALOGUE+" .stampbutton",select:"."+i.DIALOGUE+" .selectbutton",highlight:"."+i.DIALOGUE+" .highlightbutton"},p=4,d=function(e,t){this.x=parseInt(e,10),this.y=parseInt(t,10),this.clip=function(e){return this.xe.x+e.width&&(this.x=e.x+e.width),this.ye.y+e.height&&(this.y=e.y+e.height),this}};M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.point=d;var v=function(e,t,n,r){this.x=e,this.y=t,this.width=n,this.height=r,this.bound=function(e){var t=0,n=0,r=0,i=0,s=0,o;for(s=0;sn||s===0)n=o.x;if(o.yi||s===0)i=o.y}return this.x=t,this.y=r,this.width=n-t,this.height=i-r,this},this.has_min_width=function(){return this.width>=5},this.has_min_height=function(){return this.height>=5},this.set_min_width=function(){this.width=5},this.set_min_height=function(){this.height=5}};M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.rect=v;var m=function(){this.start=!1,this.end=!1,this.starttime=0,this.annotationstart=!1,this.tool="comment",this.commentcolour="yellow",this.annotationcolour="red",this.stamp="",this.path=[]};M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.edit=m;var g=function(t){this.editor=t,this.shapes=[],this.nodes=[],this.erase=function(){if(this.shapes)while(this.shapes.length>0)this.editor.graphic.removeShape(this.shapes.pop());if(this.nodes)while(this.nodes.length>0)this.nodes.pop().remove()},this.scroll_update=function(e,t){var n,r,i;for(n=0;n'),f=e.Node.create('');a.setAttrs({alt:M.util.get_string("deleteannotation","assignfeedback_editpdf")}),a.setStyles({backgroundColor:"white"}),f.addClass("deleteannotationbutton"),f.append(a),n.append(f),f.setData("annotation",this),f.setStyle("zIndex","200"),f.on("click",this.remove,this),f.on("key",this.remove,"space,enter",this),f.setX(r[0]+t.x+t.width-18),f.setY(r[1]+t.y+6),this.drawable.nodes.push(f)}return this.drawable},draw:function(){return this.draw_highlight(),this.drawable},remove:function(e){var t,n;e.preventDefault(),t=this.editor.pages[this.editor.currentpage].annotations;for(n=0;n"),r.setStyles({position:"absolute",display:"inline-block",backgroundImage:"url("+this.editor.get_stamp_image_url(this.path)+")",width:this.endx-this.x,height:this.endy-this.y,backgroundSize:"100% 100%",zIndex:50}),n.append(r),r.setX(i.x),r.setY(i.y),t.store_position(r,i.x,i.y),r.on("gesturemovestart",this.editor.edit_start,null,this.editor),r.on("gesturemove",this.editor.edit_move,null,this.editor),r.on("gesturemoveend",this.editor.edit_end,null,this.editor),t.nodes.push(r),this.drawable=t,T.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdf.rect,r=new M.assignfeedback_editpdf.drawable(this.editor),i=e.one(s.DRAWINGREGION),o,u;return n.bound([t.start,t.end]),u=this.editor.get_window_coordinates(new M.assignfeedback_editpdf.point(n.x,n.y)),o=e.Node.create("
"),o.setStyles({position:"absolute",display:"inline-block",backgroundImage:"url("+this.editor.get_stamp_image_url(t.stamp)+")",width:n.width,height:n.height,backgroundSize:"100% 100%",zIndex:50}),i.append(o),o.setX(u.x),o.setY(u.y),r.store_position(o,u.x,u.y),r.nodes.push(o),r},init_from_edit:function(e){var t=new M.assignfeedback_editpdf.rect;return t.bound([e.start,e.end]),t.width<40&&(t.width=40),t.height<40&&(t.height=40),this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=t.x,this.y=t.y,this.endx=t.x+t.width,this.endy=t.y+t.height,this.colour=e.annotationcolour,this.path=e.stamp,!0},move:function(e,t){var n=e-this.x,r=t-this.y;this.x+=n,this.y+=r,this.endx+=n,this.endy+=r,this.drawable&&this.drawable.erase(),this.editor.drawables.push(this.draw())}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.annotationstamp=T;var N="Dropdown menu",C;C=function(e){e.draggable=!1,e.centered=!1,e.width="auto",e.visible=!1,e.footerContent="",C.superclass.constructor.apply(this,[e])},e.extend(C,M.core.dialogue,{initializer:function(t){var n,r,i,s;C.superclass.initializer.call(this,t),s=this.get("boundingBox"),s.addClass("assignfeedback_editpdf_dropdown"),n=this.get("buttonNode"),r=this.bodyNode,i=e.Node.create("

"),i.addClass("accesshide"),i.setHTML(this.get("headerText")),r.prepend(i),r.on("clickoutside",function(e){this.get("visible")&&e.target.get("id")!==n.get("id")&&e.target.ancestor().get("id")!==n.get("id")&&(e.preventDefault(),this.hide())},this),n.on("click",function(e){e.preventDefault(),this.show()},this),n.on("key",this.show,"enter,space",this)},show:function(){var t=this.get("buttonNode"),n=C.superclass.show.call(this);return this.align(t,[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),n}},{NAME:N,ATTRS:{headerText:{value:""},buttonNode:{value:null}}}),e.Base.modifyAttrs(C,{modal:{getter:function(){return!1}}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.dropdown=C;var k="Colourpicker",L;L=function(e){L.superclass.constructor.apply(this,[e])},e.extend(L,M.assignfeedback_editpdf.dropdown,{initializer:function(t){var n=e.Node.create('