Gitlab CSE Unil

Commit d921fd04 authored by M. Chardon's avatar M. Chardon
Browse files

deselection de lelement si clique à côte

parent 7dde37e2
......@@ -1019,6 +1019,10 @@ Y.extend(ANNOTATION, Y.Base, {
});
this.drawable.shapes.push(shape);
shape.editor = this.editor;
//shape.on('clickoutside', this.remove_selection, this);
shape.on('clickoutside', Y.rbind(this.editor.redraw_annotation, this.editor));
// Add a delete X to the annotation.
var deleteicon = Y.Node.create('<img src="' + M.util.image_url('trash', 'assignfeedback_editpdfplus') + '"/>'),
deletelink = Y.Node.create('<a href="#" role="button"></a>');
......@@ -1045,6 +1049,12 @@ Y.extend(ANNOTATION, Y.Base, {
}
return this.drawable;
},
remove_selection: function (e) {
Y.log('remove_selection');
if (this.drawable) {
this.drawable.erase();
}
},
/**
* Draw an annotation
* @public
......@@ -5974,6 +5984,15 @@ EDITOR.prototype = {
}
if (tool !== "select") {
this.redraw_annotation();
}
if (!has_parent) {
this.currentedit.parent_annot_element = null;
}
this.refresh_button_state();
},
redraw_annotation: function (e) {
this.currentannotation = null;
var annotations = this.pages[this.currentpage].annotations;
Y.each(annotations, function (annotation) {
......@@ -5983,12 +6002,6 @@ EDITOR.prototype = {
annotation.draw();
}
});
}
if (!has_parent) {
this.currentedit.parent_annot_element = null;
}
this.refresh_button_state();
},
/**
* JSON encode the current page data - stripping out drawable references which cannot be encoded.
......
......@@ -1019,6 +1019,10 @@ Y.extend(ANNOTATION, Y.Base, {
});
this.drawable.shapes.push(shape);
shape.editor = this.editor;
//shape.on('clickoutside', this.remove_selection, this);
shape.on('clickoutside', Y.rbind(this.editor.redraw_annotation, this.editor));
// Add a delete X to the annotation.
var deleteicon = Y.Node.create('<img src="' + M.util.image_url('trash', 'assignfeedback_editpdfplus') + '"/>'),
deletelink = Y.Node.create('<a href="#" role="button"></a>');
......@@ -1045,6 +1049,11 @@ Y.extend(ANNOTATION, Y.Base, {
}
return this.drawable;
},
remove_selection: function (e) {
if (this.drawable) {
this.drawable.erase();
}
},
/**
* Draw an annotation
* @public
......@@ -5966,6 +5975,15 @@ EDITOR.prototype = {
}
if (tool !== "select") {
this.redraw_annotation();
}
if (!has_parent) {
this.currentedit.parent_annot_element = null;
}
this.refresh_button_state();
},
redraw_annotation: function (e) {
this.currentannotation = null;
var annotations = this.pages[this.currentpage].annotations;
Y.each(annotations, function (annotation) {
......@@ -5975,12 +5993,6 @@ EDITOR.prototype = {
annotation.draw();
}
});
}
if (!has_parent) {
this.currentedit.parent_annot_element = null;
}
this.refresh_button_state();
},
/**
* JSON encode the current page data - stripping out drawable references which cannot be encoded.
......
......@@ -478,6 +478,9 @@ Y.extend(ANNOTATION, Y.Base, {
});
this.drawable.shapes.push(shape);
shape.editor = this.editor;
shape.on('clickoutside', Y.rbind(this.editor.redraw_annotation, this.editor));
// Add a delete X to the annotation.
var deleteicon = Y.Node.create('<img src="' + M.util.image_url('trash', 'assignfeedback_editpdfplus') + '"/>'),
deletelink = Y.Node.create('<a href="#" role="button"></a>');
......
......@@ -656,6 +656,15 @@ EDITOR.prototype = {
}
if (tool !== "select") {
this.redraw_annotation();
}
if (!has_parent) {
this.currentedit.parent_annot_element = null;
}
this.refresh_button_state();
},
redraw_annotation: function (e) {
this.currentannotation = null;
var annotations = this.pages[this.currentpage].annotations;
Y.each(annotations, function (annotation) {
......@@ -665,12 +674,6 @@ EDITOR.prototype = {
annotation.draw();
}
});
}
if (!has_parent) {
this.currentedit.parent_annot_element = null;
}
this.refresh_button_state();
},
/**
* JSON encode the current page data - stripping out drawable references which cannot be encoded.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment