zoukankan      html  css  js  c++  java
  • raphael.js 拖动扩展

    (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();
    

     下载地址

  • 相关阅读:
    C# 委托应用总结
    C语言指针总结
    SQL2005四个排名函数(row_number、rank、dense_rank和ntile)的比较
    C#接口
    C# Linq
    C#反射
    重写与重载
    mysql01
    ajax
    bootstrap02导航菜单
  • 原文地址:https://www.cnblogs.com/southhuachen/p/5626527.html
Copyright © 2011-2022 走看看