diff --git a/mod/assign/feedback/editpdf/styles.css b/mod/assign/feedback/editpdf/styles.css index d723442ebd0..52e7536c8c9 100644 --- a/mod/assign/feedback/editpdf/styles.css +++ b/mod/assign/feedback/editpdf/styles.css @@ -27,7 +27,12 @@ } .assignfeedback_editpdf_widget .drawingregion[data-currenttool=select] .drawingcanvas { - cursor: pointer; + cursor: default; +} + +.assignfeedback_editpdf_widget .drawingregion[data-currenttool=select] .commentdrawable textarea, +.assignfeedback_editpdf_widget .drawingregion[data-currenttool=select] .commentdrawable svg { + cursor: move; } .assignfeedback_editpdf_widget .drawingregion { @@ -337,7 +342,7 @@ ul.assignfeedback_editpdf_menu { } .assignfeedback_editpdf_widget .commentdrawable { - display: inline-block; + display: flex; z-index: 1; } 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 56f1f76c874..5f704e2cb65 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 @@ -2592,11 +2592,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) { 'height': scrollheight + 'px', 'overflow': 'hidden' }); - marker.setStyles({ - 'position': 'absolute', - 'bottom': 0 - scrollheight + 'px', - 'color': COMMENTCOLOUR[this.colour] - }); + marker.setStyle('color', COMMENTCOLOUR[this.colour]); this.attach_events(node, menu); if (focus) { node.focus(); @@ -2630,35 +2626,37 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) { */ this.attach_events = function(node, menu) { var container = node.ancestor('div'), - label = node.ancestor('label'); + label = node.ancestor('label'), + marker = label.next('svg'); // Function to collapse a comment to a marker icon. node.collapse = function(delay) { node.collapse.delay = Y.later(delay, node, function() { - container.addClass('commentcollapsed'); + if (editor.collapsecomments) { + container.addClass('commentcollapsed'); + } }); }; // Function to expand a comment. node.expand = function() { - container.removeClass('commentcollapsed'); + if (node.getData('dragging') !== true) { + if (node.collapse.delay) { + node.collapse.delay.cancel(); + } + container.removeClass('commentcollapsed'); + } }; // Expand comment on mouse over (under certain conditions) or click/tap. container.on('mouseenter', function() { if (editor.currentedit.tool === 'comment' || editor.currentedit.tool === 'select' || this.editor.get('readonly')) { node.expand(); - if (node.collapse.delay) { - node.collapse.delay.cancel(); - } } }, this); - container.on('click', function() { + container.on('click|tap', function() { node.expand(); node.focus(); - if (node.collapse.delay) { - node.collapse.delay.cancel(); - } }, this); // Functions to capture reverse tabbing events. @@ -2718,9 +2716,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) { // Collapse comment on blur. container.on('blur', function() { node.active = false; - if (editor.collapsecomments) { - node.collapse(800); - } + node.collapse(800); }, this); if (!this.editor.get('readonly')) { @@ -2758,38 +2754,37 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) { node.on('gesturemovestart', function(e) { if (editor.currentedit.tool === 'select') { e.preventDefault(); - node.setData('dragging', true); - node.setData('offsetx', e.clientX - node.getX()); - node.setData('offsety', e.clientY - node.getY()); + if (editor.collapsecomments) { + node.setData('offsetx', 8); + node.setData('offsety', 8); + } else { + node.setData('offsetx', e.clientX - container.getX()); + node.setData('offsety', e.clientY - container.getY()); + } } }); - node.on('gesturemoveend', function() { - if (editor.currentedit.tool === 'select') { - node.setData('dragging', false); - this.editor.save_current_page(); - } - }, null, this); node.on('gesturemove', function(e) { if (editor.currentedit.tool === 'select') { var x = e.clientX - node.getData('offsetx'), y = e.clientY - node.getData('offsety'), - nodewidth, - nodeheight, newlocation, windowlocation, bounds; - nodewidth = parseInt(node.getStyle('width'), 10); - nodeheight = parseInt(node.getStyle('height'), 10); + if (node.getData('dragging') !== true) { + // Collapse comment during move. + node.collapse(0); + node.setData('dragging', true); + } newlocation = this.editor.get_canvas_coordinates(new M.assignfeedback_editpdf.point(x, y)); bounds = this.editor.get_canvas_bounds(true); bounds.x = 0; bounds.y = 0; - bounds.width -= nodewidth + 42; - bounds.height -= nodeheight + 8; - // Clip to the window size - the comment size. + bounds.width -= 24; + bounds.height -= 24; + // Clip to the window size - the comment icon size. newlocation.clip(bounds); this.x = newlocation.x; @@ -2801,6 +2796,63 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) { this.drawable.store_position(container, windowlocation.x, windowlocation.y); } }, null, this); + node.on('gesturemoveend', function() { + if (editor.currentedit.tool === 'select') { + if (node.getData('dragging') === true) { + node.setData('dragging', false); + } + this.editor.save_current_page(); + } + }, null, this); + marker.on('gesturemovestart', function(e) { + if (editor.currentedit.tool === 'select') { + e.preventDefault(); + node.setData('offsetx', e.clientX - container.getX()); + node.setData('offsety', e.clientY - container.getY()); + node.expand(); + } + }); + marker.on('gesturemove', function(e) { + if (editor.currentedit.tool === 'select') { + var x = e.clientX - node.getData('offsetx'), + y = e.clientY - node.getData('offsety'), + newlocation, + windowlocation, + bounds; + + if (node.getData('dragging') !== true) { + // Collapse comment during move. + node.collapse(100); + node.setData('dragging', true); + } + + newlocation = this.editor.get_canvas_coordinates(new M.assignfeedback_editpdf.point(x, y)); + bounds = this.editor.get_canvas_bounds(true); + bounds.x = 0; + bounds.y = 0; + + bounds.width -= 24; + bounds.height -= 24; + // Clip to the window size - the comment icon size. + newlocation.clip(bounds); + + this.x = newlocation.x; + this.y = newlocation.y; + + windowlocation = this.editor.get_window_coordinates(newlocation); + container.setX(windowlocation.x); + container.setY(windowlocation.y); + this.drawable.store_position(container, windowlocation.x, windowlocation.y); + } + }, null, this); + marker.on('gesturemoveend', function() { + if (editor.currentedit.tool === 'select') { + if (node.getData('dragging') === true) { + node.setData('dragging', false); + } + this.editor.save_current_page(); + } + }, null, this); this.menu = new M.assignfeedback_editpdf.commentmenu({ buttonNode: this.menulink, @@ -4455,13 +4507,15 @@ EDITOR.prototype = { * @method expandCollapseComments */ expandCollapseComments: function() { + var comments = Y.all('.commentdrawable'); + if (this.collapsecomments) { this.collapsecomments = false; + comments.removeClass('commentcollapsed'); } else { this.collapsecomments = true; + comments.addClass('commentcollapsed'); } - - this.redraw(); }, /** 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 0111190cf9d..b3620af12df 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 @@ -2,8 +2,8 @@ YUI.add("moodle-assignfeedback_editpdf-editor",function(e,t){var n=M.cfg.wwwroot ,this.path=s.join(":")),this.drawable&&this.drawable.erase(),this.editor.drawables.push(this.draw())},draw_current_edit:function(e){var t=e&&!1;return t},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=t.y,this.endx=t.x+t.width,this.endy=t.y+t.height,this.colour=e.annotationcolour,this.path="",t.has_min_width()&&t.has_min_height()}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.annotation=y;var b=function(e){b.superclass.constructor.apply(this,[e])};b.NAME="annotationline",b.ATTRS={},e.extend(b,M.assignfeedback_editpdf.annotation,{draw:function(){var t,n;return t=new M.assignfeedback_editpdf.drawable(this.editor),n=this.editor.graphic.addShape({type:e.Path,fill:!1,stroke:{weight:p,color:l[this.colour]}}),n.moveTo(this.x,this.y),n.lineTo(this.endx,this.endy),n.end(),t.shapes.push(n),this.drawable=t,b.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdf.drawable(this.editor),r;return r=this.editor.graphic.addShape({type:e.Path,fill:!1,stroke:{weight:p,color:l[t.annotationcolour]}}),r.moveTo(t.start.x,t.start.y),r.lineTo(t.end.x,t.end.y),r.end(),n.shapes.push(r),n},init_from_edit:function(e){return this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=e.start.x,this.y=e.start.y,this.endx=e.end.x,this.endy=e.end.y,this.colour=e.annotationcolour,this.path="",this.endx-this.x!==0||this.endy-this.y!==0}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.annotationline=b;var w=function(e){w.superclass.constructor.apply(this,[e])};w.NAME="annotationrectangle",w.ATTRS={},e.extend(w,M.assignfeedback_editpdf.annotation,{draw:function(){var t,n,r;return t=new M.assignfeedback_editpdf.drawable(this.editor),n=new M.assignfeedback_editpdf.rect,n.bound([new M.assignfeedback_editpdf.point(this.x,this.y),new M.assignfeedback_editpdf.point(this.endx,this.endy)]),r=this.editor.graphic.addShape({type:e.Rect,width:n.width,height:n.height,stroke:{weight:p,color:l[this.colour]},x:n.x,y:n.y}),t.shapes.push(r),this.drawable=t,w.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdf.drawable(this.editor),r,i;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(),i.has_min_height()||i.set_min_height(),r=this.editor.graphic.addShape({type:e.Rect,width:i.width,height:i.height,stroke:{weight:p,color:l[t.annotationcolour]},x:i.x,y:i.y}),n.shapes.push(r),n}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.annotationrectangle=w;var E=function(e){E.superclass.constructor.apply(this,[e])};E.NAME="annotationoval",E.ATTRS={},e.extend(E,M.assignfeedback_editpdf.annotation,{draw:function(){var t,n,r;return t=new M.assignfeedback_editpdf.drawable(this.editor),n=new M.assignfeedback_editpdf.rect,n.bound([new M.assignfeedback_editpdf.point(this.x,this.y),new M.assignfeedback_editpdf.point(this.endx,this.endy)]),r=this.editor.graphic.addShape({type:e.Ellipse,width:n.width,height:n.height,stroke:{weight:p,color:l[this.colour]},x:n.x,y:n.y}),t.shapes.push(r),this.drawable=t,E.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdf.drawable(this.editor),r,i;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(),i.has_min_height()||i.set_min_height(),r=this.editor.graphic.addShape({type:e.Ellipse,width:i.width,height:i.height,stroke:{weight:p,color:l[t.annotationcolour]},x:i.x,y:i.y}),n.shapes.push(r),n}}),M.assignfeedback_editpdf=M.assignfeedback_editpdf||{},M.assignfeedback_editpdf.annotationoval=E;var S=function(e){S.superclass.constructor.apply(this,[e])};S.NAME="annotationpen",S.ATTRS={},e.extend(S,M.assignfeedback_editpdf.annotation,{draw:function(){var t,n,r,i,s;return t=new M.assignfeedback_editpdf.drawable(this.editor),n=this.editor.graphic.addShape({type:e.Path,fill:!1,stroke:{weight:p,color:l[this.colour]}}),r=!0,i=this.path.split(":"),e.each(i,function(e){s=e.split(","),r?(n.moveTo(s[0],s[1]),r=!1):n.lineTo(s[0],s[1])},this),n.end(),t.shapes.push(n),this.drawable=t,S.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdf.drawable(this.editor),r,i;return r=this.editor.graphic.addShape({type:e.Path,fill:!1,stroke:{weight:p,color:l[t.annotationcolour]}}),i=!0,e.each(t.path,function(e){i?(r.moveTo(e.x,e.y),i=!1):r.lineTo(e.x,e.y)},this),r.end(),n.shapes.push(r),n},init_from_edit:function(e){var t=new M.assignfeedback_editpdf.rect,n=[],r=0;t.bound(e.path);for(r=0;r"),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('