[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 // This file is part of Moodle - http://moodle.org/ 2 // 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. 7 // 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. 12 // 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/>. 15 16 /** 17 * Provides an in browser PDF editor. 18 * 19 * @module moodle-assignfeedback_editpdf-editor 20 */ 21 22 /** 23 * Class representing a oval. 24 * 25 * @namespace M.assignfeedback_editpdf 26 * @class annotationoval 27 * @extends M.assignfeedback_editpdf.annotation 28 */ 29 ANNOTATIONOVAL = function(config) { 30 ANNOTATIONOVAL.superclass.constructor.apply(this, [config]); 31 }; 32 33 ANNOTATIONOVAL.NAME = "annotationoval"; 34 ANNOTATIONOVAL.ATTRS = {}; 35 36 Y.extend(ANNOTATIONOVAL, M.assignfeedback_editpdf.annotation, { 37 /** 38 * Draw a oval annotation 39 * @protected 40 * @method draw 41 * @return M.assignfeedback_editpdf.drawable 42 */ 43 draw : function() { 44 var drawable, 45 shape; 46 47 drawable = new M.assignfeedback_editpdf.drawable(this.editor); 48 49 bounds = new M.assignfeedback_editpdf.rect(); 50 bounds.bound([new M.assignfeedback_editpdf.point(this.x, this.y), 51 new M.assignfeedback_editpdf.point(this.endx, this.endy)]); 52 53 shape = this.editor.graphic.addShape({ 54 type: Y.Ellipse, 55 width: bounds.width, 56 height: bounds.height, 57 stroke: { 58 weight: STROKEWEIGHT, 59 color: ANNOTATIONCOLOUR[this.colour] 60 }, 61 x: bounds.x, 62 y: bounds.y 63 }); 64 drawable.shapes.push(shape); 65 this.drawable = drawable; 66 67 return ANNOTATIONOVAL.superclass.draw.apply(this); 68 }, 69 70 /** 71 * Draw the in progress edit. 72 * 73 * @public 74 * @method draw_current_edit 75 * @param M.assignfeedback_editpdf.edit edit 76 */ 77 draw_current_edit : function(edit) { 78 var drawable = new M.assignfeedback_editpdf.drawable(this.editor), 79 shape, 80 bounds; 81 82 bounds = new M.assignfeedback_editpdf.rect(); 83 bounds.bound([new M.assignfeedback_editpdf.point(edit.start.x, edit.start.y), 84 new M.assignfeedback_editpdf.point(edit.end.x, edit.end.y)]); 85 86 // Set min. width and height of oval. 87 if (!bounds.has_min_width()) { 88 bounds.set_min_width(); 89 } 90 if (!bounds.has_min_height()) { 91 bounds.set_min_height(); 92 } 93 94 shape = this.editor.graphic.addShape({ 95 type: Y.Ellipse, 96 width: bounds.width, 97 height: bounds.height, 98 stroke: { 99 weight: STROKEWEIGHT, 100 color: ANNOTATIONCOLOUR[edit.annotationcolour] 101 }, 102 x: bounds.x, 103 y: bounds.y 104 }); 105 106 drawable.shapes.push(shape); 107 108 return drawable; 109 } 110 }); 111 112 M.assignfeedback_editpdf = M.assignfeedback_editpdf || {}; 113 M.assignfeedback_editpdf.annotationoval = ANNOTATIONOVAL;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |