[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/mod/assign/feedback/editpdf/yui/src/editor/js/ -> drawable.js (source)

   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 drawable thing which contains both Y.Nodes, and Y.Shapes.
  24   *
  25   * @namespace M.assignfeedback_editpdf
  26   * @param M.assignfeedback_editpdf.editor editor
  27   * @class drawable
  28   */
  29  DRAWABLE = function(editor) {
  30  
  31      /**
  32       * Reference to M.assignfeedback_editpdf.editor.
  33       * @property editor
  34       * @type M.assignfeedback_editpdf.editor
  35       * @public
  36       */
  37      this.editor = editor;
  38  
  39      /**
  40       * Array of Y.Shape
  41       * @property shapes
  42       * @type Y.Shape[]
  43       * @public
  44       */
  45      this.shapes = [];
  46  
  47      /**
  48       * Array of Y.Node
  49       * @property nodes
  50       * @type Y.Node[]
  51       * @public
  52       */
  53      this.nodes = [];
  54  
  55      /**
  56       * Delete the shapes from the drawable.
  57       * @protected
  58       * @method erase_drawable
  59       */
  60      this.erase = function() {
  61          if (this.shapes) {
  62              while (this.shapes.length > 0) {
  63                  this.editor.graphic.removeShape(this.shapes.pop());
  64              }
  65          }
  66          if (this.nodes) {
  67              while (this.nodes.length > 0) {
  68                  this.nodes.pop().remove();
  69              }
  70          }
  71      };
  72  
  73  };
  74  
  75  M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
  76  M.assignfeedback_editpdf.drawable = DRAWABLE;


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1