Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'MDL-60123-33' of https://github.com/snake/moodle into M…
…OODLE_33_STABLE
  • Loading branch information
David Monllao committed Oct 20, 2017
2 parents a5adcc8 + 3d8e2ef commit d0abd8f
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 25 deletions.
Expand Up @@ -3372,6 +3372,14 @@ EDITOR.prototype = {
*/
currentannotation: null,

/**
* Track the previous annotation so we can remove selection highlights.
* @property lastannotation
* @type M.assignfeedback_editpdf.annotation
* @protected
*/
lastannotation: null,

/**
* Last selected annotation tool
* @property lastannotationtool
Expand Down Expand Up @@ -4144,8 +4152,7 @@ EDITOR.prototype = {
scrollleft = canvas.get('docScrollX'),
point = {x: e.clientX - offset[0] + scrollleft,
y: e.clientY - offset[1] + scrolltop},
selected = false,
lastannotation;
selected = false;

// Ignore right mouse click.
if (e.button === 3) {
Expand Down Expand Up @@ -4177,20 +4184,29 @@ EDITOR.prototype = {
});

if (selected) {
lastannotation = this.currentannotation;
this.lastannotation = this.currentannotation;
this.currentannotation = selected;
if (lastannotation && lastannotation !== selected) {
if (this.lastannotation && this.lastannotation !== selected) {
// Redraw the last selected annotation to remove the highlight.
if (lastannotation.drawable) {
lastannotation.drawable.erase();
this.drawables.push(lastannotation.draw());
if (this.lastannotation.drawable) {
this.lastannotation.drawable.erase();
this.drawables.push(this.lastannotation.draw());
}
}
// Redraw the newly selected annotation to show the highlight.
if (this.currentannotation.drawable) {
this.currentannotation.drawable.erase();
}
this.drawables.push(this.currentannotation.draw());
} else {
this.lastannotation = this.currentannotation;
this.currentannotation = null;

// Redraw the last selected annotation to remove the highlight.
if (this.lastannotation && this.lastannotation.drawable) {
this.lastannotation.drawable.erase();
this.drawables.push(this.lastannotation.draw());
}
}
}
if (this.currentannotation) {
Expand Down

0 comments on commit d0abd8f

Please sign in to comment.