[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/assign/feedback/editpdf/yui/src/editor/js/ -> point.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 2d point.
  24   *
  25   * @namespace M.assignfeedback_editpdf
  26   * @param Number x
  27   * @param Number y
  28   * @class point
  29   */
  30  var POINT = function(x, y) {
  31  
  32      /**
  33       * X coordinate.
  34       * @property x
  35       * @type int
  36       * @public
  37       */
  38      this.x = parseInt(x, 10);
  39  
  40      /**
  41       * Y coordinate.
  42       * @property y
  43       * @type int
  44       * @public
  45       */
  46      this.y = parseInt(y, 10);
  47  
  48      /**
  49       * Clip this point to the rect
  50       * @method clip
  51       * @param M.assignfeedback_editpdf.point
  52       * @public
  53       */
  54      this.clip = function(bounds) {
  55          if (this.x < bounds.x) {
  56              this.x = bounds.x;
  57          }
  58          if (this.x > (bounds.x + bounds.width)) {
  59              this.x = bounds.x + bounds.width;
  60          }
  61          if (this.y < bounds.y) {
  62              this.y = bounds.y;
  63          }
  64          if (this.y > (bounds.y + bounds.height)) {
  65              this.y = bounds.y + bounds.height;
  66          }
  67          // For chaining.
  68          return this;
  69      };
  70  };
  71  
  72  M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
  73  M.assignfeedback_editpdf.point = POINT;


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1