Index: mod/assign/feedback/editpdf/yui/src/editor/js/editor.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- mod/assign/feedback/editpdf/yui/src/editor/js/editor.js (revision 147981ede954a3ecb946aed32c9f3ca62943eac2) +++ mod/assign/feedback/editpdf/yui/src/editor/js/editor.js (revision cd134c32707512b8df54b78758ee1ebbb3a351a4) @@ -223,6 +223,22 @@ */ editingcomment: false, + /** + * Prevent simulated scroll + * @property simulatescroll + * @type Boolean + * @protected + */ + simulatescroll: false, + + /** + * Extreme scroll position + * @property scrollend + * @type int + * @protected + */ + scrollend: 0, + /** * Should inactive comments be collapsed? * @@ -367,7 +383,7 @@ * @method open_in_panel */ open_in_panel: function(panel) { - var drawingcanvas; + var drawingcanvas, drawingregion; this.panel = panel; panel.append(this.get('body')); @@ -378,6 +394,9 @@ drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS); this.graphic = new Y.Graphic({render: drawingcanvas}); + drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); + drawingregion.on('scroll', this.simulate_scroll, this); + if (!this.get('readonly')) { drawingcanvas.on('gesturemovestart', this.edit_start, null, this); drawingcanvas.on('gesturemove', this.edit_move, null, this); @@ -394,7 +413,7 @@ * @method link_handler */ link_handler: function(e) { - var drawingcanvas; + var drawingcanvas, drawingregion; var resize = true; e.preventDefault(); @@ -417,6 +436,9 @@ drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS); this.graphic = new Y.Graphic({render: drawingcanvas}); + drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); + drawingregion.on('scroll', this.simulate_scroll, this); + if (!this.get('readonly')) { drawingcanvas.on('gesturemovestart', this.edit_start, null, this); drawingcanvas.on('gesturemove', this.edit_move, null, this); @@ -1440,6 +1462,7 @@ */ previous_page: function(e) { e.preventDefault(); + this.simulatescroll = false; this.currentpage--; if (this.currentpage < 0) { this.currentpage = 0; @@ -1455,6 +1478,7 @@ */ next_page: function(e) { e.preventDefault(); + this.simulatescroll = false; this.currentpage++; if (this.currentpage >= this.pages.length) { this.currentpage = this.pages.length - 1; @@ -1463,6 +1487,39 @@ this.change_page(); }, + /** + * Simulate the transition to the next (previous) page + * when the canvas for drawing scrolls to extreme positions + * @protected + * @method simulate_scroll + */ + simulate_scroll: function () { + var drawingregion, y, previousbutton, nextbutton; + + drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); + y = parseInt(drawingregion.get('scrollTop'), 10); + + if (y > 0) { + this.simulatescroll = true; + } + + // go to next page if it exists + if (drawingregion.get('scrollHeight') - drawingregion.get('scrollTop') == drawingregion.get('clientHeight') + && this.currentpage < this.pages.length -1) { + this.scrollend = y; + nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON); + nextbutton.simulate("click"); + drawingregion.set('scrollTop', 1); + } + + // go to previous page if it exists + if (y == 0 && this.simulatescroll == true && this.currentpage > 0) { + previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON); + previousbutton.simulate("click"); + drawingregion.set('scrollTop', this.scrollend - 1); + } + }, + /** * Update any absolutely positioned nodes, within each drawable, when the drawing canvas is scrolled * @protected Index: mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js (revision 9d29dbf4deb0ca3832365a5673cf82f74f122bc7) +++ mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js (revision cd134c32707512b8df54b78758ee1ebbb3a351a4) @@ -3519,6 +3519,22 @@ */ editingcomment: false, + /** + * Prevent simulated scroll + * @property simulatescroll + * @type Boolean + * @protected + */ + simulatescroll: false, + + /** + * Extreme scroll position + * @property scrollend + * @type int + * @protected + */ + scrollend: 0, + /** * Should inactive comments be collapsed? * @@ -3663,7 +3679,7 @@ * @method open_in_panel */ open_in_panel: function(panel) { - var drawingcanvas; + var drawingcanvas, drawingregion; this.panel = panel; panel.append(this.get('body')); @@ -3674,6 +3690,9 @@ drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS); this.graphic = new Y.Graphic({render: drawingcanvas}); + drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); + drawingregion.on('scroll', this.simulate_scroll, this); + if (!this.get('readonly')) { drawingcanvas.on('gesturemovestart', this.edit_start, null, this); drawingcanvas.on('gesturemove', this.edit_move, null, this); @@ -3690,7 +3709,7 @@ * @method link_handler */ link_handler: function(e) { - var drawingcanvas; + var drawingcanvas, drawingregion; var resize = true; e.preventDefault(); @@ -3713,6 +3732,9 @@ drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS); this.graphic = new Y.Graphic({render: drawingcanvas}); + drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); + drawingregion.on('scroll', this.simulate_scroll, this); + if (!this.get('readonly')) { drawingcanvas.on('gesturemovestart', this.edit_start, null, this); drawingcanvas.on('gesturemove', this.edit_move, null, this); @@ -4736,6 +4758,7 @@ */ previous_page: function(e) { e.preventDefault(); + this.simulatescroll = false; this.currentpage--; if (this.currentpage < 0) { this.currentpage = 0; @@ -4751,6 +4774,7 @@ */ next_page: function(e) { e.preventDefault(); + this.simulatescroll = false; this.currentpage++; if (this.currentpage >= this.pages.length) { this.currentpage = this.pages.length - 1; @@ -4759,6 +4783,39 @@ this.change_page(); }, + /** + * Simulate the transition to the next (previous) page + * when the canvas for drawing scrolls to extreme positions + * @protected + * @method simulate_scroll + */ + simulate_scroll: function () { + var drawingregion, y, previousbutton, nextbutton; + + drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); + y = parseInt(drawingregion.get('scrollTop'), 10); + + if (y > 0) { + this.simulatescroll = true; + } + + // go to next page if it exists + if (drawingregion.get('scrollHeight') - drawingregion.get('scrollTop') == drawingregion.get('clientHeight') + && this.currentpage < this.pages.length -1) { + this.scrollend = y; + nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON); + nextbutton.simulate("click"); + drawingregion.set('scrollTop', 1); + } + + // go to previous page if it exists + if (y == 0 && this.simulatescroll == true && this.currentpage > 0) { + previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON); + previousbutton.simulate("click"); + drawingregion.set('scrollTop', this.scrollend - 1); + } + }, + /** * Update any absolutely positioned nodes, within each drawable, when the drawing canvas is scrolled * @protected Index: mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js (revision 9d29dbf4deb0ca3832365a5673cf82f74f122bc7) +++ mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js (revision cd134c32707512b8df54b78758ee1ebbb3a351a4) @@ -3,8 +3,8 @@ .graphic.addShape({type:e.Rect,width:r.width,height:r.height,stroke:!1,fill:{color:i},x:r.x,y:r.y}),t.shapes.push(n),this.drawable=t,x.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdf.drawable(this.editor),r,i,s;return i=new M.assignfeedback_editpdf.rect,i.bound([new M.assignfeedback_editpdf.point(t.start.x,t.start.y),new M.assignfeedback_editpdf.point(t.end.x,t.end.y)]),i.has_min_width()||i.set_min_width(),s=l[t.annotationcolour],s=s.replace("rgb","rgba"),s=s.replace(")",",0.5)"),r=this.editor.graphic.addShape({type:e.Rect,width:i.width,height:20,stroke:!1,fill:{color:s},x:i.x,y:t.start.y-10}),n.shapes.push(r),n},init_from_edit:function(e){var t=new M.assignfeedback_editpdf.rect;return t.bound([e.start,e.end]),this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=t.x,this.y=e.start.y-10,this.endx=t.x+t.width,this.endy=e.start.y+10,this.colour=e.annotationcolour,this.page="",t.has_min_width()}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.annotationhighlight=x;var T=function(e){T.superclass.constructor.apply(this,[e])};T.NAME="annotationstamp",T.ATTRS={},e.extend(T,M.assignfeedback_editpdf.annotation,{draw:function(){var t=new M.assignfeedback_editpdf.drawable(this.editor),n=this.editor.get_dialogue_element(s.DRAWINGCANVAS),r,i;return i=this.editor.get_window_coordinates(new M.assignfeedback_editpdf.point(this.x,this.y)),r=e.Node.create("
"),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),this.editor.get("readonly")||(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=this.editor.get_dialogue_element(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('