MDL-55240 editpdf: Revert changes in MDL-54772

* Revert rendering of annotations and comments back to the
  drawing region.
* Bind events to stamp annotation when editing only.
This commit is contained in:
Jun Pataleta
2016-07-15 10:39:38 +08:00
parent 8d6dde0805
commit 8e6d1ac1d6
5 changed files with 45 additions and 18 deletions
@@ -1553,7 +1553,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
*/
draw : function() {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@@ -1569,10 +1569,19 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
'zIndex': 50
});
drawingcanvas.append(node);
drawingregion.append(node);
node.setX(position.x);
node.setY(position.y);
drawable.store_position(node, position.x, position.y);
// Bind events only when editing.
if (!this.editor.get('readonly')) {
// Pass through the event handlers on the div.
node.on('gesturemovestart', this.editor.edit_start, null, this.editor);
node.on('gesturemove', this.editor.edit_move, null, this.editor);
node.on('gesturemoveend', this.editor.edit_end, null, this.editor);
}
drawable.nodes.push(node);
this.drawable = drawable;
@@ -2501,7 +2510,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,
drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
container,
menu,
position,
@@ -2531,7 +2540,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
color: COMMENTTEXTCOLOUR
});
drawingcanvas.append(container);
drawingregion.append(container);
container.setStyle('position', 'absolute');
container.setX(position.x);
container.setY(position.y);
File diff suppressed because one or more lines are too long
@@ -1553,7 +1553,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
*/
draw : function() {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@@ -1569,10 +1569,19 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
'zIndex': 50
});
drawingcanvas.append(node);
drawingregion.append(node);
node.setX(position.x);
node.setY(position.y);
drawable.store_position(node, position.x, position.y);
// Bind events only when editing.
if (!this.editor.get('readonly')) {
// Pass through the event handlers on the div.
node.on('gesturemovestart', this.editor.edit_start, null, this.editor);
node.on('gesturemove', this.editor.edit_move, null, this.editor);
node.on('gesturemoveend', this.editor.edit_end, null, this.editor);
}
drawable.nodes.push(node);
this.drawable = drawable;
@@ -2501,7 +2510,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,
drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
container,
menu,
position,
@@ -2531,7 +2540,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
color: COMMENTTEXTCOLOUR
});
drawingcanvas.append(container);
drawingregion.append(container);
container.setStyle('position', 'absolute');
container.setX(position.x);
container.setY(position.y);
@@ -42,7 +42,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
*/
draw : function() {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@@ -58,10 +58,19 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
'zIndex': 50
});
drawingcanvas.append(node);
drawingregion.append(node);
node.setX(position.x);
node.setY(position.y);
drawable.store_position(node, position.x, position.y);
// Bind events only when editing.
if (!this.editor.get('readonly')) {
// Pass through the event handlers on the div.
node.on('gesturemovestart', this.editor.edit_start, null, this.editor);
node.on('gesturemove', this.editor.edit_move, null, this.editor);
node.on('gesturemoveend', this.editor.edit_end, null, this.editor);
}
drawable.nodes.push(node);
this.drawable = drawable;
+2 -2
View File
@@ -159,7 +159,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,
drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
container,
menu,
position,
@@ -189,7 +189,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
color: COMMENTTEXTCOLOUR
});
drawingcanvas.append(container);
drawingregion.append(container);
container.setStyle('position', 'absolute');
container.setX(position.x);
container.setY(position.y);