Gitlab CSE Unil

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

fin comment js files

parent 27ce7620
......@@ -1153,7 +1153,7 @@ Y.extend(ANNOTATION, Y.Base, {
* Delete an annotation
* @protected
* @method remove
* @param event
* @param {event} e
*/
remove: function (e) {
var annotations,
......@@ -1175,8 +1175,8 @@ Y.extend(ANNOTATION, Y.Base, {
/**
* Move an annotation to a new location.
* @public
* @param int newx
* @param int newy
* @param {int} newx
* @param {int} newy
* @method move_annotation
*/
move: function (newx, newy) {
......@@ -1209,7 +1209,7 @@ Y.extend(ANNOTATION, Y.Base, {
*
* @public
* @method draw_current_edit
* @param M.assignfeedback_editpdfplus.edit edit
* @param {M.assignfeedback_editpdfplus.edit} edit
*/
draw_current_edit: function (edit) {
var noop = edit && false;
......@@ -1221,7 +1221,7 @@ Y.extend(ANNOTATION, Y.Base, {
*
* @public
* @method init_from_edit
* @param M.assignfeedback_editpdfplus.edit edit
* @param {M.assignfeedback_editpdfplus.edit} edit
* @return bool if width/height is more than min. required.
*/
init_from_edit: function (edit) {
......
/* global M, Y, SELECTOR */
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
......@@ -131,6 +133,11 @@ Y.extend(ANNOTATIONCOMMENTPLUS, M.assignfeedback_editpdfplus.annotation, {
// Min width and height is always more than 40px.
return true;
},
/**
* Display cartridge and toolbox for the annotation
* @param {type} edit
* @returns {Boolean} res
*/
draw_catridge: function (edit) {
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
if (this.divcartridge === '') {
......@@ -171,6 +178,9 @@ Y.extend(ANNOTATIONCOMMENTPLUS, M.assignfeedback_editpdfplus.annotation, {
}
return true;
},
/**
* Display the annotation according to current parameters
*/
apply_visibility_annot: function () {
ANNOTATIONCOMMENTPLUS.superclass.apply_visibility_annot.apply(this);
......@@ -190,20 +200,20 @@ Y.extend(ANNOTATIONCOMMENTPLUS, M.assignfeedback_editpdfplus.annotation, {
}
}
},
save_annot: function () {
var input = this.editor.get_dialogue_element('#' + this.divcartridge + "_editinput");
var result = input.get('value');
this.textannot = result;
this.editor.save_current_page();
if (result.length === 0) {
result = "  ";
}
var valref = this.editor.get_dialogue_element('#' + this.divcartridge + "_valref");
valref.set('value', result);
this.apply_visibility_annot();
this.hide_edit();
return;
},
/*save_annot: function () {
var input = this.editor.get_dialogue_element('#' + this.divcartridge + "_editinput");
var result = input.get('value');
this.textannot = result;
this.editor.save_current_page();
if (result.length === 0) {
result = "  ";
}
var valref = this.editor.get_dialogue_element('#' + this.divcartridge + "_valref");
valref.set('value', result);
this.apply_visibility_annot();
this.hide_edit();
return;
},*/
/**
* Move an annotation to a new location.
* @public
......
/* global M, Y */
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
......@@ -186,9 +188,18 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
}
this.editor.drawables.push(this.draw());
},
/**
* Get the color of the element, depend of data on DB
* @return {string} color
*/
get_color: function () {
return this.colour;
},
/**
* Display cartridge and toolbox for the annotation
* @param {type} edit
* @returns {Boolean} res
*/
draw_catridge: function (edit) {
if (this.parent_annot_element === null && this.parent_annot === 0) {
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
......@@ -311,6 +322,10 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
}
return true;
},
/**
* drag-and-drop process
* @param {type} e
*/
move_cartridge_continue: function (e) {
e.preventDefault();
......@@ -327,6 +342,10 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
divcartridge.setX(offsetcanvas[0] + this.cartridgex + diffx);
divcartridge.setY(offsetcanvas[1] + this.y + this.cartridgey + diffy);
},
/**
* drag-and-drop stop
* @param {type} e
*/
move_cartridge_stop: function (e) {
e.preventDefault();
......@@ -352,10 +371,17 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
this.editor.save_current_page();
},
/**
* Add child annotation (new associed frame)
* @param {type} e
*/
add_annot: function (e) {
this.editor.currentedit.parent_annot_element = this;
this.editor.handle_tool_button(e, TOOLTYPELIB.FRAME, 'ctbutton' + this.toolid, 1);
},
/**
* Display color/border picker toolbar
*/
display_picker: function () {
var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge);
var divpalette = this.editor.get_dialogue_element('#' + this.divcartridge + "_picker");
......@@ -364,6 +390,9 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
divpalette.show();
buttonrenderdisplay.on('click', this.hide_picker, this);
},
/**
* Hide color/border picker toolbar
*/
hide_picker: function () {
var divpalette = this.editor.get_dialogue_element('#' + this.divcartridge + "_picker");
var buttonrenderdisplay = this.editor.get_dialogue_element('#' + this.divcartridge + "_buttonpencil");
......@@ -372,6 +401,12 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
divcartridge.setStyle('z-index', 0);
buttonrenderdisplay.on('click', this.display_picker, this);
},
/**
* Apply "change color" on element and children
*
* @param {type} e
* @param {string} colour
*/
change_color: function (e, colour) {
this.colour = colour;
var shape = this.editor.graphic.getShapeById(this.shape_id);
......@@ -412,6 +447,12 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
this.hide_picker();
this.editor.save_current_page();
},
/**
* Apply "change border" on element and children
*
* @param {type} e
* @param {string} colour
*/
change_border: function (e, border) {
this.borderstyle = border;
var shape = this.editor.graphic.getShapeById(this.shape_id);
......@@ -463,6 +504,10 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
divpalette.hide();
this.editor.save_current_page();
},
/**
* display annotation edditing view
* @param {type} e
*/
edit_annot: function (e) {
if (!this.parent_annot_element) {
var buttonrender = this.editor.get_dialogue_element('#' + this.divcartridge + "_buttonpencil");
......@@ -475,6 +520,11 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
ANNOTATIONFRAME.superclass.edit_annot.call(this);
}
},
/**
* remove annotation detail view
* @param {type} e
* @param {string} clickType
*/
hide_edit: function () {
ANNOTATIONFRAME.superclass.hide_edit.call(this);
var divdisplay = this.editor.get_dialogue_element('#' + this.divcartridge + "_display");
......@@ -497,7 +547,7 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
}
},
/**
* Delete an annotation
* Delete an annotation and its children
* @protected
* @method remove
* @param event
......
/* global M, Y, SELECTOR */
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
......@@ -138,6 +140,11 @@ Y.extend(ANNOTATIONHIGHLIGHTPLUS, M.assignfeedback_editpdfplus.annotation, {
return (bounds.has_min_width());
},
/**
* Display cartridge and toolbox for the annotation
* @param {type} edit
* @returns {Boolean} res
*/
draw_catridge: function (edit) {
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
if (this.divcartridge === '') {
......
/* global Y, M, SELECTOR */
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
......@@ -129,6 +131,11 @@ Y.extend(ANNOTATIONSTAMPCOMMENT, M.assignfeedback_editpdfplus.annotation, {
// Min width and height is always more than 40px.
return true;
},
/**
* Display cartridge and toolbox for the annotation
* @param {type} edit
* @returns {Boolean} res
*/
draw_catridge: function (edit) {
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
if (this.divcartridge === '') {
......@@ -223,6 +230,12 @@ Y.extend(ANNOTATIONSTAMPCOMMENT, M.assignfeedback_editpdfplus.annotation, {
}
this.editor.drawables.push(this.draw());
},
/**
* Delete an annotation
* @protected
* @method remove
* @param {event} e
*/
remove: function (e) {
var annotations,
i;
......@@ -246,48 +259,7 @@ Y.extend(ANNOTATIONSTAMPCOMMENT, M.assignfeedback_editpdfplus.annotation, {
return;
}
}
},
/*move_cartridge_continue: function (e) {
e.preventDefault();
var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
clientpoint = new M.assignfeedback_editpdfplus.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')),
point = this.editor.get_canvas_coordinates(clientpoint);
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
var diffx = point.x - this.oldx;
var diffy = point.y - this.oldy;
var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge);
divcartridge.setX(offsetcanvas[0] + this.x + this.cartridgex + diffx);
divcartridge.setY(offsetcanvas[1] + this.y + this.cartridgey + diffy);
},*/
/*move_cartridge_stop: function (e) {
e.preventDefault();
var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge");
divcartridge.detach('mousemove', this.move_cartridge_continue, this);
divcartridge.detach('mouseup', this.move_cartridge_stop, this);
var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
clientpoint = new M.assignfeedback_editpdfplus.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')),
point = this.editor.get_canvas_coordinates(clientpoint);
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
var diffx = point.x - this.oldx;
var diffy = point.y - this.oldy;
this.cartridgex += diffx;
this.cartridgey += diffy;
var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge);
divcartridge.setX(offsetcanvas[0] + this.x + this.cartridgex);
divcartridge.setY(offsetcanvas[1] + this.y + this.cartridgey);
this.editor.save_current_page();
}*/
}
});
......
/* global M, Y, SELECTOR */
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
......@@ -130,6 +132,11 @@ Y.extend(ANNOTATIONSTAMPPLUS, M.assignfeedback_editpdfplus.annotation, {
// Min width and height is always more than 40px.
return true;
},
/**
* display annotation edditing view
* No edit annot for this annotation
* @param {type} e
*/
edit_annot: function (e) {
return true;
},
......
/* global M, Y, STROKEWEIGHT, SELECTOR */
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
......@@ -48,9 +50,6 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
verticallinecolour;
drawable = new M.assignfeedback_editpdfplus.drawable(this.editor);
/*bounds = new M.assignfeedback_editpdfplus.rect();
bounds.bound([new M.assignfeedback_editpdfplus.point(this.x, this.y),
new M.assignfeedback_editpdfplus.point(this.endx, this.endy)]);*/
verticallinecolour = this.get_color();
......@@ -148,6 +147,11 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
this.page = '';
return !(((this.endx - this.x) === 0) && ((this.endy - this.y) === 0));
},
/**
* Display cartridge and toolbox for the annotation
* @param {type} edit
* @returns {Boolean} res
*/
draw_catridge: function (edit) {
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
if (this.divcartridge === '') {
......@@ -195,47 +199,6 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
}
return true;
},
/*move_cartridge_continue: function (e) {
e.preventDefault();
var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
clientpoint = new M.assignfeedback_editpdfplus.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')),
point = this.editor.get_canvas_coordinates(clientpoint);
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
var diffx = point.x - this.oldx;
var diffy = point.y - this.oldy;
var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge);
divcartridge.setX(offsetcanvas[0] + this.x + this.cartridgex + diffx);
divcartridge.setY(offsetcanvas[1] + this.y + this.cartridgey + diffy);
},
move_cartridge_stop: function (e) {
e.preventDefault();
var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge");
divcartridge.detach('mousemove', this.move_cartridge_continue, this);
divcartridge.detach('mouseup', this.move_cartridge_stop, this);
var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
clientpoint = new M.assignfeedback_editpdfplus.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')),
point = this.editor.get_canvas_coordinates(clientpoint);
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
var diffx = point.x - this.oldx;
var diffy = point.y - this.oldy;
this.cartridgex += diffx;
this.cartridgey += diffy;
var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge);
divcartridge.setX(offsetcanvas[0] + this.x + this.cartridgex);
divcartridge.setY(offsetcanvas[1] + this.y + this.cartridgey);
this.editor.save_current_page();
},*/
/**
* Delete an annotation
* @protected
......
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