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 c7bc840c26a..051eb5de90e 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 @@ -4779,7 +4779,7 @@ EDITOR.prototype = { */ disable_touch_scroll: function() { if (this.event_listener_options_supported()) { - document.addEventListener('touchmove', this.stop_touch_scroll, {passive: false}); + document.addEventListener('touchmove', this.stop_touch_scroll.bind(this), {passive: false}); } }, @@ -4788,8 +4788,12 @@ EDITOR.prototype = { * @param {Object} e */ stop_touch_scroll: function(e) { - e.stopPropagation(); - e.preventDefault(); + var drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); + + if (drawingregion.contains(e.target)) { + e.stopPropagation(); + e.preventDefault(); + } } }; 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 49bfac98be6..26e4b5daac6 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 @@ -6,4 +6,4 @@ this.path.split(":"),e.each(o,function(e){u=e.split(","),a=parseInt(u[0],10),f=p i={method:"post",context:this,sync:!1,data:{sesskey:M.cfg.sesskey,action:"addtoquicklist",userid:this.editor.get("userid"),commenttext:t.rawtext,width:t.width,colour:t.colour,attemptnumber:this.editor.get("attemptnumber"),assignmentid:this.editor.get("assignmentid")},on:{success:function(t,n){var r,i;try{r=e.JSON.parse(n.responseText);if(r.error)return new M.core.ajaxException(r);i=new M.assignfeedback_editpdf.quickcomment(r.id,r.rawtext,r.width,r.colour),this.comments.push(i),this.comments.sort(function(e,t){return e.rawtext.localeCompare(t.rawtext)})}catch(s){return new M.core.exception(s)}},failure:function(e,t){return M.core.exception(t.responseText)}}},e.io(r,i)},this.remove=function(t){var r=n,i;if(!t)return;i={method:"post",context:this,sync:!1,data:{sesskey:M.cfg.sesskey,action:"removefromquicklist",userid:this.editor.get("userid"),commentid:t.id,attemptnumber:this.editor.get("attemptnumber"),assignmentid:this.editor.get("assignmentid")},on:{success:function(){var e;e=this.comments.indexOf(t),e>=0&&this.comments.splice(e,1)},failure:function(e,t){return M.core.exception(t.responseText)}}},e.io(r,i)},this.load=function(){var t=n,r;r={method:"get",context:this,sync:!1,data:{sesskey:M.cfg.sesskey,action:"loadquicklist",userid:this.editor.get("userid"),attemptnumber:this.editor.get("attemptnumber"),assignmentid:this.editor.get("assignmentid")},on:{success:function(t,n){var r;try{r=e.JSON.parse(n.responseText);if(r.error)return new M.core.ajaxException(r);e.each(r,function(e){var t=new M.assignfeedback_editpdf.quickcomment(e.id,e.rawtext,e.width,e.colour);this.comments.push(t)},this),this.comments.sort(function(e,t){return e.rawtext.localeCompare(t.rawtext)})}catch(i){return new M.core.exception(i)}},failure:function(e,t){return M.core.exception(t.responseText)}}},e.io(t,r)}};M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.quickcommentlist=F;var I=function(){I.superclass.constructor.apply(this,arguments)};I.prototype={dialogue:null,panel:null,pagecount:0,currentpage:0,pages:[],documentstatus:0,loadingicon:null,pageimage:null,graphic:null,currentedit:new M.assignfeedback_editpdf.edit,currentdrawable:!1,drawables:[],currentcomment:null,currentannotation:null,lastannotation:null,lastannotationtool:"pen",quicklist:null,searchcommentswindow:null,currentstamp:null,stamps:[],editingcomment:!1,collapsecomments:!0,initializer:function(){var t;t=e.one("#"+this.get("linkid")),t&&(t.on("click",this.link_handler,this),t.on("key",this.link_handler,"down:13",this),require(["mod_assign/grading_review_panel"],function(n){var r=new n,i=r.getReviewPanel("assignfeedback_editpdf");i&&(i=e.one(i),i.empty(),t.ancestor(".fitem").hide(),this.open_in_panel(i)),this.currentedit.start=!1,this.currentedit.end=!1,this.get("readonly")||(this.quicklist=new M.assignfeedback_editpdf.quickcommentlist(this))}.bind(this)))},refresh_button_state:function(){var e,t,n,r,i,o;e=this.get_dialogue_element(s.COMMENTCOLOURBUTTON),n=M.util.image_url("background_colour_"+this.currentedit.commentcolour,"assignfeedback_editpdf"),e.one("img").setAttribute("src",n),this.currentedit.commentcolour==="clear"?e.one("img").setStyle("borderStyle","dashed"):e.one("img").setStyle("borderStyle","solid"),e=this.get_dialogue_element(s.ANNOTATIONCOLOURBUTTON),n=M.util.image_url("colour_"+this.currentedit.annotationcolour,"assignfeedback_editpdf"),e.one("img").setAttribute("src",n),t=this.get_dialogue_element(h[this.currentedit.tool]),t.addClass("assignfeedback_editpdf_selectedbutton"),t.setAttribute("aria-pressed","true"),r=this.get_dialogue_element(s.DRAWINGREGION),r.setAttribute("data-currenttool",this.currentedit.tool),e=this.get_dialogue_element(s.STAMPSBUTTON),i=this.get_stamp_image_url(this.currentedit.stamp),e.one("img").setAttrs({src:i,height:"16",width:"16"}),o=this.get_dialogue_element(s.DRAWINGCANVAS);switch(this.currentedit.tool){case"drag":o.setStyle("cursor","move");break;case"highlight":o.setStyle("cursor","text");break;case"select":o.setStyle("cursor","default");break;case"stamp":o.setStyle("cursor","url("+i+"), crosshair");break;default:o.setStyle("cursor","crosshair")}},get_canvas_bounds:function(){var e=this.get_dialogue_element(s.DRAWINGCANVAS),t=e.getXY(),n=t[0],r=t[1],i=parseInt(e.getStyle("width"),10),o=parseInt(e.getStyle("height"),10);return new M.assignfeedback_editpdf.rect(n,r,i,o)},get_canvas_coordinates:function(e){var t=this.get_canvas_bounds(),n=new M.assignfeedback_editpdf.point(e.x-t.x,e.y-t.y);return t.x=t.y=0,n.clip(t),n},get_window_coordinates:function(e){var t=this.get_canvas_bounds(),n=new M.assignfeedback_editpdf.point(e.x+t.x,e.y+t.y);return n},open_in_panel:function(t){var n,r;this.panel=t,t.append(this.get("body")),t.addClass(i.DIALOGUE),this.loadingicon=this.get_dialogue_element(s.LOADINGICON),n=this.get_dialogue_element(s.DRAWINGCANVAS),this.graphic=new e.Graphic({render:n}),r=this.get_dialogue_element(s.DRAWINGREGION),r.on("scroll",this.move_canvas,this),this.get("readonly")||(n.on("gesturemovestart",this.edit_start,null,this),n.on("gesturemove",this.edit_move,null,this),n.on("gesturemoveend",this.edit_end,null,this),this.refresh_button_state()),this.start_generation()},link_handler:function(t){var n,r,o=!0;t.preventDefault(),this.dialogue||(this.dialogue=new M.core.dialogue({headerContent:this.get("header"),bodyContent:this.get("body"),footerContent:this.get("footer"),modal:!0,width:"840px",visible:!1,draggable:!0}),this.dialogue.get("boundingBox").addClass(i.DIALOGUE),this.loadingicon=this.get_dialogue_element(s.LOADINGICON),n=this.get_dialogue_element(s.DRAWINGCANVAS),this.graphic=new e.Graphic({render:n}),r=this.get_dialogue_element(s.DRAWINGREGION),r.on("scroll",this.move_canvas,this),this.get("readonly")||(n.on("gesturemovestart",this.edit_start,null,this),n.on("gesturemove",this.edit_move,null,this),n.on("gesturemoveend",this.edit_end,null,this),this.refresh_button_state()),this.start_generation(),n.on("windowresize",this.resize,this),o=!1),this.dialogue.centerDialogue (),this.dialogue.show(),this.dialogue.dd.on("drag:end",this.redraw,this),o&&this.resize()},start_generation:function(){this.poll_document_conversion_status()},poll_document_conversion_status:function(){var t=this.get("userid");e.io(n,{method:"get",context:this,sync:!1,data:{sesskey:M.cfg.sesskey,action:"pollconversions",userid:this.get("userid"),attemptnumber:this.get("attemptnumber"),assignmentid:this.get("assignmentid"),readonly:this.get("readonly")?1:0},on:{success:function(n,r){var i=e.one(s.USERINFOREGION);if(i){var o=i.getAttribute("data-userid");if(o&&o!=t)return}var u=this.handle_response_data(r),a=!1;if(u){this.documentstatus=u.status;if(u.status===0)a=!0;else if(u.status===1||u.status===3)a=!0;else if(u.status===2||u.status===-1)this.pagecount=u.pagecount,u.pageready==u.pagecount?this.prepare_pages_for_display(u):(this.update_page_load_progress(),this.start_document_to_image_conversion());a&&e.later(1e3,this,this.poll_document_conversion_status)}},failure:function(e,t){return new M.core.exception(t.responseText)}}})},start_document_to_image_conversion:function(){e.io(n,{method:"get",context:this,sync:!1,data:{sesskey:M.cfg.sesskey,action:"pollconversions",userid:this.get("userid"),attemptnumber:this.get("attemptnumber"),assignmentid:this.get("assignmentid"),readonly:this.get("readonly")?1:0},on:{success:function(e,t){var n=this.handle_response_data(t);n&&(this.documentstatus=n.status,n.status===2&&this.prepare_pages_for_display(n))},failure:function(e,t){return new M.core.exception(t.responseText)}}})},warning:function(t,n){var r=this.get_dialogue_element(s.ICONMESSAGECONTAINER),i=this.get_dialogue_element(s.WARNINGMESSAGECONTAINER),o=15,u=1,a="assignfeedback_editpdf_warningmessages alert alert-warning";n&&(o=4,a="assignfeedback_editpdf_warningmessages alert alert-info");var f=e.Node.create('<div class="'+a+'" role="alert"></div>');f.append(r.one("*").cloneNode()),f.append(t),i.prepend(f),f.transition({duration:u,delay:o,opacity:0},function(){f.remove()})},prepare_pages_for_display:function(e){var t,n,r,i,s,o;if(!e.pagecount){this.dialogue&&this.dialogue.hide(),i=new M.core.alert({message:M.util.get_string("cannotopenpdf","assignfeedback_editpdf")}),i.show();return}this.pages=e.pages;for(t=0;t<this.pages.length;t++){for(n=0;n<this.pages[t].comments.length;n++)r=this.pages[t].comments[n],this.pages[t].comments[n]=new M.assignfeedback_editpdf.comment(this,r.gradeid,r.pageno,r.x,r.y,r.width,r.colour,r.rawtext);for(n=0;n<this.pages[t].annotations.length;n++)s=this.pages[t].annotations[n],this.pages[t].annotations[n]=this.create_annotation(s.type,s)}o=this.get("readonly"),!o&&e.partial&&this.warning(M.util.get_string("partialwarning","assignfeedback_editpdf"),!1),this.quicklist&&this.quicklist.load(),this.setup_navigation(),this.setup_toolbar(),this.change_page()},update_page_load_progress:function(){var t,n=0,i=this.get_dialogue_element(s.PROGRESSBARCONTAINER+" .bar");if(!i)return;t={method:"get",context:this,sync:!1,data:{sesskey:M.cfg.sesskey,action:"conversionstatus",userid:this.get("userid"),attemptnumber:this.get("attemptnumber"),assignmentid:this.get("assignmentid")},on:{success:function(i,o){n=0;var u=0,a=this.get_dialogue_element(s.PROGRESSBARCONTAINER+" .bar");a&&(u=o.response/this.pagecount*100,a.setStyle("width",u+"%"),a.ancestor(s.PROGRESSBARCONTAINER).setAttribute("aria-valuenow",u),u<100&&(M.util.js_pending("checkconversionstatus"),e.later(1e3,this,function(){M.util.js_complete("checkconversionstatus"),e.io(r,t)})))},failure:function(i,s){return n+=1,this.pagecount===0&&n<5&&(M.util.js_pending("checkconversionstatus"),e.later(1e3,this,function(){M.util.js_complete("checkconversionstatus"),e.io(r,t)})),new M.core.exception(s.responseText)}}},M.util.js_pending("checkconversionstatus"),e.later(1e3,this,function(){n=0,M.util.js_complete("checkconversionstatus"),e.io(r,t)})},handle_response_data:function(t){var n;try{n=e.JSON.parse(t.responseText);if(!n.error)return n;this.dialogue&&this.dialogue.hide(),new M.core.alert({message:M.util.get_string("cannotopenpdf","assignfeedback_editpdf"),visible:!0})}catch(r){this.dialogue&&this.dialogue.hide(),new M.core.alert({title:M.util.get_string("cannotopenpdf","assignfeedback_editpdf"),visible:!0})}return},get_stamp_image_url:function(t){var n=this.get("stampfiles"),r="";return e.Array.each(n,function(e){e.indexOf(t)>0&&(r=e)},this),r},setup_toolbar:function(){var t,n,r,i,o,u,a,c,p;i=this.get_dialogue_element(s.SEARCHCOMMENTSBUTTON),i.on("click",this.open_search_comments,this),i.on("key",this.open_search_comments,"down:13",this),o=this.get_dialogue_element(s.EXPCOLCOMMENTSBUTTON),o.on("click",this.expandCollapseComments,this),o.on("key",this.expandCollapseComments,"down:13",this);if(this.get("readonly"))return;this.disable_touch_scroll(),e.each(h,function(e,n){t=this.get_dialogue_element(e),t.on("click",this.handle_tool_button,this,n),t.on("key",this.handle_tool_button,"down:13",this,n),t.setAttribute("aria-pressed","false")},this),n=this.get_dialogue_element(s.COMMENTCOLOURBUTTON),c=new M.assignfeedback_editpdf.colourpicker({buttonNode:n,colours:f,iconprefix:"background_colour_",callback:function(e){var t=e.target.getAttribute("data-colour");t||(t=e.target.ancestor().getAttribute("data-colour")),this.currentedit.commentcolour=t,this.handle_tool_button(e,"comment")},context:this}),r=this.get_dialogue_element(s.ANNOTATIONCOLOURBUTTON),c=new M.assignfeedback_editpdf.colourpicker({buttonNode:r,iconprefix:"colour_",colours:l,callback:function(e){var t=e.target.getAttribute("data-colour");t||(t=e.target.ancestor().getAttribute("data-colour")),this.currentedit.annotationcolour=t,this.lastannotationtool?this.handle_tool_button(e,this.lastannotationtool):this.handle_tool_button(e,"pen")},context:this}),a=this.get("stampfiles"),a.length<=0?this.get_dialogue_element(h.stamp).ancestor().hide():(p=a[0].substr(a[0].lastIndexOf("/")+1),this.currentedit.stamp=p,u=this.get_dialogue_element(s.STAMPSBUTTON),c=new M.assignfeedback_editpdf.stamppicker( {buttonNode:u,stamps:a,callback:function(e){var t=e.target.getAttribute("data-stamp"),n;t||(t=e.target.ancestor().getAttribute("data-stamp")),n=t.substr(t.lastIndexOf("/")),this.currentedit.stamp=n,this.handle_tool_button(e,"stamp")},context:this}),this.refresh_button_state())},handle_tool_button:function(e,t){var n;e.preventDefault(),n=this.get_dialogue_element(h[this.currentedit.tool]),n.removeClass("assignfeedback_editpdf_selectedbutton"),n.setAttribute("aria-pressed","false"),this.currentedit.tool=t,t!=="comment"&&t!=="select"&&t!=="drag"&&t!=="stamp"&&(this.lastannotationtool=t),this.refresh_button_state()},stringify_current_page:function(){var t=[],n=[],r,i=0;for(i=0;i<this.pages[this.currentpage].comments.length;i++)t[i]=this.pages[this.currentpage].comments[i].clean();for(i=0;i<this.pages[this.currentpage].annotations.length;i++)n[i]=this.pages[this.currentpage].annotations[i].clean();return r={comments:t,annotations:n},e.JSON.stringify(r)},get_current_drawable:function(){var e,t,n=!1;return!this.currentedit.start||!this.currentedit.end?!1:(this.currentedit.tool==="comment"?(e=new M.assignfeedback_editpdf.comment(this),n=e.draw_current_edit(this.currentedit)):(t=this.create_annotation(this.currentedit.tool,{}),t&&(n=t.draw_current_edit(this.currentedit))),n)},get_dialogue_element:function(e){return this.panel?this.panel.one(e):this.dialogue.get("boundingBox").one(e)},redraw_current_edit:function(){this.currentdrawable&&this.currentdrawable.erase(),this.currentdrawable=this.get_current_drawable()},edit_start:function(t){var n=this.get_dialogue_element(s.DRAWINGCANVAS),r=n.getXY(),i=n.get("docScrollY"),o=n.get("docScrollX"),u={x:t.clientX-r[0]+o,y:t.clientY-r[1]+i},a=!1;if(t.button===3)return;if(this.currentedit.starttime)return;if(this.editingcomment)return;this.currentedit.starttime=(new Date).getTime(),this.currentedit.start=u,this.currentedit.end={x:u.x,y:u.y};if(this.currentedit.tool==="select"){var f=this.currentedit.end.x,l=this.currentedit.end.y,c=this.pages[this.currentpage].annotations;e.each(c,function(e){(f-e.x)*(f-e.endx)<=0&&(l-e.y)*(l-e.endy)<=0&&(a=e)}),a?(this.lastannotation=this.currentannotation,this.currentannotation=a,this.lastannotation&&this.lastannotation!==a&&this.lastannotation.drawable&&(this.lastannotation.drawable.erase(),this.drawables.push(this.lastannotation.draw())),this.currentannotation.drawable&&this.currentannotation.drawable.erase(),this.drawables.push(this.currentannotation.draw())):(this.lastannotation=this.currentannotation,this.currentannotation=null,this.lastannotation&&this.lastannotation.drawable&&(this.lastannotation.drawable.erase(),this.drawables.push(this.lastannotation.draw())))}this.currentannotation&&(this.currentedit.annotationstart={x:this.currentannotation.x,y:this.currentannotation.y})},edit_move:function(e){e.preventDefault();var t=this.get_canvas_bounds(),n=this.get_dialogue_element(s.DRAWINGCANVAS),r=this.get_dialogue_element(s.DRAWINGREGION),i=new M.assignfeedback_editpdf.point(e.clientX+n.get("docScrollX"),e.clientY+n.get("docScrollY")),o=this.get_canvas_coordinates(i),u,a;if(o.x<0||o.x>t.width||o.y<0||o.y>t.height)return;this.currentedit.tool==="pen"&&this.currentedit.path.push(o),this.currentedit.tool==="select"?this.currentannotation&&this.currentedit&&this.currentannotation.move(this.currentedit.annotationstart.x+o.x-this.currentedit.start.x,this.currentedit.annotationstart.y+o.y-this.currentedit.start.y):this.currentedit.tool==="drag"?(u=o.x-this.currentedit.start.x,a=o.y-this.currentedit.start.y,r.getDOMNode().scrollLeft-=u,r.getDOMNode().scrollTop-=a):this.currentedit.start&&(this.currentedit.end=o,this.redraw_current_edit())},edit_end:function(){var e,t,n;e=(new Date).getTime()-this.currentedit.start;if(e<c||this.currentedit.start===!1)return;this.currentedit.tool==="comment"?(this.currentdrawable&&this.currentdrawable.erase(),this.currentdrawable=!1,t=new M.assignfeedback_editpdf.comment(this),t.init_from_edit(this.currentedit)&&(this.pages[this.currentpage].comments.push(t),this.drawables.push(t.draw(!0)),this.editingcomment=!0)):(n=this.create_annotation(this.currentedit.tool,{}),n&&(this.currentdrawable&&this.currentdrawable.erase(),this.currentdrawable=!1,n.init_from_edit(this.currentedit)&&(this.pages[this.currentpage].annotations.push(n),this.drawables.push(n.draw())))),this.save_current_page(),this.currentedit.starttime=0,this.currentedit.start=!1,this.currentedit.end=!1,this.currentedit.path=[]},resize:function(){var t,n;if(this.dialogue){if(!this.dialogue.get("visible"))return;this.dialogue.centerDialogue()}return n=e.one("body").get("winHeight")-120,n<100&&(n=100),t=this.get_dialogue_element(s.DRAWINGREGION),this.dialogue&&t.setStyle("maxHeight",n+"px"),this.redraw(),!0},create_annotation:function(e,t){return t.type=e,t.editor=this,e==="line"?new M.assignfeedback_editpdf.annotationline(t):e==="rectangle"?new M.assignfeedback_editpdf.annotationrectangle(t):e==="oval"?new M.assignfeedback_editpdf.annotationoval(t):e==="pen"?new M.assignfeedback_editpdf.annotationpen(t):e==="highlight"?new M.assignfeedback_editpdf.annotationhighlight(t):e==="stamp"?new M.assignfeedback_editpdf.annotationstamp(t):!1},save_current_page:function(){this.clear_warnings(!1);var t=n,r;r={method:"post",context:this,sync:!1,data:{sesskey:M.cfg.sesskey,action:"savepage",index:this.currentpage,userid:this.get("userid"),attemptnumber:this.get("attemptnumber"),assignmentid:this.get("assignmentid"),page:this.stringify_current_page()},on:{success:function(t,n){var r;try{r=e.JSON.parse(n.responseText);if(r.error)return new M.core.ajaxException(r);e.one(s.UNSAVEDCHANGESINPUT).set("value","true"),this.warning(M.util.get_string("draftchangessaved","assignfeedback_editpdf"),!0)}catch(i){return new M.core.exception(i)}},failure:function(e,t){return new M.core.exception(t.responseText)}}},e.io(t,r)},open_search_comments:function(e){this.searchcommentswindow||(this.searchcommentswindow=new M.assignfeedback_editpdf.commentsearch({editor:this})),this -.searchcommentswindow.show(),e.preventDefault()},expandCollapseComments:function(){var t=e.all(".commentdrawable");this.collapsecomments?(this.collapsecomments=!1,t.removeClass("commentcollapsed")):(this.collapsecomments=!0,t.addClass("commentcollapsed"))},redraw:function(){var e,t;t=this.pages[this.currentpage];if(t===undefined)return;while(this.drawables.length>0)this.drawables.pop().erase();for(e=0;e<t.annotations.length;e++)this.drawables.push(t.annotations[e].draw());for(e=0;e<t.comments.length;e++)this.drawables.push(t.comments[e].draw(!1))},clear_warnings:function(e){var t=this.get_dialogue_element(s.WARNINGMESSAGECONTAINER);e?t.empty():t.all(".alert-info").remove(!0)},change_page:function(){var e=this.get_dialogue_element(s.DRAWINGCANVAS),t,n,r;n=this.get_dialogue_element(s.PREVIOUSBUTTON),r=this.get_dialogue_element(s.NEXTBUTTON),this.currentpage>0?n.removeAttribute("disabled"):n.setAttribute("disabled","true"),this.currentpage<this.pagecount-1?r.removeAttribute("disabled"):r.setAttribute("disabled","true"),t=this.pages[this.currentpage],this.loadingicon&&this.loadingicon.hide(),e.setStyle("backgroundImage",'url("'+t.url+'")'),e.setStyle("width",t.width+"px"),e.setStyle("height",t.height+"px"),e.scrollIntoView(),this.get_dialogue_element(s.PAGESELECT).set("selectedIndex",this.currentpage),this.resize()},setup_navigation:function(){var t,n,r,i,o,u;t=this.get_dialogue_element(s.PAGESELECT);var a=t.all("option");if(a.size()<=1)for(n=0;n<this.pages.length;n++)i=e.Node.create("<option/>"),i.setAttribute("value",n),r={page:n+1,total:this.pages.length},i.setHTML(M.util.get_string("pagexofy","assignfeedback_editpdf",r)),t.append(i);t.removeAttribute("disabled"),t.on("change",function(){this.currentpage=t.get("value"),this.clear_warnings(!1),this.change_page()},this),o=this.get_dialogue_element(s.PREVIOUSBUTTON),u=this.get_dialogue_element(s.NEXTBUTTON),o.on("click",this.previous_page,this),o.on("key",this.previous_page,"down:13",this),u.on("click",this.next_page,this),u.on("key",this.next_page,"down:13",this)},previous_page:function(e){e.preventDefault(),this.currentpage--,this.currentpage<0&&(this.currentpage=0),this.clear_warnings(!1),this.change_page()},next_page:function(e){e.preventDefault(),this.currentpage++,this.currentpage>=this.pages.length&&(this.currentpage=this.pages.length-1),this.clear_warnings(!1),this.change_page()},move_canvas:function(){var e,t,n,r;e=this.get_dialogue_element(s.DRAWINGREGION),t=parseInt(e.get("scrollLeft"),10),n=parseInt(e.get("scrollTop"),10);for(r=0;r<this.drawables.length;r++)this.drawables[r].scroll_update(t,n)},event_listener_options_supported:function(){var e=!1,t,n="testpassiveeventoptions";try{t=Object.defineProperty({},"passive",{get:function(){e=!0}}),document.addEventListener(n,t,t),document.removeEventListener(n,t,t)}catch(r){e=!1}return e},disable_touch_scroll:function(){this.event_listener_options_supported()&&document.addEventListener("touchmove",this.stop_touch_scroll,{passive:!1})},stop_touch_scroll:function(e){e.stopPropagation(),e.preventDefault()}},e.extend(I,e.Base,I.prototype,{NAME:"moodle-assignfeedback_editpdf-editor",ATTRS:{userid:{validator:e.Lang.isInteger,value:0},assignmentid:{validator:e.Lang.isInteger,value:0},attemptnumber:{validator:e.Lang.isInteger,value:0},header:{validator:e.Lang.isString,value:""},body:{validator:e.Lang.isString,value:""},footer:{validator:e.Lang.isString,value:""},linkid:{validator:e.Lang.isString,value:""},deletelinkid:{validator:e.Lang.isString,value:""},readonly:{validator:e.Lang.isBoolean,value:!0},stampfiles:{validator:e.Lang.isArray,value:""}}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.editor=M.assignfeedback_editpdf.editor||{},M.assignfeedback_editpdf.editor.init=M.assignfeedback_editpdf.editor.init||function(e){return M.assignfeedback_editpdf.instance=new I(e),M.assignfeedback_editpdf.instance}},"@VERSION@",{requires:["base","event","node","io","graphics","json","event-move","event-resize","transition","querystring-stringify-simple","moodle-core-notification-dialog","moodle-core-notification-alert","moodle-core-notification-warning","moodle-core-notification-exception","moodle-core-notification-ajaxexception"]}); +.searchcommentswindow.show(),e.preventDefault()},expandCollapseComments:function(){var t=e.all(".commentdrawable");this.collapsecomments?(this.collapsecomments=!1,t.removeClass("commentcollapsed")):(this.collapsecomments=!0,t.addClass("commentcollapsed"))},redraw:function(){var e,t;t=this.pages[this.currentpage];if(t===undefined)return;while(this.drawables.length>0)this.drawables.pop().erase();for(e=0;e<t.annotations.length;e++)this.drawables.push(t.annotations[e].draw());for(e=0;e<t.comments.length;e++)this.drawables.push(t.comments[e].draw(!1))},clear_warnings:function(e){var t=this.get_dialogue_element(s.WARNINGMESSAGECONTAINER);e?t.empty():t.all(".alert-info").remove(!0)},change_page:function(){var e=this.get_dialogue_element(s.DRAWINGCANVAS),t,n,r;n=this.get_dialogue_element(s.PREVIOUSBUTTON),r=this.get_dialogue_element(s.NEXTBUTTON),this.currentpage>0?n.removeAttribute("disabled"):n.setAttribute("disabled","true"),this.currentpage<this.pagecount-1?r.removeAttribute("disabled"):r.setAttribute("disabled","true"),t=this.pages[this.currentpage],this.loadingicon&&this.loadingicon.hide(),e.setStyle("backgroundImage",'url("'+t.url+'")'),e.setStyle("width",t.width+"px"),e.setStyle("height",t.height+"px"),e.scrollIntoView(),this.get_dialogue_element(s.PAGESELECT).set("selectedIndex",this.currentpage),this.resize()},setup_navigation:function(){var t,n,r,i,o,u;t=this.get_dialogue_element(s.PAGESELECT);var a=t.all("option");if(a.size()<=1)for(n=0;n<this.pages.length;n++)i=e.Node.create("<option/>"),i.setAttribute("value",n),r={page:n+1,total:this.pages.length},i.setHTML(M.util.get_string("pagexofy","assignfeedback_editpdf",r)),t.append(i);t.removeAttribute("disabled"),t.on("change",function(){this.currentpage=t.get("value"),this.clear_warnings(!1),this.change_page()},this),o=this.get_dialogue_element(s.PREVIOUSBUTTON),u=this.get_dialogue_element(s.NEXTBUTTON),o.on("click",this.previous_page,this),o.on("key",this.previous_page,"down:13",this),u.on("click",this.next_page,this),u.on("key",this.next_page,"down:13",this)},previous_page:function(e){e.preventDefault(),this.currentpage--,this.currentpage<0&&(this.currentpage=0),this.clear_warnings(!1),this.change_page()},next_page:function(e){e.preventDefault(),this.currentpage++,this.currentpage>=this.pages.length&&(this.currentpage=this.pages.length-1),this.clear_warnings(!1),this.change_page()},move_canvas:function(){var e,t,n,r;e=this.get_dialogue_element(s.DRAWINGREGION),t=parseInt(e.get("scrollLeft"),10),n=parseInt(e.get("scrollTop"),10);for(r=0;r<this.drawables.length;r++)this.drawables[r].scroll_update(t,n)},event_listener_options_supported:function(){var e=!1,t,n="testpassiveeventoptions";try{t=Object.defineProperty({},"passive",{get:function(){e=!0}}),document.addEventListener(n,t,t),document.removeEventListener(n,t,t)}catch(r){e=!1}return e},disable_touch_scroll:function(){this.event_listener_options_supported()&&document.addEventListener("touchmove",this.stop_touch_scroll.bind(this),{passive:!1})},stop_touch_scroll:function(e){var t=this.get_dialogue_element(s.DRAWINGREGION);t.contains(e.target)&&(e.stopPropagation(),e.preventDefault())}},e.extend(I,e.Base,I.prototype,{NAME:"moodle-assignfeedback_editpdf-editor",ATTRS:{userid:{validator:e.Lang.isInteger,value:0},assignmentid:{validator:e.Lang.isInteger,value:0},attemptnumber:{validator:e.Lang.isInteger,value:0},header:{validator:e.Lang.isString,value:""},body:{validator:e.Lang.isString,value:""},footer:{validator:e.Lang.isString,value:""},linkid:{validator:e.Lang.isString,value:""},deletelinkid:{validator:e.Lang.isString,value:""},readonly:{validator:e.Lang.isBoolean,value:!0},stampfiles:{validator:e.Lang.isArray,value:""}}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.editor=M.assignfeedback_editpdf.editor||{},M.assignfeedback_editpdf.editor.init=M.assignfeedback_editpdf.editor.init||function(e){return M.assignfeedback_editpdf.instance=new I(e),M.assignfeedback_editpdf.instance}},"@VERSION@",{requires:["base","event","node","io","graphics","json","event-move","event-resize","transition","querystring-stringify-simple","moodle-core-notification-dialog","moodle-core-notification-alert","moodle-core-notification-warning","moodle-core-notification-exception","moodle-core-notification-ajaxexception"]}); diff --git a/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor.js b/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor.js index c7bc840c26a..051eb5de90e 100644 --- a/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor.js +++ b/mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor.js @@ -4779,7 +4779,7 @@ EDITOR.prototype = { */ disable_touch_scroll: function() { if (this.event_listener_options_supported()) { - document.addEventListener('touchmove', this.stop_touch_scroll, {passive: false}); + document.addEventListener('touchmove', this.stop_touch_scroll.bind(this), {passive: false}); } }, @@ -4788,8 +4788,12 @@ EDITOR.prototype = { * @param {Object} e */ stop_touch_scroll: function(e) { - e.stopPropagation(); - e.preventDefault(); + var drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); + + if (drawingregion.contains(e.target)) { + e.stopPropagation(); + e.preventDefault(); + } } }; diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/editor.js b/mod/assign/feedback/editpdf/yui/src/editor/js/editor.js index 480c2c7c48e..4e4897021b7 100644 --- a/mod/assign/feedback/editpdf/yui/src/editor/js/editor.js +++ b/mod/assign/feedback/editpdf/yui/src/editor/js/editor.js @@ -1503,7 +1503,7 @@ EDITOR.prototype = { */ disable_touch_scroll: function() { if (this.event_listener_options_supported()) { - document.addEventListener('touchmove', this.stop_touch_scroll, {passive: false}); + document.addEventListener('touchmove', this.stop_touch_scroll.bind(this), {passive: false}); } }, @@ -1512,8 +1512,12 @@ EDITOR.prototype = { * @param {Object} e */ stop_touch_scroll: function(e) { - e.stopPropagation(); - e.preventDefault(); + var drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); + + if (drawingregion.contains(e.target)) { + e.stopPropagation(); + e.preventDefault(); + } } };