1
// This file is part of Moodle - http://moodle.org/
3
// Moodle is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, either version 3 of the License, or
6
// (at your option) any later version.
8
// Moodle is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License
14
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
* Class representing a oval.
19
* @namespace M.assignfeedback_editpdf
20
* @class annotationoval
22
* @module moodle-assignfeedback_editpdf-editor
24
ANNOTATIONOVAL = function(config) {
25
ANNOTATIONOVAL.superclass.constructor.apply(this, [config]);
28
ANNOTATIONOVAL.NAME = "annotationoval";
29
ANNOTATIONOVAL.ATTRS = {};
31
Y.extend(ANNOTATIONOVAL, M.assignfeedback_editpdf.annotation, {
33
* Draw a oval annotation
36
* @return M.assignfeedback_editpdf.drawable
42
drawable = new M.assignfeedback_editpdf.drawable(this.editor);
44
bounds = new M.assignfeedback_editpdf.rect();
45
bounds.bound([new M.assignfeedback_editpdf.point(this.x, this.y),
46
new M.assignfeedback_editpdf.point(this.endx, this.endy)]);
48
shape = this.editor.graphic.addShape({
51
height: bounds.height,
54
color: ANNOTATIONCOLOUR[this.colour]
59
drawable.shapes.push(shape);
60
this.drawable = drawable;
62
return ANNOTATIONOVAL.superclass.draw.apply(this);
66
* Draw the in progress edit.
69
* @method draw_current_edit
70
* @param M.assignfeedback_editpdf.edit edit
72
draw_current_edit : function(edit) {
73
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
77
bounds = new M.assignfeedback_editpdf.rect();
78
bounds.bound([new M.assignfeedback_editpdf.point(edit.start.x, edit.start.y),
79
new M.assignfeedback_editpdf.point(edit.end.x, edit.end.y)]);
81
// Set min. width and height of oval.
82
if (!bounds.has_min_width()) {
83
bounds.set_min_width();
85
if (!bounds.has_min_height()) {
86
bounds.set_min_height();
89
shape = this.editor.graphic.addShape({
92
height: bounds.height,
95
color: ANNOTATIONCOLOUR[edit.annotationcolour]
101
drawable.shapes.push(shape);
107
M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
108
M.assignfeedback_editpdf.annotationoval = ANNOTATIONOVAL;