"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
//////////////////////////////////////////////////////////////////////////////
//  拖拽宽度|宽度
//
//
/////////////////////////////////////////////////////////////////////////////

function JSDragDiv(divElement) {
  this.DivElement = divElement;
  this.MouseDownPoint; //点击鼠标位置
  this.MouseMovePoint;
  this.Cache = {};
  this.MouseMoveCallback;
  this.MouseDownCallback;
  var self = this;
  divElement.onmousedown = function (e) {
    self.OnMouseDown(e);
    document.onmousemove = function (e) {
      self.OnMouseMove(e);
    };
    document.onmouseup = function (e) {
      self.OnMouseUp(e);
    };
  };
  this.OnMouseDown = function (e) {
    console.log("[JSDragDiv::OnMouseDown] x=".concat(e.clientX, " y=").concat(e.clientY));
    this.MouseDownPoint = {
      X: e.clientX,
      Y: e.clientY
    };
    this.MouseMovePoint = {
      X: e.clientX,
      Y: e.clientY
    };
    if (this.MouseDownCallback) this.MouseDownCallback(e, this);
  };
  this.OnMouseMove = function (e) {
    console.log("[JSDragDiv::OnMouseMove] x=".concat(e.clientX, " y=").concat(e.clientY));
    if (this.MouseMoveCallback) this.MouseMoveCallback(e, this);
    this.MouseMovePoint = {
      X: e.clientX,
      Y: e.clientY
    };
  };
  this.OnMouseUp = function (e) {
    console.log("[JSDragDiv::OnMouseUp] x=".concat(e.clientX, " y=").concat(e.clientY));
    //清空事件
    document.onmousemove = null;
    document.onmouseup = null;
  };
}

/*暴露外部用的方法*/
var _default = exports["default"] = {
  JSDragDiv: JSDragDiv
};