MDL-55245 assignfeedback_editpdf: Enable text in comments to be selected
Only move comment boxes if 'select' tool is selected, enabling users to drag-select text within comments using the 'comment' tool.
This commit is contained in:
committed by
Eloy Lafuente (stronk7)
parent
34930b4115
commit
ab3894208a
+34
-28
@@ -2618,43 +2618,49 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
|
||||
});
|
||||
|
||||
node.on('gesturemovestart', function(e) {
|
||||
node.setData('dragging', true);
|
||||
node.setData('offsetx', e.clientX - node.getX());
|
||||
node.setData('offsety', e.clientY - node.getY());
|
||||
if (editor.currentedit.tool === 'select') {
|
||||
node.setData('dragging', true);
|
||||
node.setData('offsetx', e.clientX - node.getX());
|
||||
node.setData('offsety', e.clientY - node.getY());
|
||||
}
|
||||
});
|
||||
node.on('gesturemoveend', function() {
|
||||
node.setData('dragging', false);
|
||||
this.editor.save_current_page();
|
||||
if (editor.currentedit.tool === 'select') {
|
||||
node.setData('dragging', false);
|
||||
this.editor.save_current_page();
|
||||
}
|
||||
}, null, this);
|
||||
node.on('gesturemove', function(e) {
|
||||
var x = e.clientX - node.getData('offsetx'),
|
||||
y = e.clientY - node.getData('offsety'),
|
||||
nodewidth,
|
||||
nodeheight,
|
||||
newlocation,
|
||||
windowlocation,
|
||||
bounds;
|
||||
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);
|
||||
nodewidth = parseInt(node.getStyle('width'), 10);
|
||||
nodeheight = parseInt(node.getStyle('height'), 10);
|
||||
|
||||
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;
|
||||
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.
|
||||
newlocation.clip(bounds);
|
||||
bounds.width -= nodewidth + 42;
|
||||
bounds.height -= nodeheight + 8;
|
||||
// Clip to the window size - the comment size.
|
||||
newlocation.clip(bounds);
|
||||
|
||||
this.x = newlocation.x;
|
||||
this.y = newlocation.y;
|
||||
this.x = newlocation.x;
|
||||
this.y = newlocation.y;
|
||||
|
||||
windowlocation = this.editor.get_window_coordinates(newlocation);
|
||||
node.ancestor().setX(windowlocation.x);
|
||||
node.ancestor().setY(windowlocation.y);
|
||||
this.drawable.store_position(node.ancestor(), windowlocation.x, windowlocation.y);
|
||||
windowlocation = this.editor.get_window_coordinates(newlocation);
|
||||
node.ancestor().setX(windowlocation.x);
|
||||
node.ancestor().setY(windowlocation.y);
|
||||
this.drawable.store_position(node.ancestor(), windowlocation.x, windowlocation.y);
|
||||
}
|
||||
}, null, this);
|
||||
|
||||
this.menu = new M.assignfeedback_editpdf.commentmenu({
|
||||
|
||||
+5
-5
File diff suppressed because one or more lines are too long
+34
-28
@@ -2618,43 +2618,49 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
|
||||
});
|
||||
|
||||
node.on('gesturemovestart', function(e) {
|
||||
node.setData('dragging', true);
|
||||
node.setData('offsetx', e.clientX - node.getX());
|
||||
node.setData('offsety', e.clientY - node.getY());
|
||||
if (editor.currentedit.tool === 'select') {
|
||||
node.setData('dragging', true);
|
||||
node.setData('offsetx', e.clientX - node.getX());
|
||||
node.setData('offsety', e.clientY - node.getY());
|
||||
}
|
||||
});
|
||||
node.on('gesturemoveend', function() {
|
||||
node.setData('dragging', false);
|
||||
this.editor.save_current_page();
|
||||
if (editor.currentedit.tool === 'select') {
|
||||
node.setData('dragging', false);
|
||||
this.editor.save_current_page();
|
||||
}
|
||||
}, null, this);
|
||||
node.on('gesturemove', function(e) {
|
||||
var x = e.clientX - node.getData('offsetx'),
|
||||
y = e.clientY - node.getData('offsety'),
|
||||
nodewidth,
|
||||
nodeheight,
|
||||
newlocation,
|
||||
windowlocation,
|
||||
bounds;
|
||||
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);
|
||||
nodewidth = parseInt(node.getStyle('width'), 10);
|
||||
nodeheight = parseInt(node.getStyle('height'), 10);
|
||||
|
||||
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;
|
||||
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.
|
||||
newlocation.clip(bounds);
|
||||
bounds.width -= nodewidth + 42;
|
||||
bounds.height -= nodeheight + 8;
|
||||
// Clip to the window size - the comment size.
|
||||
newlocation.clip(bounds);
|
||||
|
||||
this.x = newlocation.x;
|
||||
this.y = newlocation.y;
|
||||
this.x = newlocation.x;
|
||||
this.y = newlocation.y;
|
||||
|
||||
windowlocation = this.editor.get_window_coordinates(newlocation);
|
||||
node.ancestor().setX(windowlocation.x);
|
||||
node.ancestor().setY(windowlocation.y);
|
||||
this.drawable.store_position(node.ancestor(), windowlocation.x, windowlocation.y);
|
||||
windowlocation = this.editor.get_window_coordinates(newlocation);
|
||||
node.ancestor().setX(windowlocation.x);
|
||||
node.ancestor().setY(windowlocation.y);
|
||||
this.drawable.store_position(node.ancestor(), windowlocation.x, windowlocation.y);
|
||||
}
|
||||
}, null, this);
|
||||
|
||||
this.menu = new M.assignfeedback_editpdf.commentmenu({
|
||||
|
||||
+34
-28
@@ -265,43 +265,49 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
|
||||
});
|
||||
|
||||
node.on('gesturemovestart', function(e) {
|
||||
node.setData('dragging', true);
|
||||
node.setData('offsetx', e.clientX - node.getX());
|
||||
node.setData('offsety', e.clientY - node.getY());
|
||||
if (editor.currentedit.tool === 'select') {
|
||||
node.setData('dragging', true);
|
||||
node.setData('offsetx', e.clientX - node.getX());
|
||||
node.setData('offsety', e.clientY - node.getY());
|
||||
}
|
||||
});
|
||||
node.on('gesturemoveend', function() {
|
||||
node.setData('dragging', false);
|
||||
this.editor.save_current_page();
|
||||
if (editor.currentedit.tool === 'select') {
|
||||
node.setData('dragging', false);
|
||||
this.editor.save_current_page();
|
||||
}
|
||||
}, null, this);
|
||||
node.on('gesturemove', function(e) {
|
||||
var x = e.clientX - node.getData('offsetx'),
|
||||
y = e.clientY - node.getData('offsety'),
|
||||
nodewidth,
|
||||
nodeheight,
|
||||
newlocation,
|
||||
windowlocation,
|
||||
bounds;
|
||||
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);
|
||||
nodewidth = parseInt(node.getStyle('width'), 10);
|
||||
nodeheight = parseInt(node.getStyle('height'), 10);
|
||||
|
||||
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;
|
||||
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.
|
||||
newlocation.clip(bounds);
|
||||
bounds.width -= nodewidth + 42;
|
||||
bounds.height -= nodeheight + 8;
|
||||
// Clip to the window size - the comment size.
|
||||
newlocation.clip(bounds);
|
||||
|
||||
this.x = newlocation.x;
|
||||
this.y = newlocation.y;
|
||||
this.x = newlocation.x;
|
||||
this.y = newlocation.y;
|
||||
|
||||
windowlocation = this.editor.get_window_coordinates(newlocation);
|
||||
node.ancestor().setX(windowlocation.x);
|
||||
node.ancestor().setY(windowlocation.y);
|
||||
this.drawable.store_position(node.ancestor(), windowlocation.x, windowlocation.y);
|
||||
windowlocation = this.editor.get_window_coordinates(newlocation);
|
||||
node.ancestor().setX(windowlocation.x);
|
||||
node.ancestor().setY(windowlocation.y);
|
||||
this.drawable.store_position(node.ancestor(), windowlocation.x, windowlocation.y);
|
||||
}
|
||||
}, null, this);
|
||||
|
||||
this.menu = new M.assignfeedback_editpdf.commentmenu({
|
||||
|
||||
Reference in New Issue
Block a user