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