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:36:45 +08:00
parent 36a19ecc26
commit 667cec9ba1
5 changed files with 45 additions and 18 deletions
@@ -1564,7 +1564,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;
@@ -1580,10 +1580,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;
@@ -2515,7 +2524,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,
@@ -2545,7 +2554,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
@@ -1564,7 +1564,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;
@@ -1580,10 +1580,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;
@@ -2515,7 +2524,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,
@@ -2545,7 +2554,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);
@@ -43,7 +43,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;
@@ -59,10 +59,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
@@ -160,7 +160,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,
@@ -190,7 +190,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);