VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-full/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol-svg__js__controller__CViewBox.js
/*** module: node_modules/absol-svg/js/controller/CViewBox.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _Vec = _interopRequireDefault(require("absol/src/Math/Vec2"));


/***
 *
 * @param {SvgViewBox}  $svg
 * @constructor
 */
function CViewBox($svg) {
  this.$svg = $svg;
  this.clientRect = {
    width: 0,
    height: 0
  };
  this.viewBox = {
    x: 0,
    y: 0,
    width: 0,
    height: 0
  };
  this._zoom = 1;
  this._origin = new _Vec.default(0, 0);
}
/***
 *
 * @param {Vec2} v
 * @return Vec2
 */


CViewBox.prototype.screen2view = function (v) {
  return v.div(this._zoom).sub(this._origin);
};
/***
 *
 * @param {Vec2} v
 * @return Vec2
 */


CViewBox.prototype.view2screen = function (v) {
  return v.add(this._origin).mult(this._zoom);
};

CViewBox.prototype.updateClientRect = function () {
  var bound = this.$svg.getBoundingClientRect();
  this.clientRect.width = bound.width;
  this.clientRect.height = bound.height;
  this.updateViewBox();
};

CViewBox.prototype.updateViewBox = function () {
  var o = this._origin;
  var cRect = this.clientRect;
  var zoom = this._zoom;
  var viewBox = this.viewBox;
  viewBox.x = -o.x / this.zoom;
  viewBox.y = -o.y / zoom;
  viewBox.width = cRect.width / zoom;
  viewBox.height = cRect.height / zoom;
  this.$svg.attr('viewBox', [viewBox.x, viewBox.y, viewBox.width, viewBox.height].join(' '));
};

Object.defineProperty(CViewBox.prototype, 'zoom', {
  set: function (val) {
    this._zoom = val;
    this.updateViewBox();
  },
  get: function () {
    return this._zoom;
  }
});
Object.defineProperty(CViewBox.prototype, 'origin', {
  set: function (val) {
    this._origin = val;
    this.updateViewBox();
  },
  get: function () {
    return this._origin;
  }
});
var _default = CViewBox;
exports.default = _default;

VaKeR 2022