(function (R) {
            R.el.draggable = function (move, start, up) {
                this._ui = this._ui || {};

                var that = this;

                this._ui.onMove = R.is(move, 'function') ?
                    move : function (distanceX, distanceY, x, y, deltaX, deltaY) {
                        that.translate(deltaX, deltaY);
                    };

                this._ui.onStart = R.is(start, 'function') ? start : function (x, y) {
                };

                function onMove(distanceX, distanceY, x, y) {
                    var deltaX = x - that._ui.lastX;
                    var deltaY = y - that._ui.lastY;
                    that._ui.lastX = x;
                    that._ui.lastY = y;
                    that._ui.onMove(distanceX, distanceY, x, y, deltaX, deltaY);
                    that.paper.safari();
                };

                function onStart(x, y) {
                    that._ui.lastX = x;
                    that._ui.lastY = y;
                    that._ui.onStart(x, y);
                };

                return this.drag(onMove, onStart, up);
            };
        })(Raphael);


          //调用方法
           rect.draggable();

 下载地址

相关文章:

  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2021-04-20
  • 2022-01-19
  • 2022-02-03
  • 2021-09-30
  • 2021-07-03
猜你喜欢
  • 2022-12-23
  • 2021-04-22
  • 2022-12-23
  • 2022-03-04
  • 2021-05-08
  • 2021-11-12
相关资源
相似解决方案